From 05799efa74365d5c10e3ccc965b80cf50f2331c0 Mon Sep 17 00:00:00 2001 From: Rehaan Ahmad Date: Fri, 17 Jul 2026 19:54:45 -0700 Subject: [PATCH 1/2] Report pane: restore Markdown heading hierarchy in report-md Co-Authored-By: Claude Fable 5 --- .../{index-DgScguTc.js => index-NHXRZTC4.js} | 288 +++++++++--------- ...{index-BsmS7b0n.css => index-g4cfTv1P.css} | 2 +- ui/dist/index.html | 4 +- ui/src/styles.css | 25 ++ 4 files changed, 172 insertions(+), 147 deletions(-) rename ui/dist/assets/{index-DgScguTc.js => index-NHXRZTC4.js} (76%) rename ui/dist/assets/{index-BsmS7b0n.css => index-g4cfTv1P.css} (52%) diff --git a/ui/dist/assets/index-DgScguTc.js b/ui/dist/assets/index-NHXRZTC4.js similarity index 76% rename from ui/dist/assets/index-DgScguTc.js rename to ui/dist/assets/index-NHXRZTC4.js index d704024..862f450 100644 --- a/ui/dist/assets/index-DgScguTc.js +++ b/ui/dist/assets/index-NHXRZTC4.js @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ey;function uA(){if(Ey)return xo;Ey=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,l){var u=null;if(l!==void 0&&(u=""+l),a.key!==void 0&&(u=""+a.key),"key"in a){l={};for(var o in a)o!=="key"&&(l[o]=a[o])}else l=a;return a=l.ref,{$$typeof:e,type:r,key:u,ref:a!==void 0?a:null,props:l}}return xo.Fragment=t,xo.jsx=n,xo.jsxs=n,xo}var ky;function hA(){return ky||(ky=1,Id.exports=uA()),Id.exports}var m=hA(),zd={exports:{}},He={};/** + */var Ey;function aA(){if(Ey)return xo;Ey=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,l){var u=null;if(l!==void 0&&(u=""+l),a.key!==void 0&&(u=""+a.key),"key"in a){l={};for(var o in a)o!=="key"&&(l[o]=a[o])}else l=a;return a=l.ref,{$$typeof:e,type:r,key:u,ref:a!==void 0?a:null,props:l}}return xo.Fragment=t,xo.jsx=n,xo.jsxs=n,xo}var ky;function oA(){return ky||(ky=1,Id.exports=aA()),Id.exports}var m=oA(),zd={exports:{}},He={};/** * @license React * react.production.js * @@ -14,7 +14,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ay;function fA(){if(Ay)return He;Ay=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),_=Symbol.iterator;function v(O){return O===null||typeof O!="object"?null:(O=_&&O[_]||O["@@iterator"],typeof O=="function"?O:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,b={};function S(O,$,U){this.props=O,this.context=$,this.refs=b,this.updater=U||w}S.prototype.isReactComponent={},S.prototype.setState=function(O,$){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,$,"setState")},S.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function x(){}x.prototype=S.prototype;function y(O,$,U){this.props=O,this.context=$,this.refs=b,this.updater=U||w}var E=y.prototype=new x;E.constructor=y,C(E,S.prototype),E.isPureReactComponent=!0;var R=Array.isArray;function N(){}var D={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function j(O,$,U){var Q=U.ref;return{$$typeof:e,type:O,key:$,ref:Q!==void 0?Q:null,props:U}}function B(O,$){return j(O.type,$,O.props)}function F(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function Y(O){var $={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(U){return $[U]})}var H=/\/+/g;function z(O,$){return typeof O=="object"&&O!==null&&O.key!=null?Y(""+O.key):$.toString(36)}function V(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(N,N):(O.status="pending",O.then(function($){O.status==="pending"&&(O.status="fulfilled",O.value=$)},function($){O.status==="pending"&&(O.status="rejected",O.reason=$)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function G(O,$,U,Q,re){var ae=typeof O;(ae==="undefined"||ae==="boolean")&&(O=null);var Z=!1;if(O===null)Z=!0;else switch(ae){case"bigint":case"string":case"number":Z=!0;break;case"object":switch(O.$$typeof){case e:case t:Z=!0;break;case p:return Z=O._init,G(Z(O._payload),$,U,Q,re)}}if(Z)return re=re(O),Z=Q===""?"."+z(O,0):Q,R(re)?(U="",Z!=null&&(U=Z.replace(H,"$&/")+"/"),G(re,$,U,"",function(ne){return ne})):re!=null&&(F(re)&&(re=B(re,U+(re.key==null||O&&O.key===re.key?"":(""+re.key).replace(H,"$&/")+"/")+Z)),$.push(re)),1;Z=0;var P=Q===""?".":Q+":";if(R(O))for(var ee=0;ee>>1,M=G[L];if(0>>1;La(U,K))Qa(re,U)?(G[L]=re,G[Q]=K,L=Q):(G[L]=U,G[$]=K,L=$);else if(Qa(re,K))G[L]=re,G[Q]=K,L=Q;else break e}}return X}function a(G,X){var K=G.sortIndex-X.sortIndex;return K!==0?K:G.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,o=u.now();e.unstable_now=function(){return u.now()-o}}var c=[],f=[],p=1,d=null,_=3,v=!1,w=!1,C=!1,b=!1,S=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;function E(G){for(var X=n(f);X!==null;){if(X.callback===null)r(f);else if(X.startTime<=G)r(f),X.sortIndex=X.expirationTime,t(c,X);else break;X=n(f)}}function R(G){if(C=!1,E(G),!w)if(n(c)!==null)w=!0,N||(N=!0,Y());else{var X=n(f);X!==null&&V(R,X.startTime-G)}}var N=!1,D=-1,T=5,j=-1;function B(){return b?!0:!(e.unstable_now()-jG&&B());){var L=d.callback;if(typeof L=="function"){d.callback=null,_=d.priorityLevel;var M=L(d.expirationTime<=G);if(G=e.unstable_now(),typeof M=="function"){d.callback=M,E(G),X=!0;break t}d===n(c)&&r(c),E(G)}else r(c);d=n(c)}if(d!==null)X=!0;else{var O=n(f);O!==null&&V(R,O.startTime-G),X=!1}}break e}finally{d=null,_=K,v=!1}X=void 0}}finally{X?Y():N=!1}}}var Y;if(typeof y=="function")Y=function(){y(F)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,z=H.port2;H.port1.onmessage=F,Y=function(){z.postMessage(null)}}else Y=function(){S(F,0)};function V(G,X){D=S(function(){G(e.unstable_now())},X)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(G){G.callback=null},e.unstable_forceFrameRate=function(G){0>G||125L?(G.sortIndex=K,t(f,G),n(c)===null&&G===n(f)&&(C?(x(D),D=-1):C=!0,V(R,K-L))):(G.sortIndex=M,t(c,G),w||v||(w=!0,N||(N=!0,Y()))),G},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(G){var X=_;return function(){var K=_;_=X;try{return G.apply(this,arguments)}finally{_=K}}}})(Pd)),Pd}var Ry;function gA(){return Ry||(Ry=1,Fd.exports=pA()),Fd.exports}var Ud={exports:{}},Jt={};/** + */var Ty;function uA(){return Ty||(Ty=1,(function(e){function t(q,X){var K=q.length;q.push(X);e:for(;0>>1,M=q[L];if(0>>1;La(F,K))Qa(re,F)?(q[L]=re,q[Q]=K,L=Q):(q[L]=F,q[$]=K,L=$);else if(Qa(re,K))q[L]=re,q[Q]=K,L=Q;else break e}}return X}function a(q,X){var K=q.sortIndex-X.sortIndex;return K!==0?K:q.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,o=u.now();e.unstable_now=function(){return u.now()-o}}var c=[],f=[],p=1,d=null,_=3,v=!1,w=!1,C=!1,b=!1,S=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;function E(q){for(var X=n(f);X!==null;){if(X.callback===null)r(f);else if(X.startTime<=q)r(f),X.sortIndex=X.expirationTime,t(c,X);else break;X=n(f)}}function R(q){if(C=!1,E(q),!w)if(n(c)!==null)w=!0,N||(N=!0,G());else{var X=n(f);X!==null&&Y(R,X.startTime-q)}}var N=!1,D=-1,T=5,j=-1;function B(){return b?!0:!(e.unstable_now()-jq&&B());){var L=d.callback;if(typeof L=="function"){d.callback=null,_=d.priorityLevel;var M=L(d.expirationTime<=q);if(q=e.unstable_now(),typeof M=="function"){d.callback=M,E(q),X=!0;break t}d===n(c)&&r(c),E(q)}else r(c);d=n(c)}if(d!==null)X=!0;else{var O=n(f);O!==null&&Y(R,O.startTime-q),X=!1}}break e}finally{d=null,_=K,v=!1}X=void 0}}finally{X?G():N=!1}}}var G;if(typeof y=="function")G=function(){y(z)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,H=U.port2;U.port1.onmessage=z,G=function(){H.postMessage(null)}}else G=function(){S(z,0)};function Y(q,X){D=S(function(){q(e.unstable_now())},X)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125L?(q.sortIndex=K,t(f,q),n(c)===null&&q===n(f)&&(C?(x(D),D=-1):C=!0,Y(R,K-L))):(q.sortIndex=M,t(c,q),w||v||(w=!0,N||(N=!0,G()))),q},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(q){var X=_;return function(){var K=_;_=X;try{return q.apply(this,arguments)}finally{_=K}}}})(Pd)),Pd}var Ry;function hA(){return Ry||(Ry=1,Fd.exports=uA()),Fd.exports}var Ud={exports:{}},Jt={};/** * @license React * react-dom.production.js * @@ -30,7 +30,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Dy;function mA(){if(Dy)return Jt;Dy=1;var e=al();function t(c){var f="https://react.dev/errors/"+c;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ud.exports=mA(),Ud.exports}/** + */var Dy;function fA(){if(Dy)return Jt;Dy=1;var e=al();function t(c){var f="https://react.dev/errors/"+c;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ud.exports=fA(),Ud.exports}/** * @license React * react-dom-client.production.js * @@ -38,325 +38,325 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var jy;function _A(){if(jy)return wo;jy=1;var e=gA(),t=al(),n=FS();function r(i){var s="https://react.dev/errors/"+i;if(1M||(i.current=L[M],L[M]=null,M--)}function U(i,s){M++,L[M]=i.current,i.current=s}var Q=O(null),re=O(null),ae=O(null),Z=O(null);function P(i,s){switch(U(ae,s),U(re,i),U(Q,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?Wv(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=Wv(s),i=Xv(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}$(Q),U(Q,i)}function ee(){$(Q),$(re),$(ae)}function ne(i){i.memoizedState!==null&&U(Z,i);var s=Q.current,h=Xv(s,i.type);s!==h&&(U(re,i),U(Q,h))}function ge(i){re.current===i&&($(Q),$(re)),Z.current===i&&($(Z),vo._currentValue=K)}var he,ye;function be(i){if(he===void 0)try{throw Error()}catch(h){var s=h.stack.trim().match(/\n( *(at )?)/);he=s&&s[1]||"",ye=-1M||(i.current=L[M],L[M]=null,M--)}function F(i,s){M++,L[M]=i.current,i.current=s}var Q=O(null),re=O(null),ae=O(null),Z=O(null);function P(i,s){switch(F(ae,s),F(re,i),F(Q,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?Wv(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=Wv(s),i=Xv(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}$(Q),F(Q,i)}function ee(){$(Q),$(re),$(ae)}function ne(i){i.memoizedState!==null&&F(Z,i);var s=Q.current,h=Xv(s,i.type);s!==h&&(F(re,i),F(Q,h))}function ge(i){re.current===i&&($(Q),$(re)),Z.current===i&&($(Z),vo._currentValue=K)}var he,ye;function be(i){if(he===void 0)try{throw Error()}catch(h){var s=h.stack.trim().match(/\n( *(at )?)/);he=s&&s[1]||"",ye=-1)":-1k||J[g]!==ce[k]){var me=` `+J[g].replace(" at new "," at ");return i.displayName&&me.includes("")&&(me=me.replace("",i.displayName)),me}while(1<=g&&0<=k);break}}}finally{ke=!1,Error.prepareStackTrace=h}return(h=i?i.displayName||i.name:"")?be(h):""}function Ce(i,s){switch(i.tag){case 26:case 27:case 5:return be(i.type);case 16:return be("Lazy");case 13:return i.child!==s&&s!==null?be("Suspense Fallback"):be("Suspense");case 19:return be("SuspenseList");case 0:case 15:return Ee(i.type,!1);case 11:return Ee(i.type.render,!1);case 1:return Ee(i.type,!0);case 31:return be("Activity");default:return""}}function rt(i){try{var s="",h=null;do s+=Ce(i,h),h=i,i=i.return;while(i);return s}catch(g){return` Error generating stack: `+g.message+` -`+g.stack}}var bt=Object.prototype.hasOwnProperty,Ge=e.unstable_scheduleCallback,ct=e.unstable_cancelCallback,Pt=e.unstable_shouldYield,ht=e.unstable_requestPaint,Fe=e.unstable_now,fe=e.unstable_getCurrentPriorityLevel,ie=e.unstable_ImmediatePriority,de=e.unstable_UserBlockingPriority,Se=e.unstable_NormalPriority,Ae=e.unstable_LowPriority,De=e.unstable_IdlePriority,Ve=e.log,Ie=e.unstable_setDisableYieldValue,Nt=null,Et=null;function qt(i){if(typeof Ve=="function"&&Ie(i),Et&&typeof Et.setStrictMode=="function")try{Et.setStrictMode(Nt,i)}catch{}}var st=Math.clz32?Math.clz32:ps,Ln=Math.log,Ut=Math.LN2;function ps(i){return i>>>=0,i===0?32:31-(Ln(i)/Ut|0)|0}var mi=256,_i=262144,vi=4194304;function On(i){var s=i&42;if(s!==0)return s;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 yi(i,s,h){var g=i.pendingLanes;if(g===0)return 0;var k=0,A=i.suspendedLanes,I=i.pingedLanes;i=i.warmLanes;var W=g&134217727;return W!==0?(g=W&~A,g!==0?k=On(g):(I&=W,I!==0?k=On(I):h||(h=W&~i,h!==0&&(k=On(h))))):(W=g&~A,W!==0?k=On(W):I!==0?k=On(I):h||(h=g&~i,h!==0&&(k=On(h)))),k===0?0:s!==0&&s!==k&&(s&A)===0&&(A=k&-k,h=s&-s,A>=h||A===32&&(h&4194048)!==0)?s:k}function ni(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function oe(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 we(){var i=vi;return vi<<=1,(vi&62914560)===0&&(vi=4194304),i}function Ne(i){for(var s=[],h=0;31>h;h++)s.push(i);return s}function qe(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function at(i,s,h,g,k,A){var I=i.pendingLanes;i.pendingLanes=h,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=h,i.entangledLanes&=h,i.errorRecoveryDisabledLanes&=h,i.shellSuspendCounter=0;var W=i.entanglements,J=i.expirationTimes,ce=i.hiddenUpdates;for(h=I&~h;0"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var Al=/[\n"\\]/g;function on(i){return i.replace(Al,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Da(i,s,h,g,k,A,I,W){i.name="",I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?i.type=I:i.removeAttribute("type"),s!=null?I==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+an(s)):i.value!==""+an(s)&&(i.value=""+an(s)):I!=="submit"&&I!=="reset"||i.removeAttribute("value"),s!=null?Ma(i,I,an(s)):h!=null?Ma(i,I,an(h)):g!=null&&i.removeAttribute("value"),k==null&&A!=null&&(i.defaultChecked=!!A),k!=null&&(i.checked=k&&typeof k!="function"&&typeof k!="symbol"),W!=null&&typeof W!="function"&&typeof W!="symbol"&&typeof W!="boolean"?i.name=""+an(W):i.removeAttribute("name")}function bs(i,s,h,g,k,A,I,W){if(A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(i.type=A),s!=null||h!=null){if(!(A!=="submit"&&A!=="reset"||s!=null)){Ra(i);return}h=h!=null?""+an(h):"",s=s!=null?""+an(s):h,W||s===i.value||(i.value=s),i.defaultValue=s}g=g??k,g=typeof g!="function"&&typeof g!="symbol"&&!!g,i.checked=W?i.checked:!!g,i.defaultChecked=!!g,I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"&&(i.name=I),Ra(i)}function Ma(i,s,h){s==="number"&&ys(i.ownerDocument)===i||i.defaultValue===""+h||(i.defaultValue=""+h)}function Qi(i,s,h,g){if(i=i.options,s){s={};for(var k=0;k"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bh=!1;if(Ci)try{var Oa={};Object.defineProperty(Oa,"passive",{get:function(){Bh=!0}}),window.addEventListener("test",Oa,Oa),window.removeEventListener("test",Oa,Oa)}catch{Bh=!1}var Ji=null,Ih=null,Tl=null;function Xm(){if(Tl)return Tl;var i,s=Ih,h=s.length,g,k="value"in Ji?Ji.value:Ji.textContent,A=k.length;for(i=0;i=za),t0=" ",n0=!1;function i0(i,s){switch(i){case"keyup":return ME.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function r0(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Cs=!1;function LE(i,s){switch(i){case"compositionend":return r0(s);case"keypress":return s.which!==32?null:(n0=!0,t0);case"textInput":return i=s.data,i===t0&&n0?null:i;default:return null}}function OE(i,s){if(Cs)return i==="compositionend"||!Uh&&i0(i,s)?(i=Xm(),Tl=Ih=Ji=null,Cs=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:h,offset:s-i};i=g}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=f0(h)}}function p0(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?p0(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function g0(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=ys(i.document);s instanceof i.HTMLIFrameElement;){try{var h=typeof s.contentWindow.location.href=="string"}catch{h=!1}if(h)i=s.contentWindow;else break;s=ys(i.document)}return s}function qh(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var $E=Ci&&"documentMode"in document&&11>=document.documentMode,Es=null,Vh=null,Ua=null,Yh=!1;function m0(i,s,h){var g=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Yh||Es==null||Es!==ys(g)||(g=Es,"selectionStart"in g&&qh(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Ua&&Pa(Ua,g)||(Ua=g,g=xc(Vh,"onSelect"),0>=I,k-=I,ri=1<<32-st(s)+k|h<Ue?(Ze=Re,Re=null):Ze=Re.sibling;var it=ue(se,Re,le[Ue],_e);if(it===null){Re===null&&(Re=Ze);break}i&&Re&&it.alternate===null&&s(se,Re),te=A(it,te,Ue),nt===null?Le=it:nt.sibling=it,nt=it,Re=Ze}if(Ue===le.length)return h(se,Re),Qe&&ki(se,Ue),Le;if(Re===null){for(;UeUe?(Ze=Re,Re=null):Ze=Re.sibling;var Sr=ue(se,Re,it.value,_e);if(Sr===null){Re===null&&(Re=Ze);break}i&&Re&&Sr.alternate===null&&s(se,Re),te=A(Sr,te,Ue),nt===null?Le=Sr:nt.sibling=Sr,nt=Sr,Re=Ze}if(it.done)return h(se,Re),Qe&&ki(se,Ue),Le;if(Re===null){for(;!it.done;Ue++,it=le.next())it=ve(se,it.value,_e),it!==null&&(te=A(it,te,Ue),nt===null?Le=it:nt.sibling=it,nt=it);return Qe&&ki(se,Ue),Le}for(Re=g(Re);!it.done;Ue++,it=le.next())it=pe(Re,se,Ue,it.value,_e),it!==null&&(i&&it.alternate!==null&&Re.delete(it.key===null?Ue:it.key),te=A(it,te,Ue),nt===null?Le=it:nt.sibling=it,nt=it);return i&&Re.forEach(function(cA){return s(se,cA)}),Qe&&ki(se,Ue),Le}function mt(se,te,le,_e){if(typeof le=="object"&&le!==null&&le.type===C&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case v:e:{for(var Le=le.key;te!==null;){if(te.key===Le){if(Le=le.type,Le===C){if(te.tag===7){h(se,te.sibling),_e=k(te,le.props.children),_e.return=se,se=_e;break e}}else if(te.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===T&&Pr(Le)===te.type){h(se,te.sibling),_e=k(te,le.props),Wa(_e,le),_e.return=se,se=_e;break e}h(se,te);break}else s(se,te);te=te.sibling}le.type===C?(_e=Br(le.props.children,se.mode,_e,le.key),_e.return=se,se=_e):(_e=Hl(le.type,le.key,le.props,null,se.mode,_e),Wa(_e,le),_e.return=se,se=_e)}return I(se);case w:e:{for(Le=le.key;te!==null;){if(te.key===Le)if(te.tag===4&&te.stateNode.containerInfo===le.containerInfo&&te.stateNode.implementation===le.implementation){h(se,te.sibling),_e=k(te,le.children||[]),_e.return=se,se=_e;break e}else{h(se,te);break}else s(se,te);te=te.sibling}_e=ef(le,se.mode,_e),_e.return=se,se=_e}return I(se);case T:return le=Pr(le),mt(se,te,le,_e)}if(V(le))return Te(se,te,le,_e);if(Y(le)){if(Le=Y(le),typeof Le!="function")throw Error(r(150));return le=Le.call(le),Be(se,te,le,_e)}if(typeof le.then=="function")return mt(se,te,Vl(le),_e);if(le.$$typeof===y)return mt(se,te,Ul(se,le),_e);Yl(se,le)}return typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint"?(le=""+le,te!==null&&te.tag===6?(h(se,te.sibling),_e=k(te,le),_e.return=se,se=_e):(h(se,te),_e=Jh(le,se.mode,_e),_e.return=se,se=_e),I(se)):h(se,te)}return function(se,te,le,_e){try{Ya=0;var Le=mt(se,te,le,_e);return Bs=null,Le}catch(Re){if(Re===Os||Re===Gl)throw Re;var nt=bn(29,Re,null,se.mode);return nt.lanes=_e,nt.return=se,nt}finally{}}}var $r=H0(!0),F0=H0(!1),rr=!1;function df(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function pf(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function sr(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function ar(i,s,h){var g=i.updateQueue;if(g===null)return null;if(g=g.shared,(ot&2)!==0){var k=g.pending;return k===null?s.next=s:(s.next=k.next,k.next=s),g.pending=s,s=zl(i),w0(i,null,h),s}return Il(i,g,s,h),zl(i)}function Xa(i,s,h){if(s=s.updateQueue,s!==null&&(s=s.shared,(h&4194048)!==0)){var g=s.lanes;g&=i.pendingLanes,h|=g,s.lanes=h,nn(i,h)}}function gf(i,s){var h=i.updateQueue,g=i.alternate;if(g!==null&&(g=g.updateQueue,h===g)){var k=null,A=null;if(h=h.firstBaseUpdate,h!==null){do{var I={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};A===null?k=A=I:A=A.next=I,h=h.next}while(h!==null);A===null?k=A=s:A=A.next=s}else k=A=s;h={baseState:g.baseState,firstBaseUpdate:k,lastBaseUpdate:A,shared:g.shared,callbacks:g.callbacks},i.updateQueue=h;return}i=h.lastBaseUpdate,i===null?h.firstBaseUpdate=s:i.next=s,h.lastBaseUpdate=s}var mf=!1;function Ka(){if(mf){var i=Ls;if(i!==null)throw i}}function Za(i,s,h,g){mf=!1;var k=i.updateQueue;rr=!1;var A=k.firstBaseUpdate,I=k.lastBaseUpdate,W=k.shared.pending;if(W!==null){k.shared.pending=null;var J=W,ce=J.next;J.next=null,I===null?A=ce:I.next=ce,I=J;var me=i.alternate;me!==null&&(me=me.updateQueue,W=me.lastBaseUpdate,W!==I&&(W===null?me.firstBaseUpdate=ce:W.next=ce,me.lastBaseUpdate=J))}if(A!==null){var ve=k.baseState;I=0,me=ce=J=null,W=A;do{var ue=W.lane&-536870913,pe=ue!==W.lane;if(pe?(Ke&ue)===ue:(g&ue)===ue){ue!==0&&ue===js&&(mf=!0),me!==null&&(me=me.next={lane:0,tag:W.tag,payload:W.payload,callback:null,next:null});e:{var Te=i,Be=W;ue=s;var mt=h;switch(Be.tag){case 1:if(Te=Be.payload,typeof Te=="function"){ve=Te.call(mt,ve,ue);break e}ve=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Be.payload,ue=typeof Te=="function"?Te.call(mt,ve,ue):Te,ue==null)break e;ve=d({},ve,ue);break e;case 2:rr=!0}}ue=W.callback,ue!==null&&(i.flags|=64,pe&&(i.flags|=8192),pe=k.callbacks,pe===null?k.callbacks=[ue]:pe.push(ue))}else pe={lane:ue,tag:W.tag,payload:W.payload,callback:W.callback,next:null},me===null?(ce=me=pe,J=ve):me=me.next=pe,I|=ue;if(W=W.next,W===null){if(W=k.shared.pending,W===null)break;pe=W,W=pe.next,pe.next=null,k.lastBaseUpdate=pe,k.shared.pending=null}}while(!0);me===null&&(J=ve),k.baseState=J,k.firstBaseUpdate=ce,k.lastBaseUpdate=me,A===null&&(k.shared.lanes=0),hr|=I,i.lanes=I,i.memoizedState=ve}}function P0(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function U0(i,s){var h=i.callbacks;if(h!==null)for(i.callbacks=null,i=0;iA?A:8;var I=G.T,W={};G.T=W,Of(i,!1,s,h);try{var J=k(),ce=G.S;if(ce!==null&&ce(W,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var me=QE(J,g);eo(i,s,me,En(i))}else eo(i,s,g,En(i))}catch(ve){eo(i,s,{then:function(){},status:"rejected",reason:ve},En())}finally{X.p=A,I!==null&&W.types!==null&&(I.types=W.types),G.T=I}}function rk(){}function jf(i,s,h,g){if(i.tag!==5)throw Error(r(476));var k=b_(i).queue;y_(i,k,s,K,h===null?rk:function(){return S_(i),h(g)})}function b_(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ri,lastRenderedState:K},next:null};var h={};return s.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ri,lastRenderedState:h},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function S_(i){var s=b_(i);s.next===null&&(s=i.alternate.memoizedState),eo(i,s.next.queue,{},En())}function Lf(){return Xt(vo)}function x_(){return jt().memoizedState}function w_(){return jt().memoizedState}function sk(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var h=En();i=sr(h);var g=ar(s,i,h);g!==null&&(dn(g,s,h),Xa(g,s,h)),s={cache:cf()},i.payload=s;return}s=s.return}}function ak(i,s,h){var g=En();h={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},ic(i)?E_(s,h):(h=Zh(i,s,h,g),h!==null&&(dn(h,i,g),k_(h,s,g)))}function C_(i,s,h){var g=En();eo(i,s,h,g)}function eo(i,s,h,g){var k={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(ic(i))E_(s,k);else{var A=i.alternate;if(i.lanes===0&&(A===null||A.lanes===0)&&(A=s.lastRenderedReducer,A!==null))try{var I=s.lastRenderedState,W=A(I,h);if(k.hasEagerState=!0,k.eagerState=W,yn(W,I))return Il(i,s,k,0),_t===null&&Bl(),!1}catch{}finally{}if(h=Zh(i,s,k,g),h!==null)return dn(h,i,g),k_(h,s,g),!0}return!1}function Of(i,s,h,g){if(g={lane:2,revertLane:dd(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},ic(i)){if(s)throw Error(r(479))}else s=Zh(i,h,g,2),s!==null&&dn(s,i,2)}function ic(i){var s=i.alternate;return i===Pe||s!==null&&s===Pe}function E_(i,s){zs=Kl=!0;var h=i.pending;h===null?s.next=s:(s.next=h.next,h.next=s),i.pending=s}function k_(i,s,h){if((h&4194048)!==0){var g=s.lanes;g&=i.pendingLanes,h|=g,s.lanes=h,nn(i,h)}}var to={readContext:Xt,use:Jl,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useLayoutEffect:Tt,useInsertionEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useSyncExternalStore:Tt,useId:Tt,useHostTransitionStatus:Tt,useFormState:Tt,useActionState:Tt,useOptimistic:Tt,useMemoCache:Tt,useCacheRefresh:Tt};to.useEffectEvent=Tt;var A_={readContext:Xt,use:Jl,useCallback:function(i,s){return rn().memoizedState=[i,s===void 0?null:s],i},useContext:Xt,useEffect:u_,useImperativeHandle:function(i,s,h){h=h!=null?h.concat([i]):null,tc(4194308,4,p_.bind(null,s,i),h)},useLayoutEffect:function(i,s){return tc(4194308,4,i,s)},useInsertionEffect:function(i,s){tc(4,2,i,s)},useMemo:function(i,s){var h=rn();s=s===void 0?null:s;var g=i();if(Gr){qt(!0);try{i()}finally{qt(!1)}}return h.memoizedState=[g,s],g},useReducer:function(i,s,h){var g=rn();if(h!==void 0){var k=h(s);if(Gr){qt(!0);try{h(s)}finally{qt(!1)}}}else k=s;return g.memoizedState=g.baseState=k,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:k},g.queue=i,i=i.dispatch=ak.bind(null,Pe,i),[g.memoizedState,i]},useRef:function(i){var s=rn();return i={current:i},s.memoizedState=i},useState:function(i){i=Nf(i);var s=i.queue,h=C_.bind(null,Pe,s);return s.dispatch=h,[i.memoizedState,h]},useDebugValue:Df,useDeferredValue:function(i,s){var h=rn();return Mf(h,i,s)},useTransition:function(){var i=Nf(!1);return i=y_.bind(null,Pe,i.queue,!0,!1),rn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,h){var g=Pe,k=rn();if(Qe){if(h===void 0)throw Error(r(407));h=h()}else{if(h=s(),_t===null)throw Error(r(349));(Ke&127)!==0||W0(g,s,h)}k.memoizedState=h;var A={value:h,getSnapshot:s};return k.queue=A,u_(K0.bind(null,g,A,i),[i]),g.flags|=2048,Fs(9,{destroy:void 0},X0.bind(null,g,A,h,s),null),h},useId:function(){var i=rn(),s=_t.identifierPrefix;if(Qe){var h=si,g=ri;h=(g&~(1<<32-st(g)-1)).toString(32)+h,s="_"+s+"R_"+h,h=Zl++,0<\/script>",A=A.removeChild(A.firstChild);break;case"select":A=typeof g.is=="string"?I.createElement("select",{is:g.is}):I.createElement("select"),g.multiple?A.multiple=!0:g.size&&(A.size=g.size);break;default:A=typeof g.is=="string"?I.createElement(k,{is:g.is}):I.createElement(k)}}A[$t]=s,A[Qt]=g;e:for(I=s.child;I!==null;){if(I.tag===5||I.tag===6)A.appendChild(I.stateNode);else if(I.tag!==4&&I.tag!==27&&I.child!==null){I.child.return=I,I=I.child;continue}if(I===s)break e;for(;I.sibling===null;){if(I.return===null||I.return===s)break e;I=I.return}I.sibling.return=I.return,I=I.sibling}s.stateNode=A;e:switch(Zt(A,k,g),k){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Mi(s)}}return xt(s),Xf(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,h),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==g&&Mi(s);else{if(typeof g!="string"&&s.stateNode===null)throw Error(r(166));if(i=ae.current,Ds(s)){if(i=s.stateNode,h=s.memoizedProps,g=null,k=Wt,k!==null)switch(k.tag){case 27:case 5:g=k.memoizedProps}i[$t]=s,i=!!(i.nodeValue===h||g!==null&&g.suppressHydrationWarning===!0||Vv(i.nodeValue,h)),i||nr(s,!0)}else i=wc(i).createTextNode(g),i[$t]=s,s.stateNode=i}return xt(s),null;case 31:if(h=s.memoizedState,i===null||i.memoizedState!==null){if(g=Ds(s),h!==null){if(i===null){if(!g)throw Error(r(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[$t]=s}else Ir(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;xt(s),i=!1}else h=sf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=h),i=!0;if(!i)return s.flags&256?(xn(s),s):(xn(s),null);if((s.flags&128)!==0)throw Error(r(558))}return xt(s),null;case 13:if(g=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(k=Ds(s),g!==null&&g.dehydrated!==null){if(i===null){if(!k)throw Error(r(318));if(k=s.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(r(317));k[$t]=s}else Ir(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;xt(s),k=!1}else k=sf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=k),k=!0;if(!k)return s.flags&256?(xn(s),s):(xn(s),null)}return xn(s),(s.flags&128)!==0?(s.lanes=h,s):(h=g!==null,i=i!==null&&i.memoizedState!==null,h&&(g=s.child,k=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(k=g.alternate.memoizedState.cachePool.pool),A=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(A=g.memoizedState.cachePool.pool),A!==k&&(g.flags|=2048)),h!==i&&h&&(s.child.flags|=8192),lc(s,s.updateQueue),xt(s),null);case 4:return ee(),i===null&&_d(s.stateNode.containerInfo),xt(s),null;case 10:return Ni(s.type),xt(s),null;case 19:if($(Mt),g=s.memoizedState,g===null)return xt(s),null;if(k=(s.flags&128)!==0,A=g.rendering,A===null)if(k)io(g,!1);else{if(Rt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(A=Xl(i),A!==null){for(s.flags|=128,io(g,!1),i=A.updateQueue,s.updateQueue=i,lc(s,i),s.subtreeFlags=0,i=h,h=s.child;h!==null;)C0(h,i),h=h.sibling;return U(Mt,Mt.current&1|2),Qe&&ki(s,g.treeForkCount),s.child}i=i.sibling}g.tail!==null&&Fe()>dc&&(s.flags|=128,k=!0,io(g,!1),s.lanes=4194304)}else{if(!k)if(i=Xl(A),i!==null){if(s.flags|=128,k=!0,i=i.updateQueue,s.updateQueue=i,lc(s,i),io(g,!0),g.tail===null&&g.tailMode==="hidden"&&!A.alternate&&!Qe)return xt(s),null}else 2*Fe()-g.renderingStartTime>dc&&h!==536870912&&(s.flags|=128,k=!0,io(g,!1),s.lanes=4194304);g.isBackwards?(A.sibling=s.child,s.child=A):(i=g.last,i!==null?i.sibling=A:s.child=A,g.last=A)}return g.tail!==null?(i=g.tail,g.rendering=i,g.tail=i.sibling,g.renderingStartTime=Fe(),i.sibling=null,h=Mt.current,U(Mt,k?h&1|2:h&1),Qe&&ki(s,g.treeForkCount),i):(xt(s),null);case 22:case 23:return xn(s),vf(),g=s.memoizedState!==null,i!==null?i.memoizedState!==null!==g&&(s.flags|=8192):g&&(s.flags|=8192),g?(h&536870912)!==0&&(s.flags&128)===0&&(xt(s),s.subtreeFlags&6&&(s.flags|=8192)):xt(s),h=s.updateQueue,h!==null&&lc(s,h.retryQueue),h=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(h=i.memoizedState.cachePool.pool),g=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(g=s.memoizedState.cachePool.pool),g!==h&&(s.flags|=2048),i!==null&&$(Fr),null;case 24:return h=null,i!==null&&(h=i.memoizedState.cache),s.memoizedState.cache!==h&&(s.flags|=2048),Ni(Ot),xt(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function hk(i,s){switch(nf(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return Ni(Ot),ee(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return ge(s),null;case 31:if(s.memoizedState!==null){if(xn(s),s.alternate===null)throw Error(r(340));Ir()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(xn(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));Ir()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return $(Mt),null;case 4:return ee(),null;case 10:return Ni(s.type),null;case 22:case 23:return xn(s),vf(),i!==null&&$(Fr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return Ni(Ot),null;case 25:return null;default:return null}}function Z_(i,s){switch(nf(s),s.tag){case 3:Ni(Ot),ee();break;case 26:case 27:case 5:ge(s);break;case 4:ee();break;case 31:s.memoizedState!==null&&xn(s);break;case 13:xn(s);break;case 19:$(Mt);break;case 10:Ni(s.type);break;case 22:case 23:xn(s),vf(),i!==null&&$(Fr);break;case 24:Ni(Ot)}}function ro(i,s){try{var h=s.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var k=g.next;h=k;do{if((h.tag&i)===i){g=void 0;var A=h.create,I=h.inst;g=A(),I.destroy=g}h=h.next}while(h!==k)}}catch(W){dt(s,s.return,W)}}function cr(i,s,h){try{var g=s.updateQueue,k=g!==null?g.lastEffect:null;if(k!==null){var A=k.next;g=A;do{if((g.tag&i)===i){var I=g.inst,W=I.destroy;if(W!==void 0){I.destroy=void 0,k=s;var J=h,ce=W;try{ce()}catch(me){dt(k,J,me)}}}g=g.next}while(g!==A)}}catch(me){dt(s,s.return,me)}}function Q_(i){var s=i.updateQueue;if(s!==null){var h=i.stateNode;try{U0(s,h)}catch(g){dt(i,i.return,g)}}}function J_(i,s,h){h.props=qr(i.type,i.memoizedProps),h.state=i.memoizedState;try{h.componentWillUnmount()}catch(g){dt(i,s,g)}}function so(i,s){try{var h=i.ref;if(h!==null){switch(i.tag){case 26:case 27:case 5:var g=i.stateNode;break;case 30:g=i.stateNode;break;default:g=i.stateNode}typeof h=="function"?i.refCleanup=h(g):h.current=g}}catch(k){dt(i,s,k)}}function ai(i,s){var h=i.ref,g=i.refCleanup;if(h!==null)if(typeof g=="function")try{g()}catch(k){dt(i,s,k)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(k){dt(i,s,k)}else h.current=null}function ev(i){var s=i.type,h=i.memoizedProps,g=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":h.autoFocus&&g.focus();break e;case"img":h.src?g.src=h.src:h.srcSet&&(g.srcset=h.srcSet)}}catch(k){dt(i,i.return,k)}}function Kf(i,s,h){try{var g=i.stateNode;jk(g,i.type,h,s),g[Qt]=s}catch(k){dt(i,i.return,k)}}function tv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&mr(i.type)||i.tag===4}function Zf(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||tv(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&&mr(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 Qf(i,s,h){var g=i.tag;if(g===5||g===6)i=i.stateNode,s?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(i,s):(s=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,s.appendChild(i),h=h._reactRootContainer,h!=null||s.onclick!==null||(s.onclick=wi));else if(g!==4&&(g===27&&mr(i.type)&&(h=i.stateNode,s=null),i=i.child,i!==null))for(Qf(i,s,h),i=i.sibling;i!==null;)Qf(i,s,h),i=i.sibling}function cc(i,s,h){var g=i.tag;if(g===5||g===6)i=i.stateNode,s?h.insertBefore(i,s):h.appendChild(i);else if(g!==4&&(g===27&&mr(i.type)&&(h=i.stateNode),i=i.child,i!==null))for(cc(i,s,h),i=i.sibling;i!==null;)cc(i,s,h),i=i.sibling}function nv(i){var s=i.stateNode,h=i.memoizedProps;try{for(var g=i.type,k=s.attributes;k.length;)s.removeAttributeNode(k[0]);Zt(s,g,h),s[$t]=i,s[Qt]=h}catch(A){dt(i,i.return,A)}}var ji=!1,zt=!1,Jf=!1,iv=typeof WeakSet=="function"?WeakSet:Set,Vt=null;function fk(i,s){if(i=i.containerInfo,bd=Rc,i=g0(i),qh(i)){if("selectionStart"in i)var h={start:i.selectionStart,end:i.selectionEnd};else e:{h=(h=i.ownerDocument)&&h.defaultView||window;var g=h.getSelection&&h.getSelection();if(g&&g.rangeCount!==0){h=g.anchorNode;var k=g.anchorOffset,A=g.focusNode;g=g.focusOffset;try{h.nodeType,A.nodeType}catch{h=null;break e}var I=0,W=-1,J=-1,ce=0,me=0,ve=i,ue=null;t:for(;;){for(var pe;ve!==h||k!==0&&ve.nodeType!==3||(W=I+k),ve!==A||g!==0&&ve.nodeType!==3||(J=I+g),ve.nodeType===3&&(I+=ve.nodeValue.length),(pe=ve.firstChild)!==null;)ue=ve,ve=pe;for(;;){if(ve===i)break t;if(ue===h&&++ce===k&&(W=I),ue===A&&++me===g&&(J=I),(pe=ve.nextSibling)!==null)break;ve=ue,ue=ve.parentNode}ve=pe}h=W===-1||J===-1?null:{start:W,end:J}}else h=null}h=h||{start:0,end:0}}else h=null;for(Sd={focusedElem:i,selectionRange:h},Rc=!1,Vt=s;Vt!==null;)if(s=Vt,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,Vt=i;else for(;Vt!==null;){switch(s=Vt,A=s.alternate,i=s.flags,s.tag){case 0:if((i&4)!==0&&(i=s.updateQueue,i=i!==null?i.events:null,i!==null))for(h=0;h title"))),Zt(A,g,h),A[$t]=i,Lt(A),g=A;break e;case"link":var I=cy("link","href",k).get(g+(h.href||""));if(I){for(var W=0;Wmt&&(I=mt,mt=Be,Be=I);var se=d0(W,Be),te=d0(W,mt);if(se&&te&&(pe.rangeCount!==1||pe.anchorNode!==se.node||pe.anchorOffset!==se.offset||pe.focusNode!==te.node||pe.focusOffset!==te.offset)){var le=ve.createRange();le.setStart(se.node,se.offset),pe.removeAllRanges(),Be>mt?(pe.addRange(le),pe.extend(te.node,te.offset)):(le.setEnd(te.node,te.offset),pe.addRange(le))}}}}for(ve=[],pe=W;pe=pe.parentNode;)pe.nodeType===1&&ve.push({element:pe,left:pe.scrollLeft,top:pe.scrollTop});for(typeof W.focus=="function"&&W.focus(),W=0;Wh?32:h,G.T=null,h=ad,ad=null;var A=dr,I=zi;if(Gt=0,qs=dr=null,zi=0,(ot&6)!==0)throw Error(r(331));var W=ot;if(ot|=4,pv(A.current),hv(A,A.current,I,h),ot=W,ho(0,!1),Et&&typeof Et.onPostCommitFiberRoot=="function")try{Et.onPostCommitFiberRoot(Nt,A)}catch{}return!0}finally{X.p=k,G.T=g,Mv(i,s)}}function Lv(i,s,h){s=In(h,s),s=Hf(i.stateNode,s,2),i=ar(i,s,2),i!==null&&(qe(i,2),oi(i))}function dt(i,s,h){if(i.tag===3)Lv(i,i,h);else for(;s!==null;){if(s.tag===3){Lv(s,i,h);break}else if(s.tag===1){var g=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(fr===null||!fr.has(g))){i=In(h,i),h=O_(2),g=ar(s,h,2),g!==null&&(B_(h,g,s,i),qe(g,2),oi(g));break}}s=s.return}}function ud(i,s,h){var g=i.pingCache;if(g===null){g=i.pingCache=new gk;var k=new Set;g.set(s,k)}else k=g.get(s),k===void 0&&(k=new Set,g.set(s,k));k.has(h)||(nd=!0,k.add(h),i=bk.bind(null,i,s,h),s.then(i,i))}function bk(i,s,h){var g=i.pingCache;g!==null&&g.delete(s),i.pingedLanes|=i.suspendedLanes&h,i.warmLanes&=~h,_t===i&&(Ke&h)===h&&(Rt===4||Rt===3&&(Ke&62914560)===Ke&&300>Fe()-fc?(ot&2)===0&&Vs(i,0):id|=h,Gs===Ke&&(Gs=0)),oi(i)}function Ov(i,s){s===0&&(s=we()),i=Or(i,s),i!==null&&(qe(i,s),oi(i))}function Sk(i){var s=i.memoizedState,h=0;s!==null&&(h=s.retryLane),Ov(i,h)}function xk(i,s){var h=0;switch(i.tag){case 31:case 13:var g=i.stateNode,k=i.memoizedState;k!==null&&(h=k.retryLane);break;case 19:g=i.stateNode;break;case 22:g=i.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(s),Ov(i,h)}function wk(i,s){return Ge(i,s)}var yc=null,Ws=null,hd=!1,bc=!1,fd=!1,gr=0;function oi(i){i!==Ws&&i.next===null&&(Ws===null?yc=Ws=i:Ws=Ws.next=i),bc=!0,hd||(hd=!0,Ek())}function ho(i,s){if(!fd&&bc){fd=!0;do for(var h=!1,g=yc;g!==null;){if(i!==0){var k=g.pendingLanes;if(k===0)var A=0;else{var I=g.suspendedLanes,W=g.pingedLanes;A=(1<<31-st(42|i)+1)-1,A&=k&~(I&~W),A=A&201326741?A&201326741|1:A?A|2:0}A!==0&&(h=!0,Hv(g,A))}else A=Ke,A=yi(g,g===_t?A:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(A&3)===0||ni(g,A)||(h=!0,Hv(g,A));g=g.next}while(h);fd=!1}}function Ck(){Bv()}function Bv(){bc=hd=!1;var i=0;gr!==0&&Ok()&&(i=gr);for(var s=Fe(),h=null,g=yc;g!==null;){var k=g.next,A=Iv(g,s);A===0?(g.next=null,h===null?yc=k:h.next=k,k===null&&(Ws=h)):(h=g,(i!==0||(A&3)!==0)&&(bc=!0)),g=k}Gt!==0&&Gt!==5||ho(i),gr!==0&&(gr=0)}function Iv(i,s){for(var h=i.suspendedLanes,g=i.pingedLanes,k=i.expirationTimes,A=i.pendingLanes&-62914561;0W)break;var me=J.transferSize,ve=J.initiatorType;me&&Yv(ve)&&(J=J.responseEnd,I+=me*(J"u"?null:document;function sy(i,s,h){var g=Xs;if(g&&typeof s=="string"&&s){var k=on(s);k='link[rel="'+i+'"][href="'+k+'"]',typeof h=="string"&&(k+='[crossorigin="'+h+'"]'),ry.has(k)||(ry.add(k),i={rel:i,crossOrigin:h,href:s},g.querySelector(k)===null&&(s=g.createElement("link"),Zt(s,"link",i),Lt(s),g.head.appendChild(s)))}}function Gk(i){Hi.D(i),sy("dns-prefetch",i,null)}function qk(i,s){Hi.C(i,s),sy("preconnect",i,s)}function Vk(i,s,h){Hi.L(i,s,h);var g=Xs;if(g&&i&&s){var k='link[rel="preload"][as="'+on(s)+'"]';s==="image"&&h&&h.imageSrcSet?(k+='[imagesrcset="'+on(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(k+='[imagesizes="'+on(h.imageSizes)+'"]')):k+='[href="'+on(i)+'"]';var A=k;switch(s){case"style":A=Ks(i);break;case"script":A=Zs(i)}$n.has(A)||(i=d({rel:"preload",href:s==="image"&&h&&h.imageSrcSet?void 0:i,as:s},h),$n.set(A,i),g.querySelector(k)!==null||s==="style"&&g.querySelector(mo(A))||s==="script"&&g.querySelector(_o(A))||(s=g.createElement("link"),Zt(s,"link",i),Lt(s),g.head.appendChild(s)))}}function Yk(i,s){Hi.m(i,s);var h=Xs;if(h&&i){var g=s&&typeof s.as=="string"?s.as:"script",k='link[rel="modulepreload"][as="'+on(g)+'"][href="'+on(i)+'"]',A=k;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":A=Zs(i)}if(!$n.has(A)&&(i=d({rel:"modulepreload",href:i},s),$n.set(A,i),h.querySelector(k)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(_o(A)))return}g=h.createElement("link"),Zt(g,"link",i),Lt(g),h.head.appendChild(g)}}}function Wk(i,s,h){Hi.S(i,s,h);var g=Xs;if(g&&i){var k=Ki(g).hoistableStyles,A=Ks(i);s=s||"default";var I=k.get(A);if(!I){var W={loading:0,preload:null};if(I=g.querySelector(mo(A)))W.loading=5;else{i=d({rel:"stylesheet",href:i,"data-precedence":s},h),(h=$n.get(A))&&Nd(i,h);var J=I=g.createElement("link");Lt(J),Zt(J,"link",i),J._p=new Promise(function(ce,me){J.onload=ce,J.onerror=me}),J.addEventListener("load",function(){W.loading|=1}),J.addEventListener("error",function(){W.loading|=2}),W.loading|=4,Ec(I,s,g)}I={type:"stylesheet",instance:I,count:1,state:W},k.set(A,I)}}}function Xk(i,s){Hi.X(i,s);var h=Xs;if(h&&i){var g=Ki(h).hoistableScripts,k=Zs(i),A=g.get(k);A||(A=h.querySelector(_o(k)),A||(i=d({src:i,async:!0},s),(s=$n.get(k))&&Td(i,s),A=h.createElement("script"),Lt(A),Zt(A,"link",i),h.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},g.set(k,A))}}function Kk(i,s){Hi.M(i,s);var h=Xs;if(h&&i){var g=Ki(h).hoistableScripts,k=Zs(i),A=g.get(k);A||(A=h.querySelector(_o(k)),A||(i=d({src:i,async:!0,type:"module"},s),(s=$n.get(k))&&Td(i,s),A=h.createElement("script"),Lt(A),Zt(A,"link",i),h.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},g.set(k,A))}}function ay(i,s,h,g){var k=(k=ae.current)?Cc(k):null;if(!k)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(s=Ks(h.href),h=Ki(k).hoistableStyles,g=h.get(s),g||(g={type:"style",instance:null,count:0,state:null},h.set(s,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){i=Ks(h.href);var A=Ki(k).hoistableStyles,I=A.get(i);if(I||(k=k.ownerDocument||k,I={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},A.set(i,I),(A=k.querySelector(mo(i)))&&!A._p&&(I.instance=A,I.state.loading=5),$n.has(i)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},$n.set(i,h),A||Zk(k,i,h,I.state))),s&&g===null)throw Error(r(528,""));return I}if(s&&g!==null)throw Error(r(529,""));return null;case"script":return s=h.async,h=h.src,typeof h=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Zs(h),h=Ki(k).hoistableScripts,g=h.get(s),g||(g={type:"script",instance:null,count:0,state:null},h.set(s,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Ks(i){return'href="'+on(i)+'"'}function mo(i){return'link[rel="stylesheet"]['+i+"]"}function oy(i){return d({},i,{"data-precedence":i.precedence,precedence:null})}function Zk(i,s,h,g){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?g.loading=1:(s=i.createElement("link"),g.preload=s,s.addEventListener("load",function(){return g.loading|=1}),s.addEventListener("error",function(){return g.loading|=2}),Zt(s,"link",h),Lt(s),i.head.appendChild(s))}function Zs(i){return'[src="'+on(i)+'"]'}function _o(i){return"script[async]"+i}function ly(i,s,h){if(s.count++,s.instance===null)switch(s.type){case"style":var g=i.querySelector('style[data-href~="'+on(h.href)+'"]');if(g)return s.instance=g,Lt(g),g;var k=d({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return g=(i.ownerDocument||i).createElement("style"),Lt(g),Zt(g,"style",k),Ec(g,h.precedence,i),s.instance=g;case"stylesheet":k=Ks(h.href);var A=i.querySelector(mo(k));if(A)return s.state.loading|=4,s.instance=A,Lt(A),A;g=oy(h),(k=$n.get(k))&&Nd(g,k),A=(i.ownerDocument||i).createElement("link"),Lt(A);var I=A;return I._p=new Promise(function(W,J){I.onload=W,I.onerror=J}),Zt(A,"link",g),s.state.loading|=4,Ec(A,h.precedence,i),s.instance=A;case"script":return A=Zs(h.src),(k=i.querySelector(_o(A)))?(s.instance=k,Lt(k),k):(g=h,(k=$n.get(A))&&(g=d({},h),Td(g,k)),i=i.ownerDocument||i,k=i.createElement("script"),Lt(k),Zt(k,"link",g),i.head.appendChild(k),s.instance=k);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(g=s.instance,s.state.loading|=4,Ec(g,h.precedence,i));return s.instance}function Ec(i,s,h){for(var g=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),k=g.length?g[g.length-1]:null,A=k,I=0;I title"):null)}function Qk(i,s,h){if(h===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return i=s.disabled,typeof s.precedence=="string"&&i==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function hy(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function Jk(i,s,h,g){if(h.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var k=Ks(g.href),A=s.querySelector(mo(k));if(A){s=A._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=Ac.bind(i),s.then(i,i)),h.state.loading|=4,h.instance=A,Lt(A);return}A=s.ownerDocument||s,g=oy(g),(k=$n.get(k))&&Nd(g,k),A=A.createElement("link"),Lt(A);var I=A;I._p=new Promise(function(W,J){I.onload=W,I.onerror=J}),Zt(A,"link",g),h.instance=A}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(h,s),(s=h.state.preload)&&(h.state.loading&3)===0&&(i.count++,h=Ac.bind(i),s.addEventListener("load",h),s.addEventListener("error",h))}}var Rd=0;function eA(i,s){return i.stylesheets&&i.count===0&&Tc(i,i.stylesheets),0Rd?50:800)+s);return i.unsuspend=h,function(){i.unsuspend=null,clearTimeout(g),clearTimeout(k)}}:null}function Ac(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Tc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Nc=null;function Tc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Nc=new Map,s.forEach(tA,i),Nc=null,Ac.call(i))}function tA(i,s){if(!(s.state.loading&4)){var h=Nc.get(i);if(h)var g=h.get(null);else{h=new Map,Nc.set(i,h);for(var k=i.querySelectorAll("link[data-precedence],style[data-precedence]"),A=0;A"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Hd.exports=_A(),Hd.exports}var yA=vA();/** - * @license lucide-react v1.24.0 - ISC +`+g.stack}}var bt=Object.prototype.hasOwnProperty,Ge=e.unstable_scheduleCallback,ct=e.unstable_cancelCallback,Pt=e.unstable_shouldYield,ht=e.unstable_requestPaint,Fe=e.unstable_now,fe=e.unstable_getCurrentPriorityLevel,ie=e.unstable_ImmediatePriority,de=e.unstable_UserBlockingPriority,Se=e.unstable_NormalPriority,Ae=e.unstable_LowPriority,De=e.unstable_IdlePriority,Ve=e.log,Ie=e.unstable_setDisableYieldValue,Nt=null,Ct=null;function qt(i){if(typeof Ve=="function"&&Ie(i),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(Nt,i)}catch{}}var st=Math.clz32?Math.clz32:ps,Ln=Math.log,Ut=Math.LN2;function ps(i){return i>>>=0,i===0?32:31-(Ln(i)/Ut|0)|0}var gi=256,mi=262144,_i=4194304;function On(i){var s=i&42;if(s!==0)return s;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 vi(i,s,h){var g=i.pendingLanes;if(g===0)return 0;var k=0,A=i.suspendedLanes,I=i.pingedLanes;i=i.warmLanes;var W=g&134217727;return W!==0?(g=W&~A,g!==0?k=On(g):(I&=W,I!==0?k=On(I):h||(h=W&~i,h!==0&&(k=On(h))))):(W=g&~A,W!==0?k=On(W):I!==0?k=On(I):h||(h=g&~i,h!==0&&(k=On(h)))),k===0?0:s!==0&&s!==k&&(s&A)===0&&(A=k&-k,h=s&-s,A>=h||A===32&&(h&4194048)!==0)?s:k}function ni(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function oe(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 we(){var i=_i;return _i<<=1,(_i&62914560)===0&&(_i=4194304),i}function Ne(i){for(var s=[],h=0;31>h;h++)s.push(i);return s}function qe(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function at(i,s,h,g,k,A){var I=i.pendingLanes;i.pendingLanes=h,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=h,i.entangledLanes&=h,i.errorRecoveryDisabledLanes&=h,i.shellSuspendCounter=0;var W=i.entanglements,J=i.expirationTimes,ce=i.hiddenUpdates;for(h=I&~h;0"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var Al=/[\n"\\]/g;function on(i){return i.replace(Al,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Da(i,s,h,g,k,A,I,W){i.name="",I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?i.type=I:i.removeAttribute("type"),s!=null?I==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+an(s)):i.value!==""+an(s)&&(i.value=""+an(s)):I!=="submit"&&I!=="reset"||i.removeAttribute("value"),s!=null?Ma(i,I,an(s)):h!=null?Ma(i,I,an(h)):g!=null&&i.removeAttribute("value"),k==null&&A!=null&&(i.defaultChecked=!!A),k!=null&&(i.checked=k&&typeof k!="function"&&typeof k!="symbol"),W!=null&&typeof W!="function"&&typeof W!="symbol"&&typeof W!="boolean"?i.name=""+an(W):i.removeAttribute("name")}function bs(i,s,h,g,k,A,I,W){if(A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(i.type=A),s!=null||h!=null){if(!(A!=="submit"&&A!=="reset"||s!=null)){Ra(i);return}h=h!=null?""+an(h):"",s=s!=null?""+an(s):h,W||s===i.value||(i.value=s),i.defaultValue=s}g=g??k,g=typeof g!="function"&&typeof g!="symbol"&&!!g,i.checked=W?i.checked:!!g,i.defaultChecked=!!g,I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"&&(i.name=I),Ra(i)}function Ma(i,s,h){s==="number"&&ys(i.ownerDocument)===i||i.defaultValue===""+h||(i.defaultValue=""+h)}function Qi(i,s,h,g){if(i=i.options,s){s={};for(var k=0;k"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bh=!1;if(wi)try{var Oa={};Object.defineProperty(Oa,"passive",{get:function(){Bh=!0}}),window.addEventListener("test",Oa,Oa),window.removeEventListener("test",Oa,Oa)}catch{Bh=!1}var Ji=null,Ih=null,Tl=null;function Xm(){if(Tl)return Tl;var i,s=Ih,h=s.length,g,k="value"in Ji?Ji.value:Ji.textContent,A=k.length;for(i=0;i=za),t0=" ",n0=!1;function i0(i,s){switch(i){case"keyup":return NE.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function r0(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Cs=!1;function RE(i,s){switch(i){case"compositionend":return r0(s);case"keypress":return s.which!==32?null:(n0=!0,t0);case"textInput":return i=s.data,i===t0&&n0?null:i;default:return null}}function DE(i,s){if(Cs)return i==="compositionend"||!Uh&&i0(i,s)?(i=Xm(),Tl=Ih=Ji=null,Cs=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:h,offset:s-i};i=g}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=f0(h)}}function p0(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?p0(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function g0(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=ys(i.document);s instanceof i.HTMLIFrameElement;){try{var h=typeof s.contentWindow.location.href=="string"}catch{h=!1}if(h)i=s.contentWindow;else break;s=ys(i.document)}return s}function qh(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var HE=wi&&"documentMode"in document&&11>=document.documentMode,Es=null,Vh=null,Ua=null,Yh=!1;function m0(i,s,h){var g=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Yh||Es==null||Es!==ys(g)||(g=Es,"selectionStart"in g&&qh(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Ua&&Pa(Ua,g)||(Ua=g,g=xc(Vh,"onSelect"),0>=I,k-=I,ri=1<<32-st(s)+k|h<Ue?(Ze=Re,Re=null):Ze=Re.sibling;var it=ue(se,Re,le[Ue],_e);if(it===null){Re===null&&(Re=Ze);break}i&&Re&&it.alternate===null&&s(se,Re),te=A(it,te,Ue),nt===null?Le=it:nt.sibling=it,nt=it,Re=Ze}if(Ue===le.length)return h(se,Re),Qe&&Ei(se,Ue),Le;if(Re===null){for(;UeUe?(Ze=Re,Re=null):Ze=Re.sibling;var Sr=ue(se,Re,it.value,_e);if(Sr===null){Re===null&&(Re=Ze);break}i&&Re&&Sr.alternate===null&&s(se,Re),te=A(Sr,te,Ue),nt===null?Le=Sr:nt.sibling=Sr,nt=Sr,Re=Ze}if(it.done)return h(se,Re),Qe&&Ei(se,Ue),Le;if(Re===null){for(;!it.done;Ue++,it=le.next())it=ve(se,it.value,_e),it!==null&&(te=A(it,te,Ue),nt===null?Le=it:nt.sibling=it,nt=it);return Qe&&Ei(se,Ue),Le}for(Re=g(Re);!it.done;Ue++,it=le.next())it=pe(Re,se,Ue,it.value,_e),it!==null&&(i&&it.alternate!==null&&Re.delete(it.key===null?Ue:it.key),te=A(it,te,Ue),nt===null?Le=it:nt.sibling=it,nt=it);return i&&Re.forEach(function(sA){return s(se,sA)}),Qe&&Ei(se,Ue),Le}function mt(se,te,le,_e){if(typeof le=="object"&&le!==null&&le.type===C&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case v:e:{for(var Le=le.key;te!==null;){if(te.key===Le){if(Le=le.type,Le===C){if(te.tag===7){h(se,te.sibling),_e=k(te,le.props.children),_e.return=se,se=_e;break e}}else if(te.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===T&&Pr(Le)===te.type){h(se,te.sibling),_e=k(te,le.props),Wa(_e,le),_e.return=se,se=_e;break e}h(se,te);break}else s(se,te);te=te.sibling}le.type===C?(_e=Br(le.props.children,se.mode,_e,le.key),_e.return=se,se=_e):(_e=Hl(le.type,le.key,le.props,null,se.mode,_e),Wa(_e,le),_e.return=se,se=_e)}return I(se);case w:e:{for(Le=le.key;te!==null;){if(te.key===Le)if(te.tag===4&&te.stateNode.containerInfo===le.containerInfo&&te.stateNode.implementation===le.implementation){h(se,te.sibling),_e=k(te,le.children||[]),_e.return=se,se=_e;break e}else{h(se,te);break}else s(se,te);te=te.sibling}_e=ef(le,se.mode,_e),_e.return=se,se=_e}return I(se);case T:return le=Pr(le),mt(se,te,le,_e)}if(Y(le))return Te(se,te,le,_e);if(G(le)){if(Le=G(le),typeof Le!="function")throw Error(r(150));return le=Le.call(le),Be(se,te,le,_e)}if(typeof le.then=="function")return mt(se,te,Vl(le),_e);if(le.$$typeof===y)return mt(se,te,Ul(se,le),_e);Yl(se,le)}return typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint"?(le=""+le,te!==null&&te.tag===6?(h(se,te.sibling),_e=k(te,le),_e.return=se,se=_e):(h(se,te),_e=Jh(le,se.mode,_e),_e.return=se,se=_e),I(se)):h(se,te)}return function(se,te,le,_e){try{Ya=0;var Le=mt(se,te,le,_e);return Bs=null,Le}catch(Re){if(Re===Os||Re===Gl)throw Re;var nt=bn(29,Re,null,se.mode);return nt.lanes=_e,nt.return=se,nt}finally{}}}var $r=H0(!0),F0=H0(!1),rr=!1;function df(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function pf(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function sr(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function ar(i,s,h){var g=i.updateQueue;if(g===null)return null;if(g=g.shared,(ot&2)!==0){var k=g.pending;return k===null?s.next=s:(s.next=k.next,k.next=s),g.pending=s,s=zl(i),w0(i,null,h),s}return Il(i,g,s,h),zl(i)}function Xa(i,s,h){if(s=s.updateQueue,s!==null&&(s=s.shared,(h&4194048)!==0)){var g=s.lanes;g&=i.pendingLanes,h|=g,s.lanes=h,nn(i,h)}}function gf(i,s){var h=i.updateQueue,g=i.alternate;if(g!==null&&(g=g.updateQueue,h===g)){var k=null,A=null;if(h=h.firstBaseUpdate,h!==null){do{var I={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};A===null?k=A=I:A=A.next=I,h=h.next}while(h!==null);A===null?k=A=s:A=A.next=s}else k=A=s;h={baseState:g.baseState,firstBaseUpdate:k,lastBaseUpdate:A,shared:g.shared,callbacks:g.callbacks},i.updateQueue=h;return}i=h.lastBaseUpdate,i===null?h.firstBaseUpdate=s:i.next=s,h.lastBaseUpdate=s}var mf=!1;function Ka(){if(mf){var i=Ls;if(i!==null)throw i}}function Za(i,s,h,g){mf=!1;var k=i.updateQueue;rr=!1;var A=k.firstBaseUpdate,I=k.lastBaseUpdate,W=k.shared.pending;if(W!==null){k.shared.pending=null;var J=W,ce=J.next;J.next=null,I===null?A=ce:I.next=ce,I=J;var me=i.alternate;me!==null&&(me=me.updateQueue,W=me.lastBaseUpdate,W!==I&&(W===null?me.firstBaseUpdate=ce:W.next=ce,me.lastBaseUpdate=J))}if(A!==null){var ve=k.baseState;I=0,me=ce=J=null,W=A;do{var ue=W.lane&-536870913,pe=ue!==W.lane;if(pe?(Ke&ue)===ue:(g&ue)===ue){ue!==0&&ue===js&&(mf=!0),me!==null&&(me=me.next={lane:0,tag:W.tag,payload:W.payload,callback:null,next:null});e:{var Te=i,Be=W;ue=s;var mt=h;switch(Be.tag){case 1:if(Te=Be.payload,typeof Te=="function"){ve=Te.call(mt,ve,ue);break e}ve=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Be.payload,ue=typeof Te=="function"?Te.call(mt,ve,ue):Te,ue==null)break e;ve=d({},ve,ue);break e;case 2:rr=!0}}ue=W.callback,ue!==null&&(i.flags|=64,pe&&(i.flags|=8192),pe=k.callbacks,pe===null?k.callbacks=[ue]:pe.push(ue))}else pe={lane:ue,tag:W.tag,payload:W.payload,callback:W.callback,next:null},me===null?(ce=me=pe,J=ve):me=me.next=pe,I|=ue;if(W=W.next,W===null){if(W=k.shared.pending,W===null)break;pe=W,W=pe.next,pe.next=null,k.lastBaseUpdate=pe,k.shared.pending=null}}while(!0);me===null&&(J=ve),k.baseState=J,k.firstBaseUpdate=ce,k.lastBaseUpdate=me,A===null&&(k.shared.lanes=0),hr|=I,i.lanes=I,i.memoizedState=ve}}function P0(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function U0(i,s){var h=i.callbacks;if(h!==null)for(i.callbacks=null,i=0;iA?A:8;var I=q.T,W={};q.T=W,Of(i,!1,s,h);try{var J=k(),ce=q.S;if(ce!==null&&ce(W,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var me=WE(J,g);eo(i,s,me,En(i))}else eo(i,s,g,En(i))}catch(ve){eo(i,s,{then:function(){},status:"rejected",reason:ve},En())}finally{X.p=A,I!==null&&W.types!==null&&(I.types=W.types),q.T=I}}function ek(){}function jf(i,s,h,g){if(i.tag!==5)throw Error(r(476));var k=b_(i).queue;y_(i,k,s,K,h===null?ek:function(){return S_(i),h(g)})}function b_(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ti,lastRenderedState:K},next:null};var h={};return s.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ti,lastRenderedState:h},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function S_(i){var s=b_(i);s.next===null&&(s=i.alternate.memoizedState),eo(i,s.next.queue,{},En())}function Lf(){return Xt(vo)}function x_(){return jt().memoizedState}function w_(){return jt().memoizedState}function tk(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var h=En();i=sr(h);var g=ar(s,i,h);g!==null&&(dn(g,s,h),Xa(g,s,h)),s={cache:cf()},i.payload=s;return}s=s.return}}function nk(i,s,h){var g=En();h={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},ic(i)?E_(s,h):(h=Zh(i,s,h,g),h!==null&&(dn(h,i,g),k_(h,s,g)))}function C_(i,s,h){var g=En();eo(i,s,h,g)}function eo(i,s,h,g){var k={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(ic(i))E_(s,k);else{var A=i.alternate;if(i.lanes===0&&(A===null||A.lanes===0)&&(A=s.lastRenderedReducer,A!==null))try{var I=s.lastRenderedState,W=A(I,h);if(k.hasEagerState=!0,k.eagerState=W,yn(W,I))return Il(i,s,k,0),_t===null&&Bl(),!1}catch{}finally{}if(h=Zh(i,s,k,g),h!==null)return dn(h,i,g),k_(h,s,g),!0}return!1}function Of(i,s,h,g){if(g={lane:2,revertLane:dd(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},ic(i)){if(s)throw Error(r(479))}else s=Zh(i,h,g,2),s!==null&&dn(s,i,2)}function ic(i){var s=i.alternate;return i===Pe||s!==null&&s===Pe}function E_(i,s){zs=Kl=!0;var h=i.pending;h===null?s.next=s:(s.next=h.next,h.next=s),i.pending=s}function k_(i,s,h){if((h&4194048)!==0){var g=s.lanes;g&=i.pendingLanes,h|=g,s.lanes=h,nn(i,h)}}var to={readContext:Xt,use:Jl,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useLayoutEffect:Tt,useInsertionEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useSyncExternalStore:Tt,useId:Tt,useHostTransitionStatus:Tt,useFormState:Tt,useActionState:Tt,useOptimistic:Tt,useMemoCache:Tt,useCacheRefresh:Tt};to.useEffectEvent=Tt;var A_={readContext:Xt,use:Jl,useCallback:function(i,s){return rn().memoizedState=[i,s===void 0?null:s],i},useContext:Xt,useEffect:u_,useImperativeHandle:function(i,s,h){h=h!=null?h.concat([i]):null,tc(4194308,4,p_.bind(null,s,i),h)},useLayoutEffect:function(i,s){return tc(4194308,4,i,s)},useInsertionEffect:function(i,s){tc(4,2,i,s)},useMemo:function(i,s){var h=rn();s=s===void 0?null:s;var g=i();if(Gr){qt(!0);try{i()}finally{qt(!1)}}return h.memoizedState=[g,s],g},useReducer:function(i,s,h){var g=rn();if(h!==void 0){var k=h(s);if(Gr){qt(!0);try{h(s)}finally{qt(!1)}}}else k=s;return g.memoizedState=g.baseState=k,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:k},g.queue=i,i=i.dispatch=nk.bind(null,Pe,i),[g.memoizedState,i]},useRef:function(i){var s=rn();return i={current:i},s.memoizedState=i},useState:function(i){i=Nf(i);var s=i.queue,h=C_.bind(null,Pe,s);return s.dispatch=h,[i.memoizedState,h]},useDebugValue:Df,useDeferredValue:function(i,s){var h=rn();return Mf(h,i,s)},useTransition:function(){var i=Nf(!1);return i=y_.bind(null,Pe,i.queue,!0,!1),rn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,h){var g=Pe,k=rn();if(Qe){if(h===void 0)throw Error(r(407));h=h()}else{if(h=s(),_t===null)throw Error(r(349));(Ke&127)!==0||W0(g,s,h)}k.memoizedState=h;var A={value:h,getSnapshot:s};return k.queue=A,u_(K0.bind(null,g,A,i),[i]),g.flags|=2048,Fs(9,{destroy:void 0},X0.bind(null,g,A,h,s),null),h},useId:function(){var i=rn(),s=_t.identifierPrefix;if(Qe){var h=si,g=ri;h=(g&~(1<<32-st(g)-1)).toString(32)+h,s="_"+s+"R_"+h,h=Zl++,0<\/script>",A=A.removeChild(A.firstChild);break;case"select":A=typeof g.is=="string"?I.createElement("select",{is:g.is}):I.createElement("select"),g.multiple?A.multiple=!0:g.size&&(A.size=g.size);break;default:A=typeof g.is=="string"?I.createElement(k,{is:g.is}):I.createElement(k)}}A[$t]=s,A[Qt]=g;e:for(I=s.child;I!==null;){if(I.tag===5||I.tag===6)A.appendChild(I.stateNode);else if(I.tag!==4&&I.tag!==27&&I.child!==null){I.child.return=I,I=I.child;continue}if(I===s)break e;for(;I.sibling===null;){if(I.return===null||I.return===s)break e;I=I.return}I.sibling.return=I.return,I=I.sibling}s.stateNode=A;e:switch(Zt(A,k,g),k){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Di(s)}}return xt(s),Xf(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,h),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==g&&Di(s);else{if(typeof g!="string"&&s.stateNode===null)throw Error(r(166));if(i=ae.current,Ds(s)){if(i=s.stateNode,h=s.memoizedProps,g=null,k=Wt,k!==null)switch(k.tag){case 27:case 5:g=k.memoizedProps}i[$t]=s,i=!!(i.nodeValue===h||g!==null&&g.suppressHydrationWarning===!0||Vv(i.nodeValue,h)),i||nr(s,!0)}else i=wc(i).createTextNode(g),i[$t]=s,s.stateNode=i}return xt(s),null;case 31:if(h=s.memoizedState,i===null||i.memoizedState!==null){if(g=Ds(s),h!==null){if(i===null){if(!g)throw Error(r(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[$t]=s}else Ir(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;xt(s),i=!1}else h=sf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=h),i=!0;if(!i)return s.flags&256?(xn(s),s):(xn(s),null);if((s.flags&128)!==0)throw Error(r(558))}return xt(s),null;case 13:if(g=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(k=Ds(s),g!==null&&g.dehydrated!==null){if(i===null){if(!k)throw Error(r(318));if(k=s.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(r(317));k[$t]=s}else Ir(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;xt(s),k=!1}else k=sf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=k),k=!0;if(!k)return s.flags&256?(xn(s),s):(xn(s),null)}return xn(s),(s.flags&128)!==0?(s.lanes=h,s):(h=g!==null,i=i!==null&&i.memoizedState!==null,h&&(g=s.child,k=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(k=g.alternate.memoizedState.cachePool.pool),A=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(A=g.memoizedState.cachePool.pool),A!==k&&(g.flags|=2048)),h!==i&&h&&(s.child.flags|=8192),lc(s,s.updateQueue),xt(s),null);case 4:return ee(),i===null&&_d(s.stateNode.containerInfo),xt(s),null;case 10:return Ai(s.type),xt(s),null;case 19:if($(Mt),g=s.memoizedState,g===null)return xt(s),null;if(k=(s.flags&128)!==0,A=g.rendering,A===null)if(k)io(g,!1);else{if(Rt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(A=Xl(i),A!==null){for(s.flags|=128,io(g,!1),i=A.updateQueue,s.updateQueue=i,lc(s,i),s.subtreeFlags=0,i=h,h=s.child;h!==null;)C0(h,i),h=h.sibling;return F(Mt,Mt.current&1|2),Qe&&Ei(s,g.treeForkCount),s.child}i=i.sibling}g.tail!==null&&Fe()>dc&&(s.flags|=128,k=!0,io(g,!1),s.lanes=4194304)}else{if(!k)if(i=Xl(A),i!==null){if(s.flags|=128,k=!0,i=i.updateQueue,s.updateQueue=i,lc(s,i),io(g,!0),g.tail===null&&g.tailMode==="hidden"&&!A.alternate&&!Qe)return xt(s),null}else 2*Fe()-g.renderingStartTime>dc&&h!==536870912&&(s.flags|=128,k=!0,io(g,!1),s.lanes=4194304);g.isBackwards?(A.sibling=s.child,s.child=A):(i=g.last,i!==null?i.sibling=A:s.child=A,g.last=A)}return g.tail!==null?(i=g.tail,g.rendering=i,g.tail=i.sibling,g.renderingStartTime=Fe(),i.sibling=null,h=Mt.current,F(Mt,k?h&1|2:h&1),Qe&&Ei(s,g.treeForkCount),i):(xt(s),null);case 22:case 23:return xn(s),vf(),g=s.memoizedState!==null,i!==null?i.memoizedState!==null!==g&&(s.flags|=8192):g&&(s.flags|=8192),g?(h&536870912)!==0&&(s.flags&128)===0&&(xt(s),s.subtreeFlags&6&&(s.flags|=8192)):xt(s),h=s.updateQueue,h!==null&&lc(s,h.retryQueue),h=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(h=i.memoizedState.cachePool.pool),g=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(g=s.memoizedState.cachePool.pool),g!==h&&(s.flags|=2048),i!==null&&$(Fr),null;case 24:return h=null,i!==null&&(h=i.memoizedState.cache),s.memoizedState.cache!==h&&(s.flags|=2048),Ai(Ot),xt(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function ok(i,s){switch(nf(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return Ai(Ot),ee(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return ge(s),null;case 31:if(s.memoizedState!==null){if(xn(s),s.alternate===null)throw Error(r(340));Ir()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(xn(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));Ir()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return $(Mt),null;case 4:return ee(),null;case 10:return Ai(s.type),null;case 22:case 23:return xn(s),vf(),i!==null&&$(Fr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return Ai(Ot),null;case 25:return null;default:return null}}function Z_(i,s){switch(nf(s),s.tag){case 3:Ai(Ot),ee();break;case 26:case 27:case 5:ge(s);break;case 4:ee();break;case 31:s.memoizedState!==null&&xn(s);break;case 13:xn(s);break;case 19:$(Mt);break;case 10:Ai(s.type);break;case 22:case 23:xn(s),vf(),i!==null&&$(Fr);break;case 24:Ai(Ot)}}function ro(i,s){try{var h=s.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var k=g.next;h=k;do{if((h.tag&i)===i){g=void 0;var A=h.create,I=h.inst;g=A(),I.destroy=g}h=h.next}while(h!==k)}}catch(W){dt(s,s.return,W)}}function cr(i,s,h){try{var g=s.updateQueue,k=g!==null?g.lastEffect:null;if(k!==null){var A=k.next;g=A;do{if((g.tag&i)===i){var I=g.inst,W=I.destroy;if(W!==void 0){I.destroy=void 0,k=s;var J=h,ce=W;try{ce()}catch(me){dt(k,J,me)}}}g=g.next}while(g!==A)}}catch(me){dt(s,s.return,me)}}function Q_(i){var s=i.updateQueue;if(s!==null){var h=i.stateNode;try{U0(s,h)}catch(g){dt(i,i.return,g)}}}function J_(i,s,h){h.props=qr(i.type,i.memoizedProps),h.state=i.memoizedState;try{h.componentWillUnmount()}catch(g){dt(i,s,g)}}function so(i,s){try{var h=i.ref;if(h!==null){switch(i.tag){case 26:case 27:case 5:var g=i.stateNode;break;case 30:g=i.stateNode;break;default:g=i.stateNode}typeof h=="function"?i.refCleanup=h(g):h.current=g}}catch(k){dt(i,s,k)}}function ai(i,s){var h=i.ref,g=i.refCleanup;if(h!==null)if(typeof g=="function")try{g()}catch(k){dt(i,s,k)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(k){dt(i,s,k)}else h.current=null}function ev(i){var s=i.type,h=i.memoizedProps,g=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":h.autoFocus&&g.focus();break e;case"img":h.src?g.src=h.src:h.srcSet&&(g.srcset=h.srcSet)}}catch(k){dt(i,i.return,k)}}function Kf(i,s,h){try{var g=i.stateNode;Tk(g,i.type,h,s),g[Qt]=s}catch(k){dt(i,i.return,k)}}function tv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&mr(i.type)||i.tag===4}function Zf(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||tv(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&&mr(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 Qf(i,s,h){var g=i.tag;if(g===5||g===6)i=i.stateNode,s?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(i,s):(s=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,s.appendChild(i),h=h._reactRootContainer,h!=null||s.onclick!==null||(s.onclick=xi));else if(g!==4&&(g===27&&mr(i.type)&&(h=i.stateNode,s=null),i=i.child,i!==null))for(Qf(i,s,h),i=i.sibling;i!==null;)Qf(i,s,h),i=i.sibling}function cc(i,s,h){var g=i.tag;if(g===5||g===6)i=i.stateNode,s?h.insertBefore(i,s):h.appendChild(i);else if(g!==4&&(g===27&&mr(i.type)&&(h=i.stateNode),i=i.child,i!==null))for(cc(i,s,h),i=i.sibling;i!==null;)cc(i,s,h),i=i.sibling}function nv(i){var s=i.stateNode,h=i.memoizedProps;try{for(var g=i.type,k=s.attributes;k.length;)s.removeAttributeNode(k[0]);Zt(s,g,h),s[$t]=i,s[Qt]=h}catch(A){dt(i,i.return,A)}}var Mi=!1,zt=!1,Jf=!1,iv=typeof WeakSet=="function"?WeakSet:Set,Vt=null;function lk(i,s){if(i=i.containerInfo,bd=Rc,i=g0(i),qh(i)){if("selectionStart"in i)var h={start:i.selectionStart,end:i.selectionEnd};else e:{h=(h=i.ownerDocument)&&h.defaultView||window;var g=h.getSelection&&h.getSelection();if(g&&g.rangeCount!==0){h=g.anchorNode;var k=g.anchorOffset,A=g.focusNode;g=g.focusOffset;try{h.nodeType,A.nodeType}catch{h=null;break e}var I=0,W=-1,J=-1,ce=0,me=0,ve=i,ue=null;t:for(;;){for(var pe;ve!==h||k!==0&&ve.nodeType!==3||(W=I+k),ve!==A||g!==0&&ve.nodeType!==3||(J=I+g),ve.nodeType===3&&(I+=ve.nodeValue.length),(pe=ve.firstChild)!==null;)ue=ve,ve=pe;for(;;){if(ve===i)break t;if(ue===h&&++ce===k&&(W=I),ue===A&&++me===g&&(J=I),(pe=ve.nextSibling)!==null)break;ve=ue,ue=ve.parentNode}ve=pe}h=W===-1||J===-1?null:{start:W,end:J}}else h=null}h=h||{start:0,end:0}}else h=null;for(Sd={focusedElem:i,selectionRange:h},Rc=!1,Vt=s;Vt!==null;)if(s=Vt,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,Vt=i;else for(;Vt!==null;){switch(s=Vt,A=s.alternate,i=s.flags,s.tag){case 0:if((i&4)!==0&&(i=s.updateQueue,i=i!==null?i.events:null,i!==null))for(h=0;h title"))),Zt(A,g,h),A[$t]=i,Lt(A),g=A;break e;case"link":var I=cy("link","href",k).get(g+(h.href||""));if(I){for(var W=0;Wmt&&(I=mt,mt=Be,Be=I);var se=d0(W,Be),te=d0(W,mt);if(se&&te&&(pe.rangeCount!==1||pe.anchorNode!==se.node||pe.anchorOffset!==se.offset||pe.focusNode!==te.node||pe.focusOffset!==te.offset)){var le=ve.createRange();le.setStart(se.node,se.offset),pe.removeAllRanges(),Be>mt?(pe.addRange(le),pe.extend(te.node,te.offset)):(le.setEnd(te.node,te.offset),pe.addRange(le))}}}}for(ve=[],pe=W;pe=pe.parentNode;)pe.nodeType===1&&ve.push({element:pe,left:pe.scrollLeft,top:pe.scrollTop});for(typeof W.focus=="function"&&W.focus(),W=0;Wh?32:h,q.T=null,h=ad,ad=null;var A=dr,I=Ii;if(Gt=0,qs=dr=null,Ii=0,(ot&6)!==0)throw Error(r(331));var W=ot;if(ot|=4,pv(A.current),hv(A,A.current,I,h),ot=W,ho(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(Nt,A)}catch{}return!0}finally{X.p=k,q.T=g,Mv(i,s)}}function Lv(i,s,h){s=In(h,s),s=Hf(i.stateNode,s,2),i=ar(i,s,2),i!==null&&(qe(i,2),oi(i))}function dt(i,s,h){if(i.tag===3)Lv(i,i,h);else for(;s!==null;){if(s.tag===3){Lv(s,i,h);break}else if(s.tag===1){var g=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(fr===null||!fr.has(g))){i=In(h,i),h=O_(2),g=ar(s,h,2),g!==null&&(B_(h,g,s,i),qe(g,2),oi(g));break}}s=s.return}}function ud(i,s,h){var g=i.pingCache;if(g===null){g=i.pingCache=new hk;var k=new Set;g.set(s,k)}else k=g.get(s),k===void 0&&(k=new Set,g.set(s,k));k.has(h)||(nd=!0,k.add(h),i=mk.bind(null,i,s,h),s.then(i,i))}function mk(i,s,h){var g=i.pingCache;g!==null&&g.delete(s),i.pingedLanes|=i.suspendedLanes&h,i.warmLanes&=~h,_t===i&&(Ke&h)===h&&(Rt===4||Rt===3&&(Ke&62914560)===Ke&&300>Fe()-fc?(ot&2)===0&&Vs(i,0):id|=h,Gs===Ke&&(Gs=0)),oi(i)}function Ov(i,s){s===0&&(s=we()),i=Or(i,s),i!==null&&(qe(i,s),oi(i))}function _k(i){var s=i.memoizedState,h=0;s!==null&&(h=s.retryLane),Ov(i,h)}function vk(i,s){var h=0;switch(i.tag){case 31:case 13:var g=i.stateNode,k=i.memoizedState;k!==null&&(h=k.retryLane);break;case 19:g=i.stateNode;break;case 22:g=i.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(s),Ov(i,h)}function yk(i,s){return Ge(i,s)}var yc=null,Ws=null,hd=!1,bc=!1,fd=!1,gr=0;function oi(i){i!==Ws&&i.next===null&&(Ws===null?yc=Ws=i:Ws=Ws.next=i),bc=!0,hd||(hd=!0,Sk())}function ho(i,s){if(!fd&&bc){fd=!0;do for(var h=!1,g=yc;g!==null;){if(i!==0){var k=g.pendingLanes;if(k===0)var A=0;else{var I=g.suspendedLanes,W=g.pingedLanes;A=(1<<31-st(42|i)+1)-1,A&=k&~(I&~W),A=A&201326741?A&201326741|1:A?A|2:0}A!==0&&(h=!0,Hv(g,A))}else A=Ke,A=vi(g,g===_t?A:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(A&3)===0||ni(g,A)||(h=!0,Hv(g,A));g=g.next}while(h);fd=!1}}function bk(){Bv()}function Bv(){bc=hd=!1;var i=0;gr!==0&&Dk()&&(i=gr);for(var s=Fe(),h=null,g=yc;g!==null;){var k=g.next,A=Iv(g,s);A===0?(g.next=null,h===null?yc=k:h.next=k,k===null&&(Ws=h)):(h=g,(i!==0||(A&3)!==0)&&(bc=!0)),g=k}Gt!==0&&Gt!==5||ho(i),gr!==0&&(gr=0)}function Iv(i,s){for(var h=i.suspendedLanes,g=i.pingedLanes,k=i.expirationTimes,A=i.pendingLanes&-62914561;0W)break;var me=J.transferSize,ve=J.initiatorType;me&&Yv(ve)&&(J=J.responseEnd,I+=me*(J"u"?null:document;function sy(i,s,h){var g=Xs;if(g&&typeof s=="string"&&s){var k=on(s);k='link[rel="'+i+'"][href="'+k+'"]',typeof h=="string"&&(k+='[crossorigin="'+h+'"]'),ry.has(k)||(ry.add(k),i={rel:i,crossOrigin:h,href:s},g.querySelector(k)===null&&(s=g.createElement("link"),Zt(s,"link",i),Lt(s),g.head.appendChild(s)))}}function Fk(i){zi.D(i),sy("dns-prefetch",i,null)}function Pk(i,s){zi.C(i,s),sy("preconnect",i,s)}function Uk(i,s,h){zi.L(i,s,h);var g=Xs;if(g&&i&&s){var k='link[rel="preload"][as="'+on(s)+'"]';s==="image"&&h&&h.imageSrcSet?(k+='[imagesrcset="'+on(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(k+='[imagesizes="'+on(h.imageSizes)+'"]')):k+='[href="'+on(i)+'"]';var A=k;switch(s){case"style":A=Ks(i);break;case"script":A=Zs(i)}$n.has(A)||(i=d({rel:"preload",href:s==="image"&&h&&h.imageSrcSet?void 0:i,as:s},h),$n.set(A,i),g.querySelector(k)!==null||s==="style"&&g.querySelector(mo(A))||s==="script"&&g.querySelector(_o(A))||(s=g.createElement("link"),Zt(s,"link",i),Lt(s),g.head.appendChild(s)))}}function $k(i,s){zi.m(i,s);var h=Xs;if(h&&i){var g=s&&typeof s.as=="string"?s.as:"script",k='link[rel="modulepreload"][as="'+on(g)+'"][href="'+on(i)+'"]',A=k;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":A=Zs(i)}if(!$n.has(A)&&(i=d({rel:"modulepreload",href:i},s),$n.set(A,i),h.querySelector(k)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(_o(A)))return}g=h.createElement("link"),Zt(g,"link",i),Lt(g),h.head.appendChild(g)}}}function Gk(i,s,h){zi.S(i,s,h);var g=Xs;if(g&&i){var k=Ki(g).hoistableStyles,A=Ks(i);s=s||"default";var I=k.get(A);if(!I){var W={loading:0,preload:null};if(I=g.querySelector(mo(A)))W.loading=5;else{i=d({rel:"stylesheet",href:i,"data-precedence":s},h),(h=$n.get(A))&&Nd(i,h);var J=I=g.createElement("link");Lt(J),Zt(J,"link",i),J._p=new Promise(function(ce,me){J.onload=ce,J.onerror=me}),J.addEventListener("load",function(){W.loading|=1}),J.addEventListener("error",function(){W.loading|=2}),W.loading|=4,Ec(I,s,g)}I={type:"stylesheet",instance:I,count:1,state:W},k.set(A,I)}}}function qk(i,s){zi.X(i,s);var h=Xs;if(h&&i){var g=Ki(h).hoistableScripts,k=Zs(i),A=g.get(k);A||(A=h.querySelector(_o(k)),A||(i=d({src:i,async:!0},s),(s=$n.get(k))&&Td(i,s),A=h.createElement("script"),Lt(A),Zt(A,"link",i),h.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},g.set(k,A))}}function Vk(i,s){zi.M(i,s);var h=Xs;if(h&&i){var g=Ki(h).hoistableScripts,k=Zs(i),A=g.get(k);A||(A=h.querySelector(_o(k)),A||(i=d({src:i,async:!0,type:"module"},s),(s=$n.get(k))&&Td(i,s),A=h.createElement("script"),Lt(A),Zt(A,"link",i),h.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},g.set(k,A))}}function ay(i,s,h,g){var k=(k=ae.current)?Cc(k):null;if(!k)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(s=Ks(h.href),h=Ki(k).hoistableStyles,g=h.get(s),g||(g={type:"style",instance:null,count:0,state:null},h.set(s,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){i=Ks(h.href);var A=Ki(k).hoistableStyles,I=A.get(i);if(I||(k=k.ownerDocument||k,I={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},A.set(i,I),(A=k.querySelector(mo(i)))&&!A._p&&(I.instance=A,I.state.loading=5),$n.has(i)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},$n.set(i,h),A||Yk(k,i,h,I.state))),s&&g===null)throw Error(r(528,""));return I}if(s&&g!==null)throw Error(r(529,""));return null;case"script":return s=h.async,h=h.src,typeof h=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Zs(h),h=Ki(k).hoistableScripts,g=h.get(s),g||(g={type:"script",instance:null,count:0,state:null},h.set(s,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Ks(i){return'href="'+on(i)+'"'}function mo(i){return'link[rel="stylesheet"]['+i+"]"}function oy(i){return d({},i,{"data-precedence":i.precedence,precedence:null})}function Yk(i,s,h,g){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?g.loading=1:(s=i.createElement("link"),g.preload=s,s.addEventListener("load",function(){return g.loading|=1}),s.addEventListener("error",function(){return g.loading|=2}),Zt(s,"link",h),Lt(s),i.head.appendChild(s))}function Zs(i){return'[src="'+on(i)+'"]'}function _o(i){return"script[async]"+i}function ly(i,s,h){if(s.count++,s.instance===null)switch(s.type){case"style":var g=i.querySelector('style[data-href~="'+on(h.href)+'"]');if(g)return s.instance=g,Lt(g),g;var k=d({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return g=(i.ownerDocument||i).createElement("style"),Lt(g),Zt(g,"style",k),Ec(g,h.precedence,i),s.instance=g;case"stylesheet":k=Ks(h.href);var A=i.querySelector(mo(k));if(A)return s.state.loading|=4,s.instance=A,Lt(A),A;g=oy(h),(k=$n.get(k))&&Nd(g,k),A=(i.ownerDocument||i).createElement("link"),Lt(A);var I=A;return I._p=new Promise(function(W,J){I.onload=W,I.onerror=J}),Zt(A,"link",g),s.state.loading|=4,Ec(A,h.precedence,i),s.instance=A;case"script":return A=Zs(h.src),(k=i.querySelector(_o(A)))?(s.instance=k,Lt(k),k):(g=h,(k=$n.get(A))&&(g=d({},h),Td(g,k)),i=i.ownerDocument||i,k=i.createElement("script"),Lt(k),Zt(k,"link",g),i.head.appendChild(k),s.instance=k);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(g=s.instance,s.state.loading|=4,Ec(g,h.precedence,i));return s.instance}function Ec(i,s,h){for(var g=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),k=g.length?g[g.length-1]:null,A=k,I=0;I title"):null)}function Wk(i,s,h){if(h===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return i=s.disabled,typeof s.precedence=="string"&&i==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function hy(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function Xk(i,s,h,g){if(h.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var k=Ks(g.href),A=s.querySelector(mo(k));if(A){s=A._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=Ac.bind(i),s.then(i,i)),h.state.loading|=4,h.instance=A,Lt(A);return}A=s.ownerDocument||s,g=oy(g),(k=$n.get(k))&&Nd(g,k),A=A.createElement("link"),Lt(A);var I=A;I._p=new Promise(function(W,J){I.onload=W,I.onerror=J}),Zt(A,"link",g),h.instance=A}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(h,s),(s=h.state.preload)&&(h.state.loading&3)===0&&(i.count++,h=Ac.bind(i),s.addEventListener("load",h),s.addEventListener("error",h))}}var Rd=0;function Kk(i,s){return i.stylesheets&&i.count===0&&Tc(i,i.stylesheets),0Rd?50:800)+s);return i.unsuspend=h,function(){i.unsuspend=null,clearTimeout(g),clearTimeout(k)}}:null}function Ac(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Tc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Nc=null;function Tc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Nc=new Map,s.forEach(Zk,i),Nc=null,Ac.call(i))}function Zk(i,s){if(!(s.state.loading&4)){var h=Nc.get(i);if(h)var g=h.get(null);else{h=new Map,Nc.set(i,h);for(var k=i.querySelectorAll("link[data-precedence],style[data-precedence]"),A=0;A"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Hd.exports=dA(),Hd.exports}var gA=pA();/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const PS=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** - * @license lucide-react v1.24.0 - ISC + */const HS=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** - * @license lucide-react v1.24.0 - ISC + */const mA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const SA=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/** - * @license lucide-react v1.24.0 - ISC + */const _A=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Oy=e=>{const t=SA(e);return t.charAt(0).toUpperCase()+t.slice(1)};/** - * @license lucide-react v1.24.0 - ISC + */const Oy=e=>{const t=_A(e);return t.charAt(0).toUpperCase()+t.slice(1)};/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var $d={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"};/** - * @license lucide-react v1.24.0 - ISC + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xA=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},wA=q.createContext({}),CA=()=>q.useContext(wA),EA=q.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:a="",children:l,iconNode:u,...o},c)=>{const{size:f=24,strokeWidth:p=2,absoluteStrokeWidth:d=!1,color:_="currentColor",className:v=""}=CA()??{},w=r??d?Number(n??p)*24/Number(t??f):n??p;return q.createElement("svg",{ref:c,...$d,width:t??f??$d.width,height:t??f??$d.height,stroke:e??_,strokeWidth:w,className:PS("lucide",v,a),...!l&&!xA(o)&&{"aria-hidden":"true"},...o},[...u.map(([C,b])=>q.createElement(C,b)),...Array.isArray(l)?l:[l]])});/** - * @license lucide-react v1.24.0 - ISC + */const vA=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},yA=V.createContext({}),bA=()=>V.useContext(yA),SA=V.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:a="",children:l,iconNode:u,...o},c)=>{const{size:f=24,strokeWidth:p=2,absoluteStrokeWidth:d=!1,color:_="currentColor",className:v=""}=bA()??{},w=r??d?Number(n??p)*24/Number(t??f):n??p;return V.createElement("svg",{ref:c,...$d,width:t??f??$d.width,height:t??f??$d.height,stroke:e??_,strokeWidth:w,className:HS("lucide",v,a),...!l&&!vA(o)&&{"aria-hidden":"true"},...o},[...u.map(([C,b])=>V.createElement(C,b)),...Array.isArray(l)?l:[l]])});/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $e=(e,t)=>{const n=q.forwardRef(({className:r,...a},l)=>q.createElement(EA,{ref:l,iconNode:t,className:PS(`lucide-${bA(Oy(e))}`,`lucide-${e}`,r),...a}));return n.displayName=Oy(e),n};/** - * @license lucide-react v1.24.0 - ISC + */const $e=(e,t)=>{const n=V.forwardRef(({className:r,...a},l)=>V.createElement(SA,{ref:l,iconNode:t,className:HS(`lucide-${mA(Oy(e))}`,`lucide-${e}`,r),...a}));return n.displayName=Oy(e),n};/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kA=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],jo=$e("arrow-left",kA);/** - * @license lucide-react v1.24.0 - ISC + */const xA=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],jo=$e("arrow-left",xA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const AA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ic=$e("arrow-right",AA);/** - * @license lucide-react v1.24.0 - ISC + */const wA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ic=$e("arrow-right",wA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const NA=[["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"}]],TA=$e("blocks",NA);/** - * @license lucide-react v1.24.0 - ISC + */const CA=[["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"}]],EA=$e("blocks",CA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const RA=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],DA=$e("boxes",RA);/** - * @license lucide-react v1.24.0 - ISC + */const kA=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],AA=$e("boxes",kA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const MA=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],_n=$e("check",MA);/** - * @license lucide-react v1.24.0 - ISC + */const NA=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],_n=$e("check",NA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],cs=$e("chevron-down",jA);/** - * @license lucide-react v1.24.0 - ISC + */const TA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],cs=$e("chevron-down",TA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Uu=$e("chevron-right",LA);/** - * @license lucide-react v1.24.0 - ISC + */const RA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Uu=$e("chevron-right",RA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const OA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],BA=$e("circle-stop",OA);/** - * @license lucide-react v1.24.0 - ISC + */const DA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],MA=$e("circle-stop",DA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const IA=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],zA=$e("cloud",IA);/** - * @license lucide-react v1.24.0 - ISC + */const jA=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],LA=$e("cloud",jA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const HA=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],FA=$e("code",HA);/** - * @license lucide-react v1.24.0 - ISC + */const OA=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],BA=$e("code",OA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const PA=[["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"}]],yg=$e("copy",PA);/** - * @license lucide-react v1.24.0 - ISC + */const IA=[["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"}]],yg=$e("copy",IA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const UA=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],US=$e("corner-down-left",UA);/** - * @license lucide-react v1.24.0 - ISC + */const zA=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],FS=$e("corner-down-left",zA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $A=[["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"}]],GA=$e("cpu",$A);/** - * @license lucide-react v1.24.0 - ISC + */const HA=[["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"}]],FA=$e("cpu",HA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qA=[["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"}]],VA=$e("ellipsis",qA);/** - * @license lucide-react v1.24.0 - ISC + */const PA=[["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"}]],UA=$e("ellipsis",PA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const YA=[["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"}]],$S=$e("external-link",YA);/** - * @license lucide-react v1.24.0 - ISC + */const $A=[["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"}]],PS=$e("external-link",$A);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const WA=[["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 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],GS=$e("file-code",WA);/** - * @license lucide-react v1.24.0 - ISC + */const GA=[["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 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],US=$e("file-code",GA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const XA=[["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"}]],KA=$e("file-text",XA);/** - * @license lucide-react v1.24.0 - ISC + */const qA=[["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"}]],VA=$e("file-text",qA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ZA=[["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"}]],QA=$e("file",ZA);/** - * @license lucide-react v1.24.0 - ISC + */const YA=[["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"}]],WA=$e("file",YA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const JA=[["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"}]],eN=$e("flask-conical",JA);/** - * @license lucide-react v1.24.0 - ISC + */const XA=[["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"}]],KA=$e("flask-conical",XA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tN=[["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"}]],qS=$e("folder-open",tN);/** - * @license lucide-react v1.24.0 - ISC + */const ZA=[["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"}]],$S=$e("folder-open",ZA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nN=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],VS=$e("folder-tree",nN);/** - * @license lucide-react v1.24.0 - ISC + */const QA=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],GS=$e("folder-tree",QA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const iN=[["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"}]],rN=$e("folder",iN);/** - * @license lucide-react v1.24.0 - ISC + */const JA=[["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"}]],eN=$e("folder",JA);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const sN=[["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"}]],$u=$e("git-branch",sN);/** - * @license lucide-react v1.24.0 - ISC + */const tN=[["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"}]],$u=$e("git-branch",tN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const aN=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],oN=$e("hard-drive",aN);/** - * @license lucide-react v1.24.0 - ISC + */const nN=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],iN=$e("hard-drive",nN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],cN=$e("info",lN);/** - * @license lucide-react v1.24.0 - ISC + */const rN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],sN=$e("info",rN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uN=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],hN=$e("laptop",uN);/** - * @license lucide-react v1.24.0 - ISC + */const aN=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],oN=$e("laptop",aN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fN=[["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"}]],dN=$e("lock",fN);/** - * @license lucide-react v1.24.0 - ISC + */const lN=[["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"}]],cN=$e("lock",lN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pN=[["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"}]],gN=$e("maximize-2",pN);/** - * @license lucide-react v1.24.0 - ISC + */const uN=[["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"}]],hN=$e("maximize-2",uN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mN=[["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"}]],_N=$e("minimize-2",mN);/** - * @license lucide-react v1.24.0 - ISC + */const fN=[["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"}]],dN=$e("minimize-2",fN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vN=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],YS=$e("panel-left",vN);/** - * @license lucide-react v1.24.0 - ISC + */const pN=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],qS=$e("panel-left",pN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yN=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],bg=$e("plus",yN);/** - * @license lucide-react v1.24.0 - ISC + */const gN=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],bg=$e("plus",gN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bN=[["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"}]],Su=$e("refresh-cw",bN);/** - * @license lucide-react v1.24.0 - ISC + */const mN=[["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"}]],Su=$e("refresh-cw",mN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const SN=[["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"}]],Sg=$e("rotate-cw",SN);/** - * @license lucide-react v1.24.0 - ISC + */const _N=[["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"}]],Sg=$e("rotate-cw",_N);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xN=[["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"}]],WS=$e("scroll-text",xN);/** - * @license lucide-react v1.24.0 - ISC + */const vN=[["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"}]],VS=$e("scroll-text",vN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wN=[["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"}]],Ap=$e("server",wN);/** - * @license lucide-react v1.24.0 - ISC + */const yN=[["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"}]],Ap=$e("server",yN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const CN=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],EN=$e("sliders-horizontal",CN);/** - * @license lucide-react v1.24.0 - ISC + */const bN=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],SN=$e("sliders-horizontal",bN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kN=[["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"}]],AN=$e("square-terminal",kN);/** - * @license lucide-react v1.24.0 - ISC + */const xN=[["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"}]],wN=$e("square-terminal",xN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const NN=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],XS=$e("terminal",NN);/** - * @license lucide-react v1.24.0 - ISC + */const CN=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],YS=$e("terminal",CN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const TN=[["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"}]],Gu=$e("trash-2",TN);/** - * @license lucide-react v1.24.0 - ISC + */const EN=[["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"}]],Gu=$e("trash-2",EN);/** + * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const RN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Fo=$e("x",RN);async function us(e){if(!e.ok){const t=await e.text().catch(()=>"");let n=t;try{const r=JSON.parse(t);r.error&&(n=r.error)}catch{}throw new Error(n||`HTTP ${e.status}`)}return await e.json()}const ut=e=>fetch(e).then(t=>us(t)),Dt=(e,t)=>fetch(e,{method:"POST",headers:t===void 0?{}:{"content-type":"application/json"},body:t===void 0?void 0:JSON.stringify(t)}).then(n=>us(n)),KS=(e,t)=>fetch(e,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}).then(n=>us(n)),DN=()=>ut("/api/projects").then(e=>e.projects),MN=e=>Dt("/api/projects",e).then(t=>t.project),jN=e=>ut(`/api/papers/search?q=${encodeURIComponent(e)}`).then(t=>t.papers),LN=e=>ut(`/api/papers/resolve?id=${encodeURIComponent(e)}`).then(t=>t.paper),ON=e=>Dt(`/api/projects/${e}/open`).then(t=>t.project),BN=e=>fetch(`/api/projects/${e}`,{method:"DELETE"}).then(async t=>{if(!t.ok){const n=await t.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`delete failed (${t.status})`)}}),IN=e=>ut(`/api/projects/${e}/experiments`).then(t=>t.experiments),zN=e=>ut(`/api/projects/${e}/runs`).then(t=>t.runs),HN=()=>ut("/api/instances").then(e=>e.instances),ZS=e=>Dt(`/api/runs/${e}/cancel`),FN=(e,t)=>ut(`/api/runs/${e}/log?offset=${t}`),PN=e=>ut(`/api/experiments/${e}/commits`).then(t=>t.commits),UN=(e,t)=>ut(`/api/experiments/${e}/commits/${t}/diff`),By=e=>ut(`/api/projects/${e}/working-tree`),QS=(e,t=new URLSearchParams)=>(e.sessionId&&t.set("sessionId",e.sessionId),e.ref&&t.set("ref",e.ref),t),$N=(e,t,n={})=>ut(`/api/projects/${e}/file?${QS(n,new URLSearchParams({path:t}))}`),GN=(e,t={})=>{const n=QS(t).toString();return ut(`/api/projects/${e}/code-tree${n?`?${n}`:""}`)},xg=(e,t,n)=>`https://github.com/${e}/${t}/tree/${n.split("/").map(encodeURIComponent).join("/")}`,qN=()=>ut("/api/settings/hf"),VN=e=>Dt("/api/settings/hf",{token:e}),YN=()=>ut("/api/settings/k8s"),WN=e=>Dt("/api/settings/k8s",e),XN=()=>ut("/api/settings/modal"),KN=()=>Dt("/api/settings/modal/provision"),ZN=()=>ut("/api/settings/env").then(e=>e.vars),JS=(e,t)=>Dt("/api/settings/env",{key:e,value:t}).then(n=>n.vars),QN=e=>fetch(`/api/settings/env/${encodeURIComponent(e)}`,{method:"DELETE"}).then(t=>us(t)).then(t=>t.vars),ex=()=>ut("/api/settings/data-dir"),JN=e=>Dt("/api/settings/data-dir/validate",{path:e}),eT=e=>Dt("/api/settings/data-dir",{path:e}),tT=e=>Dt("/api/settings/data-dir/move",{path:e}),nT=()=>ut("/api/settings/ssh").then(e=>e.hosts),iT=e=>Dt("/api/settings/ssh/preflight",{host:e}),rT=()=>ut("/api/settings/slurm"),sT=e=>Dt("/api/settings/slurm",e),aT=e=>Dt("/api/settings/slurm/preflight",{host:e}),oT=()=>ut("/api/settings/compute"),tx=e=>Dt("/api/settings/compute/default",e),lT=()=>ut("/api/settings/local"),cT=()=>ut("/api/settings/openresearch"),Iy=e=>ut(`/api/projects/${e}/files`),uT=(e,t)=>ut(`/api/projects/${e}/files/report?path=${encodeURIComponent(t)}`),hT=(e,t)=>fetch(`/api/projects/${e}/files?path=${encodeURIComponent(t)}`,{method:"DELETE"}).then(n=>us(n)),Np=(e,t)=>`/api/projects/${e}/files/file?path=${encodeURIComponent(t)}`,nx=()=>ut("/api/settings/git"),fT=e=>Dt("/api/settings/git",e),dT=e=>Dt("/api/settings/git/token",{token:e}),pT=()=>fetch("/api/settings/git/token",{method:"DELETE"}).then(e=>us(e)),gT=()=>ut("/api/settings/telemetry"),mT=e=>Dt("/api/settings/telemetry",{enabled:e}),_T=e=>Dt("/api/settings/telemetry/consent",{enabled:e}),wg=(e=!1)=>ut(`/api/harnesses${e?"?refresh=1":""}`).then(t=>t.harnesses),vT=()=>ut("/api/skills").then(e=>e.skills);function xu(e){const t=(e.split("/").pop()??e).replace(/^~/,"").replace(/^claude-/,""),n=[],r=[];for(const a of t.split("-"))/^\d+(\.\d+)?$/.test(a)?r.push(a):(r.length&&n.push(r.splice(0).join(".")),n.push(a==="gpt"?"GPT":a.charAt(0).toUpperCase()+a.slice(1)));return r.length&&n.push(r.join(".")),n.join(" ")}const zy=e=>ut(`/api/chat/sessions?projectId=${encodeURIComponent(e)}`).then(t=>t.sessions),yT=(e,t,n={})=>Dt("/api/chat/sessions",{projectId:e,harness:t,...n}).then(r=>r.session),bT=e=>fetch(`/api/chat/sessions/${e}`,{method:"DELETE"}).then(t=>us(t)),ST=(e,t)=>KS(`/api/chat/sessions/${e}`,{archived:t}).then(n=>n.session),xT=(e,t)=>KS(`/api/chat/sessions/${e}`,{title:t}).then(n=>n.session),Hy=e=>ut(`/api/chat/sessions/${e}/messages`).then(t=>t.messages),wT=e=>`/api/chat/attachments/${encodeURIComponent(e)}`,CT=(e,t,n={},r)=>Dt(`/api/chat/sessions/${e}/message`,{text:t,model:n.model,permissionMode:n.permissionMode,reasoningLevel:n.reasoningLevel,images:r}),ET=e=>Dt(`/api/chat/sessions/${e}/interrupt`),kT=(e,t)=>Dt(`/api/chat/sessions/${e}/respond`,t);function Sa(e){const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return`${t}s ago`;const n=Math.floor(t/60);if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Fy(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function ns(e){const t=["B","KB","MB","GB","TB"];let n=e,r=0;for(;n>=1024&&r10?`${e.slice(0,10)}…`:e}function ix(e){return e?typeof e.kind=="string"?e.kind:typeof e.type=="string"?e.type:"":""}function rx(e){return e?typeof e.flavor=="string"&&e.flavor?e.flavor:typeof e.manifest=="string"&&e.manifest?e.manifest:typeof e.namespace=="string"&&e.namespace?e.namespace:"":""}const cu=new Map;function AT(e,t){let n=cu.get(e);return n||(n=new Set,cu.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&cu.delete(e)}}function NT(e){var t;(t=cu.get(e.runId))==null||t.forEach(n=>n(e))}const Rp=new Set;function TT(e){return Rp.add(e),()=>{Rp.delete(e)}}function zc(e){Rp.forEach(t=>t(e))}const Dp=new Set;function RT(e){return Dp.add(e),()=>{Dp.delete(e)}}function Gd(e){Dp.forEach(t=>t(e))}function DT(e){const t=q.useRef(e);t.current=e,q.useEffect(()=>{const n=new EventSource("/api/events"),r=a=>{try{return JSON.parse(a.data)}catch{return null}};return n.addEventListener("run.updated",a=>{const l=r(a);l!=null&&l.run&&t.current.onRun(l.run)}),n.addEventListener("experiment.updated",a=>{const l=r(a);l!=null&&l.experiment&&t.current.onExperiment(l.experiment)}),n.addEventListener("project.updated",a=>{const l=r(a);l!=null&&l.project&&t.current.onProject(l.project)}),n.addEventListener("files.updated",a=>{var u,o;const l=r(a);l!=null&&l.projectId&&((o=(u=t.current).onFiles)==null||o.call(u,l.projectId))}),n.addEventListener("run.log",a=>{const l=r(a);l!=null&&l.runId&&NT(l)}),n.addEventListener("chat.session",a=>{const l=r(a);l!=null&&l.session&&zc({type:"session",session:l.session})}),n.addEventListener("chat.session.deleted",a=>{const l=r(a);l!=null&&l.sessionId&&zc({type:"sessionDeleted",sessionId:l.sessionId})}),n.addEventListener("chat.message",a=>{const l=r(a);l!=null&&l.message&&zc({type:"message",sessionId:l.sessionId,message:l.message})}),n.addEventListener("chat.busy",a=>{const l=r(a);l!=null&&l.sessionId&&zc({type:"busy",sessionId:l.sessionId,busy:l.busy})}),n.addEventListener("datadir.move.progress",a=>{const l=r(a);l&&Gd({type:"progress",...l})}),n.addEventListener("datadir.move.done",a=>{const l=r(a);l&&Gd({type:"done",path:l.path,oldPathLeft:l.oldPathLeft})}),n.addEventListener("datadir.move.error",a=>{const l=r(a);l&&Gd({type:"error",error:l.error})}),()=>n.close()},[])}function Py(e){const t=[],n=String(e||"");let r=n.indexOf(","),a=0,l=!1;for(;!l;){r===-1&&(r=n.length,l=!0);const u=n.slice(a,r).trim();(u||!l)&&t.push(u),a=r+1,r=n.indexOf(",",a)}return t}function MT(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const jT=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,LT=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,OT={};function Uy(e,t){return(OT.jsx?LT:jT).test(e)}const BT=/[ \t\n\f\r]/g;function IT(e){return typeof e=="object"?e.type==="text"?$y(e.value):!1:$y(e)}function $y(e){return e.replace(BT,"")===""}class ol{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}ol.prototype.normal={};ol.prototype.property={};ol.prototype.space=void 0;function sx(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new ol(n,r,t)}function Po(e){return e.toLowerCase()}class vn{constructor(t,n){this.attribute=n,this.property=t}}vn.prototype.attribute="";vn.prototype.booleanish=!1;vn.prototype.boolean=!1;vn.prototype.commaOrSpaceSeparated=!1;vn.prototype.commaSeparated=!1;vn.prototype.defined=!1;vn.prototype.mustUseProperty=!1;vn.prototype.number=!1;vn.prototype.overloadedBoolean=!1;vn.prototype.property="";vn.prototype.spaceSeparated=!1;vn.prototype.space=void 0;let zT=0;const ze=hs(),Ht=hs(),Mp=hs(),xe=hs(),vt=hs(),Jr=hs(),kn=hs();function hs(){return 2**++zT}const jp=Object.freeze(Object.defineProperty({__proto__:null,boolean:ze,booleanish:Ht,commaOrSpaceSeparated:kn,commaSeparated:Jr,number:xe,overloadedBoolean:Mp,spaceSeparated:vt},Symbol.toStringTag,{value:"Module"})),qd=Object.keys(jp);class Cg extends vn{constructor(t,n,r,a){let l=-1;if(super(t,n),Gy(this,"space",a),typeof r=="number")for(;++l4&&n.slice(0,4)==="data"&&$T.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(qy,qT);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!qy.test(l)){let u=l.replace(UT,GT);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=Cg}return new a(r,t)}function GT(e){return"-"+e.toLowerCase()}function qT(e){return e.charAt(1).toUpperCase()}const dx=sx([ax,HT,cx,ux,hx],"html"),qu=sx([ax,FT,cx,ux,hx],"svg");function Vy(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function VT(e){return e.join(" ").trim()}var Js={},Vd,Yy;function YT(){if(Yy)return Vd;Yy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,o=/^\s+|\s+$/g,c=` -`,f="/",p="*",d="",_="comment",v="declaration";function w(b,S){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];S=S||{};var x=1,y=1;function E(z){var V=z.match(t);V&&(x+=V.length);var G=z.lastIndexOf(c);y=~G?z.length-G:y+z.length}function R(){var z={line:x,column:y};return function(V){return V.position=new N(z),j(),V}}function N(z){this.start=z,this.end={line:x,column:y},this.source=S.source}N.prototype.content=b;function D(z){var V=new Error(S.source+":"+x+":"+y+": "+z);if(V.reason=z,V.filename=S.source,V.line=x,V.column=y,V.source=b,!S.silent)throw V}function T(z){var V=z.exec(b);if(V){var G=V[0];return E(G),b=b.slice(G.length),V}}function j(){T(n)}function B(z){var V;for(z=z||[];V=F();)V!==!1&&z.push(V);return z}function F(){var z=R();if(!(f!=b.charAt(0)||p!=b.charAt(1))){for(var V=2;d!=b.charAt(V)&&(p!=b.charAt(V)||f!=b.charAt(V+1));)++V;if(V+=2,d===b.charAt(V-1))return D("End of comment missing");var G=b.slice(2,V-2);return y+=2,E(G),b=b.slice(V),y+=2,z({type:_,comment:G})}}function Y(){var z=R(),V=T(r);if(V){if(F(),!T(a))return D("property missing ':'");var G=T(l),X=z({type:v,property:C(V[0].replace(e,d)),value:G?C(G[0].replace(e,d)):d});return T(u),X}}function H(){var z=[];B(z);for(var V;V=Y();)V!==!1&&(z.push(V),B(z));return z}return j(),H()}function C(b){return b?b.replace(o,d):d}return Vd=w,Vd}var Wy;function WT(){if(Wy)return Js;Wy=1;var e=Js&&Js.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Js,"__esModule",{value:!0}),Js.default=n;const t=e(YT());function n(r,a){let l=null;if(!r||typeof r!="string")return l;const u=(0,t.default)(r),o=typeof a=="function";return u.forEach(c=>{if(c.type!=="declaration")return;const{property:f,value:p}=c;o?a(f,p,c):p&&(l=l||{},l[f]=p)}),l}return Js}var Co={},Xy;function XT(){if(Xy)return Co;Xy=1,Object.defineProperty(Co,"__esModule",{value:!0}),Co.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(f){return!f||n.test(f)||e.test(f)},u=function(f,p){return p.toUpperCase()},o=function(f,p){return"".concat(p,"-")},c=function(f,p){return p===void 0&&(p={}),l(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(a,o):f=f.replace(r,o),f.replace(t,u))};return Co.camelCase=c,Co}var Eo,Ky;function KT(){if(Ky)return Eo;Ky=1;var e=Eo&&Eo.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(WT()),n=XT();function r(a,l){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(o,c){o&&c&&(u[(0,n.camelCase)(o,l)]=c)}),u}return r.default=r,Eo=r,Eo}var ZT=KT();const QT=Pu(ZT),px=gx("end"),Eg=gx("start");function gx(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function JT(e){const t=Eg(e),n=px(e);if(t&&n)return{start:t,end:n}}function Lo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Zy(e.position):"start"in e||"end"in e?Zy(e):"line"in e||"column"in e?Lp(e):""}function Lp(e){return Qy(e&&e.line)+":"+Qy(e&&e.column)}function Zy(e){return Lp(e&&e.start)+"-"+Lp(e&&e.end)}function Qy(e){return e&&typeof e=="number"?e:1}class tn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",l={},u=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?a=t:!l.cause&&t&&(u=!0,a=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?l.ruleId=r:(l.source=r.slice(0,c),l.ruleId=r.slice(c+1))}if(!l.place&&l.ancestors&&l.ancestors){const c=l.ancestors[l.ancestors.length-1];c&&(l.place=c.position)}const o=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=o?o.line:void 0,this.name=Lo(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=u&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}tn.prototype.file="";tn.prototype.name="";tn.prototype.reason="";tn.prototype.message="";tn.prototype.stack="";tn.prototype.column=void 0;tn.prototype.line=void 0;tn.prototype.ancestors=void 0;tn.prototype.cause=void 0;tn.prototype.fatal=void 0;tn.prototype.place=void 0;tn.prototype.ruleId=void 0;tn.prototype.source=void 0;const kg={}.hasOwnProperty,e3=new Map,t3=/[A-Z]/g,n3=new Set(["table","tbody","thead","tfoot","tr"]),i3=new Set(["td","th"]),mx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function r3(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=f3(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=h3(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?qu:dx,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=_x(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function _x(e,t,n){if(t.type==="element")return s3(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return a3(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return l3(e,t,n);if(t.type==="mdxjsEsm")return o3(e,t);if(t.type==="root")return c3(e,t,n);if(t.type==="text")return u3(e,t)}function s3(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=qu,e.schema=a),e.ancestors.push(t);const l=yx(e,t.tagName,!1),u=d3(e,t);let o=Ng(e,t);return n3.has(t.tagName)&&(o=o.filter(function(c){return typeof c=="string"?!IT(c):!0})),vx(e,u,l,t),Ag(u,o),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function a3(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Uo(e,t.position)}function o3(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Uo(e,t.position)}function l3(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=qu,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:yx(e,t.name,!0),u=p3(e,t),o=Ng(e,t);return vx(e,u,l,t),Ag(u,o),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function c3(e,t,n){const r={};return Ag(r,Ng(e,t)),e.create(t,e.Fragment,r,n)}function u3(e,t){return t.value}function vx(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ag(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function h3(e,t,n){return r;function r(a,l,u,o){const f=Array.isArray(u.children)?n:t;return o?f(l,u,o):f(l,u)}}function f3(e,t){return n;function n(r,a,l,u){const o=Array.isArray(l.children),c=Eg(r);return t(a,l,u,o,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function d3(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&kg.call(t.properties,a)){const l=g3(e,a,t.properties[a]);if(l){const[u,o]=l;e.tableCellAlignToStyle&&u==="align"&&typeof o=="string"&&i3.has(t.tagName)?r=o:n[u]=o}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function p3(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const u=l.expression;u.type;const o=u.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else Uo(e,t.position);else{const a=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,l=e.evaluater.evaluateExpression(o.expression)}else Uo(e,t.position);else l=r.value===null?!0:r.value;n[a]=l}return n}function Ng(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:e3;for(;++ra?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)u=Array.from(r),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);l0?(Tn(e,e.length,0,t),e):t}const t1={}.hasOwnProperty;function Sx(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Jn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const sn=Nr(/[A-Za-z]/),en=Nr(/[\dA-Za-z]/),C3=Nr(/[#-'*+\--9=?A-Z^-~]/);function wu(e){return e!==null&&(e<32||e===127)}const Op=Nr(/\d/),E3=Nr(/[\dA-Fa-f]/),k3=Nr(/[!-/:-@[-`{-~]/);function Oe(e){return e!==null&&e<-2}function yt(e){return e!==null&&(e<0||e===32)}function Xe(e){return e===-2||e===-1||e===32}const Vu=Nr(new RegExp("\\p{P}|\\p{S}","u")),is=Nr(/\s/);function Nr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function wa(e){const t=[];let n=-1,r=0,a=0;for(;++n55295&&l<57344){const o=e.charCodeAt(n+1);l<56320&&o>56319&&o<57344?(u=String.fromCharCode(l,o),a=1):u="�"}else u=String.fromCharCode(l);u&&(t.push(e.slice(r,n),encodeURIComponent(u)),r=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function et(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let l=0;return u;function u(c){return Xe(c)?(e.enter(n),o(c)):t(c)}function o(c){return Xe(c)&&l++u))return;const D=t.events.length;let T=D,j,B;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(j){B=t.events[T][1].end;break}j=!0}for(S(r),N=D;Ny;){const R=n[E];t.containerState=R[1],R[0].exit.call(t,e)}n.length=y}function x(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function D3(e,t,n){return et(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function fa(e){if(e===null||yt(e)||is(e))return 1;if(Vu(e))return 2}function Yu(e,t,n){const r=[];let a=-1;for(;++a1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},_={...e[n][1].start};i1(d,-c),i1(_,c),u={type:c>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:_},l={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:c>1?"strong":"emphasis",start:{...u.start},end:{...o.end}},e[r][1].end={...u.start},e[n][1].start={...o.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=Gn(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=Gn(f,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",l,t]]),f=Gn(f,Yu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=Gn(f,[["exit",l,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=Gn(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Tn(e,r-1,n-r+3,f),n=r+f.length-p-2;break}}for(n=-1;++n0&&Xe(N)?et(e,x,"linePrefix",l+1)(N):x(N)}function x(N){return N===null||Oe(N)?e.check(r1,C,E)(N):(e.enter("codeFlowValue"),y(N))}function y(N){return N===null||Oe(N)?(e.exit("codeFlowValue"),x(N)):(e.consume(N),y)}function E(N){return e.exit("codeFenced"),t(N)}function R(N,D,T){let j=0;return B;function B(V){return N.enter("lineEnding"),N.consume(V),N.exit("lineEnding"),F}function F(V){return N.enter("codeFencedFence"),Xe(V)?et(N,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):Y(V)}function Y(V){return V===o?(N.enter("codeFencedFenceSequence"),H(V)):T(V)}function H(V){return V===o?(j++,N.consume(V),H):j>=u?(N.exit("codeFencedFenceSequence"),Xe(V)?et(N,z,"whitespace")(V):z(V)):T(V)}function z(V){return V===null||Oe(V)?(N.exit("codeFencedFence"),D(V)):T(V)}}}function $3(e,t,n){const r=this;return a;function a(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l)}function l(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}const Wd={name:"codeIndented",tokenize:q3},G3={partial:!0,tokenize:V3};function q3(e,t,n){const r=this;return a;function a(f){return e.enter("codeIndented"),et(e,l,"linePrefix",5)(f)}function l(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?u(f):n(f)}function u(f){return f===null?c(f):Oe(f)?e.attempt(G3,u,c)(f):(e.enter("codeFlowValue"),o(f))}function o(f){return f===null||Oe(f)?(e.exit("codeFlowValue"),u(f)):(e.consume(f),o)}function c(f){return e.exit("codeIndented"),t(f)}}function V3(e,t,n){const r=this;return a;function a(u){return r.parser.lazy[r.now().line]?n(u):Oe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):et(e,l,"linePrefix",5)(u)}function l(u){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(u):Oe(u)?a(u):n(u)}}const Y3={name:"codeText",previous:X3,resolve:W3,tokenize:K3};function W3(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&ko(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ko(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ko(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(u):e.interrupt(r.parser.constructs.flow,n,t)(u)}}function Ax(e,t,n,r,a,l,u,o,c){const f=c||Number.POSITIVE_INFINITY;let p=0;return d;function d(S){return S===60?(e.enter(r),e.enter(a),e.enter(l),e.consume(S),e.exit(l),_):S===null||S===32||S===41||wu(S)?n(S):(e.enter(r),e.enter(u),e.enter(o),e.enter("chunkString",{contentType:"string"}),C(S))}function _(S){return S===62?(e.enter(l),e.consume(S),e.exit(l),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(e.exit("chunkString"),e.exit(o),_(S)):S===null||S===60||Oe(S)?n(S):(e.consume(S),S===92?w:v)}function w(S){return S===60||S===62||S===92?(e.consume(S),v):v(S)}function C(S){return!p&&(S===null||S===41||yt(S))?(e.exit("chunkString"),e.exit(o),e.exit(u),e.exit(r),t(S)):p999||v===null||v===91||v===93&&!c||v===94&&!o&&"_hiddenFootnoteSupport"in u.parser.constructs?n(v):v===93?(e.exit(l),e.enter(a),e.consume(v),e.exit(a),e.exit(r),t):Oe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),d(v))}function d(v){return v===null||v===91||v===93||Oe(v)||o++>999?(e.exit("chunkString"),p(v)):(e.consume(v),c||(c=!Xe(v)),v===92?_:d)}function _(v){return v===91||v===92||v===93?(e.consume(v),o++,d):d(v)}}function Tx(e,t,n,r,a,l){let u;return o;function o(_){return _===34||_===39||_===40?(e.enter(r),e.enter(a),e.consume(_),e.exit(a),u=_===40?41:_,c):n(_)}function c(_){return _===u?(e.enter(a),e.consume(_),e.exit(a),e.exit(r),t):(e.enter(l),f(_))}function f(_){return _===u?(e.exit(l),c(u)):_===null?n(_):Oe(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),et(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(_))}function p(_){return _===u||_===null||Oe(_)?(e.exit("chunkString"),f(_)):(e.consume(_),_===92?d:p)}function d(_){return _===u||_===92?(e.consume(_),p):p(_)}}function Oo(e,t){let n;return r;function r(a){return Oe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Xe(a)?et(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const r5={name:"definition",tokenize:a5},s5={partial:!0,tokenize:o5};function a5(e,t,n){const r=this;let a;return l;function l(v){return e.enter("definition"),u(v)}function u(v){return Nx.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function o(v){return a=Jn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),c):n(v)}function c(v){return yt(v)?Oo(e,f)(v):f(v)}function f(v){return Ax(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function p(v){return e.attempt(s5,d,d)(v)}function d(v){return Xe(v)?et(e,_,"whitespace")(v):_(v)}function _(v){return v===null||Oe(v)?(e.exit("definition"),r.parser.defined.push(a),t(v)):n(v)}}function o5(e,t,n){return r;function r(o){return yt(o)?Oo(e,a)(o):n(o)}function a(o){return Tx(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function l(o){return Xe(o)?et(e,u,"whitespace")(o):u(o)}function u(o){return o===null||Oe(o)?t(o):n(o)}}const l5={name:"hardBreakEscape",tokenize:c5};function c5(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),a}function a(l){return Oe(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const u5={name:"headingAtx",resolve:h5,tokenize:f5};function h5(e,t){let n=e.length-2,r=3,a,l;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Tn(e,r,n-r+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function f5(e,t,n){let r=0;return a;function a(p){return e.enter("atxHeading"),l(p)}function l(p){return e.enter("atxHeadingSequence"),u(p)}function u(p){return p===35&&r++<6?(e.consume(p),u):p===null||yt(p)?(e.exit("atxHeadingSequence"),o(p)):n(p)}function o(p){return p===35?(e.enter("atxHeadingSequence"),c(p)):p===null||Oe(p)?(e.exit("atxHeading"),t(p)):Xe(p)?et(e,o,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function c(p){return p===35?(e.consume(p),c):(e.exit("atxHeadingSequence"),o(p))}function f(p){return p===null||p===35||yt(p)?(e.exit("atxHeadingText"),o(p)):(e.consume(p),f)}}const d5=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],a1=["pre","script","style","textarea"],p5={concrete:!0,name:"htmlFlow",resolveTo:_5,tokenize:v5},g5={partial:!0,tokenize:b5},m5={partial:!0,tokenize:y5};function _5(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function v5(e,t,n){const r=this;let a,l,u,o,c;return f;function f(U){return p(U)}function p(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),d}function d(U){return U===33?(e.consume(U),_):U===47?(e.consume(U),l=!0,C):U===63?(e.consume(U),a=3,r.interrupt?t:M):sn(U)?(e.consume(U),u=String.fromCharCode(U),b):n(U)}function _(U){return U===45?(e.consume(U),a=2,v):U===91?(e.consume(U),a=5,o=0,w):sn(U)?(e.consume(U),a=4,r.interrupt?t:M):n(U)}function v(U){return U===45?(e.consume(U),r.interrupt?t:M):n(U)}function w(U){const Q="CDATA[";return U===Q.charCodeAt(o++)?(e.consume(U),o===Q.length?r.interrupt?t:Y:w):n(U)}function C(U){return sn(U)?(e.consume(U),u=String.fromCharCode(U),b):n(U)}function b(U){if(U===null||U===47||U===62||yt(U)){const Q=U===47,re=u.toLowerCase();return!Q&&!l&&a1.includes(re)?(a=1,r.interrupt?t(U):Y(U)):d5.includes(u.toLowerCase())?(a=6,Q?(e.consume(U),S):r.interrupt?t(U):Y(U)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(U):l?x(U):y(U))}return U===45||en(U)?(e.consume(U),u+=String.fromCharCode(U),b):n(U)}function S(U){return U===62?(e.consume(U),r.interrupt?t:Y):n(U)}function x(U){return Xe(U)?(e.consume(U),x):B(U)}function y(U){return U===47?(e.consume(U),B):U===58||U===95||sn(U)?(e.consume(U),E):Xe(U)?(e.consume(U),y):B(U)}function E(U){return U===45||U===46||U===58||U===95||en(U)?(e.consume(U),E):R(U)}function R(U){return U===61?(e.consume(U),N):Xe(U)?(e.consume(U),R):y(U)}function N(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),c=U,D):Xe(U)?(e.consume(U),N):T(U)}function D(U){return U===c?(e.consume(U),c=null,j):U===null||Oe(U)?n(U):(e.consume(U),D)}function T(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||yt(U)?R(U):(e.consume(U),T)}function j(U){return U===47||U===62||Xe(U)?y(U):n(U)}function B(U){return U===62?(e.consume(U),F):n(U)}function F(U){return U===null||Oe(U)?Y(U):Xe(U)?(e.consume(U),F):n(U)}function Y(U){return U===45&&a===2?(e.consume(U),G):U===60&&a===1?(e.consume(U),X):U===62&&a===4?(e.consume(U),O):U===63&&a===3?(e.consume(U),M):U===93&&a===5?(e.consume(U),L):Oe(U)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(g5,$,H)(U)):U===null||Oe(U)?(e.exit("htmlFlowData"),H(U)):(e.consume(U),Y)}function H(U){return e.check(m5,z,$)(U)}function z(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),V}function V(U){return U===null||Oe(U)?H(U):(e.enter("htmlFlowData"),Y(U))}function G(U){return U===45?(e.consume(U),M):Y(U)}function X(U){return U===47?(e.consume(U),u="",K):Y(U)}function K(U){if(U===62){const Q=u.toLowerCase();return a1.includes(Q)?(e.consume(U),O):Y(U)}return sn(U)&&u.length<8?(e.consume(U),u+=String.fromCharCode(U),K):Y(U)}function L(U){return U===93?(e.consume(U),M):Y(U)}function M(U){return U===62?(e.consume(U),O):U===45&&a===2?(e.consume(U),M):Y(U)}function O(U){return U===null||Oe(U)?(e.exit("htmlFlowData"),$(U)):(e.consume(U),O)}function $(U){return e.exit("htmlFlow"),t(U)}}function y5(e,t,n){const r=this;return a;function a(u){return Oe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):n(u)}function l(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}function b5(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(ll,t,n)}}const S5={name:"htmlText",tokenize:x5};function x5(e,t,n){const r=this;let a,l,u;return o;function o(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),c}function c(M){return M===33?(e.consume(M),f):M===47?(e.consume(M),R):M===63?(e.consume(M),y):sn(M)?(e.consume(M),T):n(M)}function f(M){return M===45?(e.consume(M),p):M===91?(e.consume(M),l=0,w):sn(M)?(e.consume(M),x):n(M)}function p(M){return M===45?(e.consume(M),v):n(M)}function d(M){return M===null?n(M):M===45?(e.consume(M),_):Oe(M)?(u=d,X(M)):(e.consume(M),d)}function _(M){return M===45?(e.consume(M),v):d(M)}function v(M){return M===62?G(M):M===45?_(M):d(M)}function w(M){const O="CDATA[";return M===O.charCodeAt(l++)?(e.consume(M),l===O.length?C:w):n(M)}function C(M){return M===null?n(M):M===93?(e.consume(M),b):Oe(M)?(u=C,X(M)):(e.consume(M),C)}function b(M){return M===93?(e.consume(M),S):C(M)}function S(M){return M===62?G(M):M===93?(e.consume(M),S):C(M)}function x(M){return M===null||M===62?G(M):Oe(M)?(u=x,X(M)):(e.consume(M),x)}function y(M){return M===null?n(M):M===63?(e.consume(M),E):Oe(M)?(u=y,X(M)):(e.consume(M),y)}function E(M){return M===62?G(M):y(M)}function R(M){return sn(M)?(e.consume(M),N):n(M)}function N(M){return M===45||en(M)?(e.consume(M),N):D(M)}function D(M){return Oe(M)?(u=D,X(M)):Xe(M)?(e.consume(M),D):G(M)}function T(M){return M===45||en(M)?(e.consume(M),T):M===47||M===62||yt(M)?j(M):n(M)}function j(M){return M===47?(e.consume(M),G):M===58||M===95||sn(M)?(e.consume(M),B):Oe(M)?(u=j,X(M)):Xe(M)?(e.consume(M),j):G(M)}function B(M){return M===45||M===46||M===58||M===95||en(M)?(e.consume(M),B):F(M)}function F(M){return M===61?(e.consume(M),Y):Oe(M)?(u=F,X(M)):Xe(M)?(e.consume(M),F):j(M)}function Y(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),a=M,H):Oe(M)?(u=Y,X(M)):Xe(M)?(e.consume(M),Y):(e.consume(M),z)}function H(M){return M===a?(e.consume(M),a=void 0,V):M===null?n(M):Oe(M)?(u=H,X(M)):(e.consume(M),H)}function z(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||yt(M)?j(M):(e.consume(M),z)}function V(M){return M===47||M===62||yt(M)?j(M):n(M)}function G(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function X(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),K}function K(M){return Xe(M)?et(e,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):L(M)}function L(M){return e.enter("htmlTextData"),u(M)}}const Rg={name:"labelEnd",resolveAll:k5,resolveTo:A5,tokenize:N5},w5={tokenize:T5},C5={tokenize:R5},E5={tokenize:D5};function k5(e){let t=-1;const n=[];for(;++t=3&&(f===null||Oe(f))?(e.exit("thematicBreak"),t(f)):n(f)}function c(f){return f===a?(e.consume(f),r++,c):(e.exit("thematicBreakSequence"),Xe(f)?et(e,o,"whitespace")(f):o(f))}}const pn={continuation:{tokenize:P5},exit:$5,name:"list",tokenize:F5},z5={partial:!0,tokenize:G5},H5={partial:!0,tokenize:U5};function F5(e,t,n){const r=this,a=r.events[r.events.length-1];let l=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return o;function o(v){const w=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:Op(v)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(uu,n,f)(v):f(v);if(!r.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(v)}return n(v)}function c(v){return Op(v)&&++u<10?(e.consume(v),c):(!r.interrupt||u<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),f(v)):n(v)}function f(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,e.check(ll,r.interrupt?n:p,e.attempt(z5,_,d))}function p(v){return r.containerState.initialBlankLine=!0,l++,_(v)}function d(v){return Xe(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),_):n(v)}function _(v){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function P5(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ll,a,l);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,et(e,t,"listItemIndent",r.containerState.size+1)(o)}function l(o){return r.containerState.furtherBlankLines||!Xe(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,u(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(H5,t,u)(o))}function u(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,et(e,e.attempt(pn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function U5(e,t,n){const r=this;return et(e,a,"listItemIndent",r.containerState.size+1);function a(l){const u=r.events[r.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===r.containerState.size?t(l):n(l)}}function $5(e){e.exit(this.containerState.type)}function G5(e,t,n){const r=this;return et(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(l){const u=r.events[r.events.length-1];return!Xe(l)&&u&&u[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const o1={name:"setextUnderline",resolveTo:q5,tokenize:V5};function q5(e,t){let n=e.length,r,a,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const u={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",l?(e.splice(a,0,["enter",u,t]),e.splice(l+1,0,["exit",e[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=u,e.push(["exit",u,t]),e}function V5(e,t,n){const r=this;let a;return l;function l(f){let p=r.events.length,d;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){d=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),a=f,u(f)):n(f)}function u(f){return e.enter("setextHeadingLineSequence"),o(f)}function o(f){return f===a?(e.consume(f),o):(e.exit("setextHeadingLineSequence"),Xe(f)?et(e,c,"lineSuffix")(f):c(f))}function c(f){return f===null||Oe(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const Y5={tokenize:W5};function W5(e){const t=this,n=e.attempt(ll,r,e.attempt(this.parser.constructs.flowInitial,a,et(e,e.attempt(this.parser.constructs.flow,a,e.attempt(J3,a)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const X5={resolveAll:Dx()},K5=Rx("string"),Z5=Rx("text");function Rx(e){return{resolveAll:Dx(e==="text"?Q5:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],l=n.attempt(a,u,o);return u;function u(p){return f(p)?l(p):o(p)}function o(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),c}function c(p){return f(p)?(n.exit("data"),l(p)):(n.consume(p),c)}function f(p){if(p===null)return!0;const d=a[p];let _=-1;if(d)for(;++_-1){const o=u[0];typeof o=="string"?u[0]=o.slice(r):u.shift()}l>0&&u.push(e[a].slice(0,l))}return u}function h4(e,t){let n=-1;const r=[];let a;for(;++n"");let n=t;try{const r=JSON.parse(t);r.error&&(n=r.error)}catch{}throw new Error(n||`HTTP ${e.status}`)}return await e.json()}const ut=e=>fetch(e).then(t=>us(t)),Dt=(e,t)=>fetch(e,{method:"POST",headers:t===void 0?{}:{"content-type":"application/json"},body:t===void 0?void 0:JSON.stringify(t)}).then(n=>us(n)),WS=(e,t)=>fetch(e,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}).then(n=>us(n)),AN=()=>ut("/api/projects").then(e=>e.projects),NN=e=>Dt("/api/projects",e).then(t=>t.project),TN=e=>ut(`/api/papers/search?q=${encodeURIComponent(e)}`).then(t=>t.papers),RN=e=>ut(`/api/papers/resolve?id=${encodeURIComponent(e)}`).then(t=>t.paper),DN=e=>Dt(`/api/projects/${e}/open`).then(t=>t.project),MN=e=>fetch(`/api/projects/${e}`,{method:"DELETE"}).then(async t=>{if(!t.ok){const n=await t.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`delete failed (${t.status})`)}}),jN=e=>ut(`/api/projects/${e}/experiments`).then(t=>t.experiments),LN=e=>ut(`/api/projects/${e}/runs`).then(t=>t.runs),ON=()=>ut("/api/instances").then(e=>e.instances),XS=e=>Dt(`/api/runs/${e}/cancel`),BN=(e,t)=>ut(`/api/runs/${e}/log?offset=${t}`),IN=e=>ut(`/api/experiments/${e}/commits`).then(t=>t.commits),zN=(e,t)=>ut(`/api/experiments/${e}/commits/${t}/diff`),By=e=>ut(`/api/projects/${e}/working-tree`),KS=(e,t=new URLSearchParams)=>(e.sessionId&&t.set("sessionId",e.sessionId),e.ref&&t.set("ref",e.ref),t),HN=(e,t,n={})=>ut(`/api/projects/${e}/file?${KS(n,new URLSearchParams({path:t}))}`),FN=(e,t={})=>{const n=KS(t).toString();return ut(`/api/projects/${e}/code-tree${n?`?${n}`:""}`)},xg=(e,t,n)=>`https://github.com/${e}/${t}/tree/${n.split("/").map(encodeURIComponent).join("/")}`,PN=()=>ut("/api/settings/hf"),UN=e=>Dt("/api/settings/hf",{token:e}),$N=()=>ut("/api/settings/k8s"),GN=e=>Dt("/api/settings/k8s",e),qN=()=>ut("/api/settings/modal"),VN=()=>Dt("/api/settings/modal/provision"),YN=()=>ut("/api/settings/env").then(e=>e.vars),ZS=(e,t)=>Dt("/api/settings/env",{key:e,value:t}).then(n=>n.vars),WN=e=>fetch(`/api/settings/env/${encodeURIComponent(e)}`,{method:"DELETE"}).then(t=>us(t)).then(t=>t.vars),QS=()=>ut("/api/settings/data-dir"),XN=e=>Dt("/api/settings/data-dir/validate",{path:e}),KN=e=>Dt("/api/settings/data-dir",{path:e}),ZN=e=>Dt("/api/settings/data-dir/move",{path:e}),QN=()=>ut("/api/settings/ssh").then(e=>e.hosts),JN=e=>Dt("/api/settings/ssh/preflight",{host:e}),eT=()=>ut("/api/settings/slurm"),tT=e=>Dt("/api/settings/slurm",e),nT=e=>Dt("/api/settings/slurm/preflight",{host:e}),iT=()=>ut("/api/settings/compute"),JS=e=>Dt("/api/settings/compute/default",e),rT=()=>ut("/api/settings/local"),sT=()=>ut("/api/settings/openresearch"),Iy=e=>ut(`/api/projects/${e}/files`),aT=(e,t)=>ut(`/api/projects/${e}/files/report?path=${encodeURIComponent(t)}`),oT=(e,t)=>fetch(`/api/projects/${e}/files?path=${encodeURIComponent(t)}`,{method:"DELETE"}).then(n=>us(n)),Np=(e,t)=>`/api/projects/${e}/files/file?path=${encodeURIComponent(t)}`,ex=()=>ut("/api/settings/git"),lT=e=>Dt("/api/settings/git",e),cT=e=>Dt("/api/settings/git/token",{token:e}),uT=()=>fetch("/api/settings/git/token",{method:"DELETE"}).then(e=>us(e)),hT=()=>ut("/api/settings/telemetry"),fT=e=>Dt("/api/settings/telemetry",{enabled:e}),dT=e=>Dt("/api/settings/telemetry/consent",{enabled:e}),wg=(e=!1)=>ut(`/api/harnesses${e?"?refresh=1":""}`).then(t=>t.harnesses),pT=()=>ut("/api/skills").then(e=>e.skills);function xu(e){const t=(e.split("/").pop()??e).replace(/^~/,"").replace(/^claude-/,""),n=[],r=[];for(const a of t.split("-"))/^\d+(\.\d+)?$/.test(a)?r.push(a):(r.length&&n.push(r.splice(0).join(".")),n.push(a==="gpt"?"GPT":a.charAt(0).toUpperCase()+a.slice(1)));return r.length&&n.push(r.join(".")),n.join(" ")}const zy=e=>ut(`/api/chat/sessions?projectId=${encodeURIComponent(e)}`).then(t=>t.sessions),gT=(e,t,n={})=>Dt("/api/chat/sessions",{projectId:e,harness:t,...n}).then(r=>r.session),mT=e=>fetch(`/api/chat/sessions/${e}`,{method:"DELETE"}).then(t=>us(t)),_T=(e,t)=>WS(`/api/chat/sessions/${e}`,{archived:t}).then(n=>n.session),vT=(e,t)=>WS(`/api/chat/sessions/${e}`,{title:t}).then(n=>n.session),Hy=e=>ut(`/api/chat/sessions/${e}/messages`).then(t=>t.messages),yT=e=>`/api/chat/attachments/${encodeURIComponent(e)}`,bT=(e,t,n={},r)=>Dt(`/api/chat/sessions/${e}/message`,{text:t,model:n.model,permissionMode:n.permissionMode,reasoningLevel:n.reasoningLevel,images:r}),ST=e=>Dt(`/api/chat/sessions/${e}/interrupt`),xT=(e,t)=>Dt(`/api/chat/sessions/${e}/respond`,t);function Sa(e){const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return`${t}s ago`;const n=Math.floor(t/60);if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Fy(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function ns(e){const t=["B","KB","MB","GB","TB"];let n=e,r=0;for(;n>=1024&&r10?`${e.slice(0,10)}…`:e}function tx(e){return e?typeof e.kind=="string"?e.kind:typeof e.type=="string"?e.type:"":""}function nx(e){return e?typeof e.flavor=="string"&&e.flavor?e.flavor:typeof e.manifest=="string"&&e.manifest?e.manifest:typeof e.namespace=="string"&&e.namespace?e.namespace:"":""}const cu=new Map;function wT(e,t){let n=cu.get(e);return n||(n=new Set,cu.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&cu.delete(e)}}function CT(e){var t;(t=cu.get(e.runId))==null||t.forEach(n=>n(e))}const Rp=new Set;function ET(e){return Rp.add(e),()=>{Rp.delete(e)}}function zc(e){Rp.forEach(t=>t(e))}const Dp=new Set;function kT(e){return Dp.add(e),()=>{Dp.delete(e)}}function Gd(e){Dp.forEach(t=>t(e))}function AT(e){const t=V.useRef(e);t.current=e,V.useEffect(()=>{const n=new EventSource("/api/events"),r=a=>{try{return JSON.parse(a.data)}catch{return null}};return n.addEventListener("run.updated",a=>{const l=r(a);l!=null&&l.run&&t.current.onRun(l.run)}),n.addEventListener("experiment.updated",a=>{const l=r(a);l!=null&&l.experiment&&t.current.onExperiment(l.experiment)}),n.addEventListener("project.updated",a=>{const l=r(a);l!=null&&l.project&&t.current.onProject(l.project)}),n.addEventListener("files.updated",a=>{var u,o;const l=r(a);l!=null&&l.projectId&&((o=(u=t.current).onFiles)==null||o.call(u,l.projectId))}),n.addEventListener("run.log",a=>{const l=r(a);l!=null&&l.runId&&CT(l)}),n.addEventListener("chat.session",a=>{const l=r(a);l!=null&&l.session&&zc({type:"session",session:l.session})}),n.addEventListener("chat.session.deleted",a=>{const l=r(a);l!=null&&l.sessionId&&zc({type:"sessionDeleted",sessionId:l.sessionId})}),n.addEventListener("chat.message",a=>{const l=r(a);l!=null&&l.message&&zc({type:"message",sessionId:l.sessionId,message:l.message})}),n.addEventListener("chat.busy",a=>{const l=r(a);l!=null&&l.sessionId&&zc({type:"busy",sessionId:l.sessionId,busy:l.busy})}),n.addEventListener("datadir.move.progress",a=>{const l=r(a);l&&Gd({type:"progress",...l})}),n.addEventListener("datadir.move.done",a=>{const l=r(a);l&&Gd({type:"done",path:l.path,oldPathLeft:l.oldPathLeft})}),n.addEventListener("datadir.move.error",a=>{const l=r(a);l&&Gd({type:"error",error:l.error})}),()=>n.close()},[])}function Py(e){const t=[],n=String(e||"");let r=n.indexOf(","),a=0,l=!1;for(;!l;){r===-1&&(r=n.length,l=!0);const u=n.slice(a,r).trim();(u||!l)&&t.push(u),a=r+1,r=n.indexOf(",",a)}return t}function NT(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const TT=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,RT=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,DT={};function Uy(e,t){return(DT.jsx?RT:TT).test(e)}const MT=/[ \t\n\f\r]/g;function jT(e){return typeof e=="object"?e.type==="text"?$y(e.value):!1:$y(e)}function $y(e){return e.replace(MT,"")===""}class ol{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}ol.prototype.normal={};ol.prototype.property={};ol.prototype.space=void 0;function ix(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new ol(n,r,t)}function Po(e){return e.toLowerCase()}class vn{constructor(t,n){this.attribute=n,this.property=t}}vn.prototype.attribute="";vn.prototype.booleanish=!1;vn.prototype.boolean=!1;vn.prototype.commaOrSpaceSeparated=!1;vn.prototype.commaSeparated=!1;vn.prototype.defined=!1;vn.prototype.mustUseProperty=!1;vn.prototype.number=!1;vn.prototype.overloadedBoolean=!1;vn.prototype.property="";vn.prototype.spaceSeparated=!1;vn.prototype.space=void 0;let LT=0;const ze=hs(),Ht=hs(),Mp=hs(),xe=hs(),vt=hs(),Jr=hs(),kn=hs();function hs(){return 2**++LT}const jp=Object.freeze(Object.defineProperty({__proto__:null,boolean:ze,booleanish:Ht,commaOrSpaceSeparated:kn,commaSeparated:Jr,number:xe,overloadedBoolean:Mp,spaceSeparated:vt},Symbol.toStringTag,{value:"Module"})),qd=Object.keys(jp);class Cg extends vn{constructor(t,n,r,a){let l=-1;if(super(t,n),Gy(this,"space",a),typeof r=="number")for(;++l4&&n.slice(0,4)==="data"&&HT.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(qy,PT);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!qy.test(l)){let u=l.replace(zT,FT);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=Cg}return new a(r,t)}function FT(e){return"-"+e.toLowerCase()}function PT(e){return e.charAt(1).toUpperCase()}const hx=ix([rx,OT,ox,lx,cx],"html"),qu=ix([rx,BT,ox,lx,cx],"svg");function Vy(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function UT(e){return e.join(" ").trim()}var Js={},Vd,Yy;function $T(){if(Yy)return Vd;Yy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,o=/^\s+|\s+$/g,c=` +`,f="/",p="*",d="",_="comment",v="declaration";function w(b,S){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];S=S||{};var x=1,y=1;function E(H){var Y=H.match(t);Y&&(x+=Y.length);var q=H.lastIndexOf(c);y=~q?H.length-q:y+H.length}function R(){var H={line:x,column:y};return function(Y){return Y.position=new N(H),j(),Y}}function N(H){this.start=H,this.end={line:x,column:y},this.source=S.source}N.prototype.content=b;function D(H){var Y=new Error(S.source+":"+x+":"+y+": "+H);if(Y.reason=H,Y.filename=S.source,Y.line=x,Y.column=y,Y.source=b,!S.silent)throw Y}function T(H){var Y=H.exec(b);if(Y){var q=Y[0];return E(q),b=b.slice(q.length),Y}}function j(){T(n)}function B(H){var Y;for(H=H||[];Y=z();)Y!==!1&&H.push(Y);return H}function z(){var H=R();if(!(f!=b.charAt(0)||p!=b.charAt(1))){for(var Y=2;d!=b.charAt(Y)&&(p!=b.charAt(Y)||f!=b.charAt(Y+1));)++Y;if(Y+=2,d===b.charAt(Y-1))return D("End of comment missing");var q=b.slice(2,Y-2);return y+=2,E(q),b=b.slice(Y),y+=2,H({type:_,comment:q})}}function G(){var H=R(),Y=T(r);if(Y){if(z(),!T(a))return D("property missing ':'");var q=T(l),X=H({type:v,property:C(Y[0].replace(e,d)),value:q?C(q[0].replace(e,d)):d});return T(u),X}}function U(){var H=[];B(H);for(var Y;Y=G();)Y!==!1&&(H.push(Y),B(H));return H}return j(),U()}function C(b){return b?b.replace(o,d):d}return Vd=w,Vd}var Wy;function GT(){if(Wy)return Js;Wy=1;var e=Js&&Js.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Js,"__esModule",{value:!0}),Js.default=n;const t=e($T());function n(r,a){let l=null;if(!r||typeof r!="string")return l;const u=(0,t.default)(r),o=typeof a=="function";return u.forEach(c=>{if(c.type!=="declaration")return;const{property:f,value:p}=c;o?a(f,p,c):p&&(l=l||{},l[f]=p)}),l}return Js}var Co={},Xy;function qT(){if(Xy)return Co;Xy=1,Object.defineProperty(Co,"__esModule",{value:!0}),Co.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(f){return!f||n.test(f)||e.test(f)},u=function(f,p){return p.toUpperCase()},o=function(f,p){return"".concat(p,"-")},c=function(f,p){return p===void 0&&(p={}),l(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(a,o):f=f.replace(r,o),f.replace(t,u))};return Co.camelCase=c,Co}var Eo,Ky;function VT(){if(Ky)return Eo;Ky=1;var e=Eo&&Eo.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(GT()),n=qT();function r(a,l){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(o,c){o&&c&&(u[(0,n.camelCase)(o,l)]=c)}),u}return r.default=r,Eo=r,Eo}var YT=VT();const WT=Pu(YT),fx=dx("end"),Eg=dx("start");function dx(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function XT(e){const t=Eg(e),n=fx(e);if(t&&n)return{start:t,end:n}}function Lo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Zy(e.position):"start"in e||"end"in e?Zy(e):"line"in e||"column"in e?Lp(e):""}function Lp(e){return Qy(e&&e.line)+":"+Qy(e&&e.column)}function Zy(e){return Lp(e&&e.start)+"-"+Lp(e&&e.end)}function Qy(e){return e&&typeof e=="number"?e:1}class tn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",l={},u=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?a=t:!l.cause&&t&&(u=!0,a=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?l.ruleId=r:(l.source=r.slice(0,c),l.ruleId=r.slice(c+1))}if(!l.place&&l.ancestors&&l.ancestors){const c=l.ancestors[l.ancestors.length-1];c&&(l.place=c.position)}const o=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=o?o.line:void 0,this.name=Lo(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=u&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}tn.prototype.file="";tn.prototype.name="";tn.prototype.reason="";tn.prototype.message="";tn.prototype.stack="";tn.prototype.column=void 0;tn.prototype.line=void 0;tn.prototype.ancestors=void 0;tn.prototype.cause=void 0;tn.prototype.fatal=void 0;tn.prototype.place=void 0;tn.prototype.ruleId=void 0;tn.prototype.source=void 0;const kg={}.hasOwnProperty,KT=new Map,ZT=/[A-Z]/g,QT=new Set(["table","tbody","thead","tfoot","tr"]),JT=new Set(["td","th"]),px="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function e3(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=l3(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=o3(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?qu:hx,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=gx(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function gx(e,t,n){if(t.type==="element")return t3(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return n3(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return r3(e,t,n);if(t.type==="mdxjsEsm")return i3(e,t);if(t.type==="root")return s3(e,t,n);if(t.type==="text")return a3(e,t)}function t3(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=qu,e.schema=a),e.ancestors.push(t);const l=_x(e,t.tagName,!1),u=c3(e,t);let o=Ng(e,t);return QT.has(t.tagName)&&(o=o.filter(function(c){return typeof c=="string"?!jT(c):!0})),mx(e,u,l,t),Ag(u,o),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function n3(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Uo(e,t.position)}function i3(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Uo(e,t.position)}function r3(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=qu,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:_x(e,t.name,!0),u=u3(e,t),o=Ng(e,t);return mx(e,u,l,t),Ag(u,o),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function s3(e,t,n){const r={};return Ag(r,Ng(e,t)),e.create(t,e.Fragment,r,n)}function a3(e,t){return t.value}function mx(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ag(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function o3(e,t,n){return r;function r(a,l,u,o){const f=Array.isArray(u.children)?n:t;return o?f(l,u,o):f(l,u)}}function l3(e,t){return n;function n(r,a,l,u){const o=Array.isArray(l.children),c=Eg(r);return t(a,l,u,o,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function c3(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&kg.call(t.properties,a)){const l=h3(e,a,t.properties[a]);if(l){const[u,o]=l;e.tableCellAlignToStyle&&u==="align"&&typeof o=="string"&&JT.has(t.tagName)?r=o:n[u]=o}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function u3(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const u=l.expression;u.type;const o=u.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else Uo(e,t.position);else{const a=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,l=e.evaluater.evaluateExpression(o.expression)}else Uo(e,t.position);else l=r.value===null?!0:r.value;n[a]=l}return n}function Ng(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:KT;for(;++ra?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)u=Array.from(r),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);l0?(Tn(e,e.length,0,t),e):t}const t1={}.hasOwnProperty;function yx(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Jn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const sn=Nr(/[A-Za-z]/),en=Nr(/[\dA-Za-z]/),b3=Nr(/[#-'*+\--9=?A-Z^-~]/);function wu(e){return e!==null&&(e<32||e===127)}const Op=Nr(/\d/),S3=Nr(/[\dA-Fa-f]/),x3=Nr(/[!-/:-@[-`{-~]/);function Oe(e){return e!==null&&e<-2}function yt(e){return e!==null&&(e<0||e===32)}function Xe(e){return e===-2||e===-1||e===32}const Vu=Nr(new RegExp("\\p{P}|\\p{S}","u")),is=Nr(/\s/);function Nr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function wa(e){const t=[];let n=-1,r=0,a=0;for(;++n55295&&l<57344){const o=e.charCodeAt(n+1);l<56320&&o>56319&&o<57344?(u=String.fromCharCode(l,o),a=1):u="�"}else u=String.fromCharCode(l);u&&(t.push(e.slice(r,n),encodeURIComponent(u)),r=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function et(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let l=0;return u;function u(c){return Xe(c)?(e.enter(n),o(c)):t(c)}function o(c){return Xe(c)&&l++u))return;const D=t.events.length;let T=D,j,B;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(j){B=t.events[T][1].end;break}j=!0}for(S(r),N=D;Ny;){const R=n[E];t.containerState=R[1],R[0].exit.call(t,e)}n.length=y}function x(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function A3(e,t,n){return et(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function fa(e){if(e===null||yt(e)||is(e))return 1;if(Vu(e))return 2}function Yu(e,t,n){const r=[];let a=-1;for(;++a1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},_={...e[n][1].start};i1(d,-c),i1(_,c),u={type:c>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:_},l={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:c>1?"strong":"emphasis",start:{...u.start},end:{...o.end}},e[r][1].end={...u.start},e[n][1].start={...o.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=Gn(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=Gn(f,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",l,t]]),f=Gn(f,Yu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=Gn(f,[["exit",l,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=Gn(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Tn(e,r-1,n-r+3,f),n=r+f.length-p-2;break}}for(n=-1;++n0&&Xe(N)?et(e,x,"linePrefix",l+1)(N):x(N)}function x(N){return N===null||Oe(N)?e.check(r1,C,E)(N):(e.enter("codeFlowValue"),y(N))}function y(N){return N===null||Oe(N)?(e.exit("codeFlowValue"),x(N)):(e.consume(N),y)}function E(N){return e.exit("codeFenced"),t(N)}function R(N,D,T){let j=0;return B;function B(Y){return N.enter("lineEnding"),N.consume(Y),N.exit("lineEnding"),z}function z(Y){return N.enter("codeFencedFence"),Xe(Y)?et(N,G,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):G(Y)}function G(Y){return Y===o?(N.enter("codeFencedFenceSequence"),U(Y)):T(Y)}function U(Y){return Y===o?(j++,N.consume(Y),U):j>=u?(N.exit("codeFencedFenceSequence"),Xe(Y)?et(N,H,"whitespace")(Y):H(Y)):T(Y)}function H(Y){return Y===null||Oe(Y)?(N.exit("codeFencedFence"),D(Y)):T(Y)}}}function H3(e,t,n){const r=this;return a;function a(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l)}function l(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}const Wd={name:"codeIndented",tokenize:P3},F3={partial:!0,tokenize:U3};function P3(e,t,n){const r=this;return a;function a(f){return e.enter("codeIndented"),et(e,l,"linePrefix",5)(f)}function l(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?u(f):n(f)}function u(f){return f===null?c(f):Oe(f)?e.attempt(F3,u,c)(f):(e.enter("codeFlowValue"),o(f))}function o(f){return f===null||Oe(f)?(e.exit("codeFlowValue"),u(f)):(e.consume(f),o)}function c(f){return e.exit("codeIndented"),t(f)}}function U3(e,t,n){const r=this;return a;function a(u){return r.parser.lazy[r.now().line]?n(u):Oe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):et(e,l,"linePrefix",5)(u)}function l(u){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(u):Oe(u)?a(u):n(u)}}const $3={name:"codeText",previous:q3,resolve:G3,tokenize:V3};function G3(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&ko(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ko(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ko(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(u):e.interrupt(r.parser.constructs.flow,n,t)(u)}}function Ex(e,t,n,r,a,l,u,o,c){const f=c||Number.POSITIVE_INFINITY;let p=0;return d;function d(S){return S===60?(e.enter(r),e.enter(a),e.enter(l),e.consume(S),e.exit(l),_):S===null||S===32||S===41||wu(S)?n(S):(e.enter(r),e.enter(u),e.enter(o),e.enter("chunkString",{contentType:"string"}),C(S))}function _(S){return S===62?(e.enter(l),e.consume(S),e.exit(l),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(e.exit("chunkString"),e.exit(o),_(S)):S===null||S===60||Oe(S)?n(S):(e.consume(S),S===92?w:v)}function w(S){return S===60||S===62||S===92?(e.consume(S),v):v(S)}function C(S){return!p&&(S===null||S===41||yt(S))?(e.exit("chunkString"),e.exit(o),e.exit(u),e.exit(r),t(S)):p999||v===null||v===91||v===93&&!c||v===94&&!o&&"_hiddenFootnoteSupport"in u.parser.constructs?n(v):v===93?(e.exit(l),e.enter(a),e.consume(v),e.exit(a),e.exit(r),t):Oe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),d(v))}function d(v){return v===null||v===91||v===93||Oe(v)||o++>999?(e.exit("chunkString"),p(v)):(e.consume(v),c||(c=!Xe(v)),v===92?_:d)}function _(v){return v===91||v===92||v===93?(e.consume(v),o++,d):d(v)}}function Ax(e,t,n,r,a,l){let u;return o;function o(_){return _===34||_===39||_===40?(e.enter(r),e.enter(a),e.consume(_),e.exit(a),u=_===40?41:_,c):n(_)}function c(_){return _===u?(e.enter(a),e.consume(_),e.exit(a),e.exit(r),t):(e.enter(l),f(_))}function f(_){return _===u?(e.exit(l),c(u)):_===null?n(_):Oe(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),et(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(_))}function p(_){return _===u||_===null||Oe(_)?(e.exit("chunkString"),f(_)):(e.consume(_),_===92?d:p)}function d(_){return _===u||_===92?(e.consume(_),p):p(_)}}function Oo(e,t){let n;return r;function r(a){return Oe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Xe(a)?et(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const e5={name:"definition",tokenize:n5},t5={partial:!0,tokenize:i5};function n5(e,t,n){const r=this;let a;return l;function l(v){return e.enter("definition"),u(v)}function u(v){return kx.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function o(v){return a=Jn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),c):n(v)}function c(v){return yt(v)?Oo(e,f)(v):f(v)}function f(v){return Ex(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function p(v){return e.attempt(t5,d,d)(v)}function d(v){return Xe(v)?et(e,_,"whitespace")(v):_(v)}function _(v){return v===null||Oe(v)?(e.exit("definition"),r.parser.defined.push(a),t(v)):n(v)}}function i5(e,t,n){return r;function r(o){return yt(o)?Oo(e,a)(o):n(o)}function a(o){return Ax(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function l(o){return Xe(o)?et(e,u,"whitespace")(o):u(o)}function u(o){return o===null||Oe(o)?t(o):n(o)}}const r5={name:"hardBreakEscape",tokenize:s5};function s5(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),a}function a(l){return Oe(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const a5={name:"headingAtx",resolve:o5,tokenize:l5};function o5(e,t){let n=e.length-2,r=3,a,l;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Tn(e,r,n-r+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function l5(e,t,n){let r=0;return a;function a(p){return e.enter("atxHeading"),l(p)}function l(p){return e.enter("atxHeadingSequence"),u(p)}function u(p){return p===35&&r++<6?(e.consume(p),u):p===null||yt(p)?(e.exit("atxHeadingSequence"),o(p)):n(p)}function o(p){return p===35?(e.enter("atxHeadingSequence"),c(p)):p===null||Oe(p)?(e.exit("atxHeading"),t(p)):Xe(p)?et(e,o,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function c(p){return p===35?(e.consume(p),c):(e.exit("atxHeadingSequence"),o(p))}function f(p){return p===null||p===35||yt(p)?(e.exit("atxHeadingText"),o(p)):(e.consume(p),f)}}const c5=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],a1=["pre","script","style","textarea"],u5={concrete:!0,name:"htmlFlow",resolveTo:d5,tokenize:p5},h5={partial:!0,tokenize:m5},f5={partial:!0,tokenize:g5};function d5(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function p5(e,t,n){const r=this;let a,l,u,o,c;return f;function f(F){return p(F)}function p(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),d}function d(F){return F===33?(e.consume(F),_):F===47?(e.consume(F),l=!0,C):F===63?(e.consume(F),a=3,r.interrupt?t:M):sn(F)?(e.consume(F),u=String.fromCharCode(F),b):n(F)}function _(F){return F===45?(e.consume(F),a=2,v):F===91?(e.consume(F),a=5,o=0,w):sn(F)?(e.consume(F),a=4,r.interrupt?t:M):n(F)}function v(F){return F===45?(e.consume(F),r.interrupt?t:M):n(F)}function w(F){const Q="CDATA[";return F===Q.charCodeAt(o++)?(e.consume(F),o===Q.length?r.interrupt?t:G:w):n(F)}function C(F){return sn(F)?(e.consume(F),u=String.fromCharCode(F),b):n(F)}function b(F){if(F===null||F===47||F===62||yt(F)){const Q=F===47,re=u.toLowerCase();return!Q&&!l&&a1.includes(re)?(a=1,r.interrupt?t(F):G(F)):c5.includes(u.toLowerCase())?(a=6,Q?(e.consume(F),S):r.interrupt?t(F):G(F)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(F):l?x(F):y(F))}return F===45||en(F)?(e.consume(F),u+=String.fromCharCode(F),b):n(F)}function S(F){return F===62?(e.consume(F),r.interrupt?t:G):n(F)}function x(F){return Xe(F)?(e.consume(F),x):B(F)}function y(F){return F===47?(e.consume(F),B):F===58||F===95||sn(F)?(e.consume(F),E):Xe(F)?(e.consume(F),y):B(F)}function E(F){return F===45||F===46||F===58||F===95||en(F)?(e.consume(F),E):R(F)}function R(F){return F===61?(e.consume(F),N):Xe(F)?(e.consume(F),R):y(F)}function N(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(e.consume(F),c=F,D):Xe(F)?(e.consume(F),N):T(F)}function D(F){return F===c?(e.consume(F),c=null,j):F===null||Oe(F)?n(F):(e.consume(F),D)}function T(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||yt(F)?R(F):(e.consume(F),T)}function j(F){return F===47||F===62||Xe(F)?y(F):n(F)}function B(F){return F===62?(e.consume(F),z):n(F)}function z(F){return F===null||Oe(F)?G(F):Xe(F)?(e.consume(F),z):n(F)}function G(F){return F===45&&a===2?(e.consume(F),q):F===60&&a===1?(e.consume(F),X):F===62&&a===4?(e.consume(F),O):F===63&&a===3?(e.consume(F),M):F===93&&a===5?(e.consume(F),L):Oe(F)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(h5,$,U)(F)):F===null||Oe(F)?(e.exit("htmlFlowData"),U(F)):(e.consume(F),G)}function U(F){return e.check(f5,H,$)(F)}function H(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),Y}function Y(F){return F===null||Oe(F)?U(F):(e.enter("htmlFlowData"),G(F))}function q(F){return F===45?(e.consume(F),M):G(F)}function X(F){return F===47?(e.consume(F),u="",K):G(F)}function K(F){if(F===62){const Q=u.toLowerCase();return a1.includes(Q)?(e.consume(F),O):G(F)}return sn(F)&&u.length<8?(e.consume(F),u+=String.fromCharCode(F),K):G(F)}function L(F){return F===93?(e.consume(F),M):G(F)}function M(F){return F===62?(e.consume(F),O):F===45&&a===2?(e.consume(F),M):G(F)}function O(F){return F===null||Oe(F)?(e.exit("htmlFlowData"),$(F)):(e.consume(F),O)}function $(F){return e.exit("htmlFlow"),t(F)}}function g5(e,t,n){const r=this;return a;function a(u){return Oe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):n(u)}function l(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}function m5(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(ll,t,n)}}const _5={name:"htmlText",tokenize:v5};function v5(e,t,n){const r=this;let a,l,u;return o;function o(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),c}function c(M){return M===33?(e.consume(M),f):M===47?(e.consume(M),R):M===63?(e.consume(M),y):sn(M)?(e.consume(M),T):n(M)}function f(M){return M===45?(e.consume(M),p):M===91?(e.consume(M),l=0,w):sn(M)?(e.consume(M),x):n(M)}function p(M){return M===45?(e.consume(M),v):n(M)}function d(M){return M===null?n(M):M===45?(e.consume(M),_):Oe(M)?(u=d,X(M)):(e.consume(M),d)}function _(M){return M===45?(e.consume(M),v):d(M)}function v(M){return M===62?q(M):M===45?_(M):d(M)}function w(M){const O="CDATA[";return M===O.charCodeAt(l++)?(e.consume(M),l===O.length?C:w):n(M)}function C(M){return M===null?n(M):M===93?(e.consume(M),b):Oe(M)?(u=C,X(M)):(e.consume(M),C)}function b(M){return M===93?(e.consume(M),S):C(M)}function S(M){return M===62?q(M):M===93?(e.consume(M),S):C(M)}function x(M){return M===null||M===62?q(M):Oe(M)?(u=x,X(M)):(e.consume(M),x)}function y(M){return M===null?n(M):M===63?(e.consume(M),E):Oe(M)?(u=y,X(M)):(e.consume(M),y)}function E(M){return M===62?q(M):y(M)}function R(M){return sn(M)?(e.consume(M),N):n(M)}function N(M){return M===45||en(M)?(e.consume(M),N):D(M)}function D(M){return Oe(M)?(u=D,X(M)):Xe(M)?(e.consume(M),D):q(M)}function T(M){return M===45||en(M)?(e.consume(M),T):M===47||M===62||yt(M)?j(M):n(M)}function j(M){return M===47?(e.consume(M),q):M===58||M===95||sn(M)?(e.consume(M),B):Oe(M)?(u=j,X(M)):Xe(M)?(e.consume(M),j):q(M)}function B(M){return M===45||M===46||M===58||M===95||en(M)?(e.consume(M),B):z(M)}function z(M){return M===61?(e.consume(M),G):Oe(M)?(u=z,X(M)):Xe(M)?(e.consume(M),z):j(M)}function G(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),a=M,U):Oe(M)?(u=G,X(M)):Xe(M)?(e.consume(M),G):(e.consume(M),H)}function U(M){return M===a?(e.consume(M),a=void 0,Y):M===null?n(M):Oe(M)?(u=U,X(M)):(e.consume(M),U)}function H(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||yt(M)?j(M):(e.consume(M),H)}function Y(M){return M===47||M===62||yt(M)?j(M):n(M)}function q(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function X(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),K}function K(M){return Xe(M)?et(e,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):L(M)}function L(M){return e.enter("htmlTextData"),u(M)}}const Rg={name:"labelEnd",resolveAll:x5,resolveTo:w5,tokenize:C5},y5={tokenize:E5},b5={tokenize:k5},S5={tokenize:A5};function x5(e){let t=-1;const n=[];for(;++t=3&&(f===null||Oe(f))?(e.exit("thematicBreak"),t(f)):n(f)}function c(f){return f===a?(e.consume(f),r++,c):(e.exit("thematicBreakSequence"),Xe(f)?et(e,o,"whitespace")(f):o(f))}}const pn={continuation:{tokenize:I5},exit:H5,name:"list",tokenize:B5},L5={partial:!0,tokenize:F5},O5={partial:!0,tokenize:z5};function B5(e,t,n){const r=this,a=r.events[r.events.length-1];let l=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return o;function o(v){const w=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:Op(v)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(uu,n,f)(v):f(v);if(!r.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(v)}return n(v)}function c(v){return Op(v)&&++u<10?(e.consume(v),c):(!r.interrupt||u<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),f(v)):n(v)}function f(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,e.check(ll,r.interrupt?n:p,e.attempt(L5,_,d))}function p(v){return r.containerState.initialBlankLine=!0,l++,_(v)}function d(v){return Xe(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),_):n(v)}function _(v){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function I5(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ll,a,l);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,et(e,t,"listItemIndent",r.containerState.size+1)(o)}function l(o){return r.containerState.furtherBlankLines||!Xe(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,u(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(O5,t,u)(o))}function u(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,et(e,e.attempt(pn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function z5(e,t,n){const r=this;return et(e,a,"listItemIndent",r.containerState.size+1);function a(l){const u=r.events[r.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===r.containerState.size?t(l):n(l)}}function H5(e){e.exit(this.containerState.type)}function F5(e,t,n){const r=this;return et(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(l){const u=r.events[r.events.length-1];return!Xe(l)&&u&&u[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const o1={name:"setextUnderline",resolveTo:P5,tokenize:U5};function P5(e,t){let n=e.length,r,a,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const u={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",l?(e.splice(a,0,["enter",u,t]),e.splice(l+1,0,["exit",e[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=u,e.push(["exit",u,t]),e}function U5(e,t,n){const r=this;let a;return l;function l(f){let p=r.events.length,d;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){d=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),a=f,u(f)):n(f)}function u(f){return e.enter("setextHeadingLineSequence"),o(f)}function o(f){return f===a?(e.consume(f),o):(e.exit("setextHeadingLineSequence"),Xe(f)?et(e,c,"lineSuffix")(f):c(f))}function c(f){return f===null||Oe(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const $5={tokenize:G5};function G5(e){const t=this,n=e.attempt(ll,r,e.attempt(this.parser.constructs.flowInitial,a,et(e,e.attempt(this.parser.constructs.flow,a,e.attempt(X3,a)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const q5={resolveAll:Tx()},V5=Nx("string"),Y5=Nx("text");function Nx(e){return{resolveAll:Tx(e==="text"?W5:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],l=n.attempt(a,u,o);return u;function u(p){return f(p)?l(p):o(p)}function o(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),c}function c(p){return f(p)?(n.exit("data"),l(p)):(n.consume(p),c)}function f(p){if(p===null)return!0;const d=a[p];let _=-1;if(d)for(;++_-1){const o=u[0];typeof o=="string"?u[0]=o.slice(r):u.shift()}l>0&&u.push(e[a].slice(0,l))}return u}function o4(e,t){let n=-1;const r=[];let a;for(;++n0){const Ve=Se.tokenStack[Se.tokenStack.length-1];(Ve[1]||c1).call(Se,void 0,Ve[0])}for(de.position={start:xr(ie.length>0?ie[0][1].start:{line:1,column:1,offset:0}),end:xr(ie.length>0?ie[ie.length-2][1].end:{line:1,column:1,offset:0})},De=-1;++De0&&(r.className=["language-"+a[0]]);let l={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function E4(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function k4(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function A4(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=wa(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let u,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),u=e.footnoteOrder.length):u=l+1,o+=1,e.footnoteCounts.set(r,o);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,c);const f={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,f),e.applyData(t,f)}function N4(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function T4(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Lx(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),l=a[0];l&&l.type==="text"?l.value="["+l.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=r:a.push({type:"text",value:r}),a}function R4(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Lx(e,t);const a={src:wa(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,l),e.applyData(t,l)}function D4(e,t){const n={src:wa(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function M4(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function j4(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Lx(e,t);const a={href:wa(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function L4(e,t){const n={href:wa(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function O4(e,t,n){const r=e.all(t),a=n?B4(n):Ox(t),l={},u=[];if(typeof t.checked=="boolean"){const p=r[0];let d;p&&p.type==="element"&&p.tagName==="p"?d=p:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let o=-1;for(;++o0){const Ve=Se.tokenStack[Se.tokenStack.length-1];(Ve[1]||c1).call(Se,void 0,Ve[0])}for(de.position={start:xr(ie.length>0?ie[0][1].start:{line:1,column:1,offset:0}),end:xr(ie.length>0?ie[ie.length-2][1].end:{line:1,column:1,offset:0})},De=-1;++De0&&(r.className=["language-"+a[0]]);let l={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function S4(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function x4(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function w4(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=wa(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let u,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),u=e.footnoteOrder.length):u=l+1,o+=1,e.footnoteCounts.set(r,o);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,c);const f={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,f),e.applyData(t,f)}function C4(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function E4(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Mx(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),l=a[0];l&&l.type==="text"?l.value="["+l.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=r:a.push({type:"text",value:r}),a}function k4(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Mx(e,t);const a={src:wa(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,l),e.applyData(t,l)}function A4(e,t){const n={src:wa(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function N4(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function T4(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Mx(e,t);const a={href:wa(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function R4(e,t){const n={href:wa(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function D4(e,t,n){const r=e.all(t),a=n?M4(n):jx(t),l={},u=[];if(typeof t.checked=="boolean"){const p=r[0];let d;p&&p.type==="element"&&p.tagName==="p"?d=p:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let o=-1;for(;++o1}function I4(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=Eg(t.children[1]),c=px(t.children[t.children.length-1]);o&&c&&(u.position={start:o,end:c}),a.push(u)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,l),e.applyData(t,l)}function U4(e,t,n){const r=n?n.children:void 0,l=(r?r.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,o=u?u.length:t.children.length;let c=-1;const f=[];for(;++c0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return l.push(f1(t.slice(a),a>0,!1)),l.join("")}function f1(e,t,n){let r=0,a=e.length;if(t){let l=e.codePointAt(r);for(;l===u1||l===h1;)r++,l=e.codePointAt(r)}if(n){let l=e.codePointAt(a-1);for(;l===u1||l===h1;)a--,l=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function q4(e,t){const n={type:"text",value:G4(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function V4(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Y4={blockquote:x4,break:w4,code:C4,delete:E4,emphasis:k4,footnoteReference:A4,heading:N4,html:T4,imageReference:R4,image:D4,inlineCode:M4,linkReference:j4,link:L4,listItem:O4,list:I4,paragraph:z4,root:H4,strong:F4,table:P4,tableCell:$4,tableRow:U4,text:q4,thematicBreak:V4,toml:Hc,yaml:Hc,definition:Hc,footnoteDefinition:Hc};function Hc(){}const Bx=-1,Wu=0,Bo=1,Cu=2,Dg=3,Mg=4,jg=5,Lg=6,Ix=7,zx=8,Hx=typeof self=="object"?self:globalThis,d1=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Hx[e](t)},W4=(e,t)=>{const n=(a,l)=>(e.set(l,a),a),r=a=>{if(e.has(a))return e.get(a);const[l,u]=t[a];switch(l){case Wu:case Bx:return n(u,a);case Bo:{const o=n([],a);for(const c of u)o.push(r(c));return o}case Cu:{const o=n({},a);for(const[c,f]of u)o[r(c)]=r(f);return o}case Dg:return n(new Date(u),a);case Mg:{const{source:o,flags:c}=u;return n(new RegExp(o,c),a)}case jg:{const o=n(new Map,a);for(const[c,f]of u)o.set(r(c),r(f));return o}case Lg:{const o=n(new Set,a);for(const c of u)o.add(r(c));return o}case Ix:{const{name:o,message:c}=u;return n(typeof Hx[o]=="function"?d1(o,c):new Error(c),a)}case zx:return n(BigInt(u),a);case"BigInt":return n(Object(BigInt(u)),a);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:o}=new Uint8Array(u);return n(new DataView(o),u)}}return n(d1(l,u),a)};return r},p1=e=>W4(new Map,e)(0),Xr="",{toString:X4}={},{keys:K4}=Object,Ao=e=>{const t=typeof e;if(t!=="object"||!e)return[Wu,t];const n=X4.call(e).slice(8,-1);switch(n){case"Array":return[Bo,Xr];case"Object":return[Cu,Xr];case"Date":return[Dg,Xr];case"RegExp":return[Mg,Xr];case"Map":return[jg,Xr];case"Set":return[Lg,Xr];case"DataView":return[Bo,n]}return n.includes("Array")?[Bo,n]:e instanceof Error?[Ix,e.name||"Error"]:[Cu,n]},Fc=([e,t])=>e===Wu&&(t==="function"||t==="symbol"),Z4=(e,t,n,r)=>{const a=(u,o)=>{const c=r.push(u)-1;return n.set(o,c),c},l=u=>{if(n.has(u))return n.get(u);let[o,c]=Ao(u);switch(o){case Wu:{let p=u;switch(c){case"bigint":o=zx,p=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);p=null;break;case"undefined":return a([Bx],u)}return a([o,p],u)}case Bo:{if(c){let _=u;return c==="DataView"?_=new Uint8Array(u.buffer):c==="ArrayBuffer"&&(_=new Uint8Array(u)),a([c,[..._]],u)}const p=[],d=a([o,p],u);for(const _ of u)p.push(l(_));return d}case Cu:{if(c)switch(c){case"BigInt":return a([c,u.toString()],u);case"Boolean":case"Number":case"String":return a([c,u.valueOf()],u)}if(t&&"toJSON"in u)return l(u.toJSON());const p=[],d=a([o,p],u);for(const _ of K4(u))(e||!Fc(Ao(u[_])))&&p.push([l(_),l(u[_])]);return d}case Dg:return a([o,isNaN(u.getTime())?Xr:u.toISOString()],u);case Mg:{const{source:p,flags:d}=u;return a([o,{source:p,flags:d}],u)}case jg:{const p=[],d=a([o,p],u);for(const[_,v]of u)(e||!(Fc(Ao(_))||Fc(Ao(v))))&&p.push([l(_),l(v)]);return d}case Lg:{const p=[],d=a([o,p],u);for(const _ of u)(e||!Fc(Ao(_)))&&p.push(l(_));return d}}const{message:f}=u;return a([o,{name:c,message:f}],u)};return l},g1=(e,{json:t,lossy:n}={})=>{const r=[];return Z4(!(t||n),!!t,new Map,r)(e),r},Eu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?p1(g1(e,t)):structuredClone(e):(e,t)=>p1(g1(e,t));function Q4(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function J4(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function eR(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Q4,r=e.options.footnoteBackLabel||J4,a=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let c=-1;for(;++c0&&w.push({type:"text",value:" "});let x=typeof n=="string"?n:n(c,v);typeof x=="string"&&(x={type:"text",value:x}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+_+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,v),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const b=p[p.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const x=b.children[b.children.length-1];x&&x.type==="text"?x.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...w)}else p.push(...w);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+_},children:e.wrap(p,!0)};e.patch(f,S),o.push(S)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...Eu(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:` +`});const f={type:"element",tagName:"li",properties:l,children:u};return e.patch(t,f),e.applyData(t,f)}function M4(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r1}function j4(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=Eg(t.children[1]),c=fx(t.children[t.children.length-1]);o&&c&&(u.position={start:o,end:c}),a.push(u)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,l),e.applyData(t,l)}function z4(e,t,n){const r=n?n.children:void 0,l=(r?r.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,o=u?u.length:t.children.length;let c=-1;const f=[];for(;++c0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return l.push(f1(t.slice(a),a>0,!1)),l.join("")}function f1(e,t,n){let r=0,a=e.length;if(t){let l=e.codePointAt(r);for(;l===u1||l===h1;)r++,l=e.codePointAt(r)}if(n){let l=e.codePointAt(a-1);for(;l===u1||l===h1;)a--,l=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function P4(e,t){const n={type:"text",value:F4(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function U4(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const $4={blockquote:v4,break:y4,code:b4,delete:S4,emphasis:x4,footnoteReference:w4,heading:C4,html:E4,imageReference:k4,image:A4,inlineCode:N4,linkReference:T4,link:R4,listItem:D4,list:j4,paragraph:L4,root:O4,strong:B4,table:I4,tableCell:H4,tableRow:z4,text:P4,thematicBreak:U4,toml:Hc,yaml:Hc,definition:Hc,footnoteDefinition:Hc};function Hc(){}const Lx=-1,Wu=0,Bo=1,Cu=2,Dg=3,Mg=4,jg=5,Lg=6,Ox=7,Bx=8,G4=typeof self=="object"?self:globalThis,d1=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new G4[e](t)},q4=(e,t)=>{const n=(a,l)=>(e.set(l,a),a),r=a=>{if(e.has(a))return e.get(a);const[l,u]=t[a];switch(l){case Wu:case Lx:return n(u,a);case Bo:{const o=n([],a);for(const c of u)o.push(r(c));return o}case Cu:{const o=n({},a);for(const[c,f]of u)o[r(c)]=r(f);return o}case Dg:return n(new Date(u),a);case Mg:{const{source:o,flags:c}=u;return n(new RegExp(o,c),a)}case jg:{const o=n(new Map,a);for(const[c,f]of u)o.set(r(c),r(f));return o}case Lg:{const o=n(new Set,a);for(const c of u)o.add(r(c));return o}case Ox:{const{name:o,message:c}=u;return n(d1(o,c),a)}case Bx:return n(BigInt(u),a);case"BigInt":return n(Object(BigInt(u)),a);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:o}=new Uint8Array(u);return n(new DataView(o),u)}}return n(d1(l,u),a)};return r},p1=e=>q4(new Map,e)(0),Xr="",{toString:V4}={},{keys:Y4}=Object,Ao=e=>{const t=typeof e;if(t!=="object"||!e)return[Wu,t];const n=V4.call(e).slice(8,-1);switch(n){case"Array":return[Bo,Xr];case"Object":return[Cu,Xr];case"Date":return[Dg,Xr];case"RegExp":return[Mg,Xr];case"Map":return[jg,Xr];case"Set":return[Lg,Xr];case"DataView":return[Bo,n]}return n.includes("Array")?[Bo,n]:n.includes("Error")?[Ox,n]:[Cu,n]},Fc=([e,t])=>e===Wu&&(t==="function"||t==="symbol"),W4=(e,t,n,r)=>{const a=(u,o)=>{const c=r.push(u)-1;return n.set(o,c),c},l=u=>{if(n.has(u))return n.get(u);let[o,c]=Ao(u);switch(o){case Wu:{let p=u;switch(c){case"bigint":o=Bx,p=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);p=null;break;case"undefined":return a([Lx],u)}return a([o,p],u)}case Bo:{if(c){let _=u;return c==="DataView"?_=new Uint8Array(u.buffer):c==="ArrayBuffer"&&(_=new Uint8Array(u)),a([c,[..._]],u)}const p=[],d=a([o,p],u);for(const _ of u)p.push(l(_));return d}case Cu:{if(c)switch(c){case"BigInt":return a([c,u.toString()],u);case"Boolean":case"Number":case"String":return a([c,u.valueOf()],u)}if(t&&"toJSON"in u)return l(u.toJSON());const p=[],d=a([o,p],u);for(const _ of Y4(u))(e||!Fc(Ao(u[_])))&&p.push([l(_),l(u[_])]);return d}case Dg:return a([o,isNaN(u.getTime())?Xr:u.toISOString()],u);case Mg:{const{source:p,flags:d}=u;return a([o,{source:p,flags:d}],u)}case jg:{const p=[],d=a([o,p],u);for(const[_,v]of u)(e||!(Fc(Ao(_))||Fc(Ao(v))))&&p.push([l(_),l(v)]);return d}case Lg:{const p=[],d=a([o,p],u);for(const _ of u)(e||!Fc(Ao(_)))&&p.push(l(_));return d}}const{message:f}=u;return a([o,{name:c,message:f}],u)};return l},g1=(e,{json:t,lossy:n}={})=>{const r=[];return W4(!(t||n),!!t,new Map,r)(e),r},Eu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?p1(g1(e,t)):structuredClone(e):(e,t)=>p1(g1(e,t));function X4(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function K4(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Z4(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||X4,r=e.options.footnoteBackLabel||K4,a=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let c=-1;for(;++c0&&w.push({type:"text",value:" "});let x=typeof n=="string"?n:n(c,v);typeof x=="string"&&(x={type:"text",value:x}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+_+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,v),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const b=p[p.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const x=b.children[b.children.length-1];x&&x.type==="text"?x.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...w)}else p.push(...w);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+_},children:e.wrap(p,!0)};e.patch(f,S),o.push(S)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...Eu(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:` -`}]}}const Xu=(function(e){if(e==null)return rR;if(typeof e=="function")return Ku(e);if(typeof e=="object")return Array.isArray(e)?tR(e):nR(e);if(typeof e=="string")return iR(e);throw new Error("Expected function, string, or object as test")});function tR(e){const t=[];let n=-1;for(;++n":""))+")"})}return _;function _(){let v=Fx,w,C,b;if((!t||l(c,f,p[p.length-1]||void 0))&&(v=lR(n(c,p)),v[0]===Ip))return v;if("children"in c&&c.children){const S=c;if(S.children&&v[0]!==oR)for(C=(r?S.children.length:-1)+u,b=p.concat(S);C>-1&&C":""))+")"})}return _;function _(){let v=Ix,w,C,b;if((!t||l(c,f,p[p.length-1]||void 0))&&(v=sR(n(c,p)),v[0]===Ip))return v;if("children"in c&&c.children){const S=c;if(S.children&&v[0]!==rR)for(C=(r?S.children.length:-1)+u,b=p.concat(S);C>-1&&C0&&n.push({type:"text",value:` -`}),n}function m1(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function _1(e,t){const n=uR(e,t),r=n.one(e,void 0),a=eR(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&l.children.push({type:"text",value:` -`},a),l}function gR(e,t){return e&&"run"in e?async function(n,r){const a=_1(n,{file:r,...t});await e.run(a,r)}:function(n,r){return _1(n,{file:r,...e||t})}}function v1(e){if(e)throw e}var Kd,y1;function mR(){if(y1)return Kd;y1=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},l=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),d=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!d)return!1;var _;for(_ in f);return typeof _>"u"||e.call(f,_)},u=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},o=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(r)return r(f,p).value}else return;return f[p]};return Kd=function c(){var f,p,d,_,v,w,C=arguments[0],b=1,S=arguments.length,x=!1;for(typeof C=="boolean"&&(x=C,C=arguments[1]||{},b=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});bu.length;let c;o&&u.push(a);try{c=e.apply(this,u)}catch(f){const p=f;if(o&&n)throw p;return a(p)}o||(c&&c.then&&typeof c.then=="function"?c.then(l,a):c instanceof Error?a(c):l(c))}function a(u,...o){n||(n=!0,t(u,...o))}function l(u){a(null,u)}}const li={basename:bR,dirname:SR,extname:xR,join:wR,sep:"/"};function bR(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');cl(e);let n=0,r=-1,a=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else r<0&&(l=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let u=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else u<0&&(l=!0,u=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=u));return n===r?r=u:r<0&&(r=e.length),e.slice(n,r)}function SR(e){if(cl(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function xR(e){cl(e);let t=e.length,n=-1,r=0,a=-1,l=0,u;for(;t--;){const o=e.codePointAt(t);if(o===47){if(u){r=t+1;break}continue}n<0&&(u=!0,n=t+1),o===46?a<0?a=t:l!==1&&(l=1):a>-1&&(l=-1)}return a<0||n<0||l===0||l===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function wR(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function ER(e,t){let n="",r=0,a=-1,l=0,u=-1,o,c;for(;++u<=e.length;){if(u2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),a=u,l=0;continue}}else if(n.length>0){n="",r=0,a=u,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,u):n=e.slice(a+1,u),r=u-a-1;a=u,l=0}else o===46&&l>-1?l++:l=-1}return n}function cl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const kR={cwd:AR};function AR(){return"/"}function Fp(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function NR(e){if(typeof e=="string")e=new URL(e);else if(!Fp(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return TR(e)}function TR(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[v,...w]=p;const C=r[_][1];Hp(C)&&Hp(v)&&(v=Zd(!0,C,v)),r[_]=[f,v,...w]}}}}const jR=new Bg().freeze();function tp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function np(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ip(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function S1(e){if(!Hp(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function x1(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Pc(e){return LR(e)?e:new Ux(e)}function LR(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function OR(e){return typeof e=="string"||BR(e)}function BR(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const IR="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",w1=[],C1={allowDangerousHtml:!0},zR=/^(https?|ircs?|mailto|xmpp)$/i,HR=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function $x(e){const t=FR(e),n=PR(e);return UR(t.runSync(t.parse(n),n),e)}function FR(e){const t=e.rehypePlugins||w1,n=e.remarkPlugins||w1,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...C1}:C1;return jR().use(S4).use(n).use(gR,r).use(t)}function PR(e){const t=e.children||"",n=new Ux;return typeof t=="string"&&(n.value=t),n}function UR(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,l=t.disallowedElements,u=t.skipHtml,o=t.unwrapDisallowed,c=t.urlTransform||$R;for(const p of HR)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+IR+p.id,void 0);return Og(e,f),r3(e,{Fragment:m.Fragment,components:a,ignoreInvalidStyle:!0,jsx:m.jsx,jsxs:m.jsxs,passKeys:!0,passNode:!0});function f(p,d,_){if(p.type==="raw"&&_&&typeof d=="number")return u?_.children.splice(d,1):_.children[d]={type:"text",value:p.value},d;if(p.type==="element"){let v;for(v in Yd)if(Object.hasOwn(Yd,v)&&Object.hasOwn(p.properties,v)){const w=p.properties[v],C=Yd[v];(C===null||C.includes(p.tagName))&&(p.properties[v]=c(String(w||""),v,p))}}if(p.type==="element"){let v=n?!n.includes(p.tagName):l?l.includes(p.tagName):!1;if(!v&&r&&typeof d=="number"&&(v=!r(p,d,_)),v&&_&&typeof d=="number")return o&&p.children?_.children.splice(d,1,...p.children):_.children.splice(d,1),d}}}function $R(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||zR.test(e.slice(0,t))?e:""}function E1(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function GR(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function qR(e,t,n){const a=Xu((n||{}).ignore||[]),l=VR(t);let u=-1;for(;++u0?{type:"text",value:N}:void 0),N===!1?_.lastIndex=E+1:(w!==E&&x.push({type:"text",value:f.value.slice(w,E)}),Array.isArray(N)?x.push(...N):N&&x.push(N),w=E+y[0].length,S=!0),!_.global)break;y=_.exec(f.value)}return S?(w?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=E1(e,"(");let l=E1(e,")");for(;r!==-1&&a>l;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),l++;return[e,n]}function Gx(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||is(n)||Vu(n))&&(!t||n!==47)}qx.peek=gD;function oD(){this.buffer()}function lD(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function cD(){this.buffer()}function uD(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function hD(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Jn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function fD(e){this.exit(e)}function dD(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Jn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function pD(e){this.exit(e)}function gD(){return"["}function qx(e,t,n,r){const a=n.createTracker(r);let l=a.move("[^");const u=n.enter("footnoteReference"),o=n.enter("reference");return l+=a.move(n.safe(n.associationId(e),{after:"]",before:l})),o(),u(),l+=a.move("]"),l}function mD(){return{enter:{gfmFootnoteCallString:oD,gfmFootnoteCall:lD,gfmFootnoteDefinitionLabelString:cD,gfmFootnoteDefinition:uD},exit:{gfmFootnoteCallString:hD,gfmFootnoteCall:fD,gfmFootnoteDefinitionLabelString:dD,gfmFootnoteDefinition:pD}}}function _D(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:qx},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,l,u){const o=l.createTracker(u);let c=o.move("[^");const f=l.enter("footnoteDefinition"),p=l.enter("label");return c+=o.move(l.safe(l.associationId(r),{before:c,after:"]"})),p(),c+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),c+=o.move((t?` -`:" ")+l.indentLines(l.containerFlow(r,o.current()),t?Vx:vD))),f(),c}}function vD(e,t,n){return t===0?e:Vx(e,t,n)}function Vx(e,t,n){return(n?"":" ")+e}const yD=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Yx.peek=CD;function bD(){return{canContainEols:["delete"],enter:{strikethrough:xD},exit:{strikethrough:wD}}}function SD(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:yD}],handlers:{delete:Yx}}}function xD(e){this.enter({type:"delete",children:[]},e)}function wD(e){this.exit(e)}function Yx(e,t,n,r){const a=n.createTracker(r),l=n.enter("strikethrough");let u=a.move("~~");return u+=n.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),l(),u}function CD(){return"~"}function ED(e){return e.length}function kD(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||ED,l=[],u=[],o=[],c=[];let f=0,p=-1;for(;++pf&&(f=e[p].length);++Sc[S])&&(c[S]=y)}C.push(x)}u[p]=C,o[p]=b}let d=-1;if(typeof r=="object"&&"length"in r)for(;++dc[d]&&(c[d]=x),v[d]=x),_[d]=y}u.splice(1,0,_),o.splice(1,0,v),p=-1;const w=[];for(;++p "),l.shift(2);const u=n.indentLines(n.containerFlow(e,l.current()),TD);return a(),u}function TD(e,t,n){return">"+(n?"":" ")+e}function RD(e,t){return A1(e,t.inConstruct,!0)&&!A1(e,t.notInConstruct,!1)}function A1(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ru&&(u=l):l=1,a=r+t.length,r=n.indexOf(t,a);return u}function MD(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function jD(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function LD(e,t,n,r){const a=jD(n),l=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(MD(e,n)){const d=n.enter("codeIndented"),_=n.indentLines(l,OD);return d(),_}const o=n.createTracker(r),c=a.repeat(Math.max(DD(l,a)+1,3)),f=n.enter("codeFenced");let p=o.move(c);if(e.lang){const d=n.enter(`codeFencedLang${u}`);p+=o.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...o.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${u}`);p+=o.move(" "),p+=o.move(n.safe(e.meta,{before:p,after:` +`}),n}function m1(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function _1(e,t){const n=oR(e,t),r=n.one(e,void 0),a=Z4(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&l.children.push({type:"text",value:` +`},a),l}function fR(e,t){return e&&"run"in e?async function(n,r){const a=_1(n,{file:r,...t});await e.run(a,r)}:function(n,r){return _1(n,{file:r,...e||t})}}function v1(e){if(e)throw e}var Kd,y1;function dR(){if(y1)return Kd;y1=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},l=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),d=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!d)return!1;var _;for(_ in f);return typeof _>"u"||e.call(f,_)},u=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},o=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(r)return r(f,p).value}else return;return f[p]};return Kd=function c(){var f,p,d,_,v,w,C=arguments[0],b=1,S=arguments.length,x=!1;for(typeof C=="boolean"&&(x=C,C=arguments[1]||{},b=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});bu.length;let c;o&&u.push(a);try{c=e.apply(this,u)}catch(f){const p=f;if(o&&n)throw p;return a(p)}o||(c&&c.then&&typeof c.then=="function"?c.then(l,a):c instanceof Error?a(c):l(c))}function a(u,...o){n||(n=!0,t(u,...o))}function l(u){a(null,u)}}const li={basename:_R,dirname:vR,extname:yR,join:bR,sep:"/"};function _R(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');cl(e);let n=0,r=-1,a=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else r<0&&(l=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let u=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else u<0&&(l=!0,u=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=u));return n===r?r=u:r<0&&(r=e.length),e.slice(n,r)}function vR(e){if(cl(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function yR(e){cl(e);let t=e.length,n=-1,r=0,a=-1,l=0,u;for(;t--;){const o=e.codePointAt(t);if(o===47){if(u){r=t+1;break}continue}n<0&&(u=!0,n=t+1),o===46?a<0?a=t:l!==1&&(l=1):a>-1&&(l=-1)}return a<0||n<0||l===0||l===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function bR(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function xR(e,t){let n="",r=0,a=-1,l=0,u=-1,o,c;for(;++u<=e.length;){if(u2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),a=u,l=0;continue}}else if(n.length>0){n="",r=0,a=u,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,u):n=e.slice(a+1,u),r=u-a-1;a=u,l=0}else o===46&&l>-1?l++:l=-1}return n}function cl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const wR={cwd:CR};function CR(){return"/"}function Fp(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ER(e){if(typeof e=="string")e=new URL(e);else if(!Fp(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return kR(e)}function kR(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[v,...w]=p;const C=r[_][1];Hp(C)&&Hp(v)&&(v=Zd(!0,C,v)),r[_]=[f,v,...w]}}}}const RR=new Bg().freeze();function tp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function np(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ip(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function S1(e){if(!Hp(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function x1(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Pc(e){return DR(e)?e:new Hx(e)}function DR(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function MR(e){return typeof e=="string"||jR(e)}function jR(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const LR="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",w1=[],C1={allowDangerousHtml:!0},OR=/^(https?|ircs?|mailto|xmpp)$/i,BR=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Fx(e){const t=IR(e),n=zR(e);return HR(t.runSync(t.parse(n),n),e)}function IR(e){const t=e.rehypePlugins||w1,n=e.remarkPlugins||w1,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...C1}:C1;return RR().use(_4).use(n).use(fR,r).use(t)}function zR(e){const t=e.children||"",n=new Hx;return typeof t=="string"&&(n.value=t),n}function HR(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,l=t.disallowedElements,u=t.skipHtml,o=t.unwrapDisallowed,c=t.urlTransform||FR;for(const p of BR)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+LR+p.id,void 0);return Og(e,f),e3(e,{Fragment:m.Fragment,components:a,ignoreInvalidStyle:!0,jsx:m.jsx,jsxs:m.jsxs,passKeys:!0,passNode:!0});function f(p,d,_){if(p.type==="raw"&&_&&typeof d=="number")return u?_.children.splice(d,1):_.children[d]={type:"text",value:p.value},d;if(p.type==="element"){let v;for(v in Yd)if(Object.hasOwn(Yd,v)&&Object.hasOwn(p.properties,v)){const w=p.properties[v],C=Yd[v];(C===null||C.includes(p.tagName))&&(p.properties[v]=c(String(w||""),v,p))}}if(p.type==="element"){let v=n?!n.includes(p.tagName):l?l.includes(p.tagName):!1;if(!v&&r&&typeof d=="number"&&(v=!r(p,d,_)),v&&_&&typeof d=="number")return o&&p.children?_.children.splice(d,1,...p.children):_.children.splice(d,1),d}}}function FR(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||OR.test(e.slice(0,t))?e:""}function E1(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function PR(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function UR(e,t,n){const a=Xu((n||{}).ignore||[]),l=$R(t);let u=-1;for(;++u0?{type:"text",value:N}:void 0),N===!1?_.lastIndex=E+1:(w!==E&&x.push({type:"text",value:f.value.slice(w,E)}),Array.isArray(N)?x.push(...N):N&&x.push(N),w=E+y[0].length,S=!0),!_.global)break;y=_.exec(f.value)}return S?(w?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=E1(e,"(");let l=E1(e,")");for(;r!==-1&&a>l;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),l++;return[e,n]}function Px(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||is(n)||Vu(n))&&(!t||n!==47)}Ux.peek=fD;function rD(){this.buffer()}function sD(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function aD(){this.buffer()}function oD(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function lD(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Jn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function cD(e){this.exit(e)}function uD(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Jn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function hD(e){this.exit(e)}function fD(){return"["}function Ux(e,t,n,r){const a=n.createTracker(r);let l=a.move("[^");const u=n.enter("footnoteReference"),o=n.enter("reference");return l+=a.move(n.safe(n.associationId(e),{after:"]",before:l})),o(),u(),l+=a.move("]"),l}function dD(){return{enter:{gfmFootnoteCallString:rD,gfmFootnoteCall:sD,gfmFootnoteDefinitionLabelString:aD,gfmFootnoteDefinition:oD},exit:{gfmFootnoteCallString:lD,gfmFootnoteCall:cD,gfmFootnoteDefinitionLabelString:uD,gfmFootnoteDefinition:hD}}}function pD(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Ux},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,l,u){const o=l.createTracker(u);let c=o.move("[^");const f=l.enter("footnoteDefinition"),p=l.enter("label");return c+=o.move(l.safe(l.associationId(r),{before:c,after:"]"})),p(),c+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),c+=o.move((t?` +`:" ")+l.indentLines(l.containerFlow(r,o.current()),t?$x:gD))),f(),c}}function gD(e,t,n){return t===0?e:$x(e,t,n)}function $x(e,t,n){return(n?"":" ")+e}const mD=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Gx.peek=SD;function _D(){return{canContainEols:["delete"],enter:{strikethrough:yD},exit:{strikethrough:bD}}}function vD(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:mD}],handlers:{delete:Gx}}}function yD(e){this.enter({type:"delete",children:[]},e)}function bD(e){this.exit(e)}function Gx(e,t,n,r){const a=n.createTracker(r),l=n.enter("strikethrough");let u=a.move("~~");return u+=n.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),l(),u}function SD(){return"~"}function xD(e){return e.length}function wD(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||xD,l=[],u=[],o=[],c=[];let f=0,p=-1;for(;++pf&&(f=e[p].length);++Sc[S])&&(c[S]=y)}C.push(x)}u[p]=C,o[p]=b}let d=-1;if(typeof r=="object"&&"length"in r)for(;++dc[d]&&(c[d]=x),v[d]=x),_[d]=y}u.splice(1,0,_),o.splice(1,0,v),p=-1;const w=[];for(;++p "),l.shift(2);const u=n.indentLines(n.containerFlow(e,l.current()),kD);return a(),u}function kD(e,t,n){return">"+(n?"":" ")+e}function AD(e,t){return A1(e,t.inConstruct,!0)&&!A1(e,t.notInConstruct,!1)}function A1(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ru&&(u=l):l=1,a=r+t.length,r=n.indexOf(t,a);return u}function TD(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function RD(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function DD(e,t,n,r){const a=RD(n),l=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(TD(e,n)){const d=n.enter("codeIndented"),_=n.indentLines(l,MD);return d(),_}const o=n.createTracker(r),c=a.repeat(Math.max(ND(l,a)+1,3)),f=n.enter("codeFenced");let p=o.move(c);if(e.lang){const d=n.enter(`codeFencedLang${u}`);p+=o.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...o.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${u}`);p+=o.move(" "),p+=o.move(n.safe(e.meta,{before:p,after:` `,encode:["`"],...o.current()})),d()}return p+=o.move(` `),l&&(p+=o.move(l+` -`)),p+=o.move(c),f(),p}function OD(e,t,n){return(n?"":" ")+e}function Ig(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function BD(e,t,n,r){const a=Ig(n),l=a==='"'?"Quote":"Apostrophe",u=n.enter("definition");let o=n.enter("label");const c=n.createTracker(r);let f=c.move("[");return f+=c.move(n.safe(n.associationId(e),{before:f,after:"]",...c.current()})),f+=c.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(n.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(o=n.enter("destinationRaw"),f+=c.move(n.safe(e.url,{before:f,after:e.title?" ":` -`,...c.current()}))),o(),e.title&&(o=n.enter(`title${l}`),f+=c.move(" "+a),f+=c.move(n.safe(e.title,{before:f,after:a,...c.current()})),f+=c.move(a),o()),u(),f}function ID(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Go(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ku(e,t,n){const r=fa(e),a=fa(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Wx.peek=zD;function Wx(e,t,n,r){const a=ID(n),l=n.enter("emphasis"),u=n.createTracker(r),o=u.move(a);let c=u.move(n.containerPhrasing(e,{after:a,before:o,...u.current()}));const f=c.charCodeAt(0),p=ku(r.before.charCodeAt(r.before.length-1),f,a);p.inside&&(c=Go(f)+c.slice(1));const d=c.charCodeAt(c.length-1),_=ku(r.after.charCodeAt(0),d,a);_.inside&&(c=c.slice(0,-1)+Go(d));const v=u.move(a);return l(),n.attentionEncodeSurroundingInfo={after:_.outside,before:p.outside},o+c+v}function zD(e,t,n){return n.options.emphasis||"*"}function HD(e,t){let n=!1;return Og(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Ip}),!!((!e.depth||e.depth<3)&&Tg(e)&&(t.options.setext||n))}function FD(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(r);if(HD(e,n)){const p=n.enter("headingSetext"),d=n.enter("phrasing"),_=n.containerPhrasing(e,{...l.current(),before:` +`)),p+=o.move(c),f(),p}function MD(e,t,n){return(n?"":" ")+e}function Ig(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function jD(e,t,n,r){const a=Ig(n),l=a==='"'?"Quote":"Apostrophe",u=n.enter("definition");let o=n.enter("label");const c=n.createTracker(r);let f=c.move("[");return f+=c.move(n.safe(n.associationId(e),{before:f,after:"]",...c.current()})),f+=c.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(n.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(o=n.enter("destinationRaw"),f+=c.move(n.safe(e.url,{before:f,after:e.title?" ":` +`,...c.current()}))),o(),e.title&&(o=n.enter(`title${l}`),f+=c.move(" "+a),f+=c.move(n.safe(e.title,{before:f,after:a,...c.current()})),f+=c.move(a),o()),u(),f}function LD(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Go(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ku(e,t,n){const r=fa(e),a=fa(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}qx.peek=OD;function qx(e,t,n,r){const a=LD(n),l=n.enter("emphasis"),u=n.createTracker(r),o=u.move(a);let c=u.move(n.containerPhrasing(e,{after:a,before:o,...u.current()}));const f=c.charCodeAt(0),p=ku(r.before.charCodeAt(r.before.length-1),f,a);p.inside&&(c=Go(f)+c.slice(1));const d=c.charCodeAt(c.length-1),_=ku(r.after.charCodeAt(0),d,a);_.inside&&(c=c.slice(0,-1)+Go(d));const v=u.move(a);return l(),n.attentionEncodeSurroundingInfo={after:_.outside,before:p.outside},o+c+v}function OD(e,t,n){return n.options.emphasis||"*"}function BD(e,t){let n=!1;return Og(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Ip}),!!((!e.depth||e.depth<3)&&Tg(e)&&(t.options.setext||n))}function ID(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(r);if(BD(e,n)){const p=n.enter("headingSetext"),d=n.enter("phrasing"),_=n.containerPhrasing(e,{...l.current(),before:` `,after:` `});return d(),p(),_+` `+(a===1?"=":"-").repeat(_.length-(Math.max(_.lastIndexOf("\r"),_.lastIndexOf(` `))+1))}const u="#".repeat(a),o=n.enter("headingAtx"),c=n.enter("phrasing");l.move(u+" ");let f=n.containerPhrasing(e,{before:"# ",after:` -`,...l.current()});return/^[\t ]/.test(f)&&(f=Go(f.charCodeAt(0))+f.slice(1)),f=f?u+" "+f:u,n.options.closeAtx&&(f+=" "+u),c(),o(),f}Xx.peek=PD;function Xx(e){return e.value||""}function PD(){return"<"}Kx.peek=UD;function Kx(e,t,n,r){const a=Ig(n),l=a==='"'?"Quote":"Apostrophe",u=n.enter("image");let o=n.enter("label");const c=n.createTracker(r);let f=c.move("![");return f+=c.move(n.safe(e.alt,{before:f,after:"]",...c.current()})),f+=c.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(n.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(o=n.enter("destinationRaw"),f+=c.move(n.safe(e.url,{before:f,after:e.title?" ":")",...c.current()}))),o(),e.title&&(o=n.enter(`title${l}`),f+=c.move(" "+a),f+=c.move(n.safe(e.title,{before:f,after:a,...c.current()})),f+=c.move(a),o()),f+=c.move(")"),u(),f}function UD(){return"!"}Zx.peek=$D;function Zx(e,t,n,r){const a=e.referenceType,l=n.enter("imageReference");let u=n.enter("label");const o=n.createTracker(r);let c=o.move("![");const f=n.safe(e.alt,{before:c,after:"]",...o.current()});c+=o.move(f+"]["),u();const p=n.stack;n.stack=[],u=n.enter("reference");const d=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return u(),n.stack=p,l(),a==="full"||!f||f!==d?c+=o.move(d+"]"):a==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function $D(){return"!"}Qx.peek=GD;function Qx(e,t,n){let r=e.value||"",a="`",l=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++l\u007F]/.test(e.url))}ew.peek=qD;function ew(e,t,n,r){const a=Ig(n),l=a==='"'?"Quote":"Apostrophe",u=n.createTracker(r);let o,c;if(Jx(e,n)){const p=n.stack;n.stack=[],o=n.enter("autolink");let d=u.move("<");return d+=u.move(n.containerPhrasing(e,{before:d,after:">",...u.current()})),d+=u.move(">"),o(),n.stack=p,d}o=n.enter("link"),c=n.enter("label");let f=u.move("[");return f+=u.move(n.containerPhrasing(e,{before:f,after:"](",...u.current()})),f+=u.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),f+=u.move("<"),f+=u.move(n.safe(e.url,{before:f,after:">",...u.current()})),f+=u.move(">")):(c=n.enter("destinationRaw"),f+=u.move(n.safe(e.url,{before:f,after:e.title?" ":")",...u.current()}))),c(),e.title&&(c=n.enter(`title${l}`),f+=u.move(" "+a),f+=u.move(n.safe(e.title,{before:f,after:a,...u.current()})),f+=u.move(a),c()),f+=u.move(")"),o(),f}function qD(e,t,n){return Jx(e,n)?"<":"["}tw.peek=VD;function tw(e,t,n,r){const a=e.referenceType,l=n.enter("linkReference");let u=n.enter("label");const o=n.createTracker(r);let c=o.move("[");const f=n.containerPhrasing(e,{before:c,after:"]",...o.current()});c+=o.move(f+"]["),u();const p=n.stack;n.stack=[],u=n.enter("reference");const d=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return u(),n.stack=p,l(),a==="full"||!f||f!==d?c+=o.move(d+"]"):a==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function VD(){return"["}function zg(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function YD(e){const t=zg(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function WD(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function nw(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function XD(e,t,n,r){const a=n.enter("list"),l=n.bulletCurrent;let u=e.ordered?WD(n):zg(n);const o=e.ordered?u==="."?")":".":YD(n);let c=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),nw(n)===u&&p){let d=-1;for(;++d-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let u=l.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const o=n.createTracker(r);o.move(l+" ".repeat(u-l.length)),o.shift(u);const c=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,o.current()),p);return c(),f;function p(d,_,v){return _?(v?"":" ".repeat(u))+d:(v?l:l+" ".repeat(u-l.length))+d}}function QD(e,t,n,r){const a=n.enter("paragraph"),l=n.enter("phrasing"),u=n.containerPhrasing(e,r);return l(),a(),u}const JD=Xu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function eM(e,t,n,r){return(e.children.some(function(u){return JD(u)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function tM(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}iw.peek=nM;function iw(e,t,n,r){const a=tM(n),l=n.enter("strong"),u=n.createTracker(r),o=u.move(a+a);let c=u.move(n.containerPhrasing(e,{after:a,before:o,...u.current()}));const f=c.charCodeAt(0),p=ku(r.before.charCodeAt(r.before.length-1),f,a);p.inside&&(c=Go(f)+c.slice(1));const d=c.charCodeAt(c.length-1),_=ku(r.after.charCodeAt(0),d,a);_.inside&&(c=c.slice(0,-1)+Go(d));const v=u.move(a+a);return l(),n.attentionEncodeSurroundingInfo={after:_.outside,before:p.outside},o+c+v}function nM(e,t,n){return n.options.strong||"*"}function iM(e,t,n,r){return n.safe(e.value,r)}function rM(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function sM(e,t,n){const r=(nw(n)+(n.options.ruleSpaces?" ":"")).repeat(rM(n));return n.options.ruleSpaces?r.slice(0,-1):r}const rw={blockquote:ND,break:N1,code:LD,definition:BD,emphasis:Wx,hardBreak:N1,heading:FD,html:Xx,image:Kx,imageReference:Zx,inlineCode:Qx,link:ew,linkReference:tw,list:XD,listItem:ZD,paragraph:QD,root:eM,strong:iw,text:iM,thematicBreak:sM};function aM(){return{enter:{table:oM,tableData:T1,tableHeader:T1,tableRow:cM},exit:{codeText:uM,table:lM,tableData:op,tableHeader:op,tableRow:op}}}function oM(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function lM(e){this.exit(e),this.data.inTable=void 0}function cM(e){this.enter({type:"tableRow",children:[]},e)}function op(e){this.exit(e)}function T1(e){this.enter({type:"tableCell",children:[]},e)}function uM(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,hM));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function hM(e,t){return t==="|"?t:e}function fM(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,...l.current()});return/^[\t ]/.test(f)&&(f=Go(f.charCodeAt(0))+f.slice(1)),f=f?u+" "+f:u,n.options.closeAtx&&(f+=" "+u),c(),o(),f}Vx.peek=zD;function Vx(e){return e.value||""}function zD(){return"<"}Yx.peek=HD;function Yx(e,t,n,r){const a=Ig(n),l=a==='"'?"Quote":"Apostrophe",u=n.enter("image");let o=n.enter("label");const c=n.createTracker(r);let f=c.move("![");return f+=c.move(n.safe(e.alt,{before:f,after:"]",...c.current()})),f+=c.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(n.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(o=n.enter("destinationRaw"),f+=c.move(n.safe(e.url,{before:f,after:e.title?" ":")",...c.current()}))),o(),e.title&&(o=n.enter(`title${l}`),f+=c.move(" "+a),f+=c.move(n.safe(e.title,{before:f,after:a,...c.current()})),f+=c.move(a),o()),f+=c.move(")"),u(),f}function HD(){return"!"}Wx.peek=FD;function Wx(e,t,n,r){const a=e.referenceType,l=n.enter("imageReference");let u=n.enter("label");const o=n.createTracker(r);let c=o.move("![");const f=n.safe(e.alt,{before:c,after:"]",...o.current()});c+=o.move(f+"]["),u();const p=n.stack;n.stack=[],u=n.enter("reference");const d=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return u(),n.stack=p,l(),a==="full"||!f||f!==d?c+=o.move(d+"]"):a==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function FD(){return"!"}Xx.peek=PD;function Xx(e,t,n){let r=e.value||"",a="`",l=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++l\u007F]/.test(e.url))}Zx.peek=UD;function Zx(e,t,n,r){const a=Ig(n),l=a==='"'?"Quote":"Apostrophe",u=n.createTracker(r);let o,c;if(Kx(e,n)){const p=n.stack;n.stack=[],o=n.enter("autolink");let d=u.move("<");return d+=u.move(n.containerPhrasing(e,{before:d,after:">",...u.current()})),d+=u.move(">"),o(),n.stack=p,d}o=n.enter("link"),c=n.enter("label");let f=u.move("[");return f+=u.move(n.containerPhrasing(e,{before:f,after:"](",...u.current()})),f+=u.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),f+=u.move("<"),f+=u.move(n.safe(e.url,{before:f,after:">",...u.current()})),f+=u.move(">")):(c=n.enter("destinationRaw"),f+=u.move(n.safe(e.url,{before:f,after:e.title?" ":")",...u.current()}))),c(),e.title&&(c=n.enter(`title${l}`),f+=u.move(" "+a),f+=u.move(n.safe(e.title,{before:f,after:a,...u.current()})),f+=u.move(a),c()),f+=u.move(")"),o(),f}function UD(e,t,n){return Kx(e,n)?"<":"["}Qx.peek=$D;function Qx(e,t,n,r){const a=e.referenceType,l=n.enter("linkReference");let u=n.enter("label");const o=n.createTracker(r);let c=o.move("[");const f=n.containerPhrasing(e,{before:c,after:"]",...o.current()});c+=o.move(f+"]["),u();const p=n.stack;n.stack=[],u=n.enter("reference");const d=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return u(),n.stack=p,l(),a==="full"||!f||f!==d?c+=o.move(d+"]"):a==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function $D(){return"["}function zg(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function GD(e){const t=zg(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function qD(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Jx(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function VD(e,t,n,r){const a=n.enter("list"),l=n.bulletCurrent;let u=e.ordered?qD(n):zg(n);const o=e.ordered?u==="."?")":".":GD(n);let c=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),Jx(n)===u&&p){let d=-1;for(;++d-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let u=l.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const o=n.createTracker(r);o.move(l+" ".repeat(u-l.length)),o.shift(u);const c=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,o.current()),p);return c(),f;function p(d,_,v){return _?(v?"":" ".repeat(u))+d:(v?l:l+" ".repeat(u-l.length))+d}}function XD(e,t,n,r){const a=n.enter("paragraph"),l=n.enter("phrasing"),u=n.containerPhrasing(e,r);return l(),a(),u}const KD=Xu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function ZD(e,t,n,r){return(e.children.some(function(u){return KD(u)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function QD(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}ew.peek=JD;function ew(e,t,n,r){const a=QD(n),l=n.enter("strong"),u=n.createTracker(r),o=u.move(a+a);let c=u.move(n.containerPhrasing(e,{after:a,before:o,...u.current()}));const f=c.charCodeAt(0),p=ku(r.before.charCodeAt(r.before.length-1),f,a);p.inside&&(c=Go(f)+c.slice(1));const d=c.charCodeAt(c.length-1),_=ku(r.after.charCodeAt(0),d,a);_.inside&&(c=c.slice(0,-1)+Go(d));const v=u.move(a+a);return l(),n.attentionEncodeSurroundingInfo={after:_.outside,before:p.outside},o+c+v}function JD(e,t,n){return n.options.strong||"*"}function eM(e,t,n,r){return n.safe(e.value,r)}function tM(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function nM(e,t,n){const r=(Jx(n)+(n.options.ruleSpaces?" ":"")).repeat(tM(n));return n.options.ruleSpaces?r.slice(0,-1):r}const tw={blockquote:ED,break:N1,code:DD,definition:jD,emphasis:qx,hardBreak:N1,heading:ID,html:Vx,image:Yx,imageReference:Wx,inlineCode:Xx,link:Zx,linkReference:Qx,list:VD,listItem:WD,paragraph:XD,root:ZD,strong:ew,text:eM,thematicBreak:nM};function iM(){return{enter:{table:rM,tableData:T1,tableHeader:T1,tableRow:aM},exit:{codeText:oM,table:sM,tableData:op,tableHeader:op,tableRow:op}}}function rM(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function sM(e){this.exit(e),this.data.inTable=void 0}function aM(e){this.enter({type:"tableRow",children:[]},e)}function op(e){this.exit(e)}function T1(e){this.enter({type:"tableCell",children:[]},e)}function oM(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,lM));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function lM(e,t){return t==="|"?t:e}function cM(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:_,table:u,tableCell:c,tableRow:o}};function u(v,w,C,b){return f(p(v,C,b),v.align)}function o(v,w,C,b){const S=d(v,C,b),x=f([S]);return x.slice(0,x.indexOf(` -`))}function c(v,w,C,b){const S=C.enter("tableCell"),x=C.enter("phrasing"),y=C.containerPhrasing(v,{...b,before:l,after:l});return x(),S(),y}function f(v,w){return kD(v,{align:w,alignDelimiters:r,padding:n,stringLength:a})}function p(v,w,C){const b=v.children;let S=-1;const x=[],y=w.enter("table");for(;++S0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const RM={tokenize:zM,partial:!0};function DM(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:OM,continuation:{tokenize:BM},exit:IM}},text:{91:{name:"gfmFootnoteCall",tokenize:LM},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:MM,resolveTo:jM}}}}function MM(e,t,n){const r=this;let a=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u;for(;a--;){const c=r.events[a][1];if(c.type==="labelImage"){u=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return o;function o(c){if(!u||!u._balanced)return n(c);const f=Jn(r.sliceSerialize({start:u.end,end:r.now()}));return f.codePointAt(0)!==94||!l.includes(f.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function jM(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function LM(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,u;return o;function o(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),c}function c(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(d){if(l>999||d===93&&!u||d===null||d===91||yt(d))return n(d);if(d===93){e.exit("chunkString");const _=e.exit("gfmFootnoteCallString");return a.includes(Jn(r.sliceSerialize(_)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return yt(d)||(u=!0),l++,e.consume(d),d===92?p:f}function p(d){return d===91||d===92||d===93?(e.consume(d),l++,f):f(d)}}function OM(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,u=0,o;return c;function c(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(w)}function p(w){if(u>999||w===93&&!o||w===null||w===91||yt(w))return n(w);if(w===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return l=Jn(r.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),_}return yt(w)||(o=!0),u++,e.consume(w),w===92?d:p}function d(w){return w===91||w===92||w===93?(e.consume(w),u++,p):p(w)}function _(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),a.includes(l)||a.push(l),et(e,v,"gfmFootnoteDefinitionWhitespace")):n(w)}function v(w){return t(w)}}function BM(e,t,n){return e.check(ll,t,e.attempt(RM,t,n))}function IM(e){e.exit("gfmFootnoteDefinition")}function zM(e,t,n){const r=this;return et(e,a,"gfmFootnoteDefinitionIndent",5);function a(l){const u=r.events[r.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(l):n(l)}}function HM(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(u,o){let c=-1;for(;++c1?c(w):(u.consume(w),d++,v);if(d<2&&!n)return c(w);const b=u.exit("strikethroughSequenceTemporary"),S=fa(w);return b._open=!S||S===2&&!!C,b._close=!C||C===2&&!!S,o(w)}}}class FM{constructor(){this.map=[]}add(t,n,r){PM(this,t,n,r)}consume(t){if(this.map.sort(function(l,u){return l[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const l of a)t.push(l);a=r.pop()}this.map.length=0}}function PM(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a-1;){const z=r.events[F][1].type;if(z==="lineEnding"||z==="linePrefix")F--;else break}const Y=F>-1?r.events[F][1].type:null,H=Y==="tableHead"||Y==="tableRow"?N:c;return H===N&&r.parser.lazy[r.now().line]?n(B):H(B)}function c(B){return e.enter("tableHead"),e.enter("tableRow"),f(B)}function f(B){return B===124||(u=!0,l+=1),p(B)}function p(B){return B===null?n(B):Oe(B)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),v):n(B):Xe(B)?et(e,p,"whitespace")(B):(l+=1,u&&(u=!1,a+=1),B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),u=!0,p):(e.enter("data"),d(B)))}function d(B){return B===null||B===124||yt(B)?(e.exit("data"),p(B)):(e.consume(B),B===92?_:d)}function _(B){return B===92||B===124?(e.consume(B),d):d(B)}function v(B){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(B):(e.enter("tableDelimiterRow"),u=!1,Xe(B)?et(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):w(B))}function w(B){return B===45||B===58?b(B):B===124?(u=!0,e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),C):R(B)}function C(B){return Xe(B)?et(e,b,"whitespace")(B):b(B)}function b(B){return B===58?(l+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),S):B===45?(l+=1,S(B)):B===null||Oe(B)?E(B):R(B)}function S(B){return B===45?(e.enter("tableDelimiterFiller"),x(B)):R(B)}function x(B){return B===45?(e.consume(B),x):B===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(B))}function y(B){return Xe(B)?et(e,E,"whitespace")(B):E(B)}function E(B){return B===124?w(B):B===null||Oe(B)?!u||a!==l?R(B):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(B)):R(B)}function R(B){return n(B)}function N(B){return e.enter("tableRow"),D(B)}function D(B){return B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),D):B===null||Oe(B)?(e.exit("tableRow"),t(B)):Xe(B)?et(e,D,"whitespace")(B):(e.enter("data"),T(B))}function T(B){return B===null||B===124||yt(B)?(e.exit("data"),D(B)):(e.consume(B),B===92?j:T)}function j(B){return B===92||B===124?(e.consume(B),T):T(B)}}function qM(e,t){let n=-1,r=!0,a=0,l=[0,0,0,0],u=[0,0,0,0],o=!1,c=0,f,p,d;const _=new FM;for(;++nn[2]+1){const w=n[2]+1,C=n[3]-n[2]-1;e.add(w,C,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return a!==void 0&&(l.end=Object.assign({},na(t.events,a)),e.add(a,0,[["exit",l,t]]),l=void 0),l}function D1(e,t,n,r,a){const l=[],u=na(t.events,n);a&&(a.end=Object.assign({},u),l.push(["exit",a,t])),r.end=Object.assign({},u),l.push(["exit",r,t]),e.add(n+1,0,l)}function na(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const VM={name:"tasklistCheck",tokenize:WM};function YM(){return{text:{91:VM}}}function WM(e,t,n){const r=this;return a;function a(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),l)}function l(c){return yt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),u):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),u):n(c)}function u(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(c)}function o(c){return Oe(c)?t(c):Xe(c)?e.check({tokenize:XM},t,n)(c):n(c)}}function XM(e,t,n){return et(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function KM(e){return Sx([SM(),DM(),HM(e),$M(),YM()])}const ZM={};function dw(e){const t=this,n=e||ZM,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),u=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(KM(n)),l.push(_M()),u.push(vM(n))}const QM={cjs:"javascript",console:"bash",cts:"typescript",fish:"bash",html:"markup",js:"javascript",jsx:"javascript",md:"markdown",mjs:"javascript",mts:"typescript",py:"python",rb:"ruby",sh:"bash",shell:"bash",svg:"markup",terminal:"bash",ts:"typescript",tsx:"typescript",xml:"markup",yml:"yaml",zsh:"bash"},JM={containerfile:"docker",dockerfile:"docker",justfile:"makefile",makefile:"makefile"};function Up(e){const t=e.trim().toLowerCase();return QM[t]??t}function pw(e){var a;if(!e)return null;const t=((a=e.split("/").pop())==null?void 0:a.toLowerCase())??"",n=JM[t];if(n)return Up(n);const r=t.lastIndexOf(".");return r===-1||r===t.length-1?null:Up(t.slice(r+1))}di.displayName="clike";di.aliases=[];function di(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}ul.displayName="c";ul.aliases=[];function ul(e){e.register(di),e.languages.c=e.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),e.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),e.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},e.languages.c.string],char:e.languages.c.char,comment:e.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:e.languages.c}}}}),e.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete e.languages.c.boolean}Zu.displayName="cpp";Zu.aliases=[];function Zu(e){e.register(ul),(function(t){var n=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,r=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,function(){return n.source});t.languages.cpp=t.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,function(){return n.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:n,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),t.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,function(){return r})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),t.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t.languages.cpp}}}}),t.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),t.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:t.languages.extend("cpp",{})}}),t.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},t.languages.cpp["base-clause"])})(e)}Fg.displayName="arduino";Fg.aliases=["ino"];function Fg(e){e.register(Zu),e.languages.arduino=e.languages.extend("cpp",{keyword:/\b(?:String|array|bool|boolean|break|byte|case|catch|continue|default|do|double|else|finally|for|function|goto|if|in|instanceof|int|integer|long|loop|new|null|return|setup|string|switch|throw|try|void|while|word)\b/,constant:/\b(?:ANALOG_MESSAGE|DEFAULT|DIGITAL_MESSAGE|EXTERNAL|FIRMATA_STRING|HIGH|INPUT|INPUT_PULLUP|INTERNAL|INTERNAL1V1|INTERNAL2V56|LED_BUILTIN|LOW|OUTPUT|REPORT_ANALOG|REPORT_DIGITAL|SET_PIN_MODE|SYSEX_START|SYSTEM_RESET)\b/,builtin:/\b(?:Audio|BSSID|Bridge|Client|Console|EEPROM|Esplora|EsploraTFT|Ethernet|EthernetClient|EthernetServer|EthernetUDP|File|FileIO|FileSystem|Firmata|GPRS|GSM|GSMBand|GSMClient|GSMModem|GSMPIN|GSMScanner|GSMServer|GSMVoiceCall|GSM_SMS|HttpClient|IPAddress|IRread|Keyboard|KeyboardController|LiquidCrystal|LiquidCrystal_I2C|Mailbox|Mouse|MouseController|PImage|Process|RSSI|RobotControl|RobotMotor|SD|SPI|SSID|Scheduler|Serial|Server|Servo|SoftwareSerial|Stepper|Stream|TFT|Task|USBHost|WiFi|WiFiClient|WiFiServer|WiFiUDP|Wire|YunClient|YunServer|abs|addParameter|analogRead|analogReadResolution|analogReference|analogWrite|analogWriteResolution|answerCall|attach|attachGPRS|attachInterrupt|attached|autoscroll|available|background|beep|begin|beginPacket|beginSD|beginSMS|beginSpeaker|beginTFT|beginTransmission|beginWrite|bit|bitClear|bitRead|bitSet|bitWrite|blink|blinkVersion|buffer|changePIN|checkPIN|checkPUK|checkReg|circle|cityNameRead|cityNameWrite|clear|clearScreen|click|close|compassRead|config|connect|connected|constrain|cos|countryNameRead|countryNameWrite|createChar|cursor|debugPrint|delay|delayMicroseconds|detach|detachInterrupt|digitalRead|digitalWrite|disconnect|display|displayLogos|drawBMP|drawCompass|encryptionType|end|endPacket|endSMS|endTransmission|endWrite|exists|exitValue|fill|find|findUntil|flush|gatewayIP|get|getAsynchronously|getBand|getButton|getCurrentCarrier|getIMEI|getKey|getModifiers|getOemKey|getPINUsed|getResult|getSignalStrength|getSocket|getVoiceCallStatus|getXChange|getYChange|hangCall|height|highByte|home|image|interrupts|isActionDone|isDirectory|isListening|isPIN|isPressed|isValid|keyPressed|keyReleased|keyboardRead|knobRead|leftToRight|line|lineFollowConfig|listen|listenOnLocalhost|loadImage|localIP|lowByte|macAddress|maintain|map|max|messageAvailable|micros|millis|min|mkdir|motorsStop|motorsWrite|mouseDragged|mouseMoved|mousePressed|mouseReleased|move|noAutoscroll|noBlink|noBuffer|noCursor|noDisplay|noFill|noInterrupts|noListenOnLocalhost|noStroke|noTone|onReceive|onRequest|open|openNextFile|overflow|parseCommand|parseFloat|parseInt|parsePacket|pauseMode|peek|pinMode|playFile|playMelody|point|pointTo|position|pow|prepare|press|print|printFirmwareVersion|printVersion|println|process|processInput|pulseIn|put|random|randomSeed|read|readAccelerometer|readBlue|readButton|readBytes|readBytesUntil|readGreen|readJoystickButton|readJoystickSwitch|readJoystickX|readJoystickY|readLightSensor|readMessage|readMicrophone|readNetworks|readRed|readSlider|readString|readStringUntil|readTemperature|ready|rect|release|releaseAll|remoteIP|remoteNumber|remotePort|remove|requestFrom|retrieveCallingNumber|rewindDirectory|rightToLeft|rmdir|robotNameRead|robotNameWrite|run|runAsynchronously|runShellCommand|runShellCommandAsynchronously|running|scanNetworks|scrollDisplayLeft|scrollDisplayRight|seek|sendAnalog|sendDigitalPortPair|sendDigitalPorts|sendString|sendSysex|serialEvent|setBand|setBitOrder|setClockDivider|setCursor|setDNS|setDataMode|setFirmwareVersion|setMode|setPINUsed|setSpeed|setTextSize|setTimeout|shiftIn|shiftOut|shutdown|sin|size|sqrt|startLoop|step|stop|stroke|subnetMask|switchPIN|tan|tempoWrite|text|tone|transfer|tuneWrite|turn|updateIR|userNameRead|userNameWrite|voiceCall|waitContinue|width|write|writeBlue|writeGreen|writeJSON|writeMessage|writeMicroseconds|writeRGB|writeRed|yield)\b/}),e.languages.ino=e.languages.arduino}Pg.displayName="bash";Pg.aliases=["sh","shell"];function Pg(e){(function(t){var n="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",r={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},a={bash:r,environment:{pattern:RegExp("\\$"+n),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+n),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+n),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:a},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:a},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:a.entity}}],environment:{pattern:RegExp("\\$?"+n),alias:"constant"},variable:a.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=t.languages.bash;for(var l=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],u=a.variable[1].inside,o=0;o>/g,function($,U){return"(?:"+O[+U]+")"})}function r(M,O,$){return RegExp(n(M,O),"")}function a(M,O){for(var $=0;$>/g,function(){return"(?:"+M+")"});return M.replace(/<>/g,"[^\\s\\S]")}var l={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function u(M){return"\\b(?:"+M.trim().replace(/ /g,"|")+")\\b"}var o=u(l.typeDeclaration),c=RegExp(u(l.type+" "+l.typeDeclaration+" "+l.contextual+" "+l.other)),f=u(l.typeDeclaration+" "+l.contextual+" "+l.other),p=u(l.type+" "+l.typeDeclaration+" "+l.other),d=a(/<(?:[^<>;=+\-*/%&|^]|<>)*>/.source,2),_=a(/\((?:[^()]|<>)*\)/.source,2),v=/@?\b[A-Za-z_]\w*\b/.source,w=n(/<<0>>(?:\s*<<1>>)?/.source,[v,d]),C=n(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[f,w]),b=/\[\s*(?:,\s*)*\]/.source,S=n(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[C,b]),x=n(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[d,_,b]),y=n(/\(<<0>>+(?:,<<0>>+)+\)/.source,[x]),E=n(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[y,C,b]),R={keyword:c,punctuation:/[<>()?,.:[\]]/},N=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,D=/"(?:\\.|[^\\"\r\n])*"/.source,T=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;t.languages.csharp=t.languages.extend("clike",{string:[{pattern:r(/(^|[^$\\])<<0>>/.source,[T]),lookbehind:!0,greedy:!0},{pattern:r(/(^|[^@$\\])<<0>>/.source,[D]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:r(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[C]),lookbehind:!0,inside:R},{pattern:r(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[v,E]),lookbehind:!0,inside:R},{pattern:r(/(\busing\s+)<<0>>(?=\s*=)/.source,[v]),lookbehind:!0},{pattern:r(/(\b<<0>>\s+)<<1>>/.source,[o,w]),lookbehind:!0,inside:R},{pattern:r(/(\bcatch\s*\(\s*)<<0>>/.source,[C]),lookbehind:!0,inside:R},{pattern:r(/(\bwhere\s+)<<0>>/.source,[v]),lookbehind:!0},{pattern:r(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[S]),lookbehind:!0,inside:R},{pattern:r(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[E,p,v]),inside:R}],keyword:c,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),t.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),t.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:r(/([(,]\s*)<<0>>(?=\s*:)/.source,[v]),lookbehind:!0,alias:"punctuation"}}),t.languages.insertBefore("csharp","class-name",{namespace:{pattern:r(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[v]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:r(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[_]),lookbehind:!0,alias:"class-name",inside:R},"return-type":{pattern:r(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[E,C]),inside:R,alias:"class-name"},"constructor-invocation":{pattern:r(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[E]),lookbehind:!0,inside:R,alias:"class-name"},"generic-method":{pattern:r(/<<0>>\s*<<1>>(?=\s*\()/.source,[v,d]),inside:{function:r(/^<<0>>/.source,[v]),generic:{pattern:RegExp(d),alias:"class-name",inside:R}}},"type-list":{pattern:r(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[o,w,v,E,c.source,_,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:r(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[w,_]),lookbehind:!0,greedy:!0,inside:t.languages.csharp},keyword:c,"class-name":{pattern:RegExp(E),greedy:!0,inside:R},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var j=D+"|"+N,B=n(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[j]),F=a(n(/[^"'/()]|<<0>>|\(<>*\)/.source,[B]),2),Y=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,H=n(/<<0>>(?:\s*\(<<1>>*\))?/.source,[C,F]);t.languages.insertBefore("csharp","class-name",{attribute:{pattern:r(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[Y,H]),lookbehind:!0,greedy:!0,inside:{target:{pattern:r(/^<<0>>(?=\s*:)/.source,[Y]),alias:"keyword"},"attribute-arguments":{pattern:r(/\(<<0>>*\)/.source,[F]),inside:t.languages.csharp},"class-name":{pattern:RegExp(C),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var z=/:[^}\r\n]+/.source,V=a(n(/[^"'/()]|<<0>>|\(<>*\)/.source,[B]),2),G=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[V,z]),X=a(n(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<>*\)/.source,[j]),2),K=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[X,z]);function L(M,O){return{interpolation:{pattern:r(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[M]),lookbehind:!0,inside:{"format-string":{pattern:r(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[O,z]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:t.languages.csharp}}},string:/[\s\S]+/}}t.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:r(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[G]),lookbehind:!0,greedy:!0,inside:L(G,V)},{pattern:r(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[K]),lookbehind:!0,greedy:!0,inside:L(K,X)}],char:{pattern:RegExp(N),greedy:!0}}),t.languages.dotnet=t.languages.cs=t.languages.csharp})(e)}hl.displayName="markup";hl.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function hl(e){e.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(n,r){var a={};a["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[r]},a.cdata=/^$/i;var l={"included-cdata":{pattern://i,inside:a}};l["language-"+r]={pattern:/[\s\S]+/,inside:e.languages[r]};var u={};u[n]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:l},e.languages.insertBefore("markup","cdata",u)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}Ca.displayName="css";Ca.aliases=[];function Ca(e){(function(t){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var r=t.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(e)}$g.displayName="diff";$g.aliases=[];function $g(e){(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var n={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(n).forEach(function(r){var a=n[r],l=[];/^\w+$/.test(r)||l.push(/\w+/.exec(r)[0]),r==="diff"&&l.push("bold"),t.languages.diff[r]={pattern:RegExp("^(?:["+a+`].*(?:\r +`))}function c(v,w,C,b){const S=C.enter("tableCell"),x=C.enter("phrasing"),y=C.containerPhrasing(v,{...b,before:l,after:l});return x(),S(),y}function f(v,w){return wD(v,{align:w,alignDelimiters:r,padding:n,stringLength:a})}function p(v,w,C){const b=v.children;let S=-1;const x=[],y=w.enter("table");for(;++S0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const AM={tokenize:OM,partial:!0};function NM(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:MM,continuation:{tokenize:jM},exit:LM}},text:{91:{name:"gfmFootnoteCall",tokenize:DM},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:TM,resolveTo:RM}}}}function TM(e,t,n){const r=this;let a=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u;for(;a--;){const c=r.events[a][1];if(c.type==="labelImage"){u=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return o;function o(c){if(!u||!u._balanced)return n(c);const f=Jn(r.sliceSerialize({start:u.end,end:r.now()}));return f.codePointAt(0)!==94||!l.includes(f.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function RM(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function DM(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,u;return o;function o(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),c}function c(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(d){if(l>999||d===93&&!u||d===null||d===91||yt(d))return n(d);if(d===93){e.exit("chunkString");const _=e.exit("gfmFootnoteCallString");return a.includes(Jn(r.sliceSerialize(_)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return yt(d)||(u=!0),l++,e.consume(d),d===92?p:f}function p(d){return d===91||d===92||d===93?(e.consume(d),l++,f):f(d)}}function MM(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,u=0,o;return c;function c(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(w)}function p(w){if(u>999||w===93&&!o||w===null||w===91||yt(w))return n(w);if(w===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return l=Jn(r.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),_}return yt(w)||(o=!0),u++,e.consume(w),w===92?d:p}function d(w){return w===91||w===92||w===93?(e.consume(w),u++,p):p(w)}function _(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),a.includes(l)||a.push(l),et(e,v,"gfmFootnoteDefinitionWhitespace")):n(w)}function v(w){return t(w)}}function jM(e,t,n){return e.check(ll,t,e.attempt(AM,t,n))}function LM(e){e.exit("gfmFootnoteDefinition")}function OM(e,t,n){const r=this;return et(e,a,"gfmFootnoteDefinitionIndent",5);function a(l){const u=r.events[r.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(l):n(l)}}function BM(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(u,o){let c=-1;for(;++c1?c(w):(u.consume(w),d++,v);if(d<2&&!n)return c(w);const b=u.exit("strikethroughSequenceTemporary"),S=fa(w);return b._open=!S||S===2&&!!C,b._close=!C||C===2&&!!S,o(w)}}}class IM{constructor(){this.map=[]}add(t,n,r){zM(this,t,n,r)}consume(t){if(this.map.sort(function(l,u){return l[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const l of a)t.push(l);a=r.pop()}this.map.length=0}}function zM(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a-1;){const H=r.events[z][1].type;if(H==="lineEnding"||H==="linePrefix")z--;else break}const G=z>-1?r.events[z][1].type:null,U=G==="tableHead"||G==="tableRow"?N:c;return U===N&&r.parser.lazy[r.now().line]?n(B):U(B)}function c(B){return e.enter("tableHead"),e.enter("tableRow"),f(B)}function f(B){return B===124||(u=!0,l+=1),p(B)}function p(B){return B===null?n(B):Oe(B)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),v):n(B):Xe(B)?et(e,p,"whitespace")(B):(l+=1,u&&(u=!1,a+=1),B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),u=!0,p):(e.enter("data"),d(B)))}function d(B){return B===null||B===124||yt(B)?(e.exit("data"),p(B)):(e.consume(B),B===92?_:d)}function _(B){return B===92||B===124?(e.consume(B),d):d(B)}function v(B){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(B):(e.enter("tableDelimiterRow"),u=!1,Xe(B)?et(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):w(B))}function w(B){return B===45||B===58?b(B):B===124?(u=!0,e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),C):R(B)}function C(B){return Xe(B)?et(e,b,"whitespace")(B):b(B)}function b(B){return B===58?(l+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),S):B===45?(l+=1,S(B)):B===null||Oe(B)?E(B):R(B)}function S(B){return B===45?(e.enter("tableDelimiterFiller"),x(B)):R(B)}function x(B){return B===45?(e.consume(B),x):B===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(B))}function y(B){return Xe(B)?et(e,E,"whitespace")(B):E(B)}function E(B){return B===124?w(B):B===null||Oe(B)?!u||a!==l?R(B):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(B)):R(B)}function R(B){return n(B)}function N(B){return e.enter("tableRow"),D(B)}function D(B){return B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),D):B===null||Oe(B)?(e.exit("tableRow"),t(B)):Xe(B)?et(e,D,"whitespace")(B):(e.enter("data"),T(B))}function T(B){return B===null||B===124||yt(B)?(e.exit("data"),D(B)):(e.consume(B),B===92?j:T)}function j(B){return B===92||B===124?(e.consume(B),T):T(B)}}function UM(e,t){let n=-1,r=!0,a=0,l=[0,0,0,0],u=[0,0,0,0],o=!1,c=0,f,p,d;const _=new IM;for(;++nn[2]+1){const w=n[2]+1,C=n[3]-n[2]-1;e.add(w,C,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return a!==void 0&&(l.end=Object.assign({},na(t.events,a)),e.add(a,0,[["exit",l,t]]),l=void 0),l}function D1(e,t,n,r,a){const l=[],u=na(t.events,n);a&&(a.end=Object.assign({},u),l.push(["exit",a,t])),r.end=Object.assign({},u),l.push(["exit",r,t]),e.add(n+1,0,l)}function na(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const $M={name:"tasklistCheck",tokenize:qM};function GM(){return{text:{91:$M}}}function qM(e,t,n){const r=this;return a;function a(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),l)}function l(c){return yt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),u):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),u):n(c)}function u(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(c)}function o(c){return Oe(c)?t(c):Xe(c)?e.check({tokenize:VM},t,n)(c):n(c)}}function VM(e,t,n){return et(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function YM(e){return yx([vM(),NM(),BM(e),FM(),GM()])}const WM={};function uw(e){const t=this,n=e||WM,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),u=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(YM(n)),l.push(pM()),u.push(gM(n))}const XM={cjs:"javascript",console:"bash",cts:"typescript",fish:"bash",html:"markup",js:"javascript",jsx:"javascript",md:"markdown",mjs:"javascript",mts:"typescript",py:"python",rb:"ruby",sh:"bash",shell:"bash",svg:"markup",terminal:"bash",ts:"typescript",tsx:"typescript",xml:"markup",yml:"yaml",zsh:"bash"},KM={containerfile:"docker",dockerfile:"docker",justfile:"makefile",makefile:"makefile"};function Up(e){const t=e.trim().toLowerCase();return XM[t]??t}function hw(e){var a;if(!e)return null;const t=((a=e.split("/").pop())==null?void 0:a.toLowerCase())??"",n=KM[t];if(n)return Up(n);const r=t.lastIndexOf(".");return r===-1||r===t.length-1?null:Up(t.slice(r+1))}di.displayName="clike";di.aliases=[];function di(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}ul.displayName="c";ul.aliases=[];function ul(e){e.register(di),e.languages.c=e.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),e.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),e.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},e.languages.c.string],char:e.languages.c.char,comment:e.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:e.languages.c}}}}),e.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete e.languages.c.boolean}Zu.displayName="cpp";Zu.aliases=[];function Zu(e){e.register(ul),(function(t){var n=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,r=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,function(){return n.source});t.languages.cpp=t.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,function(){return n.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:n,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),t.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,function(){return r})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),t.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t.languages.cpp}}}}),t.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),t.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:t.languages.extend("cpp",{})}}),t.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},t.languages.cpp["base-clause"])})(e)}Fg.displayName="arduino";Fg.aliases=["ino"];function Fg(e){e.register(Zu),e.languages.arduino=e.languages.extend("cpp",{keyword:/\b(?:String|array|bool|boolean|break|byte|case|catch|continue|default|do|double|else|finally|for|function|goto|if|in|instanceof|int|integer|long|loop|new|null|return|setup|string|switch|throw|try|void|while|word)\b/,constant:/\b(?:ANALOG_MESSAGE|DEFAULT|DIGITAL_MESSAGE|EXTERNAL|FIRMATA_STRING|HIGH|INPUT|INPUT_PULLUP|INTERNAL|INTERNAL1V1|INTERNAL2V56|LED_BUILTIN|LOW|OUTPUT|REPORT_ANALOG|REPORT_DIGITAL|SET_PIN_MODE|SYSEX_START|SYSTEM_RESET)\b/,builtin:/\b(?:Audio|BSSID|Bridge|Client|Console|EEPROM|Esplora|EsploraTFT|Ethernet|EthernetClient|EthernetServer|EthernetUDP|File|FileIO|FileSystem|Firmata|GPRS|GSM|GSMBand|GSMClient|GSMModem|GSMPIN|GSMScanner|GSMServer|GSMVoiceCall|GSM_SMS|HttpClient|IPAddress|IRread|Keyboard|KeyboardController|LiquidCrystal|LiquidCrystal_I2C|Mailbox|Mouse|MouseController|PImage|Process|RSSI|RobotControl|RobotMotor|SD|SPI|SSID|Scheduler|Serial|Server|Servo|SoftwareSerial|Stepper|Stream|TFT|Task|USBHost|WiFi|WiFiClient|WiFiServer|WiFiUDP|Wire|YunClient|YunServer|abs|addParameter|analogRead|analogReadResolution|analogReference|analogWrite|analogWriteResolution|answerCall|attach|attachGPRS|attachInterrupt|attached|autoscroll|available|background|beep|begin|beginPacket|beginSD|beginSMS|beginSpeaker|beginTFT|beginTransmission|beginWrite|bit|bitClear|bitRead|bitSet|bitWrite|blink|blinkVersion|buffer|changePIN|checkPIN|checkPUK|checkReg|circle|cityNameRead|cityNameWrite|clear|clearScreen|click|close|compassRead|config|connect|connected|constrain|cos|countryNameRead|countryNameWrite|createChar|cursor|debugPrint|delay|delayMicroseconds|detach|detachInterrupt|digitalRead|digitalWrite|disconnect|display|displayLogos|drawBMP|drawCompass|encryptionType|end|endPacket|endSMS|endTransmission|endWrite|exists|exitValue|fill|find|findUntil|flush|gatewayIP|get|getAsynchronously|getBand|getButton|getCurrentCarrier|getIMEI|getKey|getModifiers|getOemKey|getPINUsed|getResult|getSignalStrength|getSocket|getVoiceCallStatus|getXChange|getYChange|hangCall|height|highByte|home|image|interrupts|isActionDone|isDirectory|isListening|isPIN|isPressed|isValid|keyPressed|keyReleased|keyboardRead|knobRead|leftToRight|line|lineFollowConfig|listen|listenOnLocalhost|loadImage|localIP|lowByte|macAddress|maintain|map|max|messageAvailable|micros|millis|min|mkdir|motorsStop|motorsWrite|mouseDragged|mouseMoved|mousePressed|mouseReleased|move|noAutoscroll|noBlink|noBuffer|noCursor|noDisplay|noFill|noInterrupts|noListenOnLocalhost|noStroke|noTone|onReceive|onRequest|open|openNextFile|overflow|parseCommand|parseFloat|parseInt|parsePacket|pauseMode|peek|pinMode|playFile|playMelody|point|pointTo|position|pow|prepare|press|print|printFirmwareVersion|printVersion|println|process|processInput|pulseIn|put|random|randomSeed|read|readAccelerometer|readBlue|readButton|readBytes|readBytesUntil|readGreen|readJoystickButton|readJoystickSwitch|readJoystickX|readJoystickY|readLightSensor|readMessage|readMicrophone|readNetworks|readRed|readSlider|readString|readStringUntil|readTemperature|ready|rect|release|releaseAll|remoteIP|remoteNumber|remotePort|remove|requestFrom|retrieveCallingNumber|rewindDirectory|rightToLeft|rmdir|robotNameRead|robotNameWrite|run|runAsynchronously|runShellCommand|runShellCommandAsynchronously|running|scanNetworks|scrollDisplayLeft|scrollDisplayRight|seek|sendAnalog|sendDigitalPortPair|sendDigitalPorts|sendString|sendSysex|serialEvent|setBand|setBitOrder|setClockDivider|setCursor|setDNS|setDataMode|setFirmwareVersion|setMode|setPINUsed|setSpeed|setTextSize|setTimeout|shiftIn|shiftOut|shutdown|sin|size|sqrt|startLoop|step|stop|stroke|subnetMask|switchPIN|tan|tempoWrite|text|tone|transfer|tuneWrite|turn|updateIR|userNameRead|userNameWrite|voiceCall|waitContinue|width|write|writeBlue|writeGreen|writeJSON|writeMessage|writeMicroseconds|writeRGB|writeRed|yield)\b/}),e.languages.ino=e.languages.arduino}Pg.displayName="bash";Pg.aliases=["sh","shell"];function Pg(e){(function(t){var n="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",r={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},a={bash:r,environment:{pattern:RegExp("\\$"+n),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+n),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+n),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:a},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:a},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:a.entity}}],environment:{pattern:RegExp("\\$?"+n),alias:"constant"},variable:a.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=t.languages.bash;for(var l=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],u=a.variable[1].inside,o=0;o>/g,function($,F){return"(?:"+O[+F]+")"})}function r(M,O,$){return RegExp(n(M,O),"")}function a(M,O){for(var $=0;$>/g,function(){return"(?:"+M+")"});return M.replace(/<>/g,"[^\\s\\S]")}var l={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function u(M){return"\\b(?:"+M.trim().replace(/ /g,"|")+")\\b"}var o=u(l.typeDeclaration),c=RegExp(u(l.type+" "+l.typeDeclaration+" "+l.contextual+" "+l.other)),f=u(l.typeDeclaration+" "+l.contextual+" "+l.other),p=u(l.type+" "+l.typeDeclaration+" "+l.other),d=a(/<(?:[^<>;=+\-*/%&|^]|<>)*>/.source,2),_=a(/\((?:[^()]|<>)*\)/.source,2),v=/@?\b[A-Za-z_]\w*\b/.source,w=n(/<<0>>(?:\s*<<1>>)?/.source,[v,d]),C=n(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[f,w]),b=/\[\s*(?:,\s*)*\]/.source,S=n(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[C,b]),x=n(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[d,_,b]),y=n(/\(<<0>>+(?:,<<0>>+)+\)/.source,[x]),E=n(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[y,C,b]),R={keyword:c,punctuation:/[<>()?,.:[\]]/},N=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,D=/"(?:\\.|[^\\"\r\n])*"/.source,T=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;t.languages.csharp=t.languages.extend("clike",{string:[{pattern:r(/(^|[^$\\])<<0>>/.source,[T]),lookbehind:!0,greedy:!0},{pattern:r(/(^|[^@$\\])<<0>>/.source,[D]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:r(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[C]),lookbehind:!0,inside:R},{pattern:r(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[v,E]),lookbehind:!0,inside:R},{pattern:r(/(\busing\s+)<<0>>(?=\s*=)/.source,[v]),lookbehind:!0},{pattern:r(/(\b<<0>>\s+)<<1>>/.source,[o,w]),lookbehind:!0,inside:R},{pattern:r(/(\bcatch\s*\(\s*)<<0>>/.source,[C]),lookbehind:!0,inside:R},{pattern:r(/(\bwhere\s+)<<0>>/.source,[v]),lookbehind:!0},{pattern:r(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[S]),lookbehind:!0,inside:R},{pattern:r(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[E,p,v]),inside:R}],keyword:c,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),t.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),t.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:r(/([(,]\s*)<<0>>(?=\s*:)/.source,[v]),lookbehind:!0,alias:"punctuation"}}),t.languages.insertBefore("csharp","class-name",{namespace:{pattern:r(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[v]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:r(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[_]),lookbehind:!0,alias:"class-name",inside:R},"return-type":{pattern:r(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[E,C]),inside:R,alias:"class-name"},"constructor-invocation":{pattern:r(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[E]),lookbehind:!0,inside:R,alias:"class-name"},"generic-method":{pattern:r(/<<0>>\s*<<1>>(?=\s*\()/.source,[v,d]),inside:{function:r(/^<<0>>/.source,[v]),generic:{pattern:RegExp(d),alias:"class-name",inside:R}}},"type-list":{pattern:r(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[o,w,v,E,c.source,_,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:r(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[w,_]),lookbehind:!0,greedy:!0,inside:t.languages.csharp},keyword:c,"class-name":{pattern:RegExp(E),greedy:!0,inside:R},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var j=D+"|"+N,B=n(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[j]),z=a(n(/[^"'/()]|<<0>>|\(<>*\)/.source,[B]),2),G=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,U=n(/<<0>>(?:\s*\(<<1>>*\))?/.source,[C,z]);t.languages.insertBefore("csharp","class-name",{attribute:{pattern:r(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[G,U]),lookbehind:!0,greedy:!0,inside:{target:{pattern:r(/^<<0>>(?=\s*:)/.source,[G]),alias:"keyword"},"attribute-arguments":{pattern:r(/\(<<0>>*\)/.source,[z]),inside:t.languages.csharp},"class-name":{pattern:RegExp(C),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var H=/:[^}\r\n]+/.source,Y=a(n(/[^"'/()]|<<0>>|\(<>*\)/.source,[B]),2),q=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[Y,H]),X=a(n(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<>*\)/.source,[j]),2),K=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[X,H]);function L(M,O){return{interpolation:{pattern:r(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[M]),lookbehind:!0,inside:{"format-string":{pattern:r(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[O,H]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:t.languages.csharp}}},string:/[\s\S]+/}}t.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:r(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[q]),lookbehind:!0,greedy:!0,inside:L(q,Y)},{pattern:r(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[K]),lookbehind:!0,greedy:!0,inside:L(K,X)}],char:{pattern:RegExp(N),greedy:!0}}),t.languages.dotnet=t.languages.cs=t.languages.csharp})(e)}hl.displayName="markup";hl.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function hl(e){e.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(n,r){var a={};a["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[r]},a.cdata=/^$/i;var l={"included-cdata":{pattern://i,inside:a}};l["language-"+r]={pattern:/[\s\S]+/,inside:e.languages[r]};var u={};u[n]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:l},e.languages.insertBefore("markup","cdata",u)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}Ca.displayName="css";Ca.aliases=[];function Ca(e){(function(t){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var r=t.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(e)}$g.displayName="diff";$g.aliases=[];function $g(e){(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var n={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(n).forEach(function(r){var a=n[r],l=[];/^\w+$/.test(r)||l.push(/\w+/.exec(r)[0]),r==="diff"&&l.push("bold"),t.languages.diff[r]={pattern:RegExp("^(?:["+a+`].*(?:\r ?| -|(?![\\s\\S])))+`,"m"),alias:l,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(r)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:n})})(e)}Gg.displayName="go";Gg.aliases=[];function Gg(e){e.register(di),e.languages.go=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),e.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete e.languages.go["class-name"]}qg.displayName="ini";qg.aliases=[];function qg(e){e.languages.ini={comment:{pattern:/(^[ \f\t\v]*)[#;][^\n\r]*/m,lookbehind:!0},section:{pattern:/(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,lookbehind:!0,inside:{"section-name":{pattern:/(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,lookbehind:!0,alias:"selector"},punctuation:/\[|\]/}},key:{pattern:/(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,lookbehind:!0,alias:"attr-name"},value:{pattern:/(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,lookbehind:!0,alias:"attr-value",inside:{"inner-value":{pattern:/^("|').+(?=\1$)/,lookbehind:!0}}},punctuation:/=/}}Vg.displayName="java";Vg.aliases=[];function Vg(e){e.register(di),(function(t){var n=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,r=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,a={pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[a,{pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:a.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+r+/[A-Z]\w*\b/.source),lookbehind:!0,inside:a.inside}],keyword:n,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":a,keyword:n,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+r+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:a.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+r+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:a.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//g,function(){return n.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}Yg.displayName="regex";Yg.aliases=[];function Yg(e){(function(t){var n={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:"escape"},r=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,a={pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},l={pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},u="(?:[^\\\\-]|"+r.source+")",o=RegExp(u+"-"+u),c={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"};t.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:"operator"},"char-class-punctuation":{pattern:/^\[|\]$/,alias:"punctuation"},range:{pattern:o,inside:{escape:r,"range-punctuation":{pattern:/-/,alias:"operator"}}},"special-escape":n,"char-set":l,escape:r}},"special-escape":n,"char-set":a,backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":c}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:"function"},escape:r,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]||&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}Wg.displayName="json";Wg.aliases=["webmanifest"];function Wg(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}Xg.displayName="kotlin";Xg.aliases=["kt","kts"];function Xg(e){e.register(di),(function(t){t.languages.kotlin=t.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete t.languages.kotlin["class-name"];var n={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:t.languages.kotlin}};t.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:n},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:n},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete t.languages.kotlin.string,t.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),t.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),t.languages.kt=t.languages.kotlin,t.languages.kts=t.languages.kotlin})(e)}Kg.displayName="less";Kg.aliases=[];function Kg(e){e.register(Ca),e.languages.less=e.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),e.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}})}Zg.displayName="lua";Zg.aliases=[];function Zg(e){e.languages.lua={comment:/^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,string:{pattern:/(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,greedy:!0},number:/\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,keyword:/\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,function:/(?!\d)\w+(?=\s*(?:[({]))/,operator:[/[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,{pattern:/(^|[^.])\.\.(?!\.)/,lookbehind:!0}],punctuation:/[\[\](){},;]|\.+|:+/}}Qg.displayName="makefile";Qg.aliases=[];function Qg(e){e.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/}}Jg.displayName="yaml";Jg.aliases=["yml"];function Jg(e){(function(t){var n=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,a="(?:"+r.source+"(?:[ ]+"+n.source+")?|"+n.source+"(?:[ ]+"+r.source+")?)",l=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),u=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function o(c,f){f=(f||"").replace(/m/g,"")+"m";var p=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return a}).replace(/<>/g,function(){return c});return RegExp(p,f)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return a})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return a}).replace(/<>/g,function(){return"(?:"+l+"|"+u+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:o(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:o(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:o(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:o(u),lookbehind:!0,greedy:!0},number:{pattern:o(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:r,important:n,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(e)}em.displayName="markdown";em.aliases=["md"];function em(e){e.register(hl),(function(t){var n=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(o){return o=o.replace(//g,function(){return n}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+o+")")}var a=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,l=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return a}),u=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+l+u+"(?:"+l+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+l+u+")(?:"+l+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(a),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+l+")"+u+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+l+"$"),inside:{"table-header":{pattern:RegExp(a),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(o){["url","bold","italic","strike","code-snippet"].forEach(function(c){o!==c&&(t.languages.markdown[o].inside.content.inside[c]=t.languages.markdown[c])})}),t.hooks.add("after-tokenize",function(o){if(o.language!=="markdown"&&o.language!=="md")return;function c(f){if(!(!f||typeof f=="string"))for(var p=0,d=f.length;p]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete e.languages.objectivec["class-name"],e.languages.objc=e.languages.objectivec}nm.displayName="perl";nm.aliases=[];function nm(e){(function(t){var n=/(?:\((?:[^()\\]|\\[\s\S])*\)|\{(?:[^{}\\]|\\[\s\S])*\}|\[(?:[^[\]\\]|\\[\s\S])*\]|<(?:[^<>\\]|\\[\s\S])*>)/.source;t.languages.perl={comment:[{pattern:/(^\s*)=\w[\s\S]*?=cut.*/m,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],string:[{pattern:RegExp(/\b(?:q|qq|qw|qx)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,n].join("|")+")"),greedy:!0},{pattern:/("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/,greedy:!0},{pattern:/'(?:[^'\\\r\n]|\\.)*'/,greedy:!0}],regex:[{pattern:RegExp(/\b(?:m|qr)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,n].join("|")+")"+/[msixpodualngc]*/.source),greedy:!0},{pattern:RegExp(/(^|[^-])\b(?:s|tr|y)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,/([a-zA-Z0-9])(?:(?!\3)[^\\]|\\[\s\S])*\3(?:(?!\3)[^\\]|\\[\s\S])*\3/.source,n+/\s*/.source+n].join("|")+")"+/[msixpodualngcer]*/.source),lookbehind:!0,greedy:!0},{pattern:/\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|x|xor)\b))/,greedy:!0}],variable:[/[&*$@%]\{\^[A-Z]+\}/,/[&*$@%]\^[A-Z_]/,/[&*$@%]#?(?=\{)/,/[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+(?![\w$]))+(?:::)*/,/[&*$@%]\d+/,/(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/],filehandle:{pattern:/<(?![<=])\S*?>|\b_\b/,alias:"symbol"},"v-string":{pattern:/v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,alias:"string"},function:{pattern:/(\bsub[ \t]+)\w+/,lookbehind:!0},keyword:/\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,operator:/-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)\b/,punctuation:/[{}[\];(),:]/}})(e)}Ju.displayName="markup-templating";Ju.aliases=[];function Ju(e){e.register(hl),(function(t){function n(r,a){return"___"+r.toUpperCase()+a+"___"}Object.defineProperties(t.languages["markup-templating"]={},{buildPlaceholders:{value:function(r,a,l,u){if(r.language===a){var o=r.tokenStack=[];r.code=r.code.replace(l,function(c){if(typeof u=="function"&&!u(c))return c;for(var f=o.length,p;r.code.indexOf(p=n(a,f))!==-1;)++f;return o[f]=c,p}),r.grammar=t.languages.markup}}},tokenizePlaceholders:{value:function(r,a){if(r.language!==a||!r.tokenStack)return;r.grammar=t.languages[a];var l=0,u=Object.keys(r.tokenStack);function o(c){for(var f=0;f=u.length);f++){var p=c[f];if(typeof p=="string"||p.content&&typeof p.content=="string"){var d=u[l],_=r.tokenStack[d],v=typeof p=="string"?p:p.content,w=n(a,d),C=v.indexOf(w);if(C>-1){++l;var b=v.substring(0,C),S=new t.Token(a,t.tokenize(_,r.grammar),"language-"+a,_),x=v.substring(C+w.length),y=[];b&&y.push.apply(y,o([b])),y.push(S),x&&y.push.apply(y,o([x])),typeof p=="string"?c.splice.apply(c,[f,1].concat(y)):p.content=y}}else p.content&&o(p.content)}return c}o(r.tokens)}}})})(e)}im.displayName="php";im.aliases=[];function im(e){e.register(Ju),(function(t){var n=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,r=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],a=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,l=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,u=/[{}\[\](),:;]/;t.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:n,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:a,operator:l,punctuation:u};var o={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:t.languages.php},c=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:o}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:o}}];t.languages.insertBefore("php","variable",{string:c,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:n,string:c,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,number:a,operator:l,punctuation:u}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),t.hooks.add("before-tokenize",function(f){if(/<\?/.test(f.code)){var p=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;t.languages["markup-templating"].buildPlaceholders(f,"php",p)}}),t.hooks.add("after-tokenize",function(f){t.languages["markup-templating"].tokenizePlaceholders(f,"php")})})(e)}rm.displayName="python";rm.aliases=["py"];function rm(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}sm.displayName="r";sm.aliases=[];function sm(e){e.languages.r={comment:/#.*/,string:{pattern:/(['"])(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},"percent-operator":{pattern:/%[^%\s]*%/,alias:"operator"},boolean:/\b(?:FALSE|TRUE)\b/,ellipsis:/\.\.(?:\.|\d+)/,number:[/\b(?:Inf|NaN)\b/,/(?:\b0x[\dA-Fa-f]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/],keyword:/\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,operator:/->?>?|<(?:=|=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,punctuation:/[(){}\[\],;]/}}am.displayName="ruby";am.aliases=["rb"];function am(e){e.register(di),(function(t){t.languages.ruby=t.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===||[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),t.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var n={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:t.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete t.languages.ruby.function;var r="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",a=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;t.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+r+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+a),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+a+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),t.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+r),greedy:!0,inside:{interpolation:n,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:n,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:n,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+r),greedy:!0,inside:{interpolation:n,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:n,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete t.languages.ruby.string,t.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),t.languages.rb=t.languages.ruby})(e)}om.displayName="rust";om.aliases=[];function om(e){(function(t){for(var n=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,r=0;r<2;r++)n=n.replace(//g,function(){return n});n=n.replace(//g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+n),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(e)}lm.displayName="sass";lm.aliases=[];function lm(e){e.register(Ca),(function(t){t.languages.sass=t.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),t.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete t.languages.sass.atrule;var n=/\$[-\w]+|#\{\$[-\w]+\}/,r=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];t.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:n,operator:r}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:n,operator:r,important:t.languages.sass.important}}}),delete t.languages.sass.property,delete t.languages.sass.important,t.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})})(e)}cm.displayName="scss";cm.aliases=[];function cm(e){e.register(Ca),e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}um.displayName="sql";um.aliases=[];function um(e){e.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}}hm.displayName="swift";hm.aliases=[];function hm(e){e.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},e.languages.swift["string-literal"].forEach(function(t){t.inside.interpolation.inside=e.languages.swift})}fm.displayName="typescript";fm.aliases=["ts"];function fm(e){e.register(Qu),(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var n=t.languages.extend("typescript",{});delete n["class-name"],t.languages.typescript["class-name"].inside=n,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n}}}}),t.languages.ts=t.languages.typescript})(e)}eh.displayName="basic";eh.aliases=[];function eh(e){e.languages.basic={comment:{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},string:{pattern:/"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/,greedy:!0},number:/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,keyword:/\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SELECT CASE|SHARED|SHELL|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i,function:/\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i,operator:/<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/i,punctuation:/[,;:()]/}}dm.displayName="vbnet";dm.aliases=[];function dm(e){e.register(eh),e.languages.vbnet=e.languages.extend("basic",{comment:[{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},{pattern:/(^|[^\\:])'.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(^|[^"])"(?:""|[^"])*"(?!")/,lookbehind:!0,greedy:!0},keyword:/(?:\b(?:ADDHANDLER|ADDRESSOF|ALIAS|AND|ANDALSO|AS|BEEP|BLOAD|BOOLEAN|BSAVE|BYREF|BYTE|BYVAL|CALL(?: ABSOLUTE)?|CASE|CATCH|CBOOL|CBYTE|CCHAR|CDATE|CDBL|CDEC|CHAIN|CHAR|CHDIR|CINT|CLASS|CLEAR|CLNG|CLOSE|CLS|COBJ|COM|COMMON|CONST|CONTINUE|CSBYTE|CSHORT|CSNG|CSTR|CTYPE|CUINT|CULNG|CUSHORT|DATA|DATE|DECIMAL|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DEFAULT|DELEGATE|DIM|DIRECTCAST|DO|DOUBLE|ELSE|ELSEIF|END|ENUM|ENVIRON|ERASE|ERROR|EVENT|EXIT|FALSE|FIELD|FILES|FINALLY|FOR(?: EACH)?|FRIEND|FUNCTION|GET|GETTYPE|GETXMLNAMESPACE|GLOBAL|GOSUB|GOTO|HANDLES|IF|IMPLEMENTS|IMPORTS|IN|INHERITS|INPUT|INTEGER|INTERFACE|IOCTL|IS|ISNOT|KEY|KILL|LET|LIB|LIKE|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|ME|MKDIR|MOD|MODULE|MUSTINHERIT|MUSTOVERRIDE|MYBASE|MYCLASS|NAME|NAMESPACE|NARROWING|NEW|NEXT|NOT|NOTHING|NOTINHERITABLE|NOTOVERRIDABLE|OBJECT|OF|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPERATOR|OPTION(?: BASE)?|OPTIONAL|OR|ORELSE|OUT|OVERLOADS|OVERRIDABLE|OVERRIDES|PARAMARRAY|PARTIAL|POKE|PRIVATE|PROPERTY|PROTECTED|PUBLIC|PUT|RAISEEVENT|READ|READONLY|REDIM|REM|REMOVEHANDLER|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SBYTE|SELECT(?: CASE)?|SET|SHADOWS|SHARED|SHELL|SHORT|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|STRUCTURE|SUB|SWAP|SYNCLOCK|SYSTEM|THEN|THROW|TIMER|TO|TROFF|TRON|TRUE|TRY|TRYCAST|TYPE|TYPEOF|UINTEGER|ULONG|UNLOCK|UNTIL|USHORT|USING|VIEW PRINT|WAIT|WEND|WHEN|WHILE|WIDENING|WITH|WITHEVENTS|WRITE|WRITEONLY|XOR)|\B(?:#CONST|#ELSE|#ELSEIF|#END|#IF))(?:\$|\b)/i,punctuation:/[,;:(){}]/})}const M1=/[#.]/g;function ej(e,t){const n=e||"",r={};let a=0,l,u;for(;a=48&&t<=57}function lj(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function cj(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function O1(e){return cj(e)||mw(e)}const uj=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function hj(e,t){const n={},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,a=[];let l=0,u=-1,o="",c,f;n.position&&("start"in n.position||"indent"in n.position?(f=n.position.indent,c=n.position.start):c=n.position);let p=(c?c.line:0)||1,d=(c?c.column:0)||1,_=w(),v;for(l--;++l<=e.length;)if(v===10&&(d=(f?f[u]:0)||1),v=e.charCodeAt(l),v===38){const S=e.charCodeAt(l+1);if(S===9||S===10||S===12||S===32||S===38||S===60||Number.isNaN(S)||r&&S===r){o+=String.fromCharCode(v),d++;continue}const x=l+1;let y=x,E=x,R;if(S===35){E=++y;const H=e.charCodeAt(E);H===88||H===120?(R="hexadecimal",E=++y):R="decimal"}else R="named";let N="",D="",T="";const j=R==="named"?O1:R==="decimal"?mw:lj;for(E--;++E<=e.length;){const H=e.charCodeAt(E);if(!j(H))break;T+=String.fromCharCode(H),R==="named"&&oj.includes(T)&&(N=T,D=$o(T))}let B=e.charCodeAt(E)===59;if(B){E++;const H=R==="named"?$o(T):!1;H&&(N=T,D=H)}let F=1+E-x,Y="";if(!(!B&&n.nonTerminated===!1))if(!T)R!=="named"&&C(4,F);else if(R==="named"){if(B&&!D)C(5,1);else if(N!==T&&(E=y+N.length,F=1+E-y,B=!1),!B){const H=N?1:3;if(n.attribute){const z=e.charCodeAt(E);z===61?(C(H,F),D=""):O1(z)?D="":C(H,F)}else C(H,F)}Y=D}else{B||C(2,F);let H=Number.parseInt(T,R==="hexadecimal"?16:10);if(fj(H))C(7,F),Y="�";else if(H in L1)C(6,F),Y=L1[H];else{let z="";dj(H)&&C(6,F),H>65535&&(H-=65536,z+=String.fromCharCode(H>>>10|55296),H=56320|H&1023),Y=z+String.fromCharCode(H)}}if(Y){b(),_=w(),l=E-1,d+=E-x+1,a.push(Y);const H=w();H.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,Y,{start:_,end:H},e.slice(x-1,E)),_=H}else T=e.slice(x-1,E),o+=T,d+=T.length,l=E-1}else v===10&&(p++,u++,d=0),Number.isNaN(v)?b():(o+=String.fromCharCode(v),d++);return a.join("");function w(){return{line:p,column:d,offset:l+((c?c.offset:0)||0)}}function C(S,x){let y;n.warning&&(y=w(),y.column+=x,y.offset+=x,n.warning.call(n.warningContext||void 0,uj[S],y,S))}function b(){o&&(a.push(o),n.text&&n.text.call(n.textContext||void 0,o,{start:_,end:w()}),o="")}}function fj(e){return e>=55296&&e<=57343||e>1114111}function dj(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var pj=0,$c={},Yt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++pj}),e.__id},clone:function e(t,n){n=n||{};var r,a;switch(Yt.util.type(t)){case"Object":if(a=Yt.util.objId(t),n[a])return n[a];r={},n[a]=r;for(var l in t)t.hasOwnProperty(l)&&(r[l]=e(t[l],n));return r;case"Array":return a=Yt.util.objId(t),n[a]?n[a]:(r=[],n[a]=r,t.forEach(function(u,o){r[o]=e(u,n)}),r);default:return t}}},languages:{plain:$c,plaintext:$c,text:$c,txt:$c,extend:function(e,t){var n=Yt.util.clone(Yt.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r=r||Yt.languages;var a=r[e],l={};for(var u in a)if(a.hasOwnProperty(u)){if(u==t)for(var o in n)n.hasOwnProperty(o)&&(l[o]=n[o]);n.hasOwnProperty(u)||(l[u]=a[u])}var c=r[e];return r[e]=l,Yt.languages.DFS(Yt.languages,function(f,p){p===c&&f!=e&&(this[f]=l)}),l},DFS:function e(t,n,r,a){a=a||{};var l=Yt.util.objId;for(var u in t)if(t.hasOwnProperty(u)){n.call(t,u,t[u],r||u);var o=t[u],c=Yt.util.type(o);c==="Object"&&!a[l(o)]?(a[l(o)]=!0,e(o,n,null,a)):c==="Array"&&!a[l(o)]&&(a[l(o)]=!0,e(o,n,u,a))}}},plugins:{},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(Yt.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=Yt.tokenize(r.code,r.grammar),Yt.hooks.run("after-tokenize",r),Io.stringify(Yt.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var a=new gj;return hu(a,a.head,e),_w(e,a,t,a.head,0),_j(a)},hooks:{all:{},add:function(e,t){var n=Yt.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=Yt.hooks.all[e];if(!(!n||!n.length))for(var r=0,a;a=n[r++];)a(t)}},Token:Io};function Io(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||"").length|0}function B1(e,t,n,r){e.lastIndex=t;var a=e.exec(n);if(a&&r&&a[1]){var l=a[1].length;a.index+=l,a[0]=a[0].slice(l)}return a}function _w(e,t,n,r,a,l){for(var u in n)if(!(!n.hasOwnProperty(u)||!n[u])){var o=n[u];o=Array.isArray(o)?o:[o];for(var c=0;c=l.reach);S+=b.value.length,b=b.next){var x=b.value;if(t.length>e.length)return;if(!(x instanceof Io)){var y=1,E;if(_){if(E=B1(C,S,e,d),!E||E.index>=e.length)break;var T=E.index,R=E.index+E[0].length,N=S;for(N+=b.value.length;T>=N;)b=b.next,N+=b.value.length;if(N-=b.value.length,S=N,b.value instanceof Io)continue;for(var D=b;D!==t.tail&&(Nl.reach&&(l.reach=Y);var H=b.prev;B&&(H=hu(t,H,B),S+=B.length),mj(t,H,y);var z=new Io(u,p?Yt.tokenize(j,p):j,v,j);if(b=hu(t,H,z),F&&hu(t,b,F),y>1){var V={cause:u+","+c,reach:Y};_w(e,t,n,b.prev,S,V),l&&V.reach>l.reach&&(l.reach=V.reach)}}}}}}function gj(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function hu(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function mj(e,t,n){for(var r=t.next,a=0;an)return e;try{return je.highlight(e,t).children.map(bw)}catch{return e}}const Ej=1e5;function kj({code:e,lang:t}){const[n,r]=q.useState(!1),a=()=>{var l;(l=navigator.clipboard)==null||l.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};return m.jsxs("div",{className:"md-code",children:[m.jsx("button",{className:"md-code-copy",title:"Copy","aria-label":"Copy code",onClick:a,children:n?m.jsx(_n,{size:13}):m.jsx(yg,{size:13})}),m.jsx("pre",{children:m.jsx("code",{children:Sw(e,t,Ej)})})]})}function Aj(e){const t={};for(const n of e.matchAll(/([\w-]+)=(["'])(.*?)\2/g)){const r=n[1];r&&(t[r.toLowerCase()]=n[3]??"")}return t}function Nj(e){const t=/]*?)\/?>/gi,n=[];let r=0,a=!1;for(const l of e.matchAll(t)){const u=Aj(l[1]??"");u.path&&(a=!0,l.index>r&&n.push({type:"text",value:e.slice(r,l.index)}),n.push({children:[],data:{hName:"file-mention",hProperties:u},type:"fileMention"}),r=l.index+l[0].length)}return a?(rxw(e)}function I1({path:e,lines:t,onOpenFile:n}){const r=e.split("/").pop()||e,a=t&&Number.parseInt(t,10)||void 0,l=a!=null?`${r}:${a}`:r;return m.jsxs("button",{className:"file-chip",title:`Open ${e}`,onClick:()=>n==null?void 0:n(e),disabled:!n,children:[m.jsx(GS,{size:12}),m.jsx("span",{className:"file-chip-label",children:l})]})}function Rj(e){return!(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("#")||e.startsWith("//"))}const ww={code:({node:e,className:t,children:n,...r})=>{const a=t??"",l=/language-(\w+)/.exec(a),u=String(n??"").replace(/\n$/,"");if(!(l!=null||u.includes(` -`)))return m.jsx("code",{className:a,...r,children:n});const c=l?Up(l[1]):null;return m.jsx(kj,{code:u,lang:c})},pre:({children:e})=>m.jsx(m.Fragment,{children:e})};function qo({text:e,onOpenFile:t}){const n={"file-mention":r=>m.jsx(I1,{path:r.path,lines:r.lines,onOpenFile:t}),a:({node:r,href:a,children:l,...u})=>a&&Rj(a)&&t?m.jsx(I1,{path:decodeURI(a),onOpenFile:t}):m.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",...u,children:l}),...ww};return m.jsx("div",{className:"md",children:m.jsx($x,{remarkPlugins:[dw,Tj],components:n,children:e})})}function Dj({synthesized:e,onView:t,onApprove:n,onReject:r,onRevise:a}){const[l,u]=q.useState(!1),o=q.useRef(null),[c,f]=q.useState(!1),[p,d]=q.useState(""),_=q.useRef(null);q.useEffect(()=>{if(!l)return;const w=C=>{o.current&&!o.current.contains(C.target)&&u(!1)};return window.addEventListener("pointerdown",w),()=>window.removeEventListener("pointerdown",w)},[l]),q.useEffect(()=>{var w;c&&((w=_.current)==null||w.focus())},[c]);const v=()=>{a(p.trim()||"no specific feedback — use your judgment"),d(""),f(!1)};return m.jsxs("div",{className:"plan-strip",children:[m.jsxs("div",{className:"plan-strip-info",children:[m.jsx(WS,{size:14,className:"plan-strip-icon"}),m.jsx("span",{className:"plan-strip-title",children:e?"Claude is ready to proceed":"Claude proposed a plan"}),m.jsx("button",{className:"plan-strip-open",onClick:t,children:"Open plan"})]}),c?m.jsxs(m.Fragment,{children:[m.jsx("textarea",{ref:_,className:"plan-strip-revise-input",placeholder:"What should change? (optional)",rows:2,value:p,onChange:w=>d(w.target.value),onKeyDown:w=>{w.key==="Escape"?(w.preventDefault(),d(""),f(!1)):w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),v())}}),m.jsxs("div",{className:"prompt-actions plan-strip-actions",children:[m.jsx("button",{className:"btn-ghost",onClick:()=>{d(""),f(!1)},children:"Back"}),m.jsx("span",{className:"plan-strip-spacer"}),m.jsxs("button",{className:"btn-primary plan-strip-primary",onClick:v,children:["Revise",m.jsx(US,{size:13})]})]})]}):m.jsxs("div",{className:"prompt-actions plan-strip-actions",children:[m.jsx("button",{className:"btn-ghost",onClick:r,children:"Reject"}),m.jsx("button",{className:"btn-ghost",onClick:()=>f(!0),children:"Revise…"}),m.jsx("span",{className:"plan-strip-spacer"}),m.jsxs("div",{className:"plan-strip-approve",ref:o,children:[m.jsx("button",{className:"btn-primary plan-strip-primary",onClick:()=>n("auto"),children:"Accept and auto mode"}),m.jsx("button",{className:"btn-primary plan-strip-primary plan-strip-caret","aria-label":"More approval options",onClick:()=>u(w=>!w),children:m.jsx(cs,{size:13})}),l&&m.jsx("div",{className:"plan-strip-menu",children:m.jsx("button",{onClick:()=>{u(!1),n("bypass")},children:"Accept and bypass all"})})]})]})]})}function Cw({onSaved:e}){const[t,n]=q.useState(""),[r,a]=q.useState(!1),[l,u]=q.useState(null);async function o(c){if(c.preventDefault(),!(r||!t.trim())){a(!0),u(null);try{e(await dT(t.trim())),n("")}catch(f){u(f instanceof Error?f.message:String(f))}finally{a(!1)}}}return m.jsxs("form",{className:"onb-token-form",onSubmit:o,children:[m.jsx("input",{type:"password",value:t,onChange:c=>n(c.target.value),placeholder:"ghp_… personal access token",autoComplete:"off"}),m.jsx("button",{type:"submit",className:"btn",disabled:r||!t.trim(),children:r?"Checking…":"Save"}),m.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,workflow&description=orx",target:"_blank",rel:"noreferrer",children:"Create a token ↗"}),l&&m.jsx("div",{className:"error",children:l})]})}function Mj(e){switch(e){case"modal_job":return"Modal";case"hf_job":return"Hugging Face";case"k8s_job":return"Kubernetes";case"ssh_job":return"SSH";case"slurm_job":return"Slurm";case"openresearch_job":return"OpenResearch";case"local_job":return"This machine";default:return e||"—"}}function jj({size:e=16}){return m.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",children:[m.jsx("path",{d:"M2.25 11.535c0-3.407 1.847-6.554 4.844-8.258a9.822 9.822 0 019.687 0c2.997 1.704 4.844 4.851 4.844 8.258 0 5.266-4.337 9.535-9.687 9.535S2.25 16.8 2.25 11.535z",fill:"#FF9D0B"}),m.jsx("path",{d:"M11.938 20.086c4.797 0 8.687-3.829 8.687-8.551 0-4.722-3.89-8.55-8.687-8.55-4.798 0-8.688 3.828-8.688 8.55 0 4.722 3.89 8.55 8.688 8.55z",fill:"#FFD21E"}),m.jsx("path",{d:"M11.875 15.113c2.457 0 3.25-2.156 3.25-3.263 0-.576-.393-.394-1.023-.089-.582.283-1.365.675-2.224.675-1.798 0-3.25-1.693-3.25-.586 0 1.107.79 3.263 3.25 3.263h-.003z",fill:"#FF323D"}),m.jsx("path",{d:"M14.76 9.21c.32.108.445.753.767.585.447-.233.707-.708.659-1.204a1.235 1.235 0 00-.879-1.059 1.262 1.262 0 00-1.33.394c-.322.384-.377.92-.14 1.36.153.283.638-.177.925-.079l-.002.003zm-5.887 0c-.32.108-.448.753-.768.585a1.226 1.226 0 01-.658-1.204c.048-.495.395-.913.878-1.059a1.262 1.262 0 011.33.394c.322.384.377.92.14 1.36-.152.283-.64-.177-.925-.079l.003.003z",fill:"#3A3B45"}),m.jsx("path",{d:"M17.812 10.366a.806.806 0 00.813-.8c0-.441-.364-.8-.813-.8a.806.806 0 00-.812.8c0 .442.364.8.812.8zm-11.624 0a.806.806 0 00.812-.8c0-.441-.364-.8-.812-.8a.806.806 0 00-.813.8c0 .442.364.8.813.8z",fill:"#3A3B45"}),m.jsx("path",{d:"M4.515 13.073c-.405 0-.765.162-1.017.46a1.455 1.455 0 00-.333.925 1.801 1.801 0 00-.485-.074c-.387 0-.737.146-.985.409a1.41 1.41 0 00-.2 1.722 1.302 1.302 0 00-.447.694c-.06.222-.12.69.2 1.166a1.267 1.267 0 00-.093 1.236c.238.533.81.958 1.89 1.405l.24.096c.768.3 1.473.492 1.478.494.89.243 1.808.375 2.732.394 1.465 0 2.513-.443 3.115-1.314.93-1.342.842-2.575-.274-3.763l-.151-.154c-.692-.684-1.155-1.69-1.25-1.912-.195-.655-.71-1.383-1.562-1.383-.46.007-.889.233-1.15.605-.25-.31-.495-.553-.715-.694a1.87 1.87 0 00-.993-.312zm14.97 0c.405 0 .767.162 1.017.46.216.262.333.588.333.925.158-.047.322-.071.487-.074.388 0 .738.146.985.409a1.41 1.41 0 01.2 1.722c.22.178.377.422.445.694.06.222.12.69-.2 1.166.244.37.279.836.093 1.236-.238.533-.81.958-1.889 1.405l-.239.096c-.77.3-1.475.492-1.48.494-.89.243-1.808.375-2.732.394-1.465 0-2.513-.443-3.115-1.314-.93-1.342-.842-2.575.274-3.763l.151-.154c.695-.684 1.157-1.69 1.252-1.912.195-.655.708-1.383 1.56-1.383.46.007.889.233 1.15.605.25-.31.495-.553.718-.694.244-.162.523-.265.814-.3l.176-.012z",fill:"#FF9D0B"}),m.jsx("path",{d:"M9.785 20.132c.688-.994.638-1.74-.305-2.667-.945-.928-1.495-2.288-1.495-2.288s-.205-.788-.672-.714c-.468.074-.81 1.25.17 1.971.977.721-.195 1.21-.573.534-.375-.677-1.405-2.416-1.94-2.751-.532-.332-.907-.148-.782.541.125.687 2.357 2.35 2.14 2.707-.218.362-.983-.42-.983-.42S2.953 14.9 2.43 15.46c-.52.558.398 1.026 1.7 1.803 1.308.778 1.41.985 1.225 1.28-.187.295-3.07-2.1-3.34-1.083-.27 1.011 2.943 1.304 2.745 2.006-.2.7-2.265-1.324-2.685-.537-.425.79 2.913 1.718 2.94 1.725 1.075.276 3.813.859 4.77-.522zm4.432 0c-.687-.994-.64-1.74.305-2.667.943-.928 1.493-2.288 1.493-2.288s.205-.788.675-.714c.465.074.807 1.25-.17 1.971-.98.721.195 1.21.57.534.377-.677 1.407-2.416 1.94-2.751.532-.332.91-.148.782.541-.125.687-2.355 2.35-2.137 2.707.215.362.98-.42.98-.42S21.05 14.9 21.57 15.46c.52.558-.395 1.026-1.7 1.803-1.308.778-1.408.985-1.225 1.28.187.295 3.07-2.1 3.34-1.083.27 1.011-2.94 1.304-2.743 2.006.2.7 2.263-1.324 2.685-.537.423.79-2.912 1.718-2.94 1.725-1.077.276-3.815.859-4.77-.522z",fill:"#FFD21E"})]})}function Lj({size:e=16}){return m.jsxs("svg",{width:e,height:e,viewBox:"0 0 300 300",fill:"none","aria-hidden":"true",children:[m.jsx("path",{d:"M121.683 75.25L149.997 124L91.4816 224.75C90.3128 226.757 88.155 228 85.8174 228H32.9664C31.7976 228 30.6778 227.691 29.697 227.131C28.7161 226.57 27.8906 225.758 27.3021 224.75L0.876625 179.25C-0.292208 177.243 -0.292208 174.765 0.876625 172.75L57.512 75.25C58.0923 74.2425 58.9259 73.43 59.9068 72.8694C60.8876 72.3088 62.0074 72 63.1762 72H116.027C118.365 72 120.523 73.2431 121.692 75.25H121.683ZM299.125 172.75L242.49 75.25C241.91 74.2425 241.076 73.43 240.095 72.8694C239.114 72.3088 237.995 72 236.826 72H183.975C181.637 72 179.479 73.2431 178.311 75.25L149.997 124L208.512 224.75C209.681 226.757 211.839 228 214.177 228H267.027C268.196 228 269.316 227.691 270.297 227.131C271.278 226.57 272.103 225.758 272.692 224.75L299.117 179.25C300.286 177.243 300.286 174.765 299.117 172.75H299.125Z",fill:"#62DE61"}),m.jsx("path",{d:"M89.6018 124H150.005L121.692 75.25C120.523 73.2431 118.365 72 116.027 72H63.1763C62.0074 72 60.8876 72.3088 59.9068 72.8694L89.6018 124Z",fill:"url(#orxModalA)"}),m.jsx("path",{d:"M89.6018 124L59.9068 72.8694C58.9259 73.43 58.1005 74.2425 57.512 75.25L0.876625 172.75C-0.292208 174.765 -0.292208 177.235 0.876625 179.25L27.3021 224.75C27.8825 225.758 28.7161 226.57 29.697 227.131L89.5936 124H89.6018Z",fill:"url(#orxModalB)"}),m.jsx("path",{d:"M149.997 124H89.5936L29.697 227.131C30.6778 227.691 31.7976 228 32.9664 228H85.8174C88.155 228 90.3128 226.757 91.4816 224.75L149.997 124Z",fill:"#09AF58"}),m.jsx("path",{d:"M299.125 179.25C299.706 178.243 300 177.121 300 176H240.61L210.915 227.131C211.896 227.691 213.016 228 214.185 228H267.036C269.373 228 271.531 226.757 272.7 224.75L299.125 179.25Z",fill:"#09AF58"}),m.jsx("path",{d:"M183.975 72C182.806 72 181.686 72.3088 180.705 72.8694L240.602 176H299.992C299.992 174.879 299.698 173.758 299.117 172.75L242.49 75.25C241.321 73.2431 239.163 72 236.826 72H183.967H183.975Z",fill:"url(#orxModalC)"}),m.jsx("path",{d:"M210.907 227.131L240.602 176L180.705 72.8694C179.725 73.43 178.899 74.2425 178.311 75.25L149.997 124L208.512 224.75C209.093 225.758 209.926 226.57 210.907 227.131Z",fill:"url(#orxModalD)"}),m.jsxs("defs",{children:[m.jsxs("linearGradient",{id:"orxModalA",x1:"127.348",y1:"137",x2:"82.9561",y2:"59.6398",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#BFF9B4"}),m.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),m.jsxs("linearGradient",{id:"orxModalB",x1:"7.04774",y1:"214.131",x2:"81.1284",y2:"85.0556",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#80EE64"}),m.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),m.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),m.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),m.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),m.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),m.jsx("stop",{offset:"1",stopColor:"#09AF58"})]}),m.jsxs("linearGradient",{id:"orxModalC",x1:"278.103",y1:"188.561",x2:"204.022",y2:"59.4863",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#BFF9B4"}),m.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),m.jsxs("linearGradient",{id:"orxModalD",x1:"232.804",y1:"214.569",x2:"158.724",y2:"85.4864",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#80EE64"}),m.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),m.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),m.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),m.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),m.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),m.jsx("stop",{offset:"1",stopColor:"#09AF58"})]})]})]})}function Oj({size:e=16}){return m.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"#326CE5","aria-hidden":"true",children:m.jsx("path",{d:"M10.204 14.35l.007.01-.999 2.413a5.171 5.171 0 0 1-2.075-2.597l2.578-.437.004.005a.44.44 0 0 1 .484.606zm-.833-2.129a.44.44 0 0 0 .173-.756l.002-.011L7.585 9.7a5.143 5.143 0 0 0-.73 3.255l2.514-.725.002-.009zm1.145-1.98a.44.44 0 0 0 .699-.337l.01-.005.15-2.62a5.144 5.144 0 0 0-3.01 1.442l2.147 1.523.004-.002zm.76 2.75l.723.349.722-.347.18-.78-.5-.623h-.804l-.5.623.179.779zm1.5-3.095a.44.44 0 0 0 .7.336l.008.003 2.134-1.513a5.188 5.188 0 0 0-2.992-1.442l.148 2.615.002.001zm10.876 5.97l-5.773 7.181a1.6 1.6 0 0 1-1.248.594l-9.261.003a1.6 1.6 0 0 1-1.247-.596l-5.776-7.18a1.583 1.583 0 0 1-.307-1.34L2.1 5.573c.108-.47.425-.864.863-1.073L11.305.513a1.606 1.606 0 0 1 1.385 0l8.345 3.985c.438.209.755.604.863 1.073l2.062 8.955c.108.47-.005.963-.308 1.34zm-3.289-2.057c-.042-.01-.103-.026-.145-.034-.174-.033-.315-.025-.479-.038-.35-.037-.638-.067-.895-.148-.105-.04-.18-.165-.216-.216l-.201-.059a6.45 6.45 0 0 0-.105-2.332 6.465 6.465 0 0 0-.936-2.163c.052-.047.15-.133.177-.159.008-.09.001-.183.094-.282.197-.185.444-.338.743-.522.142-.084.273-.137.415-.242.032-.024.076-.062.11-.089.24-.191.295-.52.123-.736-.172-.216-.506-.236-.745-.045-.034.027-.08.062-.111.088-.134.116-.217.23-.33.35-.246.25-.45.458-.673.609-.097.056-.239.037-.303.033l-.19.135a6.545 6.545 0 0 0-4.146-2.003l-.012-.223c-.065-.062-.143-.115-.163-.25-.022-.268.015-.557.057-.905.023-.163.061-.298.068-.475.001-.04-.001-.099-.001-.142 0-.306-.224-.555-.5-.555-.275 0-.499.249-.499.555l.001.014c0 .041-.002.092 0 .128.006.177.044.312.067.475.042.348.078.637.056.906a.545.545 0 0 1-.162.258l-.012.211a6.424 6.424 0 0 0-4.166 2.003 8.373 8.373 0 0 1-.18-.128c-.09.012-.18.04-.297-.029-.223-.15-.427-.358-.673-.608-.113-.12-.195-.234-.329-.349-.03-.026-.077-.062-.111-.088a.594.594 0 0 0-.348-.132.481.481 0 0 0-.398.176c-.172.216-.117.546.123.737l.007.005.104.083c.142.105.272.159.414.242.299.185.546.338.743.522.076.082.09.226.1.288l.16.143a6.462 6.462 0 0 0-1.02 4.506l-.208.06c-.055.072-.133.184-.215.217-.257.081-.546.11-.895.147-.164.014-.305.006-.48.039-.037.007-.09.02-.133.03l-.004.002-.007.002c-.295.071-.484.342-.423.608.061.267.349.429.645.365l.007-.001.01-.003.129-.029c.17-.046.294-.113.448-.172.33-.118.604-.217.87-.256.112-.009.23.069.288.101l.217-.037a6.5 6.5 0 0 0 2.88 3.596l-.09.218c.033.084.069.199.044.282-.097.252-.263.517-.452.813-.091.136-.185.242-.268.399-.02.037-.045.095-.064.134-.128.275-.034.591.213.71.248.12.556-.007.69-.282v-.002c.02-.039.046-.09.062-.127.07-.162.094-.301.144-.458.132-.332.205-.68.387-.897.05-.06.13-.082.215-.105l.113-.205a6.453 6.453 0 0 0 4.609.012l.106.192c.086.028.18.042.256.155.136.232.229.507.342.84.05.156.074.295.145.457.016.037.043.09.062.129.133.276.442.402.69.282.247-.118.341-.435.213-.71-.02-.039-.045-.096-.065-.134-.083-.156-.177-.261-.268-.398-.19-.296-.346-.541-.443-.793-.04-.13.007-.21.038-.294-.018-.022-.059-.144-.083-.202a6.499 6.499 0 0 0 2.88-3.622c.064.01.176.03.213.038.075-.05.144-.114.28-.104.266.039.54.138.87.256.154.06.277.128.448.173.036.01.088.019.13.028l.009.003.007.001c.297.064.584-.098.645-.365.06-.266-.128-.537-.423-.608zM16.4 9.701l-1.95 1.746v.005a.44.44 0 0 0 .173.757l.003.01 2.526.728a5.199 5.199 0 0 0-.108-1.674A5.208 5.208 0 0 0 16.4 9.7zm-4.013 5.325a.437.437 0 0 0-.404-.232.44.44 0 0 0-.372.233h-.002l-1.268 2.292a5.164 5.164 0 0 0 3.326.003l-1.27-2.296h-.01zm1.888-1.293a.44.44 0 0 0-.27.036.44.44 0 0 0-.214.572l-.003.004 1.01 2.438a5.15 5.15 0 0 0 2.081-2.615l-2.6-.44-.004.005z"})})}function pm({size:e=16}){return m.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:m.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"})})}function Ew({kind:e,size:t=16}){switch(e){case"modal_job":return m.jsx(Lj,{size:t});case"hf_job":return m.jsx(jj,{size:t});case"k8s_job":return m.jsx(Oj,{size:t});case"ssh_job":return m.jsx(Ap,{size:t});case"slurm_job":return m.jsx(DA,{size:t});case"openresearch_job":return m.jsx(zA,{size:t});case"local_job":return m.jsx(hN,{size:t});default:return m.jsx(Ap,{size:t})}}function Bj({backend:e}){const t=ix(e),n=rx(e);return t?m.jsxs("span",{className:"backend-badge",children:[m.jsx(Ew,{kind:t}),m.jsx("span",{className:"backend-name",children:Mj(t)}),n&&m.jsx("span",{className:"backend-detail mono",children:n})]}):m.jsx("span",{className:"backend-badge muted",children:"—"})}const z1={done:{className:"st-done",live:!1},failed:{className:"st-failed",live:!1},running:{className:"st-running",live:!0},starting:{className:"st-starting",live:!0},cancelled:{className:"st-cancelled",live:!1},editing:{className:"st-editing",live:!0},idle:{className:"st-idle",live:!1}};function Ij(e){return z1[e]??z1.idle}function Vo({status:e,label:t}){const n=Ij(e);return m.jsxs("span",{className:`status-badge ${n.className}${n.live?" live":""}`,children:[m.jsx("span",{className:"dot"}),t??e]})}function lp(e){return e.installed&&e.authenticated?{cls:"ok",label:"Connected"}:e.installed?{cls:"warn",label:"Not signed in"}:{cls:"warn",label:"Not installed"}}function zj({h:e}){return e.authMethod?m.jsx(m.Fragment,{children:e.authMethod==="oauth"?"OAuth (subscription login)":"API key"}):m.jsx(m.Fragment,{children:"—"})}function Hj(){const[e,t]=q.useState(null),[n,r]=q.useState("claude-code"),[a,l]=q.useState(!1),u=c=>{l(!0),wg(c).then(t).catch(()=>{}).finally(()=>l(!1))};q.useEffect(()=>u(!1),[]);const o=e==null?void 0:e.find(c=>c.id===n);return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Harnesses"}),m.jsx("p",{className:"settings-sub",children:"Coding-agent setups detected on this machine. The research agent chat is served by OpenCode; Claude Code and Codex accounts surface their models in the composer's model picker."}),m.jsx("div",{className:"harness-tabs",children:(e??[]).map(c=>m.jsxs("button",{className:c.id===n?"active":"",onClick:()=>r(c.id),children:[c.name,m.jsx("span",{className:`harness-dot ${lp(c).cls}`})]},c.id))}),e?o?m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("span",{className:`badge ${lp(o).cls}`,children:lp(o).label}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsxs("button",{className:"btn sm",onClick:()=>u(!0),disabled:a,children:[m.jsx(Su,{size:12,className:a?"spin":""})," Refresh"]})]}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Binary"}),m.jsx("span",{className:"v",children:o.binPath??"not found on PATH"}),m.jsx("span",{className:"k",children:"Version"}),m.jsx("span",{className:"v",children:o.version??"—"}),m.jsx("span",{className:"k",children:"Auth"}),m.jsx("span",{className:"v",children:m.jsx(zj,{h:o})}),o.account&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:o.id==="opencode"?"Providers":"Account"}),m.jsx("span",{className:"v",children:o.account})]}),o.org&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Org"}),m.jsx("span",{className:"v",children:o.org})]}),o.plan&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Plan"}),m.jsx("span",{className:"v",children:o.plan})]}),m.jsx("span",{className:"k",children:"Agent models"}),m.jsx("span",{className:"v",children:o.models.length>0?`${o.models.length} available — ${o.models.slice(0,4).map(c=>xu(c.id)).join(", ")}${o.models.length>4?", …":""}`:"none"})]}),!o.agentReady&&o.agentNote&&m.jsx("p",{className:"settings-note",children:o.agentNote})]}):null:m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Detecting harnesses…"]})]})}function Fj({s:e}){if(!e.configured)return m.jsx("span",{className:"badge",children:"not configured"});const t=e.preflight;return t.kubectlFound?t.reachable?t.canCreateJobs?m.jsx("span",{className:"badge ok",children:"connected"}):m.jsx("span",{className:"badge err",children:"no job-create permission"}):m.jsx("span",{className:"badge err",children:"cluster unreachable"}):m.jsx("span",{className:"badge err",children:"kubectl not found"})}function Pj(){const[e,t]=q.useState(null),[n,r]=q.useState(null),[a,l]=q.useState(""),[u,o]=q.useState(""),[c,f]=q.useState(!1),[p,d]=q.useState(null),_=C=>{t(C),l(C.context??""),o(C.namespace)};q.useEffect(()=>{YN().then(_).catch(C=>r(C instanceof Error?C.message:String(C)))},[]);const v=e!==null&&a===(e.context??"")&&u.trim()===e.namespace;async function w(C){if(C.preventDefault(),!c){f(!0),d(null);try{_(await WN({context:a,namespace:u.trim()}))}catch(b){d(b instanceof Error?b.message:String(b))}finally{f(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run on your own cluster with ",m.jsx("code",{children:"--backend k8s"}),". The run's resources (image, GPUs, topology) come from a manifest committed on the experiment branch (default ",m.jsx("code",{children:".orx/k8s.yaml"}),"); only the cluster context and namespace live here. Auth comes from your kubeconfig."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Cluster"}),m.jsx("span",{className:"v",children:m.jsx(Fj,{s:e})})]}),e.preflight.error&&m.jsx("p",{className:"settings-note",children:e.preflight.error}),m.jsxs("form",{className:"form settings-form",onSubmit:w,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Context",m.jsxs("select",{value:a,onChange:C=>l(C.target.value),children:[m.jsxs("option",{value:"",children:["kubectl default",e.currentContext?` (${e.currentContext})`:""]}),e.contexts.map(C=>m.jsx("option",{value:C,children:C},C))]})]}),m.jsxs("label",{children:["Namespace",m.jsx("input",{className:"mono",type:"text",value:u,onChange:C=>o(C.target.value),placeholder:"default",autoComplete:"off",spellCheck:!1})]})]}),p&&m.jsx("div",{className:"error",children:p}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:c||v,children:c?"Saving…":"Save"})})]}),m.jsxs("div",{className:"settings-card",children:[m.jsx("div",{className:"settings-card-head",children:m.jsx("h3",{children:"Run manifest"})}),m.jsxs("p",{className:"settings-sub",children:["Each run applies the manifest committed on its experiment branch — default"," ",m.jsx("code",{children:".orx/k8s.yaml"}),", or ",m.jsx("code",{children:"--manifest "}),". It declares whatever the run needs (image, GPU requests, an Indexed Job across nodes, extra Services, …); orx injects the run script as ",m.jsx("code",{children:"$ORX_SCRIPT"}),", the"," ",m.jsx("code",{children:"orx-env"})," Secret, run labels, and a default timeout, and requires exactly one Job (or one labelled ",m.jsx("code",{children:'orx-primary: "true"'}),") whose completion is the run's. Logs follow that Job's leader pod. Use"," ",m.jsx("code",{children:"{{ORX_RUN}}"})," in resource names to keep re-runs collision-free."]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking kubectl…"]})]})}const Uj={env:"MODAL_TOKEN_ID env var",syncedEnv:"~/.openresearch/env",modalToml:"~/.modal.toml (modal token new)"};function $j({s:e}){return e.ready?m.jsx("span",{className:"badge ok",children:"connected"}):!e.tokenConfigured&&!e.modalImportable?m.jsx("span",{className:"badge",children:"not set up"}):e.modalImportable?e.tokenConfigured?m.jsx("span",{className:"badge",children:"unknown"}):m.jsx("span",{className:"badge err",children:"no token"}):m.jsx("span",{className:"badge err",children:e.envProvisioned?"env broken":"env not built"})}function Gj(){const[e,t]=q.useState(null),[n,r]=q.useState(null),[a,l]=q.useState(!1),[u,o]=q.useState(null);q.useEffect(()=>{XN().then(t).catch(f=>r(f instanceof Error?f.message:String(f)))},[]);async function c(){if(!a){l(!0),o(null);try{t(await KN())}catch(f){o(f instanceof Error?f.message:String(f))}finally{l(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Serverless GPUs on your own Modal account with"," ",m.jsx("code",{children:"--backend modal --flavor "})," (t4, a10g, a100-80gb, h100, …). orx manages a dedicated Python env with the Modal SDK; sandboxes scale to zero between runs."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Status"}),m.jsx("span",{className:"v",children:m.jsx($j,{s:e})}),m.jsx("span",{className:"k",children:"Environment"}),m.jsx("span",{className:"v",children:e.modalImportable?"ready":e.envProvisioned?"provisioned (modal import failing)":"not built yet"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.tokenSource?Uj[e.tokenSource]:"not configured"})]}),!e.tokenConfigured&&m.jsxs("p",{className:"settings-note",children:["No Modal token found. Run ",m.jsx("code",{children:"modal token new"}),", or add"," ",m.jsx("code",{children:"MODAL_TOKEN_ID"})," and ",m.jsx("code",{children:"MODAL_TOKEN_SECRET"})," in the Environment tab."]}),e.error&&e.envProvisioned&&!e.modalImportable&&m.jsx("p",{className:"settings-note",children:e.error}),u&&m.jsx("div",{className:"error",children:u}),!e.modalImportable&&m.jsx("div",{className:"actions",children:m.jsx("button",{className:"btn primary",onClick:()=>void c(),disabled:a,children:a?"Setting up… (~30–60s)":"Set up environment"})})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking Modal…"]})]})}function qj({test:e}){if(e===void 0)return m.jsx("span",{className:"muted",children:"never tested"});if(e==="testing")return m.jsx("span",{className:"spinner"});const t=e.reachable?e.gitFound?m.jsx("span",{className:"badge ok",children:"ready"}):m.jsx("span",{className:"badge err",children:"no git"}):m.jsx("span",{className:"badge err",title:e.error??void 0,children:"unreachable"});return m.jsxs(m.Fragment,{children:[t,m.jsx("span",{className:"ssh-tested-at",children:Sa(e.testedAt)})]})}function Vj(){const[e,t]=q.useState(null),[n,r]=q.useState({});q.useEffect(()=>{nT().then(t).catch(()=>t([]))},[]);async function a(l){r(u=>({...u,[l]:"testing"}));try{const u=await iT(l);r(o=>({...o,[l]:u}))}catch(u){r(o=>({...o,[l]:{reachable:!1,gitFound:!1,error:u instanceof Error?u.message:String(u),testedAt:Date.now()}}))}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run experiments directly on your own boxes with"," ",m.jsx("code",{children:"--backend ssh --host "}),". Hosts come from"," ",m.jsx("code",{children:"~/.ssh/config"}),"; auth uses your keys/agent (orx never reads a key). The host just needs ",m.jsx("code",{children:"git"})," and ",m.jsx("code",{children:"bash"}),"."]}),e===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Reading ~/.ssh/config…"]}):e.length===0?m.jsx("p",{className:"settings-empty",children:"No hosts found in ~/.ssh/config."}):m.jsxs("table",{className:"flavor-table ssh-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Host"}),m.jsx("th",{children:"Address"}),m.jsx("th",{children:"Identity"}),m.jsx("th",{children:"Status"}),m.jsx("th",{})]})}),m.jsx("tbody",{children:e.map(l=>m.jsxs("tr",{children:[m.jsx("td",{className:"mono",children:l.host}),m.jsxs("td",{className:"mono muted",children:[[l.user,l.hostname??"—"].filter(Boolean).join("@"),l.port?`:${l.port}`:""]}),m.jsx("td",{className:"mono muted",children:l.identityFile??"—"}),m.jsx("td",{children:m.jsx(qj,{test:n[l.host]??l.lastTest})}),m.jsx("td",{children:m.jsx("button",{className:"btn sm",onClick:()=>void a(l.host),disabled:n[l.host]==="testing",children:"Test"})})]},l.host))})]})]})}function Yj({test:e}){return e===null?null:e==="testing"?m.jsx("span",{className:"spinner"}):e.reachable?e.slurmFound?e.gitFound?m.jsx("span",{className:"badge ok",children:"ready"}):m.jsx("span",{className:"badge err",children:"no git"}):m.jsx("span",{className:"badge err",children:"no slurm CLI"}):m.jsx("span",{className:"badge err",title:e.error??void 0,children:"unreachable"})}function Wj(){const[e,t]=q.useState(null),[n,r]=q.useState(null),[a,l]=q.useState(""),[u,o]=q.useState(""),[c,f]=q.useState(""),[p,d]=q.useState(""),[_,v]=q.useState(!1),[w,C]=q.useState(null),[b,S]=q.useState(null),x=b!==null&&b!=="testing"?b:null,y=D=>{t(D),l(D.host??""),o(D.partition??""),f(D.account??""),d(D.timeLimit??"")};q.useEffect(()=>{rT().then(y).catch(D=>r(D instanceof Error?D.message:String(D)))},[]);const E=e!==null&&a===(e.host??"")&&u.trim()===(e.partition??"")&&c.trim()===(e.account??"")&&p.trim()===(e.timeLimit??"");async function R(D){if(D.preventDefault(),!_){v(!0),C(null);try{y(await sT({host:a,partition:u.trim(),account:c.trim(),timeLimit:p.trim()}))}catch(T){C(T instanceof Error?T.message:String(T))}finally{v(!1)}}}async function N(D){S("testing");try{S(await aT(D))}catch(T){S({reachable:!1,slurmFound:!1,gitFound:!1,partitions:[],error:T instanceof Error?T.message:String(T)})}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run on your own cluster with ",m.jsx("code",{children:"--backend slurm [--flavor h100:2]"}),". orx submits via ",m.jsx("code",{children:"sbatch"})," on the login node over ssh (auth is your keys/agent; orx never reads a key) and the job runs in your cluster environment. The defaults below apply when a launch doesn't override them."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[(x==null?void 0:x.error)&&m.jsx("p",{className:"settings-note",children:x.error}),x&&x.partitions.length>0&&m.jsxs("p",{className:"settings-note",children:["Partitions: ",m.jsx("code",{children:x.partitions.join(", ")})]}),m.jsxs("form",{className:"form settings-form",onSubmit:R,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Login node",m.jsxs("select",{value:a,onChange:D=>{l(D.target.value),S(null)},children:[m.jsx("option",{value:"",children:"not set (pass --host per launch)"}),a&&!e.hosts.some(D=>D.host===a)&&m.jsxs("option",{value:a,children:[a," (not in ~/.ssh/config)"]}),e.hosts.map(D=>m.jsx("option",{value:D.host,children:D.host},D.host))]})]}),m.jsxs("label",{children:["Partition",m.jsx("input",{className:"mono",type:"text",list:"slurm-partitions",value:u,onChange:D=>o(D.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1}),m.jsx("datalist",{id:"slurm-partitions",children:x==null?void 0:x.partitions.map(D=>m.jsx("option",{value:D},D))})]})]}),m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Account",m.jsx("input",{className:"mono",type:"text",value:c,onChange:D=>f(D.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1})]}),m.jsxs("label",{children:["Time limit",m.jsx("input",{className:"mono",type:"text",value:p,onChange:D=>d(D.target.value),placeholder:"cluster default (e.g. 4h, 30m)",autoComplete:"off",spellCheck:!1})]})]}),w&&m.jsx("div",{className:"error",children:w}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"submit",className:"btn primary",disabled:_||E,children:_?"Saving…":"Save"}),m.jsx("button",{type:"button",className:"btn",onClick:()=>void N(a),disabled:!a||b==="testing",title:a?void 0:"Pick a login node first",children:"Test connection"}),m.jsx(Yj,{test:b})]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading slurm settings…"]})]})}function Xj(){const[e,t]=q.useState(null),[n,r]=q.useState(null);return q.useEffect(()=>{lT().then(t).catch(a=>r(a instanceof Error?a.message:String(a)))},[]),m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run experiments as detached, supervised processes on the machine running orx with"," ",m.jsx("code",{children:"--backend local"})," — handy when you're already on a GPU box and using this dashboard over port forwarding. Runs share CPU/RAM/GPU with the dashboard itself, so prefer a remote backend for anything heavy."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Hostname"}),m.jsx("span",{className:"v mono",children:e.hostname}),m.jsx("span",{className:"k",children:"System"}),m.jsxs("span",{className:"v",children:[e.os,"/",e.arch,e.chip?` — ${e.chip}`:""]}),m.jsx("span",{className:"k",children:"CPU"}),m.jsx("span",{className:"v",children:e.cpuCount>0?`${e.cpuCount} cores`:"—"}),m.jsx("span",{className:"k",children:"RAM"}),m.jsx("span",{className:"v",children:e.memBytes!==null?ns(e.memBytes):"—"}),m.jsx("span",{className:"k",children:"GPUs"}),m.jsx("span",{className:"v",children:e.gpus.length===0?"none detected (nvidia-smi)":e.gpus.map(a=>`${a.name}${a.memMib!==null?` — ${ns(a.memMib*1024*1024)}`:""}`).join(", ")})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Detecting hardware…"]})]})}function Kj(){const[e,t]=q.useState(null),[n,r]=q.useState(null);return q.useEffect(()=>{cT().then(t).catch(a=>r(a instanceof Error?a.message:String(a)))},[]),m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run on an ephemeral OpenResearch box billed to your org with"," ",m.jsx("code",{children:"--backend openresearch --flavor "})," (h100_sxm, cpu5c, …; browse with ",m.jsx("code",{children:"orx compute"}),"). The box is provisioned for the run and deleted when it ends. Needs ",m.jsx("code",{children:"orx login"})," and a registered SSH key."]}),n?m.jsx("div",{className:"error",children:n}):e?e.loggedIn?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Status"}),m.jsx("span",{className:"v",children:m.jsx("span",{className:"badge ok",children:"signed in"})}),m.jsx("span",{className:"k",children:"Orgs"}),m.jsx("span",{className:"v",children:e.orgs.length>0?e.orgs.join(", "):"—"}),m.jsx("span",{className:"k",children:"SSH key"}),m.jsx("span",{className:"v",children:e.sshKeyRegistered===!0?m.jsx("span",{className:"badge ok",children:"registered"}):e.sshKeyRegistered===!1?m.jsx("span",{className:"badge err",children:"none registered"}):m.jsx("span",{className:"badge",children:"unknown"})})]}),e.sshKeyRegistered===!1&&m.jsxs("p",{className:"settings-note",children:["Launches need a registered SSH key. Add one with"," ",m.jsx("code",{children:"orx ssh-key add ~/.ssh/id_ed25519.pub"}),"."]}),e.error&&m.jsx("p",{className:"settings-note",children:e.error})]}):m.jsxs("p",{className:"settings-note",children:["Not signed in. Run ",m.jsx("code",{children:"orx login"})," in a terminal to connect your OpenResearch account."]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking credentials…"]})]})}const H1={local:"This machine",hf:"HF Jobs",modal:"Modal",k8s:"Kubernetes",ssh:"SSH",slurm:"Slurm",openresearch:"OpenResearch"},Zj={local:"local_job",hf:"hf_job",modal:"modal_job",k8s:"k8s_job",ssh:"ssh_job",slurm:"slurm_job",openresearch:"openresearch_job"},Qj=["hf","modal","slurm","openresearch"],F1=["hf","modal","openresearch"],P1={hf:["cpu-basic","t4-small","a10g-small","a10g-large","a100-large","h100","h200"],modal:["cpu","t4","l4","a10g","a100","a100-80gb","l40s","h100","h100:2"],slurm:["gpu","h100:1","h100:2","a100:4"],openresearch:["h100_sxm","h100_sxm:2","cpu5c","cpu5g","cpu5m"]};function Jj({t:e,isDefault:t}){return e.id==="local"?m.jsx("span",{className:"badge ok",children:"ready"}):!e.configured&&t?m.jsx("span",{className:"badge warn",children:"not configured"}):e.configured?m.jsx("span",{className:"badge ok",children:"configured"}):m.jsx("span",{className:"badge",children:"not set up"})}function eL({target:e,flavor:t,onSaved:n}){var d;const[r,a]=q.useState(t??""),[l,u]=q.useState(!1),[o,c]=q.useState(null);q.useEffect(()=>a(t??""),[t]);async function f(_){if(_.preventDefault(),!l){u(!0),c(null);try{n(await tx({backend:e,flavor:r.trim()||null}))}catch(v){c(v instanceof Error?v.message:String(v))}finally{u(!1)}}}const p=r.trim()===(t??"");return m.jsxs("form",{className:"form settings-form compute-flavor-form",onSubmit:f,children:[m.jsxs("label",{children:["Default flavor",m.jsx("input",{className:"mono",type:"text",list:`flavors-${e}`,value:r,onChange:_=>a(_.target.value),placeholder:F1.includes(e)?`e.g. ${((d=P1[e])==null?void 0:d[1])??""}`:"none (CPU-only)",autoComplete:"off",spellCheck:!1}),m.jsx("datalist",{id:`flavors-${e}`,children:(P1[e]??[]).map(_=>m.jsx("option",{value:_},_))})]}),o&&m.jsx("div",{className:"error",children:o}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"submit",className:"btn sm",disabled:l||p,children:l?"Saving…":"Save flavor"}),F1.includes(e)&&!t&&m.jsxs("span",{className:"muted compute-flavor-hint",children:["This backend requires a flavor — without a default one, each launch must pass"," ",m.jsx("code",{children:"--flavor"}),"."]})]})]})}function tL({target:e,isDefault:t,defaultFlavor:n,open:r,onToggle:a,onSettings:l,onError:u}){const[o,c]=q.useState(!1),[f,p]=q.useState(!1);r&&!o&&c(!0);async function d(_){if(!f){p(!0);try{l(await tx({backend:_}))}catch(v){u(v instanceof Error?v.message:String(v))}finally{p(!1)}}}return m.jsxs("div",{className:`compute-row${r?" open":""}`,children:[m.jsxs("div",{className:"compute-row-head",onClick:a,children:[m.jsx("span",{className:"compute-row-logo",children:m.jsx(Ew,{kind:Zj[e.id],size:18})}),m.jsx("span",{className:"compute-row-name",children:H1[e.id]}),m.jsx("span",{className:"compute-row-summary",children:e.summary}),m.jsx(Jj,{t:e,isDefault:t}),t?m.jsx("span",{className:"badge compute-default-pill",children:"Default"}):m.jsx("button",{type:"button",className:"btn sm compute-make-default",onClick:_=>{_.stopPropagation(),d(e.id)},disabled:f,children:"Make default"}),m.jsx("button",{type:"button",className:"compute-chevron-btn","aria-expanded":r,"aria-label":`${r?"Collapse":"Expand"} ${H1[e.id]}`,onClick:_=>{_.stopPropagation(),a()},children:m.jsx(cs,{size:16,className:"compute-chevron"})})]}),o&&m.jsxs("div",{className:"compute-row-body",hidden:!r,children:[t&&m.jsxs("p",{className:"settings-note compute-default-note",children:["The agent launches runs here unless you tell it otherwise, and so does"," ",m.jsx("code",{children:"orx exp run"})," with no ",m.jsx("code",{children:"--backend"})," flag."," ",m.jsx("button",{type:"button",className:"btn sm",onClick:()=>void d(null),disabled:f,children:"Clear default"})]}),t&&!e.configured&&m.jsx("p",{className:"settings-note",children:"This target is the default but isn't configured — launches will fail until it's set up below."}),t&&Qj.includes(e.id)&&m.jsx(eL,{target:e.id,flavor:n,onSaved:l}),e.id==="local"&&m.jsx(Xj,{}),e.id==="hf"&&m.jsx(aL,{}),e.id==="modal"&&m.jsx(Gj,{}),e.id==="k8s"&&m.jsx(Pj,{}),e.id==="ssh"&&m.jsx(Vj,{}),e.id==="slurm"&&m.jsx(Wj,{}),e.id==="openresearch"&&m.jsx(Kj,{})]})]})}function nL(){const[e,t]=q.useState(null),[n,r]=q.useState(null),[a,l]=q.useState(null),[u,o]=q.useState(null),c=q.useRef(0);q.useEffect(()=>{const d=++c.current;oT().then(_=>{d===c.current&&(t(_),r(null))}).catch(_=>{if(d!==c.current)return;const v=_ instanceof Error?_.message:String(_);t(w=>(w===null?r(v):o(v),w))})},[a]);const f=d=>{c.current++,t(d),o(null)},p=e?e.targets:null;return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Compute"}),m.jsxs("p",{className:"settings-sub",children:["Where ",m.jsx("code",{children:"orx exp run"})," executes. Pick a default target; the agent uses it when a launch doesn't name a backend (",m.jsx("code",{children:"--backend "})," always wins)."]}),n?m.jsx("div",{className:"error",children:n}):p?m.jsxs(m.Fragment,{children:[u&&m.jsx("div",{className:"error",children:u}),m.jsx("div",{className:"compute-list",children:p.map(d=>m.jsx(tL,{target:d,isDefault:(e==null?void 0:e.defaultBackend)===d.id,defaultFlavor:(e==null?void 0:e.defaultFlavor)??null,open:a===d.id,onToggle:()=>l(_=>_===d.id?null:d.id),onSettings:f,onError:o},d.id))}),m.jsxs("p",{className:"compute-footnote",children:[m.jsx(cN,{size:14,"aria-hidden":"true"}),m.jsx("span",{children:"The default target and flavor are included in the research agent's instructions — it launches runs there unless you name another backend. No other compute settings are shared with it."})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking compute targets…"]})]})}const iL={env:"HF_TOKEN env var",openresearchEnv:"~/.openresearch/env",hfCache:"~/.cache/huggingface/token (hf auth login)"};function rL({settings:e}){return e.configured?e.valid?m.jsx("span",{className:"badge ok",children:"connected"}):m.jsx("span",{className:"badge err",children:"invalid token"}):m.jsx("span",{className:"badge",children:"not configured"})}function sL({settings:e}){return!e.configured||!e.valid?null:e.jobsWrite===!0?m.jsx("span",{className:"badge ok",children:"jobs: write OK"}):e.jobsWrite===!1?m.jsx("span",{className:"badge err",children:"no job.write permission"}):m.jsx("span",{className:"badge",children:"jobs permission unknown"})}function aL(){const[e,t]=q.useState(null),[n,r]=q.useState(null),[a,l]=q.useState(""),[u,o]=q.useState(!1),[c,f]=q.useState(null),p=q.useRef(!1);q.useEffect(()=>{qN().then(_=>{p.current||t(_)}).catch(_=>{p.current||r(_ instanceof Error?_.message:String(_))})},[]);async function d(_){if(_.preventDefault(),!(!a.trim()||u)){o(!0),f(null);try{const v=await VN(a.trim());p.current=!0,t(v),r(null),l("")}catch(v){f(v instanceof Error?v.message:String(v))}finally{o(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run experiments on your Hugging Face account with"," ",m.jsx("code",{children:"--backend hf --flavor "})," (t4-small, a10g-small, a100-large, …). Billed to HF per minute."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Status"}),m.jsx("span",{className:"v",children:m.jsx(rL,{settings:e})}),m.jsx("span",{className:"k",children:"Account"}),m.jsx("span",{className:"v",children:e.username??"—"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.maskedToken??"—"}),m.jsx("span",{className:"k",children:"Source"}),m.jsx("span",{className:"v",children:e.source?iL[e.source]:"not configured"}),m.jsx("span",{className:"k",children:"Jobs"}),m.jsxs("span",{className:"v",children:[m.jsx(sL,{settings:e}),(!e.configured||!e.valid)&&"—"]})]}),e.source==="env"&&m.jsx("p",{className:"settings-note",children:"HF_TOKEN is set in the environment and overrides any token saved here."}),e.valid&&e.jobsWrite===null&&m.jsxs("p",{className:"settings-note",children:["This token is valid but doesn't report whether it can launch Jobs — OAuth tokens from ",m.jsx("code",{children:"hf auth login"})," never do. Launches may still work; for a definitive check, save a write-scoped token from"," ",m.jsx("a",{href:"https://huggingface.co/settings/tokens",target:"_blank",rel:"noreferrer",children:"huggingface.co/settings/tokens"}),"."]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading status…"]}),m.jsxs("form",{className:"form settings-form",onSubmit:d,children:[m.jsxs("label",{children:[e!=null&&e.configured?"Replace token":"New token",m.jsx("input",{type:"password",value:a,onChange:_=>l(_.target.value),placeholder:"hf_…",autoComplete:"off"})]}),c&&m.jsx("div",{className:"error",children:c}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:!a.trim()||u,children:u?"Validating…":"Save"})})]})]})}const kw=/^hf_[A-Za-z0-9]{10,}$/;function Aw(){return m.jsx("tr",{children:m.jsx("td",{colSpan:3,children:m.jsxs("p",{className:"settings-note",children:["This value looks like a Hugging Face token — compute runs only read it from"," ",m.jsx("code",{children:"HF_TOKEN"}),". Save it under that key if it's meant for HF Jobs."]})})})}const U1=["HF_TOKEN","WANDB_API_KEY"];function oL({name:e,entry:t,onVars:n,onError:r}){const[a,l]=q.useState(""),[u,o]=q.useState(!1),c=d=>r(`${e}: ${d instanceof Error?d.message:String(d)}`);async function f(){if(!(!a.trim()||u)){o(!0);try{n(await JS(e,a.trim())),l("")}catch(d){c(d)}finally{o(!1)}}}async function p(){if(!u){o(!0);try{n(await QN(e))}catch(d){c(d)}finally{o(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("tr",{children:[m.jsx("td",{className:"mono",children:e}),m.jsx("td",{className:"mono muted",children:t?m.jsxs(m.Fragment,{children:[t.maskedValue,t.inProcessEnv&&m.jsx("span",{className:"badge",children:"overridden by env"})]}):m.jsx("input",{className:"mono",type:"password",value:a,onChange:d=>l(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),f()),d.key==="Escape"&&!u&&l("")},placeholder:"value","aria-label":`Value for ${e}`,autoComplete:"new-password",disabled:u})}),m.jsx("td",{children:t?m.jsx("button",{className:"icon-btn",title:`Delete ${e}`,"aria-label":`Delete ${e}`,onClick:()=>void p(),disabled:u,children:m.jsx(Gu,{size:13})}):a.trim()&&m.jsx("button",{className:"btn sm",onClick:()=>void f(),disabled:u,children:u?"Saving…":"Save"})})]}),!t&&e!=="HF_TOKEN"&&kw.test(a.trim())&&m.jsx(Aw,{})]})}function lL({onVars:e,onError:t,onDone:n}){const[r,a]=q.useState(""),[l,u]=q.useState(""),[o,c]=q.useState(!1);async function f(){if(!(!r.trim()||!l.trim()||o)){c(!0);try{e(await JS(r.trim(),l.trim())),n()}catch(d){t(`${r.trim()}: ${d instanceof Error?d.message:String(d)}`)}finally{c(!1)}}}const p=d=>{d.key==="Enter"&&(d.preventDefault(),f()),d.key==="Escape"&&!o&&n()};return m.jsxs(m.Fragment,{children:[m.jsxs("tr",{children:[m.jsx("td",{children:m.jsx("input",{autoFocus:!0,className:"mono",type:"text",value:r,onChange:d=>a(d.target.value),onKeyDown:p,placeholder:"MY_API_KEY","aria-label":"New variable key",autoComplete:"off",spellCheck:!1,disabled:o})}),m.jsx("td",{children:m.jsx("input",{className:"mono",type:"password",value:l,onChange:d=>u(d.target.value),onKeyDown:p,placeholder:"value","aria-label":"New variable value",autoComplete:"new-password",disabled:o})}),m.jsxs("td",{children:[m.jsx("button",{className:"btn sm",onClick:()=>void f(),disabled:o||!r.trim()||!l.trim(),children:o?"Saving…":"Save"}),m.jsx("button",{className:"icon-btn",title:"Cancel","aria-label":"Cancel new variable",onClick:n,disabled:o,children:m.jsx(Fo,{size:13})})]})]}),r.trim()!=="HF_TOKEN"&&kw.test(l.trim())&&m.jsx(Aw,{})]})}function cL(){const[e,t]=q.useState(null),[n,r]=q.useState(null),[a,l]=q.useState(!1),[u,o]=q.useState(null);q.useEffect(()=>{ZN().then(t).catch(d=>r(d instanceof Error?d.message:String(d)))},[]);const c=d=>{t(d),o(null)},f=e===null?[]:e.map(d=>d.key).filter(d=>!U1.includes(d)),p=[...U1,...f];return m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Environment variables"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsxs("button",{className:"btn sm",onClick:()=>l(!0),disabled:a||e===null,children:[m.jsx(bg,{size:12})," Add variable"]})]}),m.jsxs("p",{className:"settings-sub",children:["Stored in ",m.jsx("code",{children:"~/.openresearch/env"})," and passed to runs and the research agent."," ",m.jsx("code",{children:"HF_TOKEN"})," and ",m.jsx("code",{children:"WANDB_API_KEY"})," are always listed since runs typically need them. Variables set in orx's own environment win on conflicts."]}),n?m.jsx("div",{className:"error",children:n}):e===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]}):m.jsx("table",{className:"env-table",children:m.jsxs("tbody",{children:[p.map(d=>m.jsx(oL,{name:d,entry:e.find(_=>_.key===d),onVars:c,onError:o},d)),a&&m.jsx(lL,{onVars:c,onError:o,onDone:()=>l(!1)})]})}),u&&m.jsx("div",{className:"error",children:u})]})}function uL(){const[e,t]=q.useState(null),[n,r]=q.useState(""),[a,l]=q.useState(""),[u,o]=q.useState(!1),[c,f]=q.useState(null);q.useEffect(()=>{nx().then(_=>{t(_),r(_.userName??""),l(_.userEmail??"")}).catch(()=>{})},[]);const p=e!==null&&n.trim()===(e.userName??"")&&a.trim()===(e.userEmail??"");async function d(_){if(_.preventDefault(),!(u||p)){o(!0),f(null);try{const v=await fT({userName:n.trim(),userEmail:a.trim()});t(v),r(v.userName??""),l(v.userEmail??"")}catch(v){f(v instanceof Error?v.message:String(v))}finally{o(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Git"}),m.jsx("p",{className:"settings-sub",children:"Experiment branches are committed and pushed from local clones with this identity."}),e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"settings-card",children:[m.jsx("h3",{children:"Identity"}),m.jsxs("form",{className:"form",onSubmit:d,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["user.name",m.jsx("input",{type:"text",value:n,onChange:_=>r(_.target.value),autoComplete:"off"})]}),m.jsxs("label",{children:["user.email",m.jsx("input",{type:"text",value:a,onChange:_=>l(_.target.value),autoComplete:"off"})]})]}),c&&m.jsx("div",{className:"error",children:c}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:u||p||!n.trim()&&!a.trim(),children:u?"Saving…":"Save"})})]})]}),m.jsxs("div",{className:"settings-card",children:[m.jsx("h3",{children:"GitHub access"}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"git"}),m.jsx("span",{className:"v",children:e.gitVersion??"not found"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.githubTokenSource==="env"?"GITHUB_TOKEN env var":e.githubTokenSource==="stored"?"token saved in orx":e.githubTokenSource==="gh"?"gh CLI (gh auth token)":"none found"})]}),!e.githubTokenSource&&m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-note",children:["No GitHub token found — private repo clones and branch pushes will fail. Run"," ",m.jsx("code",{children:"gh auth login"}),", or paste a personal access token:"]}),m.jsx(Cw,{onSaved:t})]}),e.githubTokenSource==="stored"&&m.jsx("div",{className:"actions",children:m.jsx("button",{className:"btn",onClick:()=>{pT().then(t).catch(()=>{})},children:"Remove saved token"})})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]})]})}function hL({value:e,max:t,label:n}){const r=t>0?Math.min(100,Math.round(e/t*100)):0;return m.jsxs("div",{className:"progress",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,children:[m.jsx("div",{className:"progress-track",children:m.jsx("div",{className:"progress-fill",style:{width:`${r}%`}})}),m.jsxs("div",{className:"progress-caption",children:[m.jsx("span",{children:n??`${r}%`}),t>0&&m.jsxs("span",{className:"mono",children:[ns(e)," / ",ns(t)]})]})]})}const fL={env:"ORX_DATA_DIR environment variable",config:"your saved setting",xdg:"XDG_DATA_HOME",default:"default location"};function dL(){const[e,t]=q.useState(null),[n,r]=q.useState(null),[a,l]=q.useState(""),[u,o]=q.useState(!1),[c,f]=q.useState(null),[p,d]=q.useState({kind:"idle"}),[_,v]=q.useState(null),w=()=>ex().then(E=>{t(E),l(R=>R||E.current)}).catch(E=>r(E instanceof Error?E.message:String(E)));q.useEffect(()=>{w()},[]),q.useEffect(()=>RT(E=>{E.type==="progress"?d(R=>{const N=R.kind==="moving"?R.total:0;return{kind:"moving",phase:E.phase,copied:E.copiedBytes,total:E.totalBytes||N}}):E.type==="done"?(d({kind:"done",oldPathLeft:E.oldPathLeft}),f(null),l(""),w()):E.type==="error"&&d({kind:"error",message:E.error})}),[]);const C=(e==null?void 0:e.source)==="env",b=a.trim(),S=e!==null&&b===e.current;async function x(){if(!(u||!b)){o(!0),v(null),f(null);try{f(await JN(b))}catch(E){v(E instanceof Error?E.message:String(E))}finally{o(!1)}}}async function y(E){if(E.preventDefault(),!(p.kind==="moving"||!b||S)&&(v(null),!!window.confirm(`Move all orx data to: +|(?![\\s\\S])))+`,"m"),alias:l,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(r)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:n})})(e)}Gg.displayName="go";Gg.aliases=[];function Gg(e){e.register(di),e.languages.go=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),e.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete e.languages.go["class-name"]}qg.displayName="ini";qg.aliases=[];function qg(e){e.languages.ini={comment:{pattern:/(^[ \f\t\v]*)[#;][^\n\r]*/m,lookbehind:!0},section:{pattern:/(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,lookbehind:!0,inside:{"section-name":{pattern:/(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,lookbehind:!0,alias:"selector"},punctuation:/\[|\]/}},key:{pattern:/(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,lookbehind:!0,alias:"attr-name"},value:{pattern:/(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,lookbehind:!0,alias:"attr-value",inside:{"inner-value":{pattern:/^("|').+(?=\1$)/,lookbehind:!0}}},punctuation:/=/}}Vg.displayName="java";Vg.aliases=[];function Vg(e){e.register(di),(function(t){var n=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,r=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,a={pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[a,{pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:a.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+r+/[A-Z]\w*\b/.source),lookbehind:!0,inside:a.inside}],keyword:n,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":a,keyword:n,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+r+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:a.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+r+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:a.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//g,function(){return n.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}Yg.displayName="regex";Yg.aliases=[];function Yg(e){(function(t){var n={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:"escape"},r=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,a={pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},l={pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},u="(?:[^\\\\-]|"+r.source+")",o=RegExp(u+"-"+u),c={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"};t.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:"operator"},"char-class-punctuation":{pattern:/^\[|\]$/,alias:"punctuation"},range:{pattern:o,inside:{escape:r,"range-punctuation":{pattern:/-/,alias:"operator"}}},"special-escape":n,"char-set":l,escape:r}},"special-escape":n,"char-set":a,backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":c}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:"function"},escape:r,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]||&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}Wg.displayName="json";Wg.aliases=["webmanifest"];function Wg(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}Xg.displayName="kotlin";Xg.aliases=["kt","kts"];function Xg(e){e.register(di),(function(t){t.languages.kotlin=t.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete t.languages.kotlin["class-name"];var n={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:t.languages.kotlin}};t.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:n},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:n},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete t.languages.kotlin.string,t.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),t.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),t.languages.kt=t.languages.kotlin,t.languages.kts=t.languages.kotlin})(e)}Kg.displayName="less";Kg.aliases=[];function Kg(e){e.register(Ca),e.languages.less=e.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),e.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}})}Zg.displayName="lua";Zg.aliases=[];function Zg(e){e.languages.lua={comment:/^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,string:{pattern:/(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,greedy:!0},number:/\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,keyword:/\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,function:/(?!\d)\w+(?=\s*(?:[({]))/,operator:[/[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,{pattern:/(^|[^.])\.\.(?!\.)/,lookbehind:!0}],punctuation:/[\[\](){},;]|\.+|:+/}}Qg.displayName="makefile";Qg.aliases=[];function Qg(e){e.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/}}Jg.displayName="yaml";Jg.aliases=["yml"];function Jg(e){(function(t){var n=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,a="(?:"+r.source+"(?:[ ]+"+n.source+")?|"+n.source+"(?:[ ]+"+r.source+")?)",l=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),u=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function o(c,f){f=(f||"").replace(/m/g,"")+"m";var p=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return a}).replace(/<>/g,function(){return c});return RegExp(p,f)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return a})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return a}).replace(/<>/g,function(){return"(?:"+l+"|"+u+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:o(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:o(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:o(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:o(u),lookbehind:!0,greedy:!0},number:{pattern:o(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:r,important:n,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(e)}em.displayName="markdown";em.aliases=["md"];function em(e){e.register(hl),(function(t){var n=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(o){return o=o.replace(//g,function(){return n}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+o+")")}var a=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,l=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return a}),u=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+l+u+"(?:"+l+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+l+u+")(?:"+l+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(a),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+l+")"+u+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+l+"$"),inside:{"table-header":{pattern:RegExp(a),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(o){["url","bold","italic","strike","code-snippet"].forEach(function(c){o!==c&&(t.languages.markdown[o].inside.content.inside[c]=t.languages.markdown[c])})}),t.hooks.add("after-tokenize",function(o){if(o.language!=="markdown"&&o.language!=="md")return;function c(f){if(!(!f||typeof f=="string"))for(var p=0,d=f.length;p]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete e.languages.objectivec["class-name"],e.languages.objc=e.languages.objectivec}nm.displayName="perl";nm.aliases=[];function nm(e){(function(t){var n=/(?:\((?:[^()\\]|\\[\s\S])*\)|\{(?:[^{}\\]|\\[\s\S])*\}|\[(?:[^[\]\\]|\\[\s\S])*\]|<(?:[^<>\\]|\\[\s\S])*>)/.source;t.languages.perl={comment:[{pattern:/(^\s*)=\w[\s\S]*?=cut.*/m,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],string:[{pattern:RegExp(/\b(?:q|qq|qw|qx)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,n].join("|")+")"),greedy:!0},{pattern:/("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/,greedy:!0},{pattern:/'(?:[^'\\\r\n]|\\.)*'/,greedy:!0}],regex:[{pattern:RegExp(/\b(?:m|qr)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,n].join("|")+")"+/[msixpodualngc]*/.source),greedy:!0},{pattern:RegExp(/(^|[^-])\b(?:s|tr|y)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,/([a-zA-Z0-9])(?:(?!\3)[^\\]|\\[\s\S])*\3(?:(?!\3)[^\\]|\\[\s\S])*\3/.source,n+/\s*/.source+n].join("|")+")"+/[msixpodualngcer]*/.source),lookbehind:!0,greedy:!0},{pattern:/\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|x|xor)\b))/,greedy:!0}],variable:[/[&*$@%]\{\^[A-Z]+\}/,/[&*$@%]\^[A-Z_]/,/[&*$@%]#?(?=\{)/,/[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+(?![\w$]))+(?:::)*/,/[&*$@%]\d+/,/(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/],filehandle:{pattern:/<(?![<=])\S*?>|\b_\b/,alias:"symbol"},"v-string":{pattern:/v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,alias:"string"},function:{pattern:/(\bsub[ \t]+)\w+/,lookbehind:!0},keyword:/\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,operator:/-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)\b/,punctuation:/[{}[\];(),:]/}})(e)}Ju.displayName="markup-templating";Ju.aliases=[];function Ju(e){e.register(hl),(function(t){function n(r,a){return"___"+r.toUpperCase()+a+"___"}Object.defineProperties(t.languages["markup-templating"]={},{buildPlaceholders:{value:function(r,a,l,u){if(r.language===a){var o=r.tokenStack=[];r.code=r.code.replace(l,function(c){if(typeof u=="function"&&!u(c))return c;for(var f=o.length,p;r.code.indexOf(p=n(a,f))!==-1;)++f;return o[f]=c,p}),r.grammar=t.languages.markup}}},tokenizePlaceholders:{value:function(r,a){if(r.language!==a||!r.tokenStack)return;r.grammar=t.languages[a];var l=0,u=Object.keys(r.tokenStack);function o(c){for(var f=0;f=u.length);f++){var p=c[f];if(typeof p=="string"||p.content&&typeof p.content=="string"){var d=u[l],_=r.tokenStack[d],v=typeof p=="string"?p:p.content,w=n(a,d),C=v.indexOf(w);if(C>-1){++l;var b=v.substring(0,C),S=new t.Token(a,t.tokenize(_,r.grammar),"language-"+a,_),x=v.substring(C+w.length),y=[];b&&y.push.apply(y,o([b])),y.push(S),x&&y.push.apply(y,o([x])),typeof p=="string"?c.splice.apply(c,[f,1].concat(y)):p.content=y}}else p.content&&o(p.content)}return c}o(r.tokens)}}})})(e)}im.displayName="php";im.aliases=[];function im(e){e.register(Ju),(function(t){var n=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,r=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],a=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,l=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,u=/[{}\[\](),:;]/;t.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:n,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:a,operator:l,punctuation:u};var o={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:t.languages.php},c=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:o}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:o}}];t.languages.insertBefore("php","variable",{string:c,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:n,string:c,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,number:a,operator:l,punctuation:u}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),t.hooks.add("before-tokenize",function(f){if(/<\?/.test(f.code)){var p=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;t.languages["markup-templating"].buildPlaceholders(f,"php",p)}}),t.hooks.add("after-tokenize",function(f){t.languages["markup-templating"].tokenizePlaceholders(f,"php")})})(e)}rm.displayName="python";rm.aliases=["py"];function rm(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}sm.displayName="r";sm.aliases=[];function sm(e){e.languages.r={comment:/#.*/,string:{pattern:/(['"])(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},"percent-operator":{pattern:/%[^%\s]*%/,alias:"operator"},boolean:/\b(?:FALSE|TRUE)\b/,ellipsis:/\.\.(?:\.|\d+)/,number:[/\b(?:Inf|NaN)\b/,/(?:\b0x[\dA-Fa-f]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/],keyword:/\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,operator:/->?>?|<(?:=|=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,punctuation:/[(){}\[\],;]/}}am.displayName="ruby";am.aliases=["rb"];function am(e){e.register(di),(function(t){t.languages.ruby=t.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===||[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),t.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var n={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:t.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete t.languages.ruby.function;var r="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",a=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;t.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+r+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+a),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+a+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),t.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+r),greedy:!0,inside:{interpolation:n,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:n,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:n,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+r),greedy:!0,inside:{interpolation:n,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:n,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete t.languages.ruby.string,t.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),t.languages.rb=t.languages.ruby})(e)}om.displayName="rust";om.aliases=[];function om(e){(function(t){for(var n=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,r=0;r<2;r++)n=n.replace(//g,function(){return n});n=n.replace(//g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+n),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(e)}lm.displayName="sass";lm.aliases=[];function lm(e){e.register(Ca),(function(t){t.languages.sass=t.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),t.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete t.languages.sass.atrule;var n=/\$[-\w]+|#\{\$[-\w]+\}/,r=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];t.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:n,operator:r}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:n,operator:r,important:t.languages.sass.important}}}),delete t.languages.sass.property,delete t.languages.sass.important,t.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})})(e)}cm.displayName="scss";cm.aliases=[];function cm(e){e.register(Ca),e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}um.displayName="sql";um.aliases=[];function um(e){e.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}}hm.displayName="swift";hm.aliases=[];function hm(e){e.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},e.languages.swift["string-literal"].forEach(function(t){t.inside.interpolation.inside=e.languages.swift})}fm.displayName="typescript";fm.aliases=["ts"];function fm(e){e.register(Qu),(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var n=t.languages.extend("typescript",{});delete n["class-name"],t.languages.typescript["class-name"].inside=n,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n}}}}),t.languages.ts=t.languages.typescript})(e)}eh.displayName="basic";eh.aliases=[];function eh(e){e.languages.basic={comment:{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},string:{pattern:/"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/,greedy:!0},number:/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,keyword:/\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SELECT CASE|SHARED|SHELL|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i,function:/\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i,operator:/<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/i,punctuation:/[,;:()]/}}dm.displayName="vbnet";dm.aliases=[];function dm(e){e.register(eh),e.languages.vbnet=e.languages.extend("basic",{comment:[{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},{pattern:/(^|[^\\:])'.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(^|[^"])"(?:""|[^"])*"(?!")/,lookbehind:!0,greedy:!0},keyword:/(?:\b(?:ADDHANDLER|ADDRESSOF|ALIAS|AND|ANDALSO|AS|BEEP|BLOAD|BOOLEAN|BSAVE|BYREF|BYTE|BYVAL|CALL(?: ABSOLUTE)?|CASE|CATCH|CBOOL|CBYTE|CCHAR|CDATE|CDBL|CDEC|CHAIN|CHAR|CHDIR|CINT|CLASS|CLEAR|CLNG|CLOSE|CLS|COBJ|COM|COMMON|CONST|CONTINUE|CSBYTE|CSHORT|CSNG|CSTR|CTYPE|CUINT|CULNG|CUSHORT|DATA|DATE|DECIMAL|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DEFAULT|DELEGATE|DIM|DIRECTCAST|DO|DOUBLE|ELSE|ELSEIF|END|ENUM|ENVIRON|ERASE|ERROR|EVENT|EXIT|FALSE|FIELD|FILES|FINALLY|FOR(?: EACH)?|FRIEND|FUNCTION|GET|GETTYPE|GETXMLNAMESPACE|GLOBAL|GOSUB|GOTO|HANDLES|IF|IMPLEMENTS|IMPORTS|IN|INHERITS|INPUT|INTEGER|INTERFACE|IOCTL|IS|ISNOT|KEY|KILL|LET|LIB|LIKE|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|ME|MKDIR|MOD|MODULE|MUSTINHERIT|MUSTOVERRIDE|MYBASE|MYCLASS|NAME|NAMESPACE|NARROWING|NEW|NEXT|NOT|NOTHING|NOTINHERITABLE|NOTOVERRIDABLE|OBJECT|OF|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPERATOR|OPTION(?: BASE)?|OPTIONAL|OR|ORELSE|OUT|OVERLOADS|OVERRIDABLE|OVERRIDES|PARAMARRAY|PARTIAL|POKE|PRIVATE|PROPERTY|PROTECTED|PUBLIC|PUT|RAISEEVENT|READ|READONLY|REDIM|REM|REMOVEHANDLER|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SBYTE|SELECT(?: CASE)?|SET|SHADOWS|SHARED|SHELL|SHORT|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|STRUCTURE|SUB|SWAP|SYNCLOCK|SYSTEM|THEN|THROW|TIMER|TO|TROFF|TRON|TRUE|TRY|TRYCAST|TYPE|TYPEOF|UINTEGER|ULONG|UNLOCK|UNTIL|USHORT|USING|VIEW PRINT|WAIT|WEND|WHEN|WHILE|WIDENING|WITH|WITHEVENTS|WRITE|WRITEONLY|XOR)|\B(?:#CONST|#ELSE|#ELSEIF|#END|#IF))(?:\$|\b)/i,punctuation:/[,;:(){}]/})}const M1=/[#.]/g;function ZM(e,t){const n=e||"",r={};let a=0,l,u;for(;a=48&&t<=57}function sj(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function aj(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function O1(e){return aj(e)||dw(e)}const oj=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function lj(e,t){const n={},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,a=[];let l=0,u=-1,o="",c,f;n.position&&("start"in n.position||"indent"in n.position?(f=n.position.indent,c=n.position.start):c=n.position);let p=(c?c.line:0)||1,d=(c?c.column:0)||1,_=w(),v;for(l--;++l<=e.length;)if(v===10&&(d=(f?f[u]:0)||1),v=e.charCodeAt(l),v===38){const S=e.charCodeAt(l+1);if(S===9||S===10||S===12||S===32||S===38||S===60||Number.isNaN(S)||r&&S===r){o+=String.fromCharCode(v),d++;continue}const x=l+1;let y=x,E=x,R;if(S===35){E=++y;const U=e.charCodeAt(E);U===88||U===120?(R="hexadecimal",E=++y):R="decimal"}else R="named";let N="",D="",T="";const j=R==="named"?O1:R==="decimal"?dw:sj;for(E--;++E<=e.length;){const U=e.charCodeAt(E);if(!j(U))break;T+=String.fromCharCode(U),R==="named"&&rj.includes(T)&&(N=T,D=$o(T))}let B=e.charCodeAt(E)===59;if(B){E++;const U=R==="named"?$o(T):!1;U&&(N=T,D=U)}let z=1+E-x,G="";if(!(!B&&n.nonTerminated===!1))if(!T)R!=="named"&&C(4,z);else if(R==="named"){if(B&&!D)C(5,1);else if(N!==T&&(E=y+N.length,z=1+E-y,B=!1),!B){const U=N?1:3;if(n.attribute){const H=e.charCodeAt(E);H===61?(C(U,z),D=""):O1(H)?D="":C(U,z)}else C(U,z)}G=D}else{B||C(2,z);let U=Number.parseInt(T,R==="hexadecimal"?16:10);if(cj(U))C(7,z),G="�";else if(U in L1)C(6,z),G=L1[U];else{let H="";uj(U)&&C(6,z),U>65535&&(U-=65536,H+=String.fromCharCode(U>>>10|55296),U=56320|U&1023),G=H+String.fromCharCode(U)}}if(G){b(),_=w(),l=E-1,d+=E-x+1,a.push(G);const U=w();U.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,G,{start:_,end:U},e.slice(x-1,E)),_=U}else T=e.slice(x-1,E),o+=T,d+=T.length,l=E-1}else v===10&&(p++,u++,d=0),Number.isNaN(v)?b():(o+=String.fromCharCode(v),d++);return a.join("");function w(){return{line:p,column:d,offset:l+((c?c.offset:0)||0)}}function C(S,x){let y;n.warning&&(y=w(),y.column+=x,y.offset+=x,n.warning.call(n.warningContext||void 0,oj[S],y,S))}function b(){o&&(a.push(o),n.text&&n.text.call(n.textContext||void 0,o,{start:_,end:w()}),o="")}}function cj(e){return e>=55296&&e<=57343||e>1114111}function uj(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var hj=0,$c={},Yt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++hj}),e.__id},clone:function e(t,n){n=n||{};var r,a;switch(Yt.util.type(t)){case"Object":if(a=Yt.util.objId(t),n[a])return n[a];r={},n[a]=r;for(var l in t)t.hasOwnProperty(l)&&(r[l]=e(t[l],n));return r;case"Array":return a=Yt.util.objId(t),n[a]?n[a]:(r=[],n[a]=r,t.forEach(function(u,o){r[o]=e(u,n)}),r);default:return t}}},languages:{plain:$c,plaintext:$c,text:$c,txt:$c,extend:function(e,t){var n=Yt.util.clone(Yt.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r=r||Yt.languages;var a=r[e],l={};for(var u in a)if(a.hasOwnProperty(u)){if(u==t)for(var o in n)n.hasOwnProperty(o)&&(l[o]=n[o]);n.hasOwnProperty(u)||(l[u]=a[u])}var c=r[e];return r[e]=l,Yt.languages.DFS(Yt.languages,function(f,p){p===c&&f!=e&&(this[f]=l)}),l},DFS:function e(t,n,r,a){a=a||{};var l=Yt.util.objId;for(var u in t)if(t.hasOwnProperty(u)){n.call(t,u,t[u],r||u);var o=t[u],c=Yt.util.type(o);c==="Object"&&!a[l(o)]?(a[l(o)]=!0,e(o,n,null,a)):c==="Array"&&!a[l(o)]&&(a[l(o)]=!0,e(o,n,u,a))}}},plugins:{},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(Yt.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=Yt.tokenize(r.code,r.grammar),Yt.hooks.run("after-tokenize",r),Io.stringify(Yt.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var a=new fj;return hu(a,a.head,e),pw(e,a,t,a.head,0),pj(a)},hooks:{all:{},add:function(e,t){var n=Yt.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=Yt.hooks.all[e];if(!(!n||!n.length))for(var r=0,a;a=n[r++];)a(t)}},Token:Io};function Io(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||"").length|0}function B1(e,t,n,r){e.lastIndex=t;var a=e.exec(n);if(a&&r&&a[1]){var l=a[1].length;a.index+=l,a[0]=a[0].slice(l)}return a}function pw(e,t,n,r,a,l){for(var u in n)if(!(!n.hasOwnProperty(u)||!n[u])){var o=n[u];o=Array.isArray(o)?o:[o];for(var c=0;c=l.reach);S+=b.value.length,b=b.next){var x=b.value;if(t.length>e.length)return;if(!(x instanceof Io)){var y=1,E;if(_){if(E=B1(C,S,e,d),!E||E.index>=e.length)break;var T=E.index,R=E.index+E[0].length,N=S;for(N+=b.value.length;T>=N;)b=b.next,N+=b.value.length;if(N-=b.value.length,S=N,b.value instanceof Io)continue;for(var D=b;D!==t.tail&&(Nl.reach&&(l.reach=G);var U=b.prev;B&&(U=hu(t,U,B),S+=B.length),dj(t,U,y);var H=new Io(u,p?Yt.tokenize(j,p):j,v,j);if(b=hu(t,U,H),z&&hu(t,b,z),y>1){var Y={cause:u+","+c,reach:G};pw(e,t,n,b.prev,S,Y),l&&Y.reach>l.reach&&(l.reach=Y.reach)}}}}}}function fj(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function hu(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function dj(e,t,n){for(var r=t.next,a=0;an)return e;try{return je.highlight(e,t).children.map(_w)}catch{return e}}const xj=1e5;function wj({code:e,lang:t}){const[n,r]=V.useState(!1),a=()=>{var l;(l=navigator.clipboard)==null||l.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};return m.jsxs("div",{className:"md-code",children:[m.jsx("button",{className:"md-code-copy",title:"Copy","aria-label":"Copy code",onClick:a,children:n?m.jsx(_n,{size:13}):m.jsx(yg,{size:13})}),m.jsx("pre",{children:m.jsx("code",{children:vw(e,t,xj)})})]})}function Cj(e){const t={};for(const n of e.matchAll(/([\w-]+)=(["'])(.*?)\2/g)){const r=n[1];r&&(t[r.toLowerCase()]=n[3]??"")}return t}function Ej(e){const t=/]*?)\/?>/gi,n=[];let r=0,a=!1;for(const l of e.matchAll(t)){const u=Cj(l[1]??"");u.path&&(a=!0,l.index>r&&n.push({type:"text",value:e.slice(r,l.index)}),n.push({children:[],data:{hName:"file-mention",hProperties:u},type:"fileMention"}),r=l.index+l[0].length)}return a?(ryw(e)}function I1({path:e,lines:t,onOpenFile:n}){const r=e.split("/").pop()||e,a=t&&Number.parseInt(t,10)||void 0,l=a!=null?`${r}:${a}`:r;return m.jsxs("button",{className:"file-chip",title:`Open ${e}`,onClick:()=>n==null?void 0:n(e),disabled:!n,children:[m.jsx(US,{size:12}),m.jsx("span",{className:"file-chip-label",children:l})]})}function Aj(e){return!(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("#")||e.startsWith("//"))}const bw={code:({node:e,className:t,children:n,...r})=>{const a=t??"",l=/language-(\w+)/.exec(a),u=String(n??"").replace(/\n$/,"");if(!(l!=null||u.includes(` +`)))return m.jsx("code",{className:a,...r,children:n});const c=l?Up(l[1]):null;return m.jsx(wj,{code:u,lang:c})},pre:({children:e})=>m.jsx(m.Fragment,{children:e})};function qo({text:e,onOpenFile:t}){const n={"file-mention":r=>m.jsx(I1,{path:r.path,lines:r.lines,onOpenFile:t}),a:({node:r,href:a,children:l,...u})=>a&&Aj(a)&&t?m.jsx(I1,{path:decodeURI(a),onOpenFile:t}):m.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",...u,children:l}),...bw};return m.jsx("div",{className:"md",children:m.jsx(Fx,{remarkPlugins:[uw,kj],components:n,children:e})})}function Nj({synthesized:e,onView:t,onApprove:n,onReject:r,onRevise:a}){const[l,u]=V.useState(!1),o=V.useRef(null),[c,f]=V.useState(!1),[p,d]=V.useState(""),_=V.useRef(null);V.useEffect(()=>{if(!l)return;const w=C=>{o.current&&!o.current.contains(C.target)&&u(!1)};return window.addEventListener("pointerdown",w),()=>window.removeEventListener("pointerdown",w)},[l]),V.useEffect(()=>{var w;c&&((w=_.current)==null||w.focus())},[c]);const v=()=>{a(p.trim()||"no specific feedback — use your judgment"),d(""),f(!1)};return m.jsxs("div",{className:"plan-strip",children:[m.jsxs("div",{className:"plan-strip-info",children:[m.jsx(VS,{size:14,className:"plan-strip-icon"}),m.jsx("span",{className:"plan-strip-title",children:e?"Claude is ready to proceed":"Claude proposed a plan"}),m.jsx("button",{className:"plan-strip-open",onClick:t,children:"Open plan"})]}),c?m.jsxs(m.Fragment,{children:[m.jsx("textarea",{ref:_,className:"plan-strip-revise-input",placeholder:"What should change? (optional)",rows:2,value:p,onChange:w=>d(w.target.value),onKeyDown:w=>{w.key==="Escape"?(w.preventDefault(),d(""),f(!1)):w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),v())}}),m.jsxs("div",{className:"prompt-actions plan-strip-actions",children:[m.jsx("button",{className:"btn-ghost",onClick:()=>{d(""),f(!1)},children:"Back"}),m.jsx("span",{className:"plan-strip-spacer"}),m.jsxs("button",{className:"btn-primary plan-strip-primary",onClick:v,children:["Revise",m.jsx(FS,{size:13})]})]})]}):m.jsxs("div",{className:"prompt-actions plan-strip-actions",children:[m.jsx("button",{className:"btn-ghost",onClick:r,children:"Reject"}),m.jsx("button",{className:"btn-ghost",onClick:()=>f(!0),children:"Revise…"}),m.jsx("span",{className:"plan-strip-spacer"}),m.jsxs("div",{className:"plan-strip-approve",ref:o,children:[m.jsx("button",{className:"btn-primary plan-strip-primary",onClick:()=>n("auto"),children:"Accept and auto mode"}),m.jsx("button",{className:"btn-primary plan-strip-primary plan-strip-caret","aria-label":"More approval options",onClick:()=>u(w=>!w),children:m.jsx(cs,{size:13})}),l&&m.jsx("div",{className:"plan-strip-menu",children:m.jsx("button",{onClick:()=>{u(!1),n("bypass")},children:"Accept and bypass all"})})]})]})]})}function Sw({onSaved:e}){const[t,n]=V.useState(""),[r,a]=V.useState(!1),[l,u]=V.useState(null);async function o(c){if(c.preventDefault(),!(r||!t.trim())){a(!0),u(null);try{e(await cT(t.trim())),n("")}catch(f){u(f instanceof Error?f.message:String(f))}finally{a(!1)}}}return m.jsxs("form",{className:"onb-token-form",onSubmit:o,children:[m.jsx("input",{type:"password",value:t,onChange:c=>n(c.target.value),placeholder:"ghp_… personal access token",autoComplete:"off"}),m.jsx("button",{type:"submit",className:"btn",disabled:r||!t.trim(),children:r?"Checking…":"Save"}),m.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,workflow&description=orx",target:"_blank",rel:"noreferrer",children:"Create a token ↗"}),l&&m.jsx("div",{className:"error",children:l})]})}function Tj(e){switch(e){case"modal_job":return"Modal";case"hf_job":return"Hugging Face";case"k8s_job":return"Kubernetes";case"ssh_job":return"SSH";case"slurm_job":return"Slurm";case"openresearch_job":return"OpenResearch";case"local_job":return"This machine";default:return e||"—"}}function Rj({size:e=16}){return m.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",children:[m.jsx("path",{d:"M2.25 11.535c0-3.407 1.847-6.554 4.844-8.258a9.822 9.822 0 019.687 0c2.997 1.704 4.844 4.851 4.844 8.258 0 5.266-4.337 9.535-9.687 9.535S2.25 16.8 2.25 11.535z",fill:"#FF9D0B"}),m.jsx("path",{d:"M11.938 20.086c4.797 0 8.687-3.829 8.687-8.551 0-4.722-3.89-8.55-8.687-8.55-4.798 0-8.688 3.828-8.688 8.55 0 4.722 3.89 8.55 8.688 8.55z",fill:"#FFD21E"}),m.jsx("path",{d:"M11.875 15.113c2.457 0 3.25-2.156 3.25-3.263 0-.576-.393-.394-1.023-.089-.582.283-1.365.675-2.224.675-1.798 0-3.25-1.693-3.25-.586 0 1.107.79 3.263 3.25 3.263h-.003z",fill:"#FF323D"}),m.jsx("path",{d:"M14.76 9.21c.32.108.445.753.767.585.447-.233.707-.708.659-1.204a1.235 1.235 0 00-.879-1.059 1.262 1.262 0 00-1.33.394c-.322.384-.377.92-.14 1.36.153.283.638-.177.925-.079l-.002.003zm-5.887 0c-.32.108-.448.753-.768.585a1.226 1.226 0 01-.658-1.204c.048-.495.395-.913.878-1.059a1.262 1.262 0 011.33.394c.322.384.377.92.14 1.36-.152.283-.64-.177-.925-.079l.003.003z",fill:"#3A3B45"}),m.jsx("path",{d:"M17.812 10.366a.806.806 0 00.813-.8c0-.441-.364-.8-.813-.8a.806.806 0 00-.812.8c0 .442.364.8.812.8zm-11.624 0a.806.806 0 00.812-.8c0-.441-.364-.8-.812-.8a.806.806 0 00-.813.8c0 .442.364.8.813.8z",fill:"#3A3B45"}),m.jsx("path",{d:"M4.515 13.073c-.405 0-.765.162-1.017.46a1.455 1.455 0 00-.333.925 1.801 1.801 0 00-.485-.074c-.387 0-.737.146-.985.409a1.41 1.41 0 00-.2 1.722 1.302 1.302 0 00-.447.694c-.06.222-.12.69.2 1.166a1.267 1.267 0 00-.093 1.236c.238.533.81.958 1.89 1.405l.24.096c.768.3 1.473.492 1.478.494.89.243 1.808.375 2.732.394 1.465 0 2.513-.443 3.115-1.314.93-1.342.842-2.575-.274-3.763l-.151-.154c-.692-.684-1.155-1.69-1.25-1.912-.195-.655-.71-1.383-1.562-1.383-.46.007-.889.233-1.15.605-.25-.31-.495-.553-.715-.694a1.87 1.87 0 00-.993-.312zm14.97 0c.405 0 .767.162 1.017.46.216.262.333.588.333.925.158-.047.322-.071.487-.074.388 0 .738.146.985.409a1.41 1.41 0 01.2 1.722c.22.178.377.422.445.694.06.222.12.69-.2 1.166.244.37.279.836.093 1.236-.238.533-.81.958-1.889 1.405l-.239.096c-.77.3-1.475.492-1.48.494-.89.243-1.808.375-2.732.394-1.465 0-2.513-.443-3.115-1.314-.93-1.342-.842-2.575.274-3.763l.151-.154c.695-.684 1.157-1.69 1.252-1.912.195-.655.708-1.383 1.56-1.383.46.007.889.233 1.15.605.25-.31.495-.553.718-.694.244-.162.523-.265.814-.3l.176-.012z",fill:"#FF9D0B"}),m.jsx("path",{d:"M9.785 20.132c.688-.994.638-1.74-.305-2.667-.945-.928-1.495-2.288-1.495-2.288s-.205-.788-.672-.714c-.468.074-.81 1.25.17 1.971.977.721-.195 1.21-.573.534-.375-.677-1.405-2.416-1.94-2.751-.532-.332-.907-.148-.782.541.125.687 2.357 2.35 2.14 2.707-.218.362-.983-.42-.983-.42S2.953 14.9 2.43 15.46c-.52.558.398 1.026 1.7 1.803 1.308.778 1.41.985 1.225 1.28-.187.295-3.07-2.1-3.34-1.083-.27 1.011 2.943 1.304 2.745 2.006-.2.7-2.265-1.324-2.685-.537-.425.79 2.913 1.718 2.94 1.725 1.075.276 3.813.859 4.77-.522zm4.432 0c-.687-.994-.64-1.74.305-2.667.943-.928 1.493-2.288 1.493-2.288s.205-.788.675-.714c.465.074.807 1.25-.17 1.971-.98.721.195 1.21.57.534.377-.677 1.407-2.416 1.94-2.751.532-.332.91-.148.782.541-.125.687-2.355 2.35-2.137 2.707.215.362.98-.42.98-.42S21.05 14.9 21.57 15.46c.52.558-.395 1.026-1.7 1.803-1.308.778-1.408.985-1.225 1.28.187.295 3.07-2.1 3.34-1.083.27 1.011-2.94 1.304-2.743 2.006.2.7 2.263-1.324 2.685-.537.423.79-2.912 1.718-2.94 1.725-1.077.276-3.815.859-4.77-.522z",fill:"#FFD21E"})]})}function Dj({size:e=16}){return m.jsxs("svg",{width:e,height:e,viewBox:"0 0 300 300",fill:"none","aria-hidden":"true",children:[m.jsx("path",{d:"M121.683 75.25L149.997 124L91.4816 224.75C90.3128 226.757 88.155 228 85.8174 228H32.9664C31.7976 228 30.6778 227.691 29.697 227.131C28.7161 226.57 27.8906 225.758 27.3021 224.75L0.876625 179.25C-0.292208 177.243 -0.292208 174.765 0.876625 172.75L57.512 75.25C58.0923 74.2425 58.9259 73.43 59.9068 72.8694C60.8876 72.3088 62.0074 72 63.1762 72H116.027C118.365 72 120.523 73.2431 121.692 75.25H121.683ZM299.125 172.75L242.49 75.25C241.91 74.2425 241.076 73.43 240.095 72.8694C239.114 72.3088 237.995 72 236.826 72H183.975C181.637 72 179.479 73.2431 178.311 75.25L149.997 124L208.512 224.75C209.681 226.757 211.839 228 214.177 228H267.027C268.196 228 269.316 227.691 270.297 227.131C271.278 226.57 272.103 225.758 272.692 224.75L299.117 179.25C300.286 177.243 300.286 174.765 299.117 172.75H299.125Z",fill:"#62DE61"}),m.jsx("path",{d:"M89.6018 124H150.005L121.692 75.25C120.523 73.2431 118.365 72 116.027 72H63.1763C62.0074 72 60.8876 72.3088 59.9068 72.8694L89.6018 124Z",fill:"url(#orxModalA)"}),m.jsx("path",{d:"M89.6018 124L59.9068 72.8694C58.9259 73.43 58.1005 74.2425 57.512 75.25L0.876625 172.75C-0.292208 174.765 -0.292208 177.235 0.876625 179.25L27.3021 224.75C27.8825 225.758 28.7161 226.57 29.697 227.131L89.5936 124H89.6018Z",fill:"url(#orxModalB)"}),m.jsx("path",{d:"M149.997 124H89.5936L29.697 227.131C30.6778 227.691 31.7976 228 32.9664 228H85.8174C88.155 228 90.3128 226.757 91.4816 224.75L149.997 124Z",fill:"#09AF58"}),m.jsx("path",{d:"M299.125 179.25C299.706 178.243 300 177.121 300 176H240.61L210.915 227.131C211.896 227.691 213.016 228 214.185 228H267.036C269.373 228 271.531 226.757 272.7 224.75L299.125 179.25Z",fill:"#09AF58"}),m.jsx("path",{d:"M183.975 72C182.806 72 181.686 72.3088 180.705 72.8694L240.602 176H299.992C299.992 174.879 299.698 173.758 299.117 172.75L242.49 75.25C241.321 73.2431 239.163 72 236.826 72H183.967H183.975Z",fill:"url(#orxModalC)"}),m.jsx("path",{d:"M210.907 227.131L240.602 176L180.705 72.8694C179.725 73.43 178.899 74.2425 178.311 75.25L149.997 124L208.512 224.75C209.093 225.758 209.926 226.57 210.907 227.131Z",fill:"url(#orxModalD)"}),m.jsxs("defs",{children:[m.jsxs("linearGradient",{id:"orxModalA",x1:"127.348",y1:"137",x2:"82.9561",y2:"59.6398",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#BFF9B4"}),m.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),m.jsxs("linearGradient",{id:"orxModalB",x1:"7.04774",y1:"214.131",x2:"81.1284",y2:"85.0556",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#80EE64"}),m.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),m.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),m.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),m.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),m.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),m.jsx("stop",{offset:"1",stopColor:"#09AF58"})]}),m.jsxs("linearGradient",{id:"orxModalC",x1:"278.103",y1:"188.561",x2:"204.022",y2:"59.4863",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#BFF9B4"}),m.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),m.jsxs("linearGradient",{id:"orxModalD",x1:"232.804",y1:"214.569",x2:"158.724",y2:"85.4864",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#80EE64"}),m.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),m.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),m.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),m.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),m.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),m.jsx("stop",{offset:"1",stopColor:"#09AF58"})]})]})]})}function Mj({size:e=16}){return m.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"#326CE5","aria-hidden":"true",children:m.jsx("path",{d:"M10.204 14.35l.007.01-.999 2.413a5.171 5.171 0 0 1-2.075-2.597l2.578-.437.004.005a.44.44 0 0 1 .484.606zm-.833-2.129a.44.44 0 0 0 .173-.756l.002-.011L7.585 9.7a5.143 5.143 0 0 0-.73 3.255l2.514-.725.002-.009zm1.145-1.98a.44.44 0 0 0 .699-.337l.01-.005.15-2.62a5.144 5.144 0 0 0-3.01 1.442l2.147 1.523.004-.002zm.76 2.75l.723.349.722-.347.18-.78-.5-.623h-.804l-.5.623.179.779zm1.5-3.095a.44.44 0 0 0 .7.336l.008.003 2.134-1.513a5.188 5.188 0 0 0-2.992-1.442l.148 2.615.002.001zm10.876 5.97l-5.773 7.181a1.6 1.6 0 0 1-1.248.594l-9.261.003a1.6 1.6 0 0 1-1.247-.596l-5.776-7.18a1.583 1.583 0 0 1-.307-1.34L2.1 5.573c.108-.47.425-.864.863-1.073L11.305.513a1.606 1.606 0 0 1 1.385 0l8.345 3.985c.438.209.755.604.863 1.073l2.062 8.955c.108.47-.005.963-.308 1.34zm-3.289-2.057c-.042-.01-.103-.026-.145-.034-.174-.033-.315-.025-.479-.038-.35-.037-.638-.067-.895-.148-.105-.04-.18-.165-.216-.216l-.201-.059a6.45 6.45 0 0 0-.105-2.332 6.465 6.465 0 0 0-.936-2.163c.052-.047.15-.133.177-.159.008-.09.001-.183.094-.282.197-.185.444-.338.743-.522.142-.084.273-.137.415-.242.032-.024.076-.062.11-.089.24-.191.295-.52.123-.736-.172-.216-.506-.236-.745-.045-.034.027-.08.062-.111.088-.134.116-.217.23-.33.35-.246.25-.45.458-.673.609-.097.056-.239.037-.303.033l-.19.135a6.545 6.545 0 0 0-4.146-2.003l-.012-.223c-.065-.062-.143-.115-.163-.25-.022-.268.015-.557.057-.905.023-.163.061-.298.068-.475.001-.04-.001-.099-.001-.142 0-.306-.224-.555-.5-.555-.275 0-.499.249-.499.555l.001.014c0 .041-.002.092 0 .128.006.177.044.312.067.475.042.348.078.637.056.906a.545.545 0 0 1-.162.258l-.012.211a6.424 6.424 0 0 0-4.166 2.003 8.373 8.373 0 0 1-.18-.128c-.09.012-.18.04-.297-.029-.223-.15-.427-.358-.673-.608-.113-.12-.195-.234-.329-.349-.03-.026-.077-.062-.111-.088a.594.594 0 0 0-.348-.132.481.481 0 0 0-.398.176c-.172.216-.117.546.123.737l.007.005.104.083c.142.105.272.159.414.242.299.185.546.338.743.522.076.082.09.226.1.288l.16.143a6.462 6.462 0 0 0-1.02 4.506l-.208.06c-.055.072-.133.184-.215.217-.257.081-.546.11-.895.147-.164.014-.305.006-.48.039-.037.007-.09.02-.133.03l-.004.002-.007.002c-.295.071-.484.342-.423.608.061.267.349.429.645.365l.007-.001.01-.003.129-.029c.17-.046.294-.113.448-.172.33-.118.604-.217.87-.256.112-.009.23.069.288.101l.217-.037a6.5 6.5 0 0 0 2.88 3.596l-.09.218c.033.084.069.199.044.282-.097.252-.263.517-.452.813-.091.136-.185.242-.268.399-.02.037-.045.095-.064.134-.128.275-.034.591.213.71.248.12.556-.007.69-.282v-.002c.02-.039.046-.09.062-.127.07-.162.094-.301.144-.458.132-.332.205-.68.387-.897.05-.06.13-.082.215-.105l.113-.205a6.453 6.453 0 0 0 4.609.012l.106.192c.086.028.18.042.256.155.136.232.229.507.342.84.05.156.074.295.145.457.016.037.043.09.062.129.133.276.442.402.69.282.247-.118.341-.435.213-.71-.02-.039-.045-.096-.065-.134-.083-.156-.177-.261-.268-.398-.19-.296-.346-.541-.443-.793-.04-.13.007-.21.038-.294-.018-.022-.059-.144-.083-.202a6.499 6.499 0 0 0 2.88-3.622c.064.01.176.03.213.038.075-.05.144-.114.28-.104.266.039.54.138.87.256.154.06.277.128.448.173.036.01.088.019.13.028l.009.003.007.001c.297.064.584-.098.645-.365.06-.266-.128-.537-.423-.608zM16.4 9.701l-1.95 1.746v.005a.44.44 0 0 0 .173.757l.003.01 2.526.728a5.199 5.199 0 0 0-.108-1.674A5.208 5.208 0 0 0 16.4 9.7zm-4.013 5.325a.437.437 0 0 0-.404-.232.44.44 0 0 0-.372.233h-.002l-1.268 2.292a5.164 5.164 0 0 0 3.326.003l-1.27-2.296h-.01zm1.888-1.293a.44.44 0 0 0-.27.036.44.44 0 0 0-.214.572l-.003.004 1.01 2.438a5.15 5.15 0 0 0 2.081-2.615l-2.6-.44-.004.005z"})})}function pm({size:e=16}){return m.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:m.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"})})}function xw({kind:e,size:t=16}){switch(e){case"modal_job":return m.jsx(Dj,{size:t});case"hf_job":return m.jsx(Rj,{size:t});case"k8s_job":return m.jsx(Mj,{size:t});case"ssh_job":return m.jsx(Ap,{size:t});case"slurm_job":return m.jsx(AA,{size:t});case"openresearch_job":return m.jsx(LA,{size:t});case"local_job":return m.jsx(oN,{size:t});default:return m.jsx(Ap,{size:t})}}function jj({backend:e}){const t=tx(e),n=nx(e);return t?m.jsxs("span",{className:"backend-badge",children:[m.jsx(xw,{kind:t}),m.jsx("span",{className:"backend-name",children:Tj(t)}),n&&m.jsx("span",{className:"backend-detail mono",children:n})]}):m.jsx("span",{className:"backend-badge muted",children:"—"})}const z1={done:{className:"st-done",live:!1},failed:{className:"st-failed",live:!1},running:{className:"st-running",live:!0},starting:{className:"st-starting",live:!0},cancelled:{className:"st-cancelled",live:!1},editing:{className:"st-editing",live:!0},idle:{className:"st-idle",live:!1}};function Lj(e){return z1[e]??z1.idle}function Vo({status:e,label:t}){const n=Lj(e);return m.jsxs("span",{className:`status-badge ${n.className}${n.live?" live":""}`,children:[m.jsx("span",{className:"dot"}),t??e]})}function lp(e){return e.installed&&e.authenticated?{cls:"ok",label:"Connected"}:e.installed?{cls:"warn",label:"Not signed in"}:{cls:"warn",label:"Not installed"}}function Oj({h:e}){return e.authMethod?m.jsx(m.Fragment,{children:e.authMethod==="oauth"?"OAuth (subscription login)":"API key"}):m.jsx(m.Fragment,{children:"—"})}function Bj(){const[e,t]=V.useState(null),[n,r]=V.useState("claude-code"),[a,l]=V.useState(!1),u=c=>{l(!0),wg(c).then(t).catch(()=>{}).finally(()=>l(!1))};V.useEffect(()=>u(!1),[]);const o=e==null?void 0:e.find(c=>c.id===n);return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Harnesses"}),m.jsx("p",{className:"settings-sub",children:"Coding-agent setups detected on this machine. The research agent chat is served by OpenCode; Claude Code and Codex accounts surface their models in the composer's model picker."}),m.jsx("div",{className:"harness-tabs",children:(e??[]).map(c=>m.jsxs("button",{className:c.id===n?"active":"",onClick:()=>r(c.id),children:[c.name,m.jsx("span",{className:`harness-dot ${lp(c).cls}`})]},c.id))}),e?o?m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("span",{className:`badge ${lp(o).cls}`,children:lp(o).label}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsxs("button",{className:"btn sm",onClick:()=>u(!0),disabled:a,children:[m.jsx(Su,{size:12,className:a?"spin":""})," Refresh"]})]}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Binary"}),m.jsx("span",{className:"v",children:o.binPath??"not found on PATH"}),m.jsx("span",{className:"k",children:"Version"}),m.jsx("span",{className:"v",children:o.version??"—"}),m.jsx("span",{className:"k",children:"Auth"}),m.jsx("span",{className:"v",children:m.jsx(Oj,{h:o})}),o.account&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:o.id==="opencode"?"Providers":"Account"}),m.jsx("span",{className:"v",children:o.account})]}),o.org&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Org"}),m.jsx("span",{className:"v",children:o.org})]}),o.plan&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Plan"}),m.jsx("span",{className:"v",children:o.plan})]}),m.jsx("span",{className:"k",children:"Agent models"}),m.jsx("span",{className:"v",children:o.models.length>0?`${o.models.length} available — ${o.models.slice(0,4).map(c=>xu(c.id)).join(", ")}${o.models.length>4?", …":""}`:"none"})]}),!o.agentReady&&o.agentNote&&m.jsx("p",{className:"settings-note",children:o.agentNote})]}):null:m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Detecting harnesses…"]})]})}function Ij({s:e}){if(!e.configured)return m.jsx("span",{className:"badge",children:"not configured"});const t=e.preflight;return t.kubectlFound?t.reachable?t.canCreateJobs?m.jsx("span",{className:"badge ok",children:"connected"}):m.jsx("span",{className:"badge err",children:"no job-create permission"}):m.jsx("span",{className:"badge err",children:"cluster unreachable"}):m.jsx("span",{className:"badge err",children:"kubectl not found"})}function zj(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(""),[u,o]=V.useState(""),[c,f]=V.useState(!1),[p,d]=V.useState(null),_=C=>{t(C),l(C.context??""),o(C.namespace)};V.useEffect(()=>{$N().then(_).catch(C=>r(C instanceof Error?C.message:String(C)))},[]);const v=e!==null&&a===(e.context??"")&&u.trim()===e.namespace;async function w(C){if(C.preventDefault(),!c){f(!0),d(null);try{_(await GN({context:a,namespace:u.trim()}))}catch(b){d(b instanceof Error?b.message:String(b))}finally{f(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run on your own cluster with ",m.jsx("code",{children:"--backend k8s"}),". The run's resources (image, GPUs, topology) come from a manifest committed on the experiment branch (default ",m.jsx("code",{children:".orx/k8s.yaml"}),"); only the cluster context and namespace live here. Auth comes from your kubeconfig."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Cluster"}),m.jsx("span",{className:"v",children:m.jsx(Ij,{s:e})})]}),e.preflight.error&&m.jsx("p",{className:"settings-note",children:e.preflight.error}),m.jsxs("form",{className:"form settings-form",onSubmit:w,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Context",m.jsxs("select",{value:a,onChange:C=>l(C.target.value),children:[m.jsxs("option",{value:"",children:["kubectl default",e.currentContext?` (${e.currentContext})`:""]}),e.contexts.map(C=>m.jsx("option",{value:C,children:C},C))]})]}),m.jsxs("label",{children:["Namespace",m.jsx("input",{className:"mono",type:"text",value:u,onChange:C=>o(C.target.value),placeholder:"default",autoComplete:"off",spellCheck:!1})]})]}),p&&m.jsx("div",{className:"error",children:p}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:c||v,children:c?"Saving…":"Save"})})]}),m.jsxs("div",{className:"settings-card",children:[m.jsx("div",{className:"settings-card-head",children:m.jsx("h3",{children:"Run manifest"})}),m.jsxs("p",{className:"settings-sub",children:["Each run applies the manifest committed on its experiment branch — default"," ",m.jsx("code",{children:".orx/k8s.yaml"}),", or ",m.jsx("code",{children:"--manifest "}),". It declares whatever the run needs (image, GPU requests, an Indexed Job across nodes, extra Services, …); orx injects the run script as ",m.jsx("code",{children:"$ORX_SCRIPT"}),", the"," ",m.jsx("code",{children:"orx-env"})," Secret, run labels, and a default timeout, and requires exactly one Job (or one labelled ",m.jsx("code",{children:'orx-primary: "true"'}),") whose completion is the run's. Logs follow that Job's leader pod. Use"," ",m.jsx("code",{children:"{{ORX_RUN}}"})," in resource names to keep re-runs collision-free."]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking kubectl…"]})]})}const Hj={env:"MODAL_TOKEN_ID env var",syncedEnv:"~/.openresearch/env",modalToml:"~/.modal.toml (modal token new)"};function Fj({s:e}){return e.ready?m.jsx("span",{className:"badge ok",children:"connected"}):!e.tokenConfigured&&!e.modalImportable?m.jsx("span",{className:"badge",children:"not set up"}):e.modalImportable?e.tokenConfigured?m.jsx("span",{className:"badge",children:"unknown"}):m.jsx("span",{className:"badge err",children:"no token"}):m.jsx("span",{className:"badge err",children:e.envProvisioned?"env broken":"env not built"})}function Pj(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(!1),[u,o]=V.useState(null);V.useEffect(()=>{qN().then(t).catch(f=>r(f instanceof Error?f.message:String(f)))},[]);async function c(){if(!a){l(!0),o(null);try{t(await VN())}catch(f){o(f instanceof Error?f.message:String(f))}finally{l(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Serverless GPUs on your own Modal account with"," ",m.jsx("code",{children:"--backend modal --flavor "})," (t4, a10g, a100-80gb, h100, …). orx manages a dedicated Python env with the Modal SDK; sandboxes scale to zero between runs."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Status"}),m.jsx("span",{className:"v",children:m.jsx(Fj,{s:e})}),m.jsx("span",{className:"k",children:"Environment"}),m.jsx("span",{className:"v",children:e.modalImportable?"ready":e.envProvisioned?"provisioned (modal import failing)":"not built yet"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.tokenSource?Hj[e.tokenSource]:"not configured"})]}),!e.tokenConfigured&&m.jsxs("p",{className:"settings-note",children:["No Modal token found. Run ",m.jsx("code",{children:"modal token new"}),", or add"," ",m.jsx("code",{children:"MODAL_TOKEN_ID"})," and ",m.jsx("code",{children:"MODAL_TOKEN_SECRET"})," in the Environment tab."]}),e.error&&e.envProvisioned&&!e.modalImportable&&m.jsx("p",{className:"settings-note",children:e.error}),u&&m.jsx("div",{className:"error",children:u}),!e.modalImportable&&m.jsx("div",{className:"actions",children:m.jsx("button",{className:"btn primary",onClick:()=>void c(),disabled:a,children:a?"Setting up… (~30–60s)":"Set up environment"})})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking Modal…"]})]})}function Uj({test:e}){if(e===void 0)return m.jsx("span",{className:"muted",children:"never tested"});if(e==="testing")return m.jsx("span",{className:"spinner"});const t=e.reachable?e.gitFound?m.jsx("span",{className:"badge ok",children:"ready"}):m.jsx("span",{className:"badge err",children:"no git"}):m.jsx("span",{className:"badge err",title:e.error??void 0,children:"unreachable"});return m.jsxs(m.Fragment,{children:[t,m.jsx("span",{className:"ssh-tested-at",children:Sa(e.testedAt)})]})}function $j(){const[e,t]=V.useState(null),[n,r]=V.useState({});V.useEffect(()=>{QN().then(t).catch(()=>t([]))},[]);async function a(l){r(u=>({...u,[l]:"testing"}));try{const u=await JN(l);r(o=>({...o,[l]:u}))}catch(u){r(o=>({...o,[l]:{reachable:!1,gitFound:!1,error:u instanceof Error?u.message:String(u),testedAt:Date.now()}}))}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run experiments directly on your own boxes with"," ",m.jsx("code",{children:"--backend ssh --host "}),". Hosts come from"," ",m.jsx("code",{children:"~/.ssh/config"}),"; auth uses your keys/agent (orx never reads a key). The host just needs ",m.jsx("code",{children:"git"})," and ",m.jsx("code",{children:"bash"}),"."]}),e===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Reading ~/.ssh/config…"]}):e.length===0?m.jsx("p",{className:"settings-empty",children:"No hosts found in ~/.ssh/config."}):m.jsxs("table",{className:"flavor-table ssh-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Host"}),m.jsx("th",{children:"Address"}),m.jsx("th",{children:"Identity"}),m.jsx("th",{children:"Status"}),m.jsx("th",{})]})}),m.jsx("tbody",{children:e.map(l=>m.jsxs("tr",{children:[m.jsx("td",{className:"mono",children:l.host}),m.jsxs("td",{className:"mono muted",children:[[l.user,l.hostname??"—"].filter(Boolean).join("@"),l.port?`:${l.port}`:""]}),m.jsx("td",{className:"mono muted",children:l.identityFile??"—"}),m.jsx("td",{children:m.jsx(Uj,{test:n[l.host]??l.lastTest})}),m.jsx("td",{children:m.jsx("button",{className:"btn sm",onClick:()=>void a(l.host),disabled:n[l.host]==="testing",children:"Test"})})]},l.host))})]})]})}function Gj({test:e}){return e===null?null:e==="testing"?m.jsx("span",{className:"spinner"}):e.reachable?e.slurmFound?e.gitFound?m.jsx("span",{className:"badge ok",children:"ready"}):m.jsx("span",{className:"badge err",children:"no git"}):m.jsx("span",{className:"badge err",children:"no slurm CLI"}):m.jsx("span",{className:"badge err",title:e.error??void 0,children:"unreachable"})}function qj(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(""),[u,o]=V.useState(""),[c,f]=V.useState(""),[p,d]=V.useState(""),[_,v]=V.useState(!1),[w,C]=V.useState(null),[b,S]=V.useState(null),x=b!==null&&b!=="testing"?b:null,y=D=>{t(D),l(D.host??""),o(D.partition??""),f(D.account??""),d(D.timeLimit??"")};V.useEffect(()=>{eT().then(y).catch(D=>r(D instanceof Error?D.message:String(D)))},[]);const E=e!==null&&a===(e.host??"")&&u.trim()===(e.partition??"")&&c.trim()===(e.account??"")&&p.trim()===(e.timeLimit??"");async function R(D){if(D.preventDefault(),!_){v(!0),C(null);try{y(await tT({host:a,partition:u.trim(),account:c.trim(),timeLimit:p.trim()}))}catch(T){C(T instanceof Error?T.message:String(T))}finally{v(!1)}}}async function N(D){S("testing");try{S(await nT(D))}catch(T){S({reachable:!1,slurmFound:!1,gitFound:!1,partitions:[],error:T instanceof Error?T.message:String(T)})}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run on your own cluster with ",m.jsx("code",{children:"--backend slurm [--flavor h100:2]"}),". orx submits via ",m.jsx("code",{children:"sbatch"})," on the login node over ssh (auth is your keys/agent; orx never reads a key) and the job runs in your cluster environment. The defaults below apply when a launch doesn't override them."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[(x==null?void 0:x.error)&&m.jsx("p",{className:"settings-note",children:x.error}),x&&x.partitions.length>0&&m.jsxs("p",{className:"settings-note",children:["Partitions: ",m.jsx("code",{children:x.partitions.join(", ")})]}),m.jsxs("form",{className:"form settings-form",onSubmit:R,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Login node",m.jsxs("select",{value:a,onChange:D=>{l(D.target.value),S(null)},children:[m.jsx("option",{value:"",children:"not set (pass --host per launch)"}),a&&!e.hosts.some(D=>D.host===a)&&m.jsxs("option",{value:a,children:[a," (not in ~/.ssh/config)"]}),e.hosts.map(D=>m.jsx("option",{value:D.host,children:D.host},D.host))]})]}),m.jsxs("label",{children:["Partition",m.jsx("input",{className:"mono",type:"text",list:"slurm-partitions",value:u,onChange:D=>o(D.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1}),m.jsx("datalist",{id:"slurm-partitions",children:x==null?void 0:x.partitions.map(D=>m.jsx("option",{value:D},D))})]})]}),m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Account",m.jsx("input",{className:"mono",type:"text",value:c,onChange:D=>f(D.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1})]}),m.jsxs("label",{children:["Time limit",m.jsx("input",{className:"mono",type:"text",value:p,onChange:D=>d(D.target.value),placeholder:"cluster default (e.g. 4h, 30m)",autoComplete:"off",spellCheck:!1})]})]}),w&&m.jsx("div",{className:"error",children:w}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"submit",className:"btn primary",disabled:_||E,children:_?"Saving…":"Save"}),m.jsx("button",{type:"button",className:"btn",onClick:()=>void N(a),disabled:!a||b==="testing",title:a?void 0:"Pick a login node first",children:"Test connection"}),m.jsx(Gj,{test:b})]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading slurm settings…"]})]})}function Vj(){const[e,t]=V.useState(null),[n,r]=V.useState(null);return V.useEffect(()=>{rT().then(t).catch(a=>r(a instanceof Error?a.message:String(a)))},[]),m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run experiments as detached, supervised processes on the machine running orx with"," ",m.jsx("code",{children:"--backend local"})," — handy when you're already on a GPU box and using this dashboard over port forwarding. Runs share CPU/RAM/GPU with the dashboard itself, so prefer a remote backend for anything heavy."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Hostname"}),m.jsx("span",{className:"v mono",children:e.hostname}),m.jsx("span",{className:"k",children:"System"}),m.jsxs("span",{className:"v",children:[e.os,"/",e.arch,e.chip?` — ${e.chip}`:""]}),m.jsx("span",{className:"k",children:"CPU"}),m.jsx("span",{className:"v",children:e.cpuCount>0?`${e.cpuCount} cores`:"—"}),m.jsx("span",{className:"k",children:"RAM"}),m.jsx("span",{className:"v",children:e.memBytes!==null?ns(e.memBytes):"—"}),m.jsx("span",{className:"k",children:"GPUs"}),m.jsx("span",{className:"v",children:e.gpus.length===0?"none detected (nvidia-smi)":e.gpus.map(a=>`${a.name}${a.memMib!==null?` — ${ns(a.memMib*1024*1024)}`:""}`).join(", ")})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Detecting hardware…"]})]})}function Yj(){const[e,t]=V.useState(null),[n,r]=V.useState(null);return V.useEffect(()=>{sT().then(t).catch(a=>r(a instanceof Error?a.message:String(a)))},[]),m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run on an ephemeral OpenResearch box billed to your org with"," ",m.jsx("code",{children:"--backend openresearch --flavor "})," (h100_sxm, cpu5c, …; browse with ",m.jsx("code",{children:"orx compute"}),"). The box is provisioned for the run and deleted when it ends. Needs ",m.jsx("code",{children:"orx login"})," and a registered SSH key."]}),n?m.jsx("div",{className:"error",children:n}):e?e.loggedIn?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Status"}),m.jsx("span",{className:"v",children:m.jsx("span",{className:"badge ok",children:"signed in"})}),m.jsx("span",{className:"k",children:"Orgs"}),m.jsx("span",{className:"v",children:e.orgs.length>0?e.orgs.join(", "):"—"}),m.jsx("span",{className:"k",children:"SSH key"}),m.jsx("span",{className:"v",children:e.sshKeyRegistered===!0?m.jsx("span",{className:"badge ok",children:"registered"}):e.sshKeyRegistered===!1?m.jsx("span",{className:"badge err",children:"none registered"}):m.jsx("span",{className:"badge",children:"unknown"})})]}),e.sshKeyRegistered===!1&&m.jsxs("p",{className:"settings-note",children:["Launches need a registered SSH key. Add one with"," ",m.jsx("code",{children:"orx ssh-key add ~/.ssh/id_ed25519.pub"}),"."]}),e.error&&m.jsx("p",{className:"settings-note",children:e.error})]}):m.jsxs("p",{className:"settings-note",children:["Not signed in. Run ",m.jsx("code",{children:"orx login"})," in a terminal to connect your OpenResearch account."]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking credentials…"]})]})}const H1={local:"This machine",hf:"HF Jobs",modal:"Modal",k8s:"Kubernetes",ssh:"SSH",slurm:"Slurm",openresearch:"OpenResearch"},Wj={local:"local_job",hf:"hf_job",modal:"modal_job",k8s:"k8s_job",ssh:"ssh_job",slurm:"slurm_job",openresearch:"openresearch_job"},Xj=["hf","modal","slurm","openresearch"],F1=["hf","modal","openresearch"],P1={hf:["cpu-basic","t4-small","a10g-small","a10g-large","a100-large","h100","h200"],modal:["cpu","t4","l4","a10g","a100","a100-80gb","l40s","h100","h100:2"],slurm:["gpu","h100:1","h100:2","a100:4"],openresearch:["h100_sxm","h100_sxm:2","cpu5c","cpu5g","cpu5m"]};function Kj({t:e,isDefault:t}){return e.id==="local"?m.jsx("span",{className:"badge ok",children:"ready"}):!e.configured&&t?m.jsx("span",{className:"badge warn",children:"not configured"}):e.configured?m.jsx("span",{className:"badge ok",children:"configured"}):m.jsx("span",{className:"badge",children:"not set up"})}function Zj({target:e,flavor:t,onSaved:n}){var d;const[r,a]=V.useState(t??""),[l,u]=V.useState(!1),[o,c]=V.useState(null);V.useEffect(()=>a(t??""),[t]);async function f(_){if(_.preventDefault(),!l){u(!0),c(null);try{n(await JS({backend:e,flavor:r.trim()||null}))}catch(v){c(v instanceof Error?v.message:String(v))}finally{u(!1)}}}const p=r.trim()===(t??"");return m.jsxs("form",{className:"form settings-form compute-flavor-form",onSubmit:f,children:[m.jsxs("label",{children:["Default flavor",m.jsx("input",{className:"mono",type:"text",list:`flavors-${e}`,value:r,onChange:_=>a(_.target.value),placeholder:F1.includes(e)?`e.g. ${((d=P1[e])==null?void 0:d[1])??""}`:"none (CPU-only)",autoComplete:"off",spellCheck:!1}),m.jsx("datalist",{id:`flavors-${e}`,children:(P1[e]??[]).map(_=>m.jsx("option",{value:_},_))})]}),o&&m.jsx("div",{className:"error",children:o}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"submit",className:"btn sm",disabled:l||p,children:l?"Saving…":"Save flavor"}),F1.includes(e)&&!t&&m.jsxs("span",{className:"muted compute-flavor-hint",children:["This backend requires a flavor — without a default one, each launch must pass"," ",m.jsx("code",{children:"--flavor"}),"."]})]})]})}function Qj({target:e,isDefault:t,defaultFlavor:n,open:r,onToggle:a,onSettings:l,onError:u}){const[o,c]=V.useState(!1),[f,p]=V.useState(!1);r&&!o&&c(!0);async function d(_){if(!f){p(!0);try{l(await JS({backend:_}))}catch(v){u(v instanceof Error?v.message:String(v))}finally{p(!1)}}}return m.jsxs("div",{className:`compute-row${r?" open":""}`,children:[m.jsxs("div",{className:"compute-row-head",onClick:a,children:[m.jsx("span",{className:"compute-row-logo",children:m.jsx(xw,{kind:Wj[e.id],size:18})}),m.jsx("span",{className:"compute-row-name",children:H1[e.id]}),m.jsx("span",{className:"compute-row-summary",children:e.summary}),m.jsx(Kj,{t:e,isDefault:t}),t?m.jsx("span",{className:"badge compute-default-pill",children:"Default"}):m.jsx("button",{type:"button",className:"btn sm compute-make-default",onClick:_=>{_.stopPropagation(),d(e.id)},disabled:f,children:"Make default"}),m.jsx("button",{type:"button",className:"compute-chevron-btn","aria-expanded":r,"aria-label":`${r?"Collapse":"Expand"} ${H1[e.id]}`,onClick:_=>{_.stopPropagation(),a()},children:m.jsx(cs,{size:16,className:"compute-chevron"})})]}),o&&m.jsxs("div",{className:"compute-row-body",hidden:!r,children:[t&&m.jsxs("p",{className:"settings-note compute-default-note",children:["The agent launches runs here unless you tell it otherwise, and so does"," ",m.jsx("code",{children:"orx exp run"})," with no ",m.jsx("code",{children:"--backend"})," flag."," ",m.jsx("button",{type:"button",className:"btn sm",onClick:()=>void d(null),disabled:f,children:"Clear default"})]}),t&&!e.configured&&m.jsx("p",{className:"settings-note",children:"This target is the default but isn't configured — launches will fail until it's set up below."}),t&&Xj.includes(e.id)&&m.jsx(Zj,{target:e.id,flavor:n,onSaved:l}),e.id==="local"&&m.jsx(Vj,{}),e.id==="hf"&&m.jsx(iL,{}),e.id==="modal"&&m.jsx(Pj,{}),e.id==="k8s"&&m.jsx(zj,{}),e.id==="ssh"&&m.jsx($j,{}),e.id==="slurm"&&m.jsx(qj,{}),e.id==="openresearch"&&m.jsx(Yj,{})]})]})}function Jj(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(null),[u,o]=V.useState(null),c=V.useRef(0);V.useEffect(()=>{const d=++c.current;iT().then(_=>{d===c.current&&(t(_),r(null))}).catch(_=>{if(d!==c.current)return;const v=_ instanceof Error?_.message:String(_);t(w=>(w===null?r(v):o(v),w))})},[a]);const f=d=>{c.current++,t(d),o(null)},p=e?e.targets:null;return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Compute"}),m.jsxs("p",{className:"settings-sub",children:["Where ",m.jsx("code",{children:"orx exp run"})," executes. Pick a default target; the agent uses it when a launch doesn't name a backend (",m.jsx("code",{children:"--backend "})," always wins)."]}),n?m.jsx("div",{className:"error",children:n}):p?m.jsxs(m.Fragment,{children:[u&&m.jsx("div",{className:"error",children:u}),m.jsx("div",{className:"compute-list",children:p.map(d=>m.jsx(Qj,{target:d,isDefault:(e==null?void 0:e.defaultBackend)===d.id,defaultFlavor:(e==null?void 0:e.defaultFlavor)??null,open:a===d.id,onToggle:()=>l(_=>_===d.id?null:d.id),onSettings:f,onError:o},d.id))}),m.jsxs("p",{className:"compute-footnote",children:[m.jsx(sN,{size:14,"aria-hidden":"true"}),m.jsx("span",{children:"The default target and flavor are included in the research agent's instructions — it launches runs there unless you name another backend. No other compute settings are shared with it."})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking compute targets…"]})]})}const eL={env:"HF_TOKEN env var",openresearchEnv:"~/.openresearch/env",hfCache:"~/.cache/huggingface/token (hf auth login)"};function tL({settings:e}){return e.configured?e.valid?m.jsx("span",{className:"badge ok",children:"connected"}):m.jsx("span",{className:"badge err",children:"invalid token"}):m.jsx("span",{className:"badge",children:"not configured"})}function nL({settings:e}){return!e.configured||!e.valid?null:e.jobsWrite===!0?m.jsx("span",{className:"badge ok",children:"jobs: write OK"}):e.jobsWrite===!1?m.jsx("span",{className:"badge err",children:"no job.write permission"}):m.jsx("span",{className:"badge",children:"jobs permission unknown"})}function iL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(""),[u,o]=V.useState(!1),[c,f]=V.useState(null),p=V.useRef(!1);V.useEffect(()=>{PN().then(_=>{p.current||t(_)}).catch(_=>{p.current||r(_ instanceof Error?_.message:String(_))})},[]);async function d(_){if(_.preventDefault(),!(!a.trim()||u)){o(!0),f(null);try{const v=await UN(a.trim());p.current=!0,t(v),r(null),l("")}catch(v){f(v instanceof Error?v.message:String(v))}finally{o(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run experiments on your Hugging Face account with"," ",m.jsx("code",{children:"--backend hf --flavor "})," (t4-small, a10g-small, a100-large, …). Billed to HF per minute."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Status"}),m.jsx("span",{className:"v",children:m.jsx(tL,{settings:e})}),m.jsx("span",{className:"k",children:"Account"}),m.jsx("span",{className:"v",children:e.username??"—"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.maskedToken??"—"}),m.jsx("span",{className:"k",children:"Source"}),m.jsx("span",{className:"v",children:e.source?eL[e.source]:"not configured"}),m.jsx("span",{className:"k",children:"Jobs"}),m.jsxs("span",{className:"v",children:[m.jsx(nL,{settings:e}),(!e.configured||!e.valid)&&"—"]})]}),e.source==="env"&&m.jsx("p",{className:"settings-note",children:"HF_TOKEN is set in the environment and overrides any token saved here."}),e.valid&&e.jobsWrite===null&&m.jsxs("p",{className:"settings-note",children:["This token is valid but doesn't report whether it can launch Jobs — OAuth tokens from ",m.jsx("code",{children:"hf auth login"})," never do. Launches may still work; for a definitive check, save a write-scoped token from"," ",m.jsx("a",{href:"https://huggingface.co/settings/tokens",target:"_blank",rel:"noreferrer",children:"huggingface.co/settings/tokens"}),"."]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading status…"]}),m.jsxs("form",{className:"form settings-form",onSubmit:d,children:[m.jsxs("label",{children:[e!=null&&e.configured?"Replace token":"New token",m.jsx("input",{type:"password",value:a,onChange:_=>l(_.target.value),placeholder:"hf_…",autoComplete:"off"})]}),c&&m.jsx("div",{className:"error",children:c}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:!a.trim()||u,children:u?"Validating…":"Save"})})]})]})}const ww=/^hf_[A-Za-z0-9]{10,}$/;function Cw(){return m.jsx("tr",{children:m.jsx("td",{colSpan:3,children:m.jsxs("p",{className:"settings-note",children:["This value looks like a Hugging Face token — compute runs only read it from"," ",m.jsx("code",{children:"HF_TOKEN"}),". Save it under that key if it's meant for HF Jobs."]})})})}const U1=["HF_TOKEN","WANDB_API_KEY"];function rL({name:e,entry:t,onVars:n,onError:r}){const[a,l]=V.useState(""),[u,o]=V.useState(!1),c=d=>r(`${e}: ${d instanceof Error?d.message:String(d)}`);async function f(){if(!(!a.trim()||u)){o(!0);try{n(await ZS(e,a.trim())),l("")}catch(d){c(d)}finally{o(!1)}}}async function p(){if(!u){o(!0);try{n(await WN(e))}catch(d){c(d)}finally{o(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("tr",{children:[m.jsx("td",{className:"mono",children:e}),m.jsx("td",{className:"mono muted",children:t?m.jsxs(m.Fragment,{children:[t.maskedValue,t.inProcessEnv&&m.jsx("span",{className:"badge",children:"overridden by env"})]}):m.jsx("input",{className:"mono",type:"password",value:a,onChange:d=>l(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),f()),d.key==="Escape"&&!u&&l("")},placeholder:"value","aria-label":`Value for ${e}`,autoComplete:"new-password",disabled:u})}),m.jsx("td",{children:t?m.jsx("button",{className:"icon-btn",title:`Delete ${e}`,"aria-label":`Delete ${e}`,onClick:()=>void p(),disabled:u,children:m.jsx(Gu,{size:13})}):a.trim()&&m.jsx("button",{className:"btn sm",onClick:()=>void f(),disabled:u,children:u?"Saving…":"Save"})})]}),!t&&e!=="HF_TOKEN"&&ww.test(a.trim())&&m.jsx(Cw,{})]})}function sL({onVars:e,onError:t,onDone:n}){const[r,a]=V.useState(""),[l,u]=V.useState(""),[o,c]=V.useState(!1);async function f(){if(!(!r.trim()||!l.trim()||o)){c(!0);try{e(await ZS(r.trim(),l.trim())),n()}catch(d){t(`${r.trim()}: ${d instanceof Error?d.message:String(d)}`)}finally{c(!1)}}}const p=d=>{d.key==="Enter"&&(d.preventDefault(),f()),d.key==="Escape"&&!o&&n()};return m.jsxs(m.Fragment,{children:[m.jsxs("tr",{children:[m.jsx("td",{children:m.jsx("input",{autoFocus:!0,className:"mono",type:"text",value:r,onChange:d=>a(d.target.value),onKeyDown:p,placeholder:"MY_API_KEY","aria-label":"New variable key",autoComplete:"off",spellCheck:!1,disabled:o})}),m.jsx("td",{children:m.jsx("input",{className:"mono",type:"password",value:l,onChange:d=>u(d.target.value),onKeyDown:p,placeholder:"value","aria-label":"New variable value",autoComplete:"new-password",disabled:o})}),m.jsxs("td",{children:[m.jsx("button",{className:"btn sm",onClick:()=>void f(),disabled:o||!r.trim()||!l.trim(),children:o?"Saving…":"Save"}),m.jsx("button",{className:"icon-btn",title:"Cancel","aria-label":"Cancel new variable",onClick:n,disabled:o,children:m.jsx(Fo,{size:13})})]})]}),r.trim()!=="HF_TOKEN"&&ww.test(l.trim())&&m.jsx(Cw,{})]})}function aL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(!1),[u,o]=V.useState(null);V.useEffect(()=>{YN().then(t).catch(d=>r(d instanceof Error?d.message:String(d)))},[]);const c=d=>{t(d),o(null)},f=e===null?[]:e.map(d=>d.key).filter(d=>!U1.includes(d)),p=[...U1,...f];return m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Environment variables"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsxs("button",{className:"btn sm",onClick:()=>l(!0),disabled:a||e===null,children:[m.jsx(bg,{size:12})," Add variable"]})]}),m.jsxs("p",{className:"settings-sub",children:["Stored in ",m.jsx("code",{children:"~/.openresearch/env"})," and passed to runs and the research agent."," ",m.jsx("code",{children:"HF_TOKEN"})," and ",m.jsx("code",{children:"WANDB_API_KEY"})," are always listed since runs typically need them. Variables set in orx's own environment win on conflicts."]}),n?m.jsx("div",{className:"error",children:n}):e===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]}):m.jsx("table",{className:"env-table",children:m.jsxs("tbody",{children:[p.map(d=>m.jsx(rL,{name:d,entry:e.find(_=>_.key===d),onVars:c,onError:o},d)),a&&m.jsx(sL,{onVars:c,onError:o,onDone:()=>l(!1)})]})}),u&&m.jsx("div",{className:"error",children:u})]})}function oL(){const[e,t]=V.useState(null),[n,r]=V.useState(""),[a,l]=V.useState(""),[u,o]=V.useState(!1),[c,f]=V.useState(null);V.useEffect(()=>{ex().then(_=>{t(_),r(_.userName??""),l(_.userEmail??"")}).catch(()=>{})},[]);const p=e!==null&&n.trim()===(e.userName??"")&&a.trim()===(e.userEmail??"");async function d(_){if(_.preventDefault(),!(u||p)){o(!0),f(null);try{const v=await lT({userName:n.trim(),userEmail:a.trim()});t(v),r(v.userName??""),l(v.userEmail??"")}catch(v){f(v instanceof Error?v.message:String(v))}finally{o(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Git"}),m.jsx("p",{className:"settings-sub",children:"Experiment branches are committed and pushed from local clones with this identity."}),e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"settings-card",children:[m.jsx("h3",{children:"Identity"}),m.jsxs("form",{className:"form",onSubmit:d,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["user.name",m.jsx("input",{type:"text",value:n,onChange:_=>r(_.target.value),autoComplete:"off"})]}),m.jsxs("label",{children:["user.email",m.jsx("input",{type:"text",value:a,onChange:_=>l(_.target.value),autoComplete:"off"})]})]}),c&&m.jsx("div",{className:"error",children:c}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:u||p||!n.trim()&&!a.trim(),children:u?"Saving…":"Save"})})]})]}),m.jsxs("div",{className:"settings-card",children:[m.jsx("h3",{children:"GitHub access"}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"git"}),m.jsx("span",{className:"v",children:e.gitVersion??"not found"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.githubTokenSource==="env"?"GITHUB_TOKEN env var":e.githubTokenSource==="stored"?"token saved in orx":e.githubTokenSource==="gh"?"gh CLI (gh auth token)":"none found"})]}),!e.githubTokenSource&&m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-note",children:["No GitHub token found — private repo clones and branch pushes will fail. Run"," ",m.jsx("code",{children:"gh auth login"}),", or paste a personal access token:"]}),m.jsx(Sw,{onSaved:t})]}),e.githubTokenSource==="stored"&&m.jsx("div",{className:"actions",children:m.jsx("button",{className:"btn",onClick:()=>{uT().then(t).catch(()=>{})},children:"Remove saved token"})})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]})]})}function lL({value:e,max:t,label:n}){const r=t>0?Math.min(100,Math.round(e/t*100)):0;return m.jsxs("div",{className:"progress",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,children:[m.jsx("div",{className:"progress-track",children:m.jsx("div",{className:"progress-fill",style:{width:`${r}%`}})}),m.jsxs("div",{className:"progress-caption",children:[m.jsx("span",{children:n??`${r}%`}),t>0&&m.jsxs("span",{className:"mono",children:[ns(e)," / ",ns(t)]})]})]})}const cL={env:"ORX_DATA_DIR environment variable",config:"your saved setting",xdg:"XDG_DATA_HOME",default:"default location"};function uL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(""),[u,o]=V.useState(!1),[c,f]=V.useState(null),[p,d]=V.useState({kind:"idle"}),[_,v]=V.useState(null),w=()=>QS().then(E=>{t(E),l(R=>R||E.current)}).catch(E=>r(E instanceof Error?E.message:String(E)));V.useEffect(()=>{w()},[]),V.useEffect(()=>kT(E=>{E.type==="progress"?d(R=>{const N=R.kind==="moving"?R.total:0;return{kind:"moving",phase:E.phase,copied:E.copiedBytes,total:E.totalBytes||N}}):E.type==="done"?(d({kind:"done",oldPathLeft:E.oldPathLeft}),f(null),l(""),w()):E.type==="error"&&d({kind:"error",message:E.error})}),[]);const C=(e==null?void 0:e.source)==="env",b=a.trim(),S=e!==null&&b===e.current;async function x(){if(!(u||!b)){o(!0),v(null),f(null);try{f(await XN(b))}catch(E){v(E instanceof Error?E.message:String(E))}finally{o(!1)}}}async function y(E){if(E.preventDefault(),!(p.kind==="moving"||!b||S)&&(v(null),!!window.confirm(`Move all orx data to: ${b} -The store is copied to the new location and activated there. Active runs or chats will block the move.`))){d({kind:"moving",phase:"preparing",copied:0,total:(c==null?void 0:c.treeBytes)??0});try{await tT(b)}catch(R){d({kind:"idle"}),v(R instanceof Error?R.message:String(R))}}}return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Storage"}),m.jsxs("p",{className:"settings-sub",children:["Where orx keeps everything on this machine — the local database, run logs, artifacts, and chat attachments for ",m.jsx("strong",{children:"all"})," projects. Moving it copies the whole store to the new location and activates it there."]}),n?m.jsx("div",{className:"settings-card",children:m.jsx("div",{className:"error",children:n})}):e?m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Data directory"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsx("span",{className:"badge",children:e.isDefault?"default":"custom"})]}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Current"}),m.jsx("span",{className:"v mono",children:e.current}),m.jsx("span",{className:"k",children:"Source"}),m.jsx("span",{className:"v",children:fL[e.source]}),!e.isDefault&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Default"}),m.jsx("span",{className:"v mono",children:e.defaultPath})]})]}),C?m.jsxs("p",{className:"settings-note",children:["The data directory is pinned by the ",m.jsx("code",{children:"ORX_DATA_DIR"})," environment variable, which overrides this setting. Unset it to choose a location here."]}):m.jsxs("form",{className:"form settings-form",onSubmit:y,children:[m.jsxs("label",{children:["New location",m.jsx("input",{className:"mono",type:"text",value:a,onChange:E=>{l(E.target.value),f(null)},placeholder:"/absolute/path/to/openresearch",autoComplete:"off",spellCheck:!1,disabled:p.kind==="moving"})]}),c&&!c.error&&c.ok&&m.jsxs("p",{className:"settings-note",children:["Ready to move ",ns(c.treeBytes??0),c.freeBytes!=null&&` — ${ns(c.freeBytes)} free at target`,c.sameFilesystem?" (same disk, instant)":"","."]}),c&&c.ok===!1&&c.error&&m.jsx("div",{className:"error",children:c.error}),_&&m.jsx("div",{className:"error",children:_}),p.kind==="moving"&&m.jsx(hL,{value:p.copied,max:p.total,label:`${p.phase.charAt(0).toUpperCase()}${p.phase.slice(1)}…`}),p.kind==="done"&&m.jsxs("p",{className:"settings-note",children:["Moved. orx is now using the new location.",p.oldPathLeft&&m.jsxs(m.Fragment,{children:[" ","The old copy was left at ",m.jsx("code",{children:p.oldPathLeft})," (different disk) — you can delete it once you've confirmed everything works."]})]}),p.kind==="error"&&m.jsxs("div",{className:"error",children:["Move failed: ",p.message]}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"button",className:"btn",onClick:x,disabled:u||!b||S||p.kind==="moving",children:u?"Checking…":"Check"}),m.jsx("button",{type:"submit",className:"btn primary",disabled:!b||S||p.kind==="moving",children:p.kind==="moving"?"Moving…":"Move data here"})]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]})]})}const qp=e=>e==="running"||e==="starting";function pL(e){return qp(e.status)?Fy(Date.now()-e.createdAt):e.endedAt?Fy(e.endedAt-e.createdAt):"—"}function $1({instances:e,emptyLabel:t}){return e.length===0?m.jsx("p",{className:"instances-empty",children:t}):m.jsx("div",{className:"instances-table-wrap",children:m.jsxs("table",{className:"runs-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Backend"}),m.jsx("th",{children:"Project"}),m.jsx("th",{children:"Status"}),m.jsx("th",{children:"Started"}),m.jsx("th",{children:"Runtime"})]})}),m.jsx("tbody",{children:e.map(n=>{var a;const r=typeof((a=n.backend)==null?void 0:a.url)=="string"?n.backend.url:void 0;return m.jsxs("tr",{children:[m.jsx("td",{children:m.jsxs("span",{className:"backend-cell",children:[m.jsx(Bj,{backend:n.backend}),r&&m.jsx("a",{className:"icon-btn",href:r,target:"_blank",rel:"noreferrer",title:"Open job page","aria-label":"Open job page",onClick:l=>l.stopPropagation(),children:m.jsx($S,{size:12})})]})}),m.jsx("td",{children:n.projectName??Tp(n.projectId)}),m.jsx("td",{children:m.jsx(Vo,{status:n.status})}),m.jsx("td",{children:Sa(n.createdAt)}),m.jsx("td",{className:"mono",children:pL(n)})]},n.id)})})]})})}function gL(){const[e,t]=q.useState(null),[n,r]=q.useState(null),[a,l]=q.useState(!1),[,u]=q.useState(0);q.useEffect(()=>{const d=setInterval(()=>u(_=>_+1),3e4);return()=>clearInterval(d)},[]);const o=()=>{l(!0),HN().then(d=>{t(d),r(null)}).catch(d=>{r(d instanceof Error?d.message:String(d)),t(_=>_??[])}).finally(()=>l(!1))};q.useEffect(()=>o(),[]);const c=(d,_)=>_.createdAt-d.createdAt,f=e==null?void 0:e.filter(d=>qp(d.status)).sort(c),p=e==null?void 0:e.filter(d=>!qp(d.status)).sort(c);return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"settings-head-row",children:[m.jsx("h1",{children:"Instances"}),m.jsxs("button",{className:"btn sm",onClick:o,disabled:a,children:[m.jsx(Su,{size:12,className:a?"spin":""})," Refresh"]})]}),m.jsx("p",{className:"settings-sub",children:"Compute spun up across all projects — this machine, Modal, Hugging Face, SSH, Kubernetes, Slurm, and OpenResearch."}),n&&m.jsx("div",{className:"error",children:n}),!f||!p?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]}):m.jsxs(m.Fragment,{children:[m.jsxs("h2",{className:"instances-section-title",children:["Running",f.length>0&&m.jsx("span",{className:"count-badge",children:f.length})]}),m.jsx($1,{instances:f,emptyLabel:"Nothing running right now."}),m.jsx("h2",{className:"instances-section-title",children:"Past"}),m.jsx($1,{instances:p,emptyLabel:"No past instances yet."})]})]})}const mL=[{id:"harnesses",label:"Harnesses",icon:m.jsx(TA,{size:15})},{id:"compute",label:"Compute",icon:m.jsx(GA,{size:15})},{id:"instances",label:"Instances",icon:m.jsx(Ap,{size:15})},{id:"environment",label:"Environment",icon:m.jsx(AN,{size:15})},{id:"git",label:"Git",icon:m.jsx($u,{size:15})},{id:"storage",label:"Storage",icon:m.jsx(oN,{size:15})}];function _L({tab:e}){return m.jsxs("div",{className:"settings-view",children:[e==="harnesses"&&m.jsx(Hj,{}),e==="compute"&&m.jsx(nL,{}),e==="environment"&&m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Environment"}),m.jsx("p",{className:"settings-sub",children:"Variables available to runs and the research agent (API keys, tokens)."}),m.jsx(cL,{})]}),e==="instances"&&m.jsx(gL,{}),e==="git"&&m.jsx(uL,{}),e==="storage"&&m.jsx(dL,{})]})}function vL({skills:e,activeIndex:t,onPick:n,onHover:r}){return m.jsx("div",{className:"skill-menu",children:e.map((a,l)=>m.jsxs("button",{type:"button",className:`skill-item ${l===t?"active":""}`,onMouseDown:u=>{u.preventDefault(),n(a)},onMouseEnter:()=>r(l),children:[m.jsxs("span",{className:"skill-name",children:["/",a.name," ",m.jsx("span",{className:"skill-hint",children:a.argHint})]}),m.jsx("span",{className:"skill-desc",children:a.description})]},a.name))})}const Nw={"claude-code":"Claude Code",codex:"Codex",opencode:"OpenCode"};function G1(e){var n,r,a;const t=e.find(l=>l.agentReady);return t?{harness:t.id,model:((n=t.models[0])==null?void 0:n.id)??null,permissionMode:((r=t.options)==null?void 0:r.defaultPermissionMode)??null,reasoningLevel:((a=t.options)==null?void 0:a.defaultReasoningLevel)??null}:null}function th(){const[e,t]=q.useState(!1),n=q.useRef(null);return q.useEffect(()=>{if(!e)return;const r=l=>{var u;(u=n.current)!=null&&u.contains(l.target)||t(!1)},a=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),t(!1))};return document.addEventListener("mousedown",r),document.addEventListener("keydown",a,!0),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",a,!0)}},[e]),{open:e,setOpen:t,ref:n}}function yL({value:e,onSelect:t,onHarnesses:n,lockHarness:r=!1}){const[a,l]=q.useState([]),{open:u,setOpen:o,ref:c}=th(),[f,p]=q.useState("");q.useEffect(()=>{wg().then(w=>{l(w),n==null||n(w)}).catch(()=>{})},[]);const d=q.useMemo(()=>{const w=f.trim().toLowerCase();return(r&&e?a.filter(b=>b.id===e.harness):a).map(b=>{let S=b.models;return w?S=S.filter(x=>x.id.toLowerCase().includes(w)):b.id==="opencode"&&(S=S.slice(0,6)),{harness:b,models:S,hidden:w?0:b.models.length-S.length}})},[a,f,r,e]),_=(w,C)=>{var S,x;const b=(e==null?void 0:e.harness)===w.id;t({harness:w.id,model:C,permissionMode:b?e.permissionMode:((S=w.options)==null?void 0:S.defaultPermissionMode)??null,reasoningLevel:b?e.reasoningLevel:((x=w.options)==null?void 0:x.defaultReasoningLevel)??null}),o(!1),p("")},v=e?e.model?xu(e.model):"Default model":"Model";return m.jsxs("div",{className:"model-picker",ref:c,children:[m.jsxs("button",{type:"button",className:"composer-pill",title:"Harness + model for this chat",onClick:()=>o(w=>!w),children:[v,m.jsx(cs,{size:12})]}),u&&m.jsxs("div",{className:"model-menu align-right",children:[m.jsx("input",{autoFocus:!0,type:"text",placeholder:"Search models…",value:f,onChange:w=>p(w.target.value)}),m.jsxs("div",{className:"model-menu-list",children:[d.map(({harness:w,models:C,hidden:b})=>m.jsxs("div",{children:[m.jsx("div",{className:"model-group",children:w.name}),w.agentReady?m.jsxs(m.Fragment,{children:[C.map(S=>m.jsxs("button",{className:"model-item",onClick:()=>_(w,S.id),children:[m.jsxs("span",{children:[xu(S.id),m.jsx("span",{className:"model-id",children:S.id})]}),(e==null?void 0:e.harness)===w.id&&(e==null?void 0:e.model)===S.id&&m.jsx(_n,{size:13})]},S.id)),b>0&&m.jsxs("div",{className:"model-more",children:[b," more — search to find"]})]}):m.jsx("div",{className:"model-more",children:w.agentNote??"Not available"})]},w.id)),a.length===0&&m.jsx("div",{className:"model-more",children:"Detecting harnesses…"})]}),r&&e&&a.length>1&&m.jsxs("div",{className:"model-locked-note",children:[m.jsx(dN,{size:11}),"Sessions keep their harness — new chat to switch"]})]})]})}function q1({choices:e,value:t,defaultId:n,header:r,align:a="left",variant:l="pill",title:u,numbered:o=!1,onSelect:c}){var S,x;const{open:f,setOpen:p,ref:d}=th();if(e.length===0)return null;const _=t??n??((S=e[0])==null?void 0:S.id)??null,v=e.find(y=>y.id===_),w=e.find(y=>y.id===n),C=(v==null?void 0:v.label)??((x=e[0])==null?void 0:x.label)??"",b=y=>{c(y),p(!1)};return m.jsxs("div",{className:"option-picker",ref:d,children:[m.jsxs("button",{type:"button",className:l==="pill"?"composer-pill":"composer-bare",title:u,onClick:()=>p(y=>!y),children:[C,m.jsx(cs,{size:12})]}),f&&m.jsxs("div",{className:`option-menu ${a==="right"?"align-right":""}`,children:[r&&m.jsx("div",{className:"model-group",children:r}),w&&m.jsxs(m.Fragment,{children:[m.jsxs("button",{className:"model-item",onClick:()=>b(w.id),children:[m.jsxs("span",{children:[w.label," ",m.jsx("span",{className:"option-default",children:"· Default"})]}),_===w.id&&m.jsx(_n,{size:13})]}),m.jsx("div",{className:"option-sep"})]}),e.map((y,E)=>m.jsxs("button",{className:"model-item",onClick:()=>b(y.id),children:[m.jsx("span",{children:y.label}),_===y.id?m.jsx(_n,{size:13}):o&&m.jsx("span",{className:"option-num",children:E+1})]},y.id))]})]})}const Tw="orx:agent-selection";function bL(){try{const e=localStorage.getItem(Tw);return e?JSON.parse(e):null}catch{return null}}const Rw="local-";function SL(e,t){const n=e.findIndex(a=>a.id===t.id);if(n>=0){const a=e.slice();return a[n]=t,a}return[...t.role==="user"?e.filter(a=>!a.id.startsWith(Rw)):e,t]}function xL(e,t){switch(t.type){case"reset":return{messagesBySession:{},busySessions:new Set};case"seed":return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:t.messages}};case"upsertMessage":{const n=e.messagesBySession[t.sessionId]??[];return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:SL(n,t.message)}}}case"optimisticUser":{const n=e.messagesBySession[t.sessionId]??[],r=t.text?[{id:"p0",type:"text",text:t.text}]:[];t.imageUrls.forEach((l,u)=>r.push({id:`img${u}`,type:"image",text:l}));const a={id:`${Rw}${Date.now()}`,role:"user",parts:r,createdAt:Date.now()};return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:[...n,a]}}}case"busy":{const n=new Set(e.busySessions);return t.busy?n.add(t.sessionId):n.delete(t.sessionId),{...e,busySessions:n}}case"seedBusy":return{...e,busySessions:new Set(t.sessions)};case"forget":{const n={...e.messagesBySession};delete n[t.sessionId];const r=new Set(e.busySessions);return r.delete(t.sessionId),{messagesBySession:n,busySessions:r}}}}function wL({harnesses:e,selection:t}){if(e.length===0)return null;const n=t?e.find(r=>r.id===t.harness):void 0;return n?m.jsxs("p",{className:"chat-empty-hint",children:["Chatting with ",n.name,n.account?` as ${n.account}`:""," — detected automatically, switch in the model picker below."]}):m.jsx("p",{className:"chat-empty-hint",children:"No coding agent detected on this machine — install Claude Code, Codex or opencode and sign in, then re-open the model picker below."})}function Dw(e){return e==="error"?"tool-status error":e==="completed"?"tool-status":"tool-status running"}function CL(e){if(!e)return"";const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return"now";const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function V1(e){const t=e.replace(/\/+$/,"");return t.slice(t.lastIndexOf("/")+1)||t}function Vp(e){var u,o;const t=e.tool??"tool",n=((u=e.state)==null?void 0:u.input)??{},r=typeof n.command=="string"?n.command:null,a=typeof n.filePath=="string"?n.filePath:null,l=typeof n.description=="string"?n.description:null;switch(t){case"Bash":case"bash":return r?`Ran ${r}`:"Ran command";case"Read":return a?`Read ${V1(a)}`:"Read file";case"Edit":case"Write":case"NotebookEdit":return a?`Edited ${V1(a)}`:"Edited file";case"Grep":return typeof n.pattern=="string"?`Searched “${n.pattern}”`:"Searched";case"Glob":return typeof n.pattern=="string"?`Found ${n.pattern}`:"Listed files";case"WebFetch":case"WebSearch":return l??"Searched the web";case"Task":return l??"Ran a subagent";case"error":return"Error";default:{const c=l??a??r??((o=e.state)==null?void 0:o.title)??"";return c?`${t}: ${c}`:t}}}function EL({part:e,onOpenFile:t}){var o,c;const n=e.state,r=(n==null?void 0:n.error)||(n==null?void 0:n.output)||"",a=typeof((o=n==null?void 0:n.input)==null?void 0:o.command)=="string"?n.input.command:null,l=typeof((c=n==null?void 0:n.input)==null?void 0:c.filePath)=="string"?n.input.filePath:null,u=!!(r||a||l);return m.jsxs("details",{className:"tool-row",open:!1,children:[m.jsxs("summary",{children:[m.jsx("span",{className:Dw(n==null?void 0:n.status)}),m.jsx("span",{className:"tool-line",children:Vp(e)}),l&&t&&m.jsx("button",{className:"tool-open file-link",title:`Open ${l}`,onClick:f=>{f.preventDefault(),f.stopPropagation(),t(l)},children:"open"})]}),u&&m.jsxs("div",{className:"tool-detail",children:[a&&m.jsx("div",{className:"tool-cmd-full",children:a}),r&&m.jsx("div",{className:"tool-output",children:r.slice(0,2e4)})]})]})}function kL({parts:e,onOpenFile:t}){const n=e.some(c=>{var f;return((f=c.state)==null?void 0:f.status)==="running"}),r=e.some(c=>{var f;return((f=c.state)==null?void 0:f.status)==="error"}),[a,l]=q.useState(!1),u=a||n,o=e.length===1?Vp(e[0]):n?Vp(e.find(c=>{var f;return((f=c.state)==null?void 0:f.status)==="running"})??e[e.length-1]):`Used ${e.length} tools`;return m.jsxs("div",{className:`tool-group ${r?"has-error":""}`,children:[m.jsxs("button",{className:"tool-group-summary",onClick:()=>l(c=>!c),children:[m.jsx("span",{className:Dw(n?"running":r?"error":"completed")}),m.jsx("span",{className:"tool-line",children:o}),m.jsx(Uu,{size:12,className:`tool-chevron ${u?"open":""}`})]}),u&&m.jsx("div",{className:"tool-group-rows",children:e.map(c=>m.jsx(EL,{part:c,onOpenFile:t},c.id))})]})}function AL({part:e,onRespond:t,onOpenFile:n,onOpenPlan:r}){var p,d,_;const a=e.prompt,[l,u]=q.useState([]),o=!t,c=v=>t==null?void 0:t({promptId:e.id,...v});if(a.resolved){if(a.kind==="permission")return null;if(a.kind==="plan"){const w=a.approved===!0?"Plan approved":a.approved===!1?a.note?"Revision requested":"Rejected":"Resolved",C=a.approved===!0?"approved":a.approved===!1?a.note?"revised":"rejected":"";return m.jsxs("details",{className:"prompt-collapsed",children:[m.jsxs("summary",{children:[m.jsx("span",{className:"prompt-collapsed-title",children:a.synthesized?"Plan":"Proposed plan"}),m.jsx("span",{className:`prompt-outcome ${C}`,children:w})]}),m.jsxs("div",{className:"prompt-collapsed-body",children:[m.jsx(qo,{text:a.plan??"",onOpenFile:n}),a.note&&m.jsx("div",{className:"prompt-collapsed-note",children:a.note})]})]})}const v=(a.answers??[]).join(", ")||a.note||"";return m.jsxs("details",{className:"prompt-collapsed",children:[m.jsxs("summary",{children:[m.jsx("span",{className:"prompt-collapsed-title",children:a.header||a.question||"Question"}),m.jsx("span",{className:`prompt-outcome ${v?"chosen":""}`,children:v||"Resolved"})]}),m.jsxs("div",{className:"prompt-collapsed-body",children:[a.header&&a.question&&m.jsx("div",{className:"prompt-q",children:a.question}),(a.options??[]).length>0&&m.jsx("ul",{className:"prompt-collapsed-options",children:(a.options??[]).map(w=>{var C;return m.jsx("li",{className:(C=a.answers)!=null&&C.includes(w.label)?"sel":"",children:w.label},w.label)})}),a.note&&a.note!==v&&m.jsx("div",{className:"prompt-collapsed-note",children:a.note})]})]})}if(a.kind==="plan"){const v=!!r;return m.jsxs("div",{className:`prompt-card plan ${o?"readonly":""}`,children:[m.jsx("div",{className:"prompt-head",children:a.synthesized?"Plan mode — ready to proceed?":"Proposed plan"}),m.jsx("div",{className:`prompt-plan ${v?"clamped":""}`,children:m.jsx(qo,{text:a.plan??"",onOpenFile:n})}),v&&m.jsx("button",{className:"prompt-plan-open",onClick:()=>r(a.plan??"",e.id),children:"View full plan"}),!o&&!v&&m.jsxs("div",{className:"prompt-actions",children:[m.jsx("button",{className:"btn-primary",onClick:()=>c({approve:!0,resumeMode:"auto"}),children:"Accept and auto mode"}),m.jsx("button",{className:"btn-ghost",onClick:()=>c({approve:!0,resumeMode:"bypass"}),children:"Accept and bypass all"}),m.jsx("button",{className:"btn-ghost",onClick:()=>c({approve:!1}),children:"Reject"})]})]})}if(a.kind==="permission"){const v=typeof((p=a.toolInput)==null?void 0:p.command)=="string"&&a.toolInput.command||typeof((d=a.toolInput)==null?void 0:d.filePath)=="string"&&a.toolInput.filePath||"",w=typeof((_=a.toolInput)==null?void 0:_.reason)=="string"&&a.toolInput.reason||"";return m.jsxs("div",{className:`prompt-card permission ${o?"readonly":""}`,children:[m.jsxs("div",{className:"prompt-head",children:["Permission needed: ",m.jsx("code",{children:a.tool})]}),v&&m.jsx("div",{className:"prompt-sub",children:v}),w&&m.jsx("div",{className:"prompt-sub",children:w}),!o&&m.jsxs("div",{className:"prompt-actions",children:[m.jsx("button",{className:"btn-primary",onClick:()=>c({approve:!0}),children:"Allow"}),m.jsx("button",{className:"btn-ghost",onClick:()=>c({approve:!1}),children:"Deny"})]})]})}const f=v=>u(w=>a.multiSelect?w.includes(v)?w.filter(C=>C!==v):[...w,v]:[v]);return m.jsxs("div",{className:`prompt-card question ${o?"readonly":""}`,children:[a.header&&m.jsx("div",{className:"prompt-head",children:a.header}),a.question&&m.jsx("div",{className:"prompt-q",children:a.question}),m.jsx("div",{className:"prompt-options",children:(a.options??[]).map(v=>{const w=l.includes(v.label);return m.jsxs("button",{className:`prompt-option ${w?"sel":""}`,disabled:o,onClick:()=>o?void 0:a.multiSelect?f(v.label):c({answers:[v.label]}),children:[m.jsx("span",{className:"prompt-option-label",children:v.label}),v.description&&m.jsx("span",{className:"prompt-option-desc",children:v.description})]},v.label)})}),a.multiSelect&&!o&&m.jsx("div",{className:"prompt-actions",children:m.jsx("button",{className:"btn-primary",disabled:l.length===0,onClick:()=>c({answers:l}),children:"Submit"})})]})}function NL(e){return e.role==="user"?!0:e.parts.some(t=>t.type==="prompt"?!!t.prompt&&!(t.prompt.resolved&&t.prompt.kind==="permission"):t.type==="text"||t.type==="reasoning"?!!t.text:!0)}function TL({message:e,onOpenFile:t,onRespond:n,onOpenPlan:r}){if(e.role==="user"){const o=e.parts.filter(f=>f.type==="text").map(f=>f.text??"").join(` -`),c=e.parts.filter(f=>f.type==="image"&&f.text).map(f=>f.text.startsWith("data:")?f.text:wT(f.text));return m.jsxs("div",{className:"msg-user",children:[o,c.length>0&&m.jsx("div",{className:"msg-images",children:c.map((f,p)=>m.jsx("a",{href:f,target:"_blank",rel:"noreferrer",children:m.jsx("img",{src:f,alt:"attachment"})},p))})]})}const a=[];let l=[];const u=()=>{l.length!==0&&(a.push(m.jsx(kL,{parts:l,onOpenFile:t},`tg-${l[0].id}`)),l=[])};for(const o of e.parts){if(o.type==="tool"){l.push(o);continue}u(),o.type==="text"&&o.text?a.push(m.jsx(qo,{text:o.text,onOpenFile:t},o.id)):o.type==="reasoning"&&o.text?a.push(m.jsxs("details",{className:"reasoning",children:[m.jsx("summary",{children:"thinking…"}),o.text]},o.id)):o.type==="prompt"&&o.prompt&&a.push(m.jsx(AL,{part:o,onRespond:n,onOpenFile:t,onOpenPlan:r},o.id))}return u(),m.jsx("div",{className:"msg-assistant",children:a})}const Mw=[{id:"active",label:"Active",railLabel:"Recents"},{id:"archived",label:"Archived",railLabel:"Archived"},{id:"all",label:"All",railLabel:"All sessions"}];function RL({value:e,onChange:t}){const{open:n,setOpen:r,ref:a}=th();return m.jsxs("div",{className:"rail-filter",ref:a,children:[m.jsx("button",{className:`icon-btn rail-filter-btn ${e!=="active"?"active":""}`,title:"Filter sessions","aria-label":"Filter sessions",onClick:()=>r(l=>!l),children:m.jsx(EN,{size:13})}),n&&m.jsx("div",{className:"option-menu drop-down align-right",children:Mw.map(l=>m.jsxs("button",{className:"model-item",onClick:()=>{t(l.id),r(!1)},children:[m.jsx("span",{children:l.label}),e===l.id&&m.jsx(_n,{size:13})]},l.id))})]})}function DL({session:e,active:t,busy:n,waiting:r,onOpen:a,onRename:l,onSetArchived:u,onDelete:o}){var y;const{open:c,setOpen:f,ref:p}=th(),d=((y=e.title)==null?void 0:y.trim())||"Untitled",[_,v]=q.useState(!1),[w,C]=q.useState(""),b=q.useRef(null);function S(){var E;C(((E=e.title)==null?void 0:E.trim())||""),v(!0)}function x(){var R;const E=w.trim();v(!1),E&&E!==(((R=e.title)==null?void 0:R.trim())||"")&&l(E)}return q.useEffect(()=>{var E,R;_&&((E=b.current)==null||E.focus(),(R=b.current)==null||R.select())},[_]),m.jsxs("div",{ref:p,role:"button",tabIndex:0,className:`session-row ${t?"active":""} ${c?"menu-open":""} ${_?"editing":""}`,title:`${Nw[e.harness]}${e.model?` · ${e.model}`:""}`,onClick:()=>{_||(c?f(!1):a())},onKeyDown:E=>{E.target===E.currentTarget&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),c?f(!1):a())},children:[m.jsx("span",{className:"session-dot",children:n&&m.jsx("span",{className:`busy-dot ${r?"waiting":""}`})}),_?m.jsx("input",{ref:b,className:"session-title-input","aria-label":"Session title",value:w,onChange:E=>C(E.target.value),onClick:E=>E.stopPropagation(),onBlur:x,onKeyDown:E=>{E.stopPropagation(),E.key==="Enter"?(E.preventDefault(),x()):E.key==="Escape"&&(E.preventDefault(),v(!1))}}):m.jsx("span",{className:"session-title",children:d}),m.jsx("span",{className:"session-time",children:CL(e.updatedAt)}),m.jsx("button",{className:"session-menu-btn",title:"Session options","aria-label":"Session options",onClick:E=>{E.stopPropagation(),f(R=>!R)},children:m.jsx(VA,{size:14})}),c&&m.jsxs("div",{className:"option-menu drop-down session-menu",children:[m.jsx("button",{className:"model-item",onClick:E=>{E.stopPropagation(),f(!1),S()},children:m.jsx("span",{children:"Rename"})}),m.jsx("button",{className:"model-item",onClick:E=>{E.stopPropagation(),f(!1),u(!e.archived)},children:m.jsx("span",{children:e.archived?"Unarchive":"Archive"})}),m.jsx("button",{className:"model-item danger",onClick:E=>{E.stopPropagation(),f(!1),o()},children:m.jsx("span",{children:"Delete"})})]})]})}function ML({projectId:e,paperId:t,railHeader:n,railOpen:r,onShowRail:a,mainView:l,onSelectMainView:u,panelOpen:o,onTogglePanel:c,onOpenFile:f,onOpenPlan:p,children:d}){var On,yi,ni;const[_,v]=q.useState([]),[w,C]=q.useState(null),[b,S]=q.useState("active"),[x,y]=q.useState(""),[E,R]=q.useState([]),[N,D]=q.useReducer(xL,{messagesBySession:{},busySessions:new Set}),[T,j]=q.useState([]),[B,F]=q.useState(bL),[Y,H]=q.useState({}),z=q.useRef(new Set),V=q.useRef(new Set),G=q.useRef(null),X=q.useRef(null),K=q.useRef(!0),L=q.useRef(null),[M,O]=q.useState([]),[$,U]=q.useState(0),[Q,re]=q.useState(!1);q.useEffect(()=>{vT().then(O).catch(()=>{})},[]);const ae=x.startsWith("/")&&!/\s/.test(x)?x.slice(1):null,Z=ae!==null&&!Q?M.filter(oe=>oe.name.startsWith(ae.toLowerCase())):[],P=Z.length>0,ee=Math.min($,Math.max(0,Z.length-1));q.useEffect(()=>U(0),[ae]);function ne(oe){var we;y(`/${oe.name} `),(we=L.current)==null||we.focus()}function ge(oe){for(const we of oe){if(!/^image\/(png|jpeg|gif|webp)$/.test(we.type))continue;const Ne=new FileReader;Ne.onload=()=>{const qe=Ne.result;R(at=>[...at,{dataUrl:qe,mediaType:we.type}])},Ne.readAsDataURL(we)}}function he(oe){const we=Array.from(oe.clipboardData.items).filter(Ne=>Ne.kind==="file"&&Ne.type.startsWith("image/")).map(Ne=>Ne.getAsFile()).filter(Ne=>Ne!==null);we.length>0&&(oe.preventDefault(),ge(we))}const ye=_.find(oe=>oe.id===w),be=ye?{harness:ye.harness,model:Y.model??ye.model,permissionMode:Y.permissionMode??ye.permissionMode,reasoningLevel:Y.reasoningLevel??ye.reasoningLevel}:B??G1(T),ke=be?T.find(oe=>oe.id===be.harness):void 0,Ee=ke==null?void 0:ke.options,Ce=oe=>{ye?H({model:oe.model,permissionMode:oe.permissionMode,reasoningLevel:oe.reasoningLevel}):(F(oe),localStorage.setItem(Tw,JSON.stringify(oe)))},rt=oe=>{be&&Ce({...be,permissionMode:oe})},bt=oe=>{be&&Ce({...be,reasoningLevel:oe})};q.useEffect(()=>{v([]),C(null),y(""),R([]),D({type:"reset"}),z.current=new Set,zy(e).then(oe=>{v(oe),C(we=>{var Ne;return we??((Ne=oe.find(qe=>!qe.archived))==null?void 0:Ne.id)??null}),D({type:"seedBusy",sessions:oe.filter(we=>we.busy).map(we=>we.id)})}).catch(()=>{})},[e]),q.useEffect(()=>{!w||z.current.has(w)||(z.current.add(w),Hy(w).then(oe=>D({type:"seed",sessionId:w,messages:oe})).catch(()=>z.current.delete(w)))},[w]),q.useEffect(()=>TT(oe=>{switch(oe.type){case"session":if(oe.session.projectId!==e||V.current.has(oe.session.id))return;v(we=>{const Ne=we.findIndex(at=>at.id===oe.session.id);if(Ne<0)return[oe.session,...we];const qe=we.slice();return qe[Ne]=oe.session,qe});break;case"sessionDeleted":Et(oe.sessionId);break;case"message":D({type:"upsertMessage",sessionId:oe.sessionId,message:oe.message});break;case"busy":D({type:"busy",sessionId:oe.sessionId,busy:oe.busy});break}}),[e]);const Ge=w?N.messagesBySession[w]??[]:[],ct=w?N.busySessions.has(w):!1,Pt=oe=>N.busySessions.has(oe)&&(N.messagesBySession[oe]??[]).some(we=>we.parts.some(Ne=>Ne.type==="prompt"&&Ne.prompt&&!Ne.prompt.resolved&&Ne.prompt.nativeId)),ht=w?Pt(w):!1,Fe=ye,fe=q.useMemo(()=>{var oe;for(let we=Ge.length-1;we>=0;we--)for(const Ne of Ge[we].parts)if(Ne.type==="prompt"&&((oe=Ne.prompt)==null?void 0:oe.kind)==="plan"&&!Ne.prompt.resolved)return{promptId:Ne.id,plan:Ne.prompt.plan??"",synthesized:!!Ne.prompt.synthesized};return null},[Ge]),ie=q.useMemo(()=>{if(!w||(Fe==null?void 0:Fe.harness)!=="claude-code")return null;for(let oe=Ge.length-1;oe>=0;oe--)for(const we of Ge[oe].parts)if(!(we.type!=="prompt"||!we.prompt||we.prompt.resolved)&&we.prompt.kind==="question")return we.prompt.nativeId&&!N.busySessions.has(w)?null:we.id;return null},[Ge,Fe==null?void 0:Fe.harness,w,N.busySessions]),[de,Se]=q.useState(null),Ae=de&&de.sessionId===w?de:null;q.useEffect(()=>{if(!de)return;const oe=N.busySessions.has(de.sessionId),we=de.sessionId===w&&fe&&fe.promptId!==de.promptId;(!oe||we)&&Se(null)},[de,fe,N.busySessions,w]);const De=p&&w?(oe,we)=>p(oe,w,we):void 0;q.useEffect(()=>H({}),[w]);const Ve=l==="chat"&&(Ge.length>0||ct);q.useLayoutEffect(()=>{K.current=!0;const oe=G.current;oe&&(oe.scrollTop=oe.scrollHeight)},[w,Ve]),q.useLayoutEffect(()=>{const oe=G.current;oe&&K.current&&(oe.scrollTop=oe.scrollHeight)},[Ge,ct]),q.useEffect(()=>{const oe=G.current,we=X.current;if(!oe||!we)return;const Ne=new ResizeObserver(()=>{K.current&&(oe.scrollTop=oe.scrollHeight)});return Ne.observe(we),Ne.observe(oe),()=>Ne.disconnect()},[Ve]);async function Ie(){const oe=x.trim(),we=E;if(!oe&&we.length===0)return;if(oe&&ie&&we.length===0){y(""),Ut({promptId:ie,answers:[],note:oe}).then(at=>{at||y(bi=>bi||oe)});return}if(ct)return;const Ne=be;if(!Ne&&!w)return;y(""),R([]);let qe=w;try{if(!qe){const nn=await yT(e,Ne.harness,{model:Ne.model,permissionMode:Ne.permissionMode,reasoningLevel:Ne.reasoningLevel});z.current.add(nn.id),v(gs=>[nn,...gs]),C(nn.id),qe=nn.id}D({type:"optimisticUser",sessionId:qe,text:oe,imageUrls:we.map(nn=>nn.dataUrl)}),D({type:"busy",sessionId:qe,busy:!0}),K.current=!0,b==="archived"&&S("active");const at=Ne?{model:Ne.model,permissionMode:Ne.permissionMode,reasoningLevel:Ne.reasoningLevel}:{};H({});const bi=we.map(nn=>({mediaType:nn.mediaType,dataBase64:nn.dataUrl.slice(nn.dataUrl.indexOf(",")+1)}));await CT(qe,oe,at,bi.length?bi:void 0)}catch{qe&&D({type:"busy",sessionId:qe,busy:!1})}}function Nt(){w&&ET(w)}q.useEffect(()=>{if(!ct||l!=="chat")return;function oe(we){var Ne;we.key!=="Escape"||we.defaultPrevented||(we.preventDefault(),Nt(),(Ne=L.current)==null||Ne.focus())}return document.addEventListener("keydown",oe),()=>document.removeEventListener("keydown",oe)},[ct,w,l]);function Et(oe){V.current.add(oe),v(we=>we.filter(Ne=>Ne.id!==oe)),C(we=>we===oe?null:we),z.current.delete(oe),D({type:"forget",sessionId:oe})}function qt(oe,we){const Ne=oe.archived;v(qe=>qe.map(at=>at.id===oe.id?{...at,archived:we}:at)),ST(oe.id,we).catch(()=>{v(qe=>qe.map(at=>at.id===oe.id?{...at,archived:Ne}:at))})}function st(oe,we){const Ne=oe.title;v(qe=>qe.map(at=>at.id===oe.id?{...at,title:we}:at)),xT(oe.id,we).catch(()=>{v(qe=>qe.map(at=>at.id===oe.id?{...at,title:Ne}:at))})}async function Ln(oe){var Ne;const we=((Ne=oe.title)==null?void 0:Ne.trim())||"Untitled";if(window.confirm(`Delete "${we}"? +The store is copied to the new location and activated there. Active runs or chats will block the move.`))){d({kind:"moving",phase:"preparing",copied:0,total:(c==null?void 0:c.treeBytes)??0});try{await ZN(b)}catch(R){d({kind:"idle"}),v(R instanceof Error?R.message:String(R))}}}return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Storage"}),m.jsxs("p",{className:"settings-sub",children:["Where orx keeps everything on this machine — the local database, run logs, artifacts, and chat attachments for ",m.jsx("strong",{children:"all"})," projects. Moving it copies the whole store to the new location and activates it there."]}),n?m.jsx("div",{className:"settings-card",children:m.jsx("div",{className:"error",children:n})}):e?m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Data directory"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsx("span",{className:"badge",children:e.isDefault?"default":"custom"})]}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Current"}),m.jsx("span",{className:"v mono",children:e.current}),m.jsx("span",{className:"k",children:"Source"}),m.jsx("span",{className:"v",children:cL[e.source]}),!e.isDefault&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Default"}),m.jsx("span",{className:"v mono",children:e.defaultPath})]})]}),C?m.jsxs("p",{className:"settings-note",children:["The data directory is pinned by the ",m.jsx("code",{children:"ORX_DATA_DIR"})," environment variable, which overrides this setting. Unset it to choose a location here."]}):m.jsxs("form",{className:"form settings-form",onSubmit:y,children:[m.jsxs("label",{children:["New location",m.jsx("input",{className:"mono",type:"text",value:a,onChange:E=>{l(E.target.value),f(null)},placeholder:"/absolute/path/to/openresearch",autoComplete:"off",spellCheck:!1,disabled:p.kind==="moving"})]}),c&&!c.error&&c.ok&&m.jsxs("p",{className:"settings-note",children:["Ready to move ",ns(c.treeBytes??0),c.freeBytes!=null&&` — ${ns(c.freeBytes)} free at target`,c.sameFilesystem?" (same disk, instant)":"","."]}),c&&c.ok===!1&&c.error&&m.jsx("div",{className:"error",children:c.error}),_&&m.jsx("div",{className:"error",children:_}),p.kind==="moving"&&m.jsx(lL,{value:p.copied,max:p.total,label:`${p.phase.charAt(0).toUpperCase()}${p.phase.slice(1)}…`}),p.kind==="done"&&m.jsxs("p",{className:"settings-note",children:["Moved. orx is now using the new location.",p.oldPathLeft&&m.jsxs(m.Fragment,{children:[" ","The old copy was left at ",m.jsx("code",{children:p.oldPathLeft})," (different disk) — you can delete it once you've confirmed everything works."]})]}),p.kind==="error"&&m.jsxs("div",{className:"error",children:["Move failed: ",p.message]}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"button",className:"btn",onClick:x,disabled:u||!b||S||p.kind==="moving",children:u?"Checking…":"Check"}),m.jsx("button",{type:"submit",className:"btn primary",disabled:!b||S||p.kind==="moving",children:p.kind==="moving"?"Moving…":"Move data here"})]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]})]})}const qp=e=>e==="running"||e==="starting";function hL(e){return qp(e.status)?Fy(Date.now()-e.createdAt):e.endedAt?Fy(e.endedAt-e.createdAt):"—"}function $1({instances:e,emptyLabel:t}){return e.length===0?m.jsx("p",{className:"instances-empty",children:t}):m.jsx("div",{className:"instances-table-wrap",children:m.jsxs("table",{className:"runs-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Backend"}),m.jsx("th",{children:"Project"}),m.jsx("th",{children:"Status"}),m.jsx("th",{children:"Started"}),m.jsx("th",{children:"Runtime"})]})}),m.jsx("tbody",{children:e.map(n=>{var a;const r=typeof((a=n.backend)==null?void 0:a.url)=="string"?n.backend.url:void 0;return m.jsxs("tr",{children:[m.jsx("td",{children:m.jsxs("span",{className:"backend-cell",children:[m.jsx(jj,{backend:n.backend}),r&&m.jsx("a",{className:"icon-btn",href:r,target:"_blank",rel:"noreferrer",title:"Open job page","aria-label":"Open job page",onClick:l=>l.stopPropagation(),children:m.jsx(PS,{size:12})})]})}),m.jsx("td",{children:n.projectName??Tp(n.projectId)}),m.jsx("td",{children:m.jsx(Vo,{status:n.status})}),m.jsx("td",{children:Sa(n.createdAt)}),m.jsx("td",{className:"mono",children:hL(n)})]},n.id)})})]})})}function fL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(!1),[,u]=V.useState(0);V.useEffect(()=>{const d=setInterval(()=>u(_=>_+1),3e4);return()=>clearInterval(d)},[]);const o=()=>{l(!0),ON().then(d=>{t(d),r(null)}).catch(d=>{r(d instanceof Error?d.message:String(d)),t(_=>_??[])}).finally(()=>l(!1))};V.useEffect(()=>o(),[]);const c=(d,_)=>_.createdAt-d.createdAt,f=e==null?void 0:e.filter(d=>qp(d.status)).sort(c),p=e==null?void 0:e.filter(d=>!qp(d.status)).sort(c);return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"settings-head-row",children:[m.jsx("h1",{children:"Instances"}),m.jsxs("button",{className:"btn sm",onClick:o,disabled:a,children:[m.jsx(Su,{size:12,className:a?"spin":""})," Refresh"]})]}),m.jsx("p",{className:"settings-sub",children:"Compute spun up across all projects — this machine, Modal, Hugging Face, SSH, Kubernetes, Slurm, and OpenResearch."}),n&&m.jsx("div",{className:"error",children:n}),!f||!p?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]}):m.jsxs(m.Fragment,{children:[m.jsxs("h2",{className:"instances-section-title",children:["Running",f.length>0&&m.jsx("span",{className:"count-badge",children:f.length})]}),m.jsx($1,{instances:f,emptyLabel:"Nothing running right now."}),m.jsx("h2",{className:"instances-section-title",children:"Past"}),m.jsx($1,{instances:p,emptyLabel:"No past instances yet."})]})]})}const dL=[{id:"harnesses",label:"Harnesses",icon:m.jsx(EA,{size:15})},{id:"compute",label:"Compute",icon:m.jsx(FA,{size:15})},{id:"instances",label:"Instances",icon:m.jsx(Ap,{size:15})},{id:"environment",label:"Environment",icon:m.jsx(wN,{size:15})},{id:"git",label:"Git",icon:m.jsx($u,{size:15})},{id:"storage",label:"Storage",icon:m.jsx(iN,{size:15})}];function pL({tab:e}){return m.jsxs("div",{className:"settings-view",children:[e==="harnesses"&&m.jsx(Bj,{}),e==="compute"&&m.jsx(Jj,{}),e==="environment"&&m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Environment"}),m.jsx("p",{className:"settings-sub",children:"Variables available to runs and the research agent (API keys, tokens)."}),m.jsx(aL,{})]}),e==="instances"&&m.jsx(fL,{}),e==="git"&&m.jsx(oL,{}),e==="storage"&&m.jsx(uL,{})]})}function gL({skills:e,activeIndex:t,onPick:n,onHover:r}){return m.jsx("div",{className:"skill-menu",children:e.map((a,l)=>m.jsxs("button",{type:"button",className:`skill-item ${l===t?"active":""}`,onMouseDown:u=>{u.preventDefault(),n(a)},onMouseEnter:()=>r(l),children:[m.jsxs("span",{className:"skill-name",children:["/",a.name," ",m.jsx("span",{className:"skill-hint",children:a.argHint})]}),m.jsx("span",{className:"skill-desc",children:a.description})]},a.name))})}const Ew={"claude-code":"Claude Code",codex:"Codex",opencode:"OpenCode"};function G1(e){var n,r,a;const t=e.find(l=>l.agentReady);return t?{harness:t.id,model:((n=t.models[0])==null?void 0:n.id)??null,permissionMode:((r=t.options)==null?void 0:r.defaultPermissionMode)??null,reasoningLevel:((a=t.options)==null?void 0:a.defaultReasoningLevel)??null}:null}function th(){const[e,t]=V.useState(!1),n=V.useRef(null);return V.useEffect(()=>{if(!e)return;const r=l=>{var u;(u=n.current)!=null&&u.contains(l.target)||t(!1)},a=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),t(!1))};return document.addEventListener("mousedown",r),document.addEventListener("keydown",a,!0),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",a,!0)}},[e]),{open:e,setOpen:t,ref:n}}function mL({value:e,onSelect:t,onHarnesses:n,lockHarness:r=!1}){const[a,l]=V.useState([]),{open:u,setOpen:o,ref:c}=th(),[f,p]=V.useState("");V.useEffect(()=>{wg().then(w=>{l(w),n==null||n(w)}).catch(()=>{})},[]);const d=V.useMemo(()=>{const w=f.trim().toLowerCase();return(r&&e?a.filter(b=>b.id===e.harness):a).map(b=>{let S=b.models;return w?S=S.filter(x=>x.id.toLowerCase().includes(w)):b.id==="opencode"&&(S=S.slice(0,6)),{harness:b,models:S,hidden:w?0:b.models.length-S.length}})},[a,f,r,e]),_=(w,C)=>{var S,x;const b=(e==null?void 0:e.harness)===w.id;t({harness:w.id,model:C,permissionMode:b?e.permissionMode:((S=w.options)==null?void 0:S.defaultPermissionMode)??null,reasoningLevel:b?e.reasoningLevel:((x=w.options)==null?void 0:x.defaultReasoningLevel)??null}),o(!1),p("")},v=e?e.model?xu(e.model):"Default model":"Model";return m.jsxs("div",{className:"model-picker",ref:c,children:[m.jsxs("button",{type:"button",className:"composer-pill",title:"Harness + model for this chat",onClick:()=>o(w=>!w),children:[v,m.jsx(cs,{size:12})]}),u&&m.jsxs("div",{className:"model-menu align-right",children:[m.jsx("input",{autoFocus:!0,type:"text",placeholder:"Search models…",value:f,onChange:w=>p(w.target.value)}),m.jsxs("div",{className:"model-menu-list",children:[d.map(({harness:w,models:C,hidden:b})=>m.jsxs("div",{children:[m.jsx("div",{className:"model-group",children:w.name}),w.agentReady?m.jsxs(m.Fragment,{children:[C.map(S=>m.jsxs("button",{className:"model-item",onClick:()=>_(w,S.id),children:[m.jsxs("span",{children:[xu(S.id),m.jsx("span",{className:"model-id",children:S.id})]}),(e==null?void 0:e.harness)===w.id&&(e==null?void 0:e.model)===S.id&&m.jsx(_n,{size:13})]},S.id)),b>0&&m.jsxs("div",{className:"model-more",children:[b," more — search to find"]})]}):m.jsx("div",{className:"model-more",children:w.agentNote??"Not available"})]},w.id)),a.length===0&&m.jsx("div",{className:"model-more",children:"Detecting harnesses…"})]}),r&&e&&a.length>1&&m.jsxs("div",{className:"model-locked-note",children:[m.jsx(cN,{size:11}),"Sessions keep their harness — new chat to switch"]})]})]})}function q1({choices:e,value:t,defaultId:n,header:r,align:a="left",variant:l="pill",title:u,numbered:o=!1,onSelect:c}){var S,x;const{open:f,setOpen:p,ref:d}=th();if(e.length===0)return null;const _=t??n??((S=e[0])==null?void 0:S.id)??null,v=e.find(y=>y.id===_),w=e.find(y=>y.id===n),C=(v==null?void 0:v.label)??((x=e[0])==null?void 0:x.label)??"",b=y=>{c(y),p(!1)};return m.jsxs("div",{className:"option-picker",ref:d,children:[m.jsxs("button",{type:"button",className:l==="pill"?"composer-pill":"composer-bare",title:u,onClick:()=>p(y=>!y),children:[C,m.jsx(cs,{size:12})]}),f&&m.jsxs("div",{className:`option-menu ${a==="right"?"align-right":""}`,children:[r&&m.jsx("div",{className:"model-group",children:r}),w&&m.jsxs(m.Fragment,{children:[m.jsxs("button",{className:"model-item",onClick:()=>b(w.id),children:[m.jsxs("span",{children:[w.label," ",m.jsx("span",{className:"option-default",children:"· Default"})]}),_===w.id&&m.jsx(_n,{size:13})]}),m.jsx("div",{className:"option-sep"})]}),e.map((y,E)=>m.jsxs("button",{className:"model-item",onClick:()=>b(y.id),children:[m.jsx("span",{children:y.label}),_===y.id?m.jsx(_n,{size:13}):o&&m.jsx("span",{className:"option-num",children:E+1})]},y.id))]})]})}const kw="orx:agent-selection";function _L(){try{const e=localStorage.getItem(kw);return e?JSON.parse(e):null}catch{return null}}const Aw="local-";function vL(e,t){const n=e.findIndex(a=>a.id===t.id);if(n>=0){const a=e.slice();return a[n]=t,a}return[...t.role==="user"?e.filter(a=>!a.id.startsWith(Aw)):e,t]}function yL(e,t){switch(t.type){case"reset":return{messagesBySession:{},busySessions:new Set};case"seed":return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:t.messages}};case"upsertMessage":{const n=e.messagesBySession[t.sessionId]??[];return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:vL(n,t.message)}}}case"optimisticUser":{const n=e.messagesBySession[t.sessionId]??[],r=t.text?[{id:"p0",type:"text",text:t.text}]:[];t.imageUrls.forEach((l,u)=>r.push({id:`img${u}`,type:"image",text:l}));const a={id:`${Aw}${Date.now()}`,role:"user",parts:r,createdAt:Date.now()};return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:[...n,a]}}}case"busy":{const n=new Set(e.busySessions);return t.busy?n.add(t.sessionId):n.delete(t.sessionId),{...e,busySessions:n}}case"seedBusy":return{...e,busySessions:new Set(t.sessions)};case"forget":{const n={...e.messagesBySession};delete n[t.sessionId];const r=new Set(e.busySessions);return r.delete(t.sessionId),{messagesBySession:n,busySessions:r}}}}function bL({harnesses:e,selection:t}){if(e.length===0)return null;const n=t?e.find(r=>r.id===t.harness):void 0;return n?m.jsxs("p",{className:"chat-empty-hint",children:["Chatting with ",n.name,n.account?` as ${n.account}`:""," — detected automatically, switch in the model picker below."]}):m.jsx("p",{className:"chat-empty-hint",children:"No coding agent detected on this machine — install Claude Code, Codex or opencode and sign in, then re-open the model picker below."})}function Nw(e){return e==="error"?"tool-status error":e==="completed"?"tool-status":"tool-status running"}function SL(e){if(!e)return"";const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return"now";const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function V1(e){const t=e.replace(/\/+$/,"");return t.slice(t.lastIndexOf("/")+1)||t}function Vp(e){var u,o;const t=e.tool??"tool",n=((u=e.state)==null?void 0:u.input)??{},r=typeof n.command=="string"?n.command:null,a=typeof n.filePath=="string"?n.filePath:null,l=typeof n.description=="string"?n.description:null;switch(t){case"Bash":case"bash":return r?`Ran ${r}`:"Ran command";case"Read":return a?`Read ${V1(a)}`:"Read file";case"Edit":case"Write":case"NotebookEdit":return a?`Edited ${V1(a)}`:"Edited file";case"Grep":return typeof n.pattern=="string"?`Searched “${n.pattern}”`:"Searched";case"Glob":return typeof n.pattern=="string"?`Found ${n.pattern}`:"Listed files";case"WebFetch":case"WebSearch":return l??"Searched the web";case"Task":return l??"Ran a subagent";case"error":return"Error";default:{const c=l??a??r??((o=e.state)==null?void 0:o.title)??"";return c?`${t}: ${c}`:t}}}function xL({part:e,onOpenFile:t}){var o,c;const n=e.state,r=(n==null?void 0:n.error)||(n==null?void 0:n.output)||"",a=typeof((o=n==null?void 0:n.input)==null?void 0:o.command)=="string"?n.input.command:null,l=typeof((c=n==null?void 0:n.input)==null?void 0:c.filePath)=="string"?n.input.filePath:null,u=!!(r||a||l);return m.jsxs("details",{className:"tool-row",open:!1,children:[m.jsxs("summary",{children:[m.jsx("span",{className:Nw(n==null?void 0:n.status)}),m.jsx("span",{className:"tool-line",children:Vp(e)}),l&&t&&m.jsx("button",{className:"tool-open file-link",title:`Open ${l}`,onClick:f=>{f.preventDefault(),f.stopPropagation(),t(l)},children:"open"})]}),u&&m.jsxs("div",{className:"tool-detail",children:[a&&m.jsx("div",{className:"tool-cmd-full",children:a}),r&&m.jsx("div",{className:"tool-output",children:r.slice(0,2e4)})]})]})}function wL({parts:e,onOpenFile:t}){const n=e.some(c=>{var f;return((f=c.state)==null?void 0:f.status)==="running"}),r=e.some(c=>{var f;return((f=c.state)==null?void 0:f.status)==="error"}),[a,l]=V.useState(!1),u=a||n,o=e.length===1?Vp(e[0]):n?Vp(e.find(c=>{var f;return((f=c.state)==null?void 0:f.status)==="running"})??e[e.length-1]):`Used ${e.length} tools`;return m.jsxs("div",{className:`tool-group ${r?"has-error":""}`,children:[m.jsxs("button",{className:"tool-group-summary",onClick:()=>l(c=>!c),children:[m.jsx("span",{className:Nw(n?"running":r?"error":"completed")}),m.jsx("span",{className:"tool-line",children:o}),m.jsx(Uu,{size:12,className:`tool-chevron ${u?"open":""}`})]}),u&&m.jsx("div",{className:"tool-group-rows",children:e.map(c=>m.jsx(xL,{part:c,onOpenFile:t},c.id))})]})}function CL({part:e,onRespond:t,onOpenFile:n,onOpenPlan:r}){var p,d,_;const a=e.prompt,[l,u]=V.useState([]),o=!t,c=v=>t==null?void 0:t({promptId:e.id,...v});if(a.resolved){if(a.kind==="permission")return null;if(a.kind==="plan"){const w=a.approved===!0?"Plan approved":a.approved===!1?a.note?"Revision requested":"Rejected":"Resolved",C=a.approved===!0?"approved":a.approved===!1?a.note?"revised":"rejected":"";return m.jsxs("details",{className:"prompt-collapsed",children:[m.jsxs("summary",{children:[m.jsx("span",{className:"prompt-collapsed-title",children:a.synthesized?"Plan":"Proposed plan"}),m.jsx("span",{className:`prompt-outcome ${C}`,children:w})]}),m.jsxs("div",{className:"prompt-collapsed-body",children:[m.jsx(qo,{text:a.plan??"",onOpenFile:n}),a.note&&m.jsx("div",{className:"prompt-collapsed-note",children:a.note})]})]})}const v=(a.answers??[]).join(", ")||a.note||"";return m.jsxs("details",{className:"prompt-collapsed",children:[m.jsxs("summary",{children:[m.jsx("span",{className:"prompt-collapsed-title",children:a.header||a.question||"Question"}),m.jsx("span",{className:`prompt-outcome ${v?"chosen":""}`,children:v||"Resolved"})]}),m.jsxs("div",{className:"prompt-collapsed-body",children:[a.header&&a.question&&m.jsx("div",{className:"prompt-q",children:a.question}),(a.options??[]).length>0&&m.jsx("ul",{className:"prompt-collapsed-options",children:(a.options??[]).map(w=>{var C;return m.jsx("li",{className:(C=a.answers)!=null&&C.includes(w.label)?"sel":"",children:w.label},w.label)})}),a.note&&a.note!==v&&m.jsx("div",{className:"prompt-collapsed-note",children:a.note})]})]})}if(a.kind==="plan"){const v=!!r;return m.jsxs("div",{className:`prompt-card plan ${o?"readonly":""}`,children:[m.jsx("div",{className:"prompt-head",children:a.synthesized?"Plan mode — ready to proceed?":"Proposed plan"}),m.jsx("div",{className:`prompt-plan ${v?"clamped":""}`,children:m.jsx(qo,{text:a.plan??"",onOpenFile:n})}),v&&m.jsx("button",{className:"prompt-plan-open",onClick:()=>r(a.plan??"",e.id),children:"View full plan"}),!o&&!v&&m.jsxs("div",{className:"prompt-actions",children:[m.jsx("button",{className:"btn-primary",onClick:()=>c({approve:!0,resumeMode:"auto"}),children:"Accept and auto mode"}),m.jsx("button",{className:"btn-ghost",onClick:()=>c({approve:!0,resumeMode:"bypass"}),children:"Accept and bypass all"}),m.jsx("button",{className:"btn-ghost",onClick:()=>c({approve:!1}),children:"Reject"})]})]})}if(a.kind==="permission"){const v=typeof((p=a.toolInput)==null?void 0:p.command)=="string"&&a.toolInput.command||typeof((d=a.toolInput)==null?void 0:d.filePath)=="string"&&a.toolInput.filePath||"",w=typeof((_=a.toolInput)==null?void 0:_.reason)=="string"&&a.toolInput.reason||"";return m.jsxs("div",{className:`prompt-card permission ${o?"readonly":""}`,children:[m.jsxs("div",{className:"prompt-head",children:["Permission needed: ",m.jsx("code",{children:a.tool})]}),v&&m.jsx("div",{className:"prompt-sub",children:v}),w&&m.jsx("div",{className:"prompt-sub",children:w}),!o&&m.jsxs("div",{className:"prompt-actions",children:[m.jsx("button",{className:"btn-primary",onClick:()=>c({approve:!0}),children:"Allow"}),m.jsx("button",{className:"btn-ghost",onClick:()=>c({approve:!1}),children:"Deny"})]})]})}const f=v=>u(w=>a.multiSelect?w.includes(v)?w.filter(C=>C!==v):[...w,v]:[v]);return m.jsxs("div",{className:`prompt-card question ${o?"readonly":""}`,children:[a.header&&m.jsx("div",{className:"prompt-head",children:a.header}),a.question&&m.jsx("div",{className:"prompt-q",children:a.question}),m.jsx("div",{className:"prompt-options",children:(a.options??[]).map(v=>{const w=l.includes(v.label);return m.jsxs("button",{className:`prompt-option ${w?"sel":""}`,disabled:o,onClick:()=>o?void 0:a.multiSelect?f(v.label):c({answers:[v.label]}),children:[m.jsx("span",{className:"prompt-option-label",children:v.label}),v.description&&m.jsx("span",{className:"prompt-option-desc",children:v.description})]},v.label)})}),a.multiSelect&&!o&&m.jsx("div",{className:"prompt-actions",children:m.jsx("button",{className:"btn-primary",disabled:l.length===0,onClick:()=>c({answers:l}),children:"Submit"})})]})}function EL(e){return e.role==="user"?!0:e.parts.some(t=>t.type==="prompt"?!!t.prompt&&!(t.prompt.resolved&&t.prompt.kind==="permission"):t.type==="text"||t.type==="reasoning"?!!t.text:!0)}function kL({message:e,onOpenFile:t,onRespond:n,onOpenPlan:r}){if(e.role==="user"){const o=e.parts.filter(f=>f.type==="text").map(f=>f.text??"").join(` +`),c=e.parts.filter(f=>f.type==="image"&&f.text).map(f=>f.text.startsWith("data:")?f.text:yT(f.text));return m.jsxs("div",{className:"msg-user",children:[o,c.length>0&&m.jsx("div",{className:"msg-images",children:c.map((f,p)=>m.jsx("a",{href:f,target:"_blank",rel:"noreferrer",children:m.jsx("img",{src:f,alt:"attachment"})},p))})]})}const a=[];let l=[];const u=()=>{l.length!==0&&(a.push(m.jsx(wL,{parts:l,onOpenFile:t},`tg-${l[0].id}`)),l=[])};for(const o of e.parts){if(o.type==="tool"){l.push(o);continue}u(),o.type==="text"&&o.text?a.push(m.jsx(qo,{text:o.text,onOpenFile:t},o.id)):o.type==="reasoning"&&o.text?a.push(m.jsxs("details",{className:"reasoning",children:[m.jsx("summary",{children:"thinking…"}),o.text]},o.id)):o.type==="prompt"&&o.prompt&&a.push(m.jsx(CL,{part:o,onRespond:n,onOpenFile:t,onOpenPlan:r},o.id))}return u(),m.jsx("div",{className:"msg-assistant",children:a})}const Tw=[{id:"active",label:"Active",railLabel:"Recents"},{id:"archived",label:"Archived",railLabel:"Archived"},{id:"all",label:"All",railLabel:"All sessions"}];function AL({value:e,onChange:t}){const{open:n,setOpen:r,ref:a}=th();return m.jsxs("div",{className:"rail-filter",ref:a,children:[m.jsx("button",{className:`icon-btn rail-filter-btn ${e!=="active"?"active":""}`,title:"Filter sessions","aria-label":"Filter sessions",onClick:()=>r(l=>!l),children:m.jsx(SN,{size:13})}),n&&m.jsx("div",{className:"option-menu drop-down align-right",children:Tw.map(l=>m.jsxs("button",{className:"model-item",onClick:()=>{t(l.id),r(!1)},children:[m.jsx("span",{children:l.label}),e===l.id&&m.jsx(_n,{size:13})]},l.id))})]})}function NL({session:e,active:t,busy:n,waiting:r,onOpen:a,onRename:l,onSetArchived:u,onDelete:o}){var y;const{open:c,setOpen:f,ref:p}=th(),d=((y=e.title)==null?void 0:y.trim())||"Untitled",[_,v]=V.useState(!1),[w,C]=V.useState(""),b=V.useRef(null);function S(){var E;C(((E=e.title)==null?void 0:E.trim())||""),v(!0)}function x(){var R;const E=w.trim();v(!1),E&&E!==(((R=e.title)==null?void 0:R.trim())||"")&&l(E)}return V.useEffect(()=>{var E,R;_&&((E=b.current)==null||E.focus(),(R=b.current)==null||R.select())},[_]),m.jsxs("div",{ref:p,role:"button",tabIndex:0,className:`session-row ${t?"active":""} ${c?"menu-open":""} ${_?"editing":""}`,title:`${Ew[e.harness]}${e.model?` · ${e.model}`:""}`,onClick:()=>{_||(c?f(!1):a())},onKeyDown:E=>{E.target===E.currentTarget&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),c?f(!1):a())},children:[m.jsx("span",{className:"session-dot",children:n&&m.jsx("span",{className:`busy-dot ${r?"waiting":""}`})}),_?m.jsx("input",{ref:b,className:"session-title-input","aria-label":"Session title",value:w,onChange:E=>C(E.target.value),onClick:E=>E.stopPropagation(),onBlur:x,onKeyDown:E=>{E.stopPropagation(),E.key==="Enter"?(E.preventDefault(),x()):E.key==="Escape"&&(E.preventDefault(),v(!1))}}):m.jsx("span",{className:"session-title",children:d}),m.jsx("span",{className:"session-time",children:SL(e.updatedAt)}),m.jsx("button",{className:"session-menu-btn",title:"Session options","aria-label":"Session options",onClick:E=>{E.stopPropagation(),f(R=>!R)},children:m.jsx(UA,{size:14})}),c&&m.jsxs("div",{className:"option-menu drop-down session-menu",children:[m.jsx("button",{className:"model-item",onClick:E=>{E.stopPropagation(),f(!1),S()},children:m.jsx("span",{children:"Rename"})}),m.jsx("button",{className:"model-item",onClick:E=>{E.stopPropagation(),f(!1),u(!e.archived)},children:m.jsx("span",{children:e.archived?"Unarchive":"Archive"})}),m.jsx("button",{className:"model-item danger",onClick:E=>{E.stopPropagation(),f(!1),o()},children:m.jsx("span",{children:"Delete"})})]})]})}function TL({projectId:e,paperId:t,railHeader:n,railOpen:r,onShowRail:a,mainView:l,onSelectMainView:u,panelOpen:o,onTogglePanel:c,onOpenFile:f,onOpenPlan:p,children:d}){var On,vi,ni;const[_,v]=V.useState([]),[w,C]=V.useState(null),[b,S]=V.useState("active"),[x,y]=V.useState(""),[E,R]=V.useState([]),[N,D]=V.useReducer(yL,{messagesBySession:{},busySessions:new Set}),[T,j]=V.useState([]),[B,z]=V.useState(_L),[G,U]=V.useState({}),H=V.useRef(new Set),Y=V.useRef(new Set),q=V.useRef(null),X=V.useRef(null),K=V.useRef(!0),L=V.useRef(null),[M,O]=V.useState([]),[$,F]=V.useState(0),[Q,re]=V.useState(!1);V.useEffect(()=>{pT().then(O).catch(()=>{})},[]);const ae=x.startsWith("/")&&!/\s/.test(x)?x.slice(1):null,Z=ae!==null&&!Q?M.filter(oe=>oe.name.startsWith(ae.toLowerCase())):[],P=Z.length>0,ee=Math.min($,Math.max(0,Z.length-1));V.useEffect(()=>F(0),[ae]);function ne(oe){var we;y(`/${oe.name} `),(we=L.current)==null||we.focus()}function ge(oe){for(const we of oe){if(!/^image\/(png|jpeg|gif|webp)$/.test(we.type))continue;const Ne=new FileReader;Ne.onload=()=>{const qe=Ne.result;R(at=>[...at,{dataUrl:qe,mediaType:we.type}])},Ne.readAsDataURL(we)}}function he(oe){const we=Array.from(oe.clipboardData.items).filter(Ne=>Ne.kind==="file"&&Ne.type.startsWith("image/")).map(Ne=>Ne.getAsFile()).filter(Ne=>Ne!==null);we.length>0&&(oe.preventDefault(),ge(we))}const ye=_.find(oe=>oe.id===w),be=ye?{harness:ye.harness,model:G.model??ye.model,permissionMode:G.permissionMode??ye.permissionMode,reasoningLevel:G.reasoningLevel??ye.reasoningLevel}:B??G1(T),ke=be?T.find(oe=>oe.id===be.harness):void 0,Ee=ke==null?void 0:ke.options,Ce=oe=>{ye?U({model:oe.model,permissionMode:oe.permissionMode,reasoningLevel:oe.reasoningLevel}):(z(oe),localStorage.setItem(kw,JSON.stringify(oe)))},rt=oe=>{be&&Ce({...be,permissionMode:oe})},bt=oe=>{be&&Ce({...be,reasoningLevel:oe})};V.useEffect(()=>{v([]),C(null),y(""),R([]),D({type:"reset"}),H.current=new Set,zy(e).then(oe=>{v(oe),C(we=>{var Ne;return we??((Ne=oe.find(qe=>!qe.archived))==null?void 0:Ne.id)??null}),D({type:"seedBusy",sessions:oe.filter(we=>we.busy).map(we=>we.id)})}).catch(()=>{})},[e]),V.useEffect(()=>{!w||H.current.has(w)||(H.current.add(w),Hy(w).then(oe=>D({type:"seed",sessionId:w,messages:oe})).catch(()=>H.current.delete(w)))},[w]),V.useEffect(()=>ET(oe=>{switch(oe.type){case"session":if(oe.session.projectId!==e||Y.current.has(oe.session.id))return;v(we=>{const Ne=we.findIndex(at=>at.id===oe.session.id);if(Ne<0)return[oe.session,...we];const qe=we.slice();return qe[Ne]=oe.session,qe});break;case"sessionDeleted":Ct(oe.sessionId);break;case"message":D({type:"upsertMessage",sessionId:oe.sessionId,message:oe.message});break;case"busy":D({type:"busy",sessionId:oe.sessionId,busy:oe.busy});break}}),[e]);const Ge=w?N.messagesBySession[w]??[]:[],ct=w?N.busySessions.has(w):!1,Pt=oe=>N.busySessions.has(oe)&&(N.messagesBySession[oe]??[]).some(we=>we.parts.some(Ne=>Ne.type==="prompt"&&Ne.prompt&&!Ne.prompt.resolved&&Ne.prompt.nativeId)),ht=w?Pt(w):!1,Fe=ye,fe=V.useMemo(()=>{var oe;for(let we=Ge.length-1;we>=0;we--)for(const Ne of Ge[we].parts)if(Ne.type==="prompt"&&((oe=Ne.prompt)==null?void 0:oe.kind)==="plan"&&!Ne.prompt.resolved)return{promptId:Ne.id,plan:Ne.prompt.plan??"",synthesized:!!Ne.prompt.synthesized};return null},[Ge]),ie=V.useMemo(()=>{if(!w||(Fe==null?void 0:Fe.harness)!=="claude-code")return null;for(let oe=Ge.length-1;oe>=0;oe--)for(const we of Ge[oe].parts)if(!(we.type!=="prompt"||!we.prompt||we.prompt.resolved)&&we.prompt.kind==="question")return we.prompt.nativeId&&!N.busySessions.has(w)?null:we.id;return null},[Ge,Fe==null?void 0:Fe.harness,w,N.busySessions]),[de,Se]=V.useState(null),Ae=de&&de.sessionId===w?de:null;V.useEffect(()=>{if(!de)return;const oe=N.busySessions.has(de.sessionId),we=de.sessionId===w&&fe&&fe.promptId!==de.promptId;(!oe||we)&&Se(null)},[de,fe,N.busySessions,w]);const De=p&&w?(oe,we)=>p(oe,w,we):void 0;V.useEffect(()=>U({}),[w]);const Ve=l==="chat"&&(Ge.length>0||ct);V.useLayoutEffect(()=>{K.current=!0;const oe=q.current;oe&&(oe.scrollTop=oe.scrollHeight)},[w,Ve]),V.useLayoutEffect(()=>{const oe=q.current;oe&&K.current&&(oe.scrollTop=oe.scrollHeight)},[Ge,ct]),V.useEffect(()=>{const oe=q.current,we=X.current;if(!oe||!we)return;const Ne=new ResizeObserver(()=>{K.current&&(oe.scrollTop=oe.scrollHeight)});return Ne.observe(we),Ne.observe(oe),()=>Ne.disconnect()},[Ve]);async function Ie(){const oe=x.trim(),we=E;if(!oe&&we.length===0)return;if(oe&&ie&&we.length===0){y(""),Ut({promptId:ie,answers:[],note:oe}).then(at=>{at||y(yi=>yi||oe)});return}if(ct)return;const Ne=be;if(!Ne&&!w)return;y(""),R([]);let qe=w;try{if(!qe){const nn=await gT(e,Ne.harness,{model:Ne.model,permissionMode:Ne.permissionMode,reasoningLevel:Ne.reasoningLevel});H.current.add(nn.id),v(gs=>[nn,...gs]),C(nn.id),qe=nn.id}D({type:"optimisticUser",sessionId:qe,text:oe,imageUrls:we.map(nn=>nn.dataUrl)}),D({type:"busy",sessionId:qe,busy:!0}),K.current=!0,b==="archived"&&S("active");const at=Ne?{model:Ne.model,permissionMode:Ne.permissionMode,reasoningLevel:Ne.reasoningLevel}:{};U({});const yi=we.map(nn=>({mediaType:nn.mediaType,dataBase64:nn.dataUrl.slice(nn.dataUrl.indexOf(",")+1)}));await bT(qe,oe,at,yi.length?yi:void 0)}catch{qe&&D({type:"busy",sessionId:qe,busy:!1})}}function Nt(){w&&ST(w)}V.useEffect(()=>{if(!ct||l!=="chat")return;function oe(we){var Ne;we.key!=="Escape"||we.defaultPrevented||(we.preventDefault(),Nt(),(Ne=L.current)==null||Ne.focus())}return document.addEventListener("keydown",oe),()=>document.removeEventListener("keydown",oe)},[ct,w,l]);function Ct(oe){Y.current.add(oe),v(we=>we.filter(Ne=>Ne.id!==oe)),C(we=>we===oe?null:we),H.current.delete(oe),D({type:"forget",sessionId:oe})}function qt(oe,we){const Ne=oe.archived;v(qe=>qe.map(at=>at.id===oe.id?{...at,archived:we}:at)),_T(oe.id,we).catch(()=>{v(qe=>qe.map(at=>at.id===oe.id?{...at,archived:Ne}:at))})}function st(oe,we){const Ne=oe.title;v(qe=>qe.map(at=>at.id===oe.id?{...at,title:we}:at)),vT(oe.id,we).catch(()=>{v(qe=>qe.map(at=>at.id===oe.id?{...at,title:Ne}:at))})}async function Ln(oe){var Ne;const we=((Ne=oe.title)==null?void 0:Ne.trim())||"Untitled";if(window.confirm(`Delete "${we}"? -Its transcript is permanently removed.`)){try{await bT(oe.id)}catch(qe){window.alert(`Failed to delete "${we}": ${qe instanceof Error?qe.message:String(qe)}`);return}Et(oe.id)}}function Ut(oe){if(!w)return Promise.resolve(!1);const we=w;return D({type:"busy",sessionId:we,busy:!0}),kT(we,oe).then(()=>!0).catch(()=>!1).finally(()=>{Hy(we).then(Ne=>D({type:"seed",sessionId:we,messages:Ne})).catch(()=>{}),zy(e).then(Ne=>{var qe;return D({type:"busy",sessionId:we,busy:!!((qe=Ne.find(at=>at.id===we))!=null&&qe.busy)})}).catch(()=>{})})}const ps=_.filter(oe=>b==="all"?!0:b==="archived"?oe.archived:!oe.archived),mi=m.jsxs("aside",{className:"session-rail floating-panel",children:[n,m.jsxs("nav",{className:"rail-nav",children:[m.jsxs("button",{className:"rail-nav-item",onClick:()=>{C(null),u("chat")},children:[m.jsx(bg,{size:15}),"New session"]}),m.jsxs("button",{className:`rail-nav-item ${l==="files"?"active":""}`,onClick:()=>u("files"),children:[m.jsx(qS,{size:15}),"Files"]}),mL.map(oe=>m.jsxs("button",{className:`rail-nav-item ${l===oe.id?"active":""}`,onClick:()=>u(oe.id),children:[oe.icon,oe.label]},oe.id))]}),m.jsxs("div",{className:"rail-body",children:[m.jsxs("div",{className:"rail-section-head",children:[m.jsx("div",{className:"rail-section-label",children:((On=Mw.find(oe=>oe.id===b))==null?void 0:On.railLabel)??"Recents"}),m.jsx(RL,{value:b,onChange:S})]}),ps.map(oe=>m.jsx(DL,{session:oe,active:oe.id===w&&l==="chat",busy:N.busySessions.has(oe.id),waiting:Pt(oe.id),onOpen:()=>{C(oe.id),u("chat")},onRename:we=>st(oe,we),onSetArchived:we=>qt(oe,we),onDelete:()=>void Ln(oe)},oe.id)),ps.length===0&&m.jsx("div",{className:"rail-empty",children:b==="archived"?"No archived sessions":_.length>0?"No active sessions":"No sessions yet"})]})]}),_i=`chat-header${r?"":" rail-hidden"}`,vi=!r&&m.jsx("button",{className:"icon-btn",title:"Show sidebar","aria-label":"Show sidebar",onClick:a,children:m.jsx(YS,{size:15})});return l!=="chat"?m.jsxs(m.Fragment,{children:[r&&mi,m.jsxs("section",{className:"chat-pane",children:[!r&&m.jsx("div",{className:_i,children:vi}),m.jsx("div",{className:"settings-view-scroll",children:d})]})]}):m.jsxs(m.Fragment,{children:[r&&mi,m.jsxs("section",{className:"chat-pane",children:[m.jsxs("div",{className:_i,children:[vi,m.jsx("div",{className:"title",title:Fe?((yi=Fe.title)==null?void 0:yi.trim())||"Untitled":"New session",children:Fe?((ni=Fe.title)==null?void 0:ni.trim())||"Untitled":"New session"}),m.jsx("button",{className:`icon-btn ${o?"active":""}`,title:"Experiments","aria-label":"Experiments",onClick:c,children:m.jsx(eN,{size:15})})]}),Ve?m.jsx("div",{className:"chat-thread",ref:G,onScroll:oe=>{const we=oe.currentTarget;K.current=we.scrollHeight-we.scrollTop-we.clientHeight<60},children:m.jsxs("div",{className:"chat-thread-inner",ref:X,children:[Ge.filter(NL).map(oe=>m.jsx(TL,{message:oe,onOpenFile:f&&(we=>f(we,w??void 0)),onRespond:Ut,onOpenPlan:De},oe.id)),ct&&(ht?m.jsx("div",{className:"working awaiting",children:"Waiting for your input…"}):m.jsxs("div",{className:"working",children:[m.jsx("span",{className:"spinner"})," Working…"]}))]})}):m.jsxs("div",{className:"chat-empty",children:[m.jsxs("h2",{children:["Open",m.jsx("span",{children:"Research"})]}),m.jsx("p",{children:"Ask the agent to explore your codebase, create and run your baseline experiment, and branch variants off it."}),m.jsx(wL,{harnesses:T,selection:B??G1(T)}),t&&m.jsxs("button",{type:"button",className:"chat-suggest mono",title:"Prefills the composer — add the compute to run on, then send",onClick:()=>{var oe;y(`/reproduce-paper ${t} on `),(oe=L.current)==null||oe.focus()},children:["/reproduce-paper ",t," on [describe your compute setup]"]})]}),m.jsxs("div",{className:"composer",children:[fe&&!(Ae&&fe.promptId===Ae.promptId)&&m.jsx(Dj,{synthesized:fe.synthesized,onView:()=>De==null?void 0:De(fe.plan,fe.promptId),onApprove:oe=>Ut({promptId:fe.promptId,approve:!0,resumeMode:oe}),onReject:()=>Ut({promptId:fe.promptId,approve:!1}),onRevise:oe=>{w&&Se({sessionId:w,promptId:fe.promptId}),Ut({promptId:fe.promptId,approve:!1,note:oe})}}),m.jsxs("div",{className:"composer-box",children:[P&&m.jsx(vL,{skills:Z,activeIndex:ee,onPick:ne,onHover:U}),E.length>0&&m.jsx("div",{className:"composer-attachments",children:E.map((oe,we)=>m.jsxs("div",{className:"attachment-thumb",children:[m.jsx("img",{src:oe.dataUrl,alt:"pasted"}),m.jsx("button",{title:"Remove image","aria-label":"Remove image",onClick:()=>R(Ne=>Ne.filter((qe,at)=>at!==we)),children:m.jsx(Fo,{size:11})})]},we))}),m.jsx("textarea",{ref:L,value:x,placeholder:ie?"Type a custom answer…":be?`Message ${Nw[be.harness]}… ( / for skills)`:"Ask the research agent… ( / for skills)",rows:2,onPaste:he,onDragOver:oe=>{oe.dataTransfer.types.includes("Files")&&oe.preventDefault()},onDrop:oe=>{oe.dataTransfer.files.length!==0&&(oe.preventDefault(),ge(Array.from(oe.dataTransfer.files)))},onChange:oe=>{y(oe.target.value),re(!1)},onKeyDown:oe=>{if(P){if(oe.key==="ArrowDown"||oe.key==="ArrowUp"){oe.preventDefault();const we=oe.key==="ArrowDown"?1:-1;U((ee+we+Z.length)%Z.length);return}if(oe.key==="Enter"||oe.key==="Tab"){oe.preventDefault(),ne(Z[ee]);return}if(oe.key==="Escape"){oe.preventDefault(),re(!0);return}}oe.key==="Enter"&&!oe.shiftKey&&(oe.preventDefault(),Ie())}}),m.jsxs("div",{className:"composer-actions",children:[m.jsx(q1,{choices:(Ee==null?void 0:Ee.permissionModes)??[],value:(be==null?void 0:be.permissionMode)??null,defaultId:(Ee==null?void 0:Ee.defaultPermissionMode)??null,header:"Mode",align:"left",variant:"pill",numbered:!0,title:"Permission mode for this chat",onSelect:rt}),m.jsx("div",{style:{flex:1}}),m.jsx(yL,{value:be,onSelect:Ce,onHarnesses:j,lockHarness:!!ye}),m.jsx(q1,{choices:(Ee==null?void 0:Ee.reasoningLevels)??[],value:(be==null?void 0:be.reasoningLevel)??null,defaultId:(Ee==null?void 0:Ee.defaultReasoningLevel)??null,header:"Reasoning",align:"right",variant:"bare",title:"Reasoning level for this chat",onSelect:bt}),ct&&!ie?m.jsx("button",{className:"send-btn stop",title:"Stop","aria-label":"Stop",onClick:Nt,children:m.jsx(Fo,{size:16})}):m.jsx("button",{className:"send-btn",title:"Send","aria-label":"Send",onClick:()=>void Ie(),disabled:!x.trim()&&E.length===0,children:m.jsx(US,{size:16})})]})]})]})]})]})}function Y1(){return{dirs:new Map,files:[]}}function jL(e){const t=Y1();for(const n of e){const r=n.split("/");let a=t;for(let l=0;ll(n),title:n,children:[c?m.jsx(cs,{size:13,className:"code-tree-chev"}):m.jsx(Uu,{size:13,className:"code-tree-chev"}),c?m.jsx(qS,{size:13}):m.jsx(rN,{size:13}),m.jsx("span",{className:"code-tree-name",children:e})]}),c&&m.jsx(jw,{node:t,parentPath:n,depth:r+1,toggled:a,onToggle:l,onOpenFile:u})]})}function jw({node:e,parentPath:t,depth:n,toggled:r,onToggle:a,onOpenFile:l}){const u=[...e.dirs.keys()].sort((c,f)=>c.localeCompare(f)),o=[...e.files].sort((c,f)=>c.localeCompare(f));return m.jsxs(m.Fragment,{children:[u.map(c=>{const f=t?`${t}/${c}`:c;return m.jsx(LL,{name:c,node:e.dirs.get(c),path:f,depth:n,toggled:r,onToggle:a,onOpenFile:l},`d:${f}`)}),o.map(c=>{const f=t?`${t}/${c}`:c;return m.jsxs("button",{type:"button",className:"code-tree-row",style:{paddingLeft:8+n*14},onClick:()=>l(f),title:f,children:[m.jsx(QA,{size:13}),m.jsx("span",{className:"code-tree-name",children:c})]},`f:${f}`)})]})}function OL({projectId:e,project:t,experiments:n,sel:r,toggled:a,onSelChange:l,onToggledChange:u,onOpenFile:o}){const[c,f]=q.useState(null),[p,d]=q.useState(null),[_,v]=q.useState(!0),w=q.useRef(0),C=q.useCallback(()=>{const E=++w.current;v(!0),GN(e,r?{ref:r}:{}).then(R=>{E===w.current&&(f(R),d(null))}).catch(R=>{E===w.current&&d(R.message)}).finally(()=>{E===w.current&&v(!1)})},[e,r]);q.useEffect(()=>(f(null),d(null),C(),()=>{w.current++}),[C]);const b=q.useMemo(()=>c?jL(c.entries):null,[c]),S=q.useCallback(E=>{const R=new Set(a);R.has(E)?R.delete(E):R.add(E),u(R)},[a,u]),x=q.useMemo(()=>{const E=new Set,R=[];for(const N of n)E.has(N.branchName)||(E.add(N.branchName),R.push({branch:N.branchName,label:N.slug}));return R},[n]),y=r||(c==null?void 0:c.branch)||null;return m.jsxs("div",{className:"code-tab",children:[m.jsxs("div",{className:"code-tab-header",children:[m.jsx("span",{className:"ctl-label",children:"Source"}),m.jsxs("select",{className:"input sm code-tab-select",value:r,onChange:E=>l(E.target.value),title:"Source to browse",children:[m.jsx("option",{value:"",children:"project clone"}),r&&!x.some(E=>E.branch===r)&&m.jsx("option",{value:r,children:r}),x.map(E=>m.jsx("option",{value:E.branch,children:E.label},E.branch))]}),y&&m.jsx("a",{className:"icon-btn",href:xg(t.githubOwner,t.githubRepo,y),target:"_blank",rel:"noopener noreferrer",title:`Open ${y} on GitHub`,children:m.jsx(pm,{size:13})}),m.jsx("span",{style:{flex:1}}),m.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:C,children:_?m.jsx("span",{className:"spinner"}):m.jsx(Sg,{size:13})})]}),(c==null?void 0:c.truncated)&&m.jsx("div",{className:"code-tab-note",children:"listing truncated"}),p&&b&&m.jsxs("div",{className:"code-tab-note",children:["Refresh failed: ",p]}),m.jsx("div",{className:"code-tab-body",children:b?b.dirs.size===0&&b.files.length===0?m.jsx("div",{className:"code-tab-note",children:"No files."}):m.jsx("div",{className:"code-tree",children:m.jsx(jw,{node:b,parentPath:"",depth:0,toggled:a,onToggle:S,onOpenFile:E=>o(E,void 0,r||void 0)})}):m.jsx("div",{className:"code-tab-note",children:p?`Failed to load: ${p}`:"Loading…"})})]})}const BL="project";function IL(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")}function zL(e){if(!e.startsWith("---"))return e;const t=e.indexOf(` ----`,3);return t===-1?e:e.slice(t+4).replace(/^\r?\n/,"")}const HL=/\.(png|jpe?g|gif|webp|svg)$/i;function Yp(e,t){for(const n of e){if(n.path===t)return n;if(n.isDir&&t.startsWith(n.path+"/")){const r=Yp(n.children??[],t);if(r)return r}}return null}function FL({projectId:e,folder:t,markdown:n}){const r=a=>IL(a)?a:Np(e,`${t}/${a.replace(/^\.?\//,"")}`);return m.jsx("div",{className:"md report-md",children:m.jsx($x,{remarkPlugins:[dw],components:{a:({href:a,children:l,...u})=>{const o=!a||a.startsWith("#");return m.jsx("a",{...u,href:o?a:r(a),...o?{}:{target:"_blank",rel:"noopener noreferrer"},children:l})},img:({src:a,alt:l})=>{if(!a||typeof a!="string")return null;const u=r(a);return m.jsxs("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"report-img",children:[m.jsx("img",{src:u,alt:l??"",loading:"lazy"}),l&&m.jsx("span",{className:"report-img-caption",children:l})]})},...ww},children:zL(n)})})}function PL({projectId:e,entry:t,onBack:n,onDelete:r}){const[a,l]=q.useState(null),[u,o]=q.useState(null);return q.useEffect(()=>{uT(e,t.path).then(c=>l(c.markdown)).catch(c=>o(c instanceof Error?c.message:String(c)))},[e,t.path,t.modifiedAt]),m.jsx("div",{className:"report-view",children:m.jsxs("div",{className:"report-view-col",children:[m.jsxs("div",{className:"report-view-head",children:[m.jsxs("button",{className:"report-back",onClick:n,children:[m.jsx(jo,{size:13})," Files"]}),m.jsx("span",{style:{flex:1}}),m.jsx("span",{className:"report-date",children:new Date(t.modifiedAt).toLocaleString()}),m.jsx("button",{className:"icon-btn",title:"Delete report folder","aria-label":"Delete report folder",onClick:()=>{window.confirm(`Delete the "${t.path}" folder from the files dir?`)&&r()},children:m.jsx(Gu,{size:14})})]}),u?m.jsx("div",{className:"error",children:u}):a===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading report…"]}):m.jsx(FL,{projectId:e,folder:t.path,markdown:a})]})})}function UL({dir:e}){const[t,n]=q.useState(!1);return m.jsxs("div",{className:"files-pill files-pill-dir",title:e,children:[m.jsx("code",{children:e}),m.jsx("button",{className:"icon-btn",title:"Copy path","aria-label":"Copy files directory path",onClick:()=>{var r;(r=navigator.clipboard)==null||r.writeText(e),n(!0),setTimeout(()=>n(!1),1200)},children:t?m.jsx(_n,{size:13}):m.jsx(yg,{size:13})})]})}function Lw({projectId:e,entries:t,depth:n,expanded:r,onToggle:a,onOpenReport:l,onDelete:u}){return m.jsx(m.Fragment,{children:t.map(o=>{var p;const c={paddingLeft:14+n*22},f=m.jsx("button",{className:"icon-btn ftree-del",title:`Delete ${o.path}`,"aria-label":`Delete ${o.path}`,onClick:d=>{d.stopPropagation(),window.confirm(`Delete "${o.path}" from the files dir?`)&&u(o.path)},children:m.jsx(Gu,{size:13})});if(o.isDir){const d=o.reportTitle!==void 0,_=r.has(o.path),v=n===0?o.experiment:void 0,w=d&&n>0,C=v?[v.title,v.branchName].filter(Boolean).join(" — "):d&&!w?o.reportTitle:void 0;return m.jsxs("div",{children:[m.jsxs("div",{className:"ftree-row clickable",style:c,title:C,onClick:()=>d?l(o.path):a(o.path),children:[m.jsx("button",{className:`ftree-chevron ${_?"open":""}`,"aria-label":_?`Collapse ${o.name}`:`Expand ${o.name}`,onClick:b=>{b.stopPropagation(),a(o.path)},children:m.jsx(Uu,{size:13})}),w?m.jsx("span",{className:"ftree-title",children:o.reportTitle}):m.jsxs("span",{className:"ftree-dirname",children:[o.name,"/"]}),d&&m.jsx("span",{className:"ftree-tag",children:"report"}),(v==null?void 0:v.latestRunStatus)&&m.jsx("span",{className:"ftree-status",children:v.latestRunStatus}),f,m.jsx("span",{className:"ftree-date",children:new Date(o.modifiedAt).toLocaleDateString()})]}),_&&(((p=o.children)==null?void 0:p.length)??0)>0&&m.jsx("div",{className:"ftree-children",children:m.jsx(Lw,{projectId:e,entries:o.children??[],depth:n+1,expanded:r,onToggle:a,onOpenReport:l,onDelete:u})})]},o.path)}return m.jsxs("div",{className:"ftree-row",style:c,children:[m.jsx("span",{className:"ftree-chevron spacer"}),m.jsxs("a",{className:"ftree-link",href:Np(e,o.path),target:"_blank",rel:"noopener noreferrer",title:o.path,children:[HL.test(o.name)&&m.jsx("img",{className:"ftree-thumb",src:Np(e,o.path),alt:"",loading:"lazy"}),m.jsx("span",{className:"ftree-name",children:o.name})]}),f,m.jsx("span",{className:"ftree-size",children:ns(o.size)})]},o.path)})})}function $L(e){const t=[],n=[],r=[];for(const a of e)a.isDir&&a.name===BL?t.push(a):a.isDir&&a.experiment?n.push(a):r.push(a);return{project:t,experiments:n,other:r}}function GL({project:e,files:t,onChanged:n,onOpenStorage:r}){const[a,l]=q.useState(null),[u,o]=q.useState(new Set),c=a&&t?Yp(t.entries,a):null;q.useEffect(()=>{var b;a&&t&&!((b=Yp(t.entries,a))!=null&&b.reportTitle)&&l(null)},[a,t]);const f=b=>o(S=>{const x=new Set(S);return x.has(b)?x.delete(b):x.add(b),x}),p=b=>{hT(e.id,b).catch(()=>{}).finally(n)};if(c!=null&&c.reportTitle)return m.jsx(PL,{projectId:e.id,entry:c,onBack:()=>l(null),onDelete:()=>{p(c.path),l(null)}});if(!t)return m.jsx("div",{className:"files-tab",children:m.jsx("div",{className:"files-col",children:m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading files…"]})})});const{project:d,experiments:_,other:v}=$L(t.entries),w=b=>m.jsx(Lw,{projectId:e.id,entries:b,depth:0,expanded:u,onToggle:f,onOpenReport:l,onDelete:p}),C=`https://github.com/${e.githubOwner}/${e.githubRepo}`;return m.jsx("div",{className:"files-tab",children:m.jsxs("div",{className:"files-col",children:[m.jsxs("div",{className:"files-meta",children:[m.jsxs("a",{className:"files-pill",href:C,target:"_blank",rel:"noopener noreferrer",children:[m.jsxs("code",{children:[e.githubOwner,"/",e.githubRepo]}),m.jsx($S,{size:12})]}),m.jsx(UL,{dir:t.dir}),m.jsx("button",{type:"button",className:"files-pill files-pill-link",onClick:r,children:"Change storage location →"})]}),m.jsxs("p",{className:"files-hint",children:["An explorer over this folder — the agent writes each experiment's reports and figures into the folder named for its slug (project-wide reports under ",m.jsx("code",{children:"project/"}),"), and you can drop in your own files."]}),t.entries.length===0?m.jsxs("p",{className:"files-empty",children:["Nothing here yet. Ask the agent for a write-up of its findings — it saves each experiment's report folder (",m.jsx("code",{children:"report.md"})," + images) into the folder above."]}):m.jsxs("div",{className:"files-card",children:[w(d),w(_),v.length>0&&(_.length>0||d.length>0)&&m.jsx("div",{className:"ftree-divider",children:"Not linked to an experiment"}),w(v),t.truncated&&m.jsx("p",{className:"files-truncated",children:"Listing truncated — the folder has more files."})]})]})})}function Gc({active:e,label:t,icon:n,onSelect:r,onClose:a}){return m.jsxs("button",{className:`tab closable ${e?"active":""}`,onClick:r,title:t,children:[n,m.jsx("span",{className:"tab-label",children:t}),m.jsx("span",{role:"button",className:"tab-close",title:"Close tab",onClick:l=>{l.stopPropagation(),a()},children:m.jsx(Fo,{size:12})})]})}function qL({owner:e,repo:t,branch:n}){return m.jsxs("a",{className:"files-pill",href:xg(e,t,n),target:"_blank",rel:"noopener noreferrer",title:`Open ${n} on GitHub`,children:[m.jsx("code",{children:n}),m.jsx(pm,{size:12})]})}function W1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function lt(e){for(var t=1;t=0||(p[c]=u[c]);return p})(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Je(e,t){return Bw(e)||(function(n,r){var a=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(a!=null){var l,u,o,c,f=[],p=!0,d=!1;try{if(o=(a=a.call(n)).next,r===0){if(Object(a)!==a)return;p=!1}else for(;!(p=(l=o.call(a)).done)&&(f.push(l.value),f.length!==r);p=!0);}catch(_){d=!0,u=_}finally{try{if(!p&&a.return!=null&&(c=a.return(),Object(c)!==c))return}finally{if(d)throw u}}return f}})(e,t)||nh(e,t)||zw()}function Ow(e){return Bw(e)||Iw(e)||nh(e)||zw()}function Rn(e){return(function(t){if(Array.isArray(t))return Xp(t)})(e)||Iw(e)||nh(e)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function Bw(e){if(Array.isArray(e))return e}function Iw(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function nh(e,t){if(e){if(typeof e=="string")return Xp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xp(e,t):void 0}}function Xp(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n!0).catch(()=>!1).finally(()=>{Hy(we).then(Ne=>D({type:"seed",sessionId:we,messages:Ne})).catch(()=>{}),zy(e).then(Ne=>{var qe;return D({type:"busy",sessionId:we,busy:!!((qe=Ne.find(at=>at.id===we))!=null&&qe.busy)})}).catch(()=>{})})}const ps=_.filter(oe=>b==="all"?!0:b==="archived"?oe.archived:!oe.archived),gi=m.jsxs("aside",{className:"session-rail floating-panel",children:[n,m.jsxs("nav",{className:"rail-nav",children:[m.jsxs("button",{className:"rail-nav-item",onClick:()=>{C(null),u("chat")},children:[m.jsx(bg,{size:15}),"New session"]}),m.jsxs("button",{className:`rail-nav-item ${l==="files"?"active":""}`,onClick:()=>u("files"),children:[m.jsx($S,{size:15}),"Files"]}),dL.map(oe=>m.jsxs("button",{className:`rail-nav-item ${l===oe.id?"active":""}`,onClick:()=>u(oe.id),children:[oe.icon,oe.label]},oe.id))]}),m.jsxs("div",{className:"rail-body",children:[m.jsxs("div",{className:"rail-section-head",children:[m.jsx("div",{className:"rail-section-label",children:((On=Tw.find(oe=>oe.id===b))==null?void 0:On.railLabel)??"Recents"}),m.jsx(AL,{value:b,onChange:S})]}),ps.map(oe=>m.jsx(NL,{session:oe,active:oe.id===w&&l==="chat",busy:N.busySessions.has(oe.id),waiting:Pt(oe.id),onOpen:()=>{C(oe.id),u("chat")},onRename:we=>st(oe,we),onSetArchived:we=>qt(oe,we),onDelete:()=>void Ln(oe)},oe.id)),ps.length===0&&m.jsx("div",{className:"rail-empty",children:b==="archived"?"No archived sessions":_.length>0?"No active sessions":"No sessions yet"})]})]}),mi=`chat-header${r?"":" rail-hidden"}`,_i=!r&&m.jsx("button",{className:"icon-btn",title:"Show sidebar","aria-label":"Show sidebar",onClick:a,children:m.jsx(qS,{size:15})});return l!=="chat"?m.jsxs(m.Fragment,{children:[r&&gi,m.jsxs("section",{className:"chat-pane",children:[!r&&m.jsx("div",{className:mi,children:_i}),m.jsx("div",{className:"settings-view-scroll",children:d})]})]}):m.jsxs(m.Fragment,{children:[r&&gi,m.jsxs("section",{className:"chat-pane",children:[m.jsxs("div",{className:mi,children:[_i,m.jsx("div",{className:"title",title:Fe?((vi=Fe.title)==null?void 0:vi.trim())||"Untitled":"New session",children:Fe?((ni=Fe.title)==null?void 0:ni.trim())||"Untitled":"New session"}),m.jsx("button",{className:`icon-btn ${o?"active":""}`,title:"Experiments","aria-label":"Experiments",onClick:c,children:m.jsx(KA,{size:15})})]}),Ve?m.jsx("div",{className:"chat-thread",ref:q,onScroll:oe=>{const we=oe.currentTarget;K.current=we.scrollHeight-we.scrollTop-we.clientHeight<60},children:m.jsxs("div",{className:"chat-thread-inner",ref:X,children:[Ge.filter(EL).map(oe=>m.jsx(kL,{message:oe,onOpenFile:f&&(we=>f(we,w??void 0)),onRespond:Ut,onOpenPlan:De},oe.id)),ct&&(ht?m.jsx("div",{className:"working awaiting",children:"Waiting for your input…"}):m.jsxs("div",{className:"working",children:[m.jsx("span",{className:"spinner"})," Working…"]}))]})}):m.jsxs("div",{className:"chat-empty",children:[m.jsxs("h2",{children:["Open",m.jsx("span",{children:"Research"})]}),m.jsx("p",{children:"Ask the agent to explore your codebase, create and run your baseline experiment, and branch variants off it."}),m.jsx(bL,{harnesses:T,selection:B??G1(T)}),t&&m.jsxs("button",{type:"button",className:"chat-suggest mono",title:"Prefills the composer — add the compute to run on, then send",onClick:()=>{var oe;y(`/reproduce-paper ${t} on `),(oe=L.current)==null||oe.focus()},children:["/reproduce-paper ",t," on [describe your compute setup]"]})]}),m.jsxs("div",{className:"composer",children:[fe&&!(Ae&&fe.promptId===Ae.promptId)&&m.jsx(Nj,{synthesized:fe.synthesized,onView:()=>De==null?void 0:De(fe.plan,fe.promptId),onApprove:oe=>Ut({promptId:fe.promptId,approve:!0,resumeMode:oe}),onReject:()=>Ut({promptId:fe.promptId,approve:!1}),onRevise:oe=>{w&&Se({sessionId:w,promptId:fe.promptId}),Ut({promptId:fe.promptId,approve:!1,note:oe})}}),m.jsxs("div",{className:"composer-box",children:[P&&m.jsx(gL,{skills:Z,activeIndex:ee,onPick:ne,onHover:F}),E.length>0&&m.jsx("div",{className:"composer-attachments",children:E.map((oe,we)=>m.jsxs("div",{className:"attachment-thumb",children:[m.jsx("img",{src:oe.dataUrl,alt:"pasted"}),m.jsx("button",{title:"Remove image","aria-label":"Remove image",onClick:()=>R(Ne=>Ne.filter((qe,at)=>at!==we)),children:m.jsx(Fo,{size:11})})]},we))}),m.jsx("textarea",{ref:L,value:x,placeholder:ie?"Type a custom answer…":be?`Message ${Ew[be.harness]}… ( / for skills)`:"Ask the research agent… ( / for skills)",rows:2,onPaste:he,onDragOver:oe=>{oe.dataTransfer.types.includes("Files")&&oe.preventDefault()},onDrop:oe=>{oe.dataTransfer.files.length!==0&&(oe.preventDefault(),ge(Array.from(oe.dataTransfer.files)))},onChange:oe=>{y(oe.target.value),re(!1)},onKeyDown:oe=>{if(P){if(oe.key==="ArrowDown"||oe.key==="ArrowUp"){oe.preventDefault();const we=oe.key==="ArrowDown"?1:-1;F((ee+we+Z.length)%Z.length);return}if(oe.key==="Enter"||oe.key==="Tab"){oe.preventDefault(),ne(Z[ee]);return}if(oe.key==="Escape"){oe.preventDefault(),re(!0);return}}oe.key==="Enter"&&!oe.shiftKey&&(oe.preventDefault(),Ie())}}),m.jsxs("div",{className:"composer-actions",children:[m.jsx(q1,{choices:(Ee==null?void 0:Ee.permissionModes)??[],value:(be==null?void 0:be.permissionMode)??null,defaultId:(Ee==null?void 0:Ee.defaultPermissionMode)??null,header:"Mode",align:"left",variant:"pill",numbered:!0,title:"Permission mode for this chat",onSelect:rt}),m.jsx("div",{style:{flex:1}}),m.jsx(mL,{value:be,onSelect:Ce,onHarnesses:j,lockHarness:!!ye}),m.jsx(q1,{choices:(Ee==null?void 0:Ee.reasoningLevels)??[],value:(be==null?void 0:be.reasoningLevel)??null,defaultId:(Ee==null?void 0:Ee.defaultReasoningLevel)??null,header:"Reasoning",align:"right",variant:"bare",title:"Reasoning level for this chat",onSelect:bt}),ct&&!ie?m.jsx("button",{className:"send-btn stop",title:"Stop","aria-label":"Stop",onClick:Nt,children:m.jsx(Fo,{size:16})}):m.jsx("button",{className:"send-btn",title:"Send","aria-label":"Send",onClick:()=>void Ie(),disabled:!x.trim()&&E.length===0,children:m.jsx(FS,{size:16})})]})]})]})]})]})}function Y1(){return{dirs:new Map,files:[]}}function RL(e){const t=Y1();for(const n of e){const r=n.split("/");let a=t;for(let l=0;ll(n),title:n,children:[c?m.jsx(cs,{size:13,className:"code-tree-chev"}):m.jsx(Uu,{size:13,className:"code-tree-chev"}),c?m.jsx($S,{size:13}):m.jsx(eN,{size:13}),m.jsx("span",{className:"code-tree-name",children:e})]}),c&&m.jsx(Rw,{node:t,parentPath:n,depth:r+1,toggled:a,onToggle:l,onOpenFile:u})]})}function Rw({node:e,parentPath:t,depth:n,toggled:r,onToggle:a,onOpenFile:l}){const u=[...e.dirs.keys()].sort((c,f)=>c.localeCompare(f)),o=[...e.files].sort((c,f)=>c.localeCompare(f));return m.jsxs(m.Fragment,{children:[u.map(c=>{const f=t?`${t}/${c}`:c;return m.jsx(DL,{name:c,node:e.dirs.get(c),path:f,depth:n,toggled:r,onToggle:a,onOpenFile:l},`d:${f}`)}),o.map(c=>{const f=t?`${t}/${c}`:c;return m.jsxs("button",{type:"button",className:"code-tree-row",style:{paddingLeft:8+n*14},onClick:()=>l(f),title:f,children:[m.jsx(WA,{size:13}),m.jsx("span",{className:"code-tree-name",children:c})]},`f:${f}`)})]})}function ML({projectId:e,project:t,experiments:n,sel:r,toggled:a,onSelChange:l,onToggledChange:u,onOpenFile:o}){const[c,f]=V.useState(null),[p,d]=V.useState(null),[_,v]=V.useState(!0),w=V.useRef(0),C=V.useCallback(()=>{const E=++w.current;v(!0),FN(e,r?{ref:r}:{}).then(R=>{E===w.current&&(f(R),d(null))}).catch(R=>{E===w.current&&d(R.message)}).finally(()=>{E===w.current&&v(!1)})},[e,r]);V.useEffect(()=>(f(null),d(null),C(),()=>{w.current++}),[C]);const b=V.useMemo(()=>c?RL(c.entries):null,[c]),S=V.useCallback(E=>{const R=new Set(a);R.has(E)?R.delete(E):R.add(E),u(R)},[a,u]),x=V.useMemo(()=>{const E=new Set,R=[];for(const N of n)E.has(N.branchName)||(E.add(N.branchName),R.push({branch:N.branchName,label:N.slug}));return R},[n]),y=r||(c==null?void 0:c.branch)||null;return m.jsxs("div",{className:"code-tab",children:[m.jsxs("div",{className:"code-tab-header",children:[m.jsx("span",{className:"ctl-label",children:"Source"}),m.jsxs("select",{className:"input sm code-tab-select",value:r,onChange:E=>l(E.target.value),title:"Source to browse",children:[m.jsx("option",{value:"",children:"project clone"}),r&&!x.some(E=>E.branch===r)&&m.jsx("option",{value:r,children:r}),x.map(E=>m.jsx("option",{value:E.branch,children:E.label},E.branch))]}),y&&m.jsx("a",{className:"icon-btn",href:xg(t.githubOwner,t.githubRepo,y),target:"_blank",rel:"noopener noreferrer",title:`Open ${y} on GitHub`,children:m.jsx(pm,{size:13})}),m.jsx("span",{style:{flex:1}}),m.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:C,children:_?m.jsx("span",{className:"spinner"}):m.jsx(Sg,{size:13})})]}),(c==null?void 0:c.truncated)&&m.jsx("div",{className:"code-tab-note",children:"listing truncated"}),p&&b&&m.jsxs("div",{className:"code-tab-note",children:["Refresh failed: ",p]}),m.jsx("div",{className:"code-tab-body",children:b?b.dirs.size===0&&b.files.length===0?m.jsx("div",{className:"code-tab-note",children:"No files."}):m.jsx("div",{className:"code-tree",children:m.jsx(Rw,{node:b,parentPath:"",depth:0,toggled:a,onToggle:S,onOpenFile:E=>o(E,void 0,r||void 0)})}):m.jsx("div",{className:"code-tab-note",children:p?`Failed to load: ${p}`:"Loading…"})})]})}const jL="project";function LL(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")}function OL(e){if(!e.startsWith("---"))return e;const t=e.indexOf(` +---`,3);return t===-1?e:e.slice(t+4).replace(/^\r?\n/,"")}const BL=/\.(png|jpe?g|gif|webp|svg)$/i;function Yp(e,t){for(const n of e){if(n.path===t)return n;if(n.isDir&&t.startsWith(n.path+"/")){const r=Yp(n.children??[],t);if(r)return r}}return null}function IL({projectId:e,folder:t,markdown:n}){const r=a=>LL(a)?a:Np(e,`${t}/${a.replace(/^\.?\//,"")}`);return m.jsx("div",{className:"md report-md",children:m.jsx(Fx,{remarkPlugins:[uw],components:{a:({href:a,children:l,...u})=>{const o=!a||a.startsWith("#");return m.jsx("a",{...u,href:o?a:r(a),...o?{}:{target:"_blank",rel:"noopener noreferrer"},children:l})},img:({src:a,alt:l})=>{if(!a||typeof a!="string")return null;const u=r(a);return m.jsxs("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"report-img",children:[m.jsx("img",{src:u,alt:l??"",loading:"lazy"}),l&&m.jsx("span",{className:"report-img-caption",children:l})]})},...bw},children:OL(n)})})}function zL({projectId:e,entry:t,onBack:n,onDelete:r}){const[a,l]=V.useState(null),[u,o]=V.useState(null);return V.useEffect(()=>{aT(e,t.path).then(c=>l(c.markdown)).catch(c=>o(c instanceof Error?c.message:String(c)))},[e,t.path,t.modifiedAt]),m.jsx("div",{className:"report-view",children:m.jsxs("div",{className:"report-view-col",children:[m.jsxs("div",{className:"report-view-head",children:[m.jsxs("button",{className:"report-back",onClick:n,children:[m.jsx(jo,{size:13})," Files"]}),m.jsx("span",{style:{flex:1}}),m.jsx("span",{className:"report-date",children:new Date(t.modifiedAt).toLocaleString()}),m.jsx("button",{className:"icon-btn",title:"Delete report folder","aria-label":"Delete report folder",onClick:()=>{window.confirm(`Delete the "${t.path}" folder from the files dir?`)&&r()},children:m.jsx(Gu,{size:14})})]}),u?m.jsx("div",{className:"error",children:u}):a===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading report…"]}):m.jsx(IL,{projectId:e,folder:t.path,markdown:a})]})})}function HL({dir:e}){const[t,n]=V.useState(!1);return m.jsxs("div",{className:"files-pill files-pill-dir",title:e,children:[m.jsx("code",{children:e}),m.jsx("button",{className:"icon-btn",title:"Copy path","aria-label":"Copy files directory path",onClick:()=>{var r;(r=navigator.clipboard)==null||r.writeText(e),n(!0),setTimeout(()=>n(!1),1200)},children:t?m.jsx(_n,{size:13}):m.jsx(yg,{size:13})})]})}function Dw({projectId:e,entries:t,depth:n,expanded:r,onToggle:a,onOpenReport:l,onDelete:u}){return m.jsx(m.Fragment,{children:t.map(o=>{var p;const c={paddingLeft:14+n*22},f=m.jsx("button",{className:"icon-btn ftree-del",title:`Delete ${o.path}`,"aria-label":`Delete ${o.path}`,onClick:d=>{d.stopPropagation(),window.confirm(`Delete "${o.path}" from the files dir?`)&&u(o.path)},children:m.jsx(Gu,{size:13})});if(o.isDir){const d=o.reportTitle!==void 0,_=r.has(o.path),v=n===0?o.experiment:void 0,w=d&&n>0,C=v?[v.title,v.branchName].filter(Boolean).join(" — "):d&&!w?o.reportTitle:void 0;return m.jsxs("div",{children:[m.jsxs("div",{className:"ftree-row clickable",style:c,title:C,onClick:()=>d?l(o.path):a(o.path),children:[m.jsx("button",{className:`ftree-chevron ${_?"open":""}`,"aria-label":_?`Collapse ${o.name}`:`Expand ${o.name}`,onClick:b=>{b.stopPropagation(),a(o.path)},children:m.jsx(Uu,{size:13})}),w?m.jsx("span",{className:"ftree-title",children:o.reportTitle}):m.jsxs("span",{className:"ftree-dirname",children:[o.name,"/"]}),d&&m.jsx("span",{className:"ftree-tag",children:"report"}),(v==null?void 0:v.latestRunStatus)&&m.jsx("span",{className:"ftree-status",children:v.latestRunStatus}),f,m.jsx("span",{className:"ftree-date",children:new Date(o.modifiedAt).toLocaleDateString()})]}),_&&(((p=o.children)==null?void 0:p.length)??0)>0&&m.jsx("div",{className:"ftree-children",children:m.jsx(Dw,{projectId:e,entries:o.children??[],depth:n+1,expanded:r,onToggle:a,onOpenReport:l,onDelete:u})})]},o.path)}return m.jsxs("div",{className:"ftree-row",style:c,children:[m.jsx("span",{className:"ftree-chevron spacer"}),m.jsxs("a",{className:"ftree-link",href:Np(e,o.path),target:"_blank",rel:"noopener noreferrer",title:o.path,children:[BL.test(o.name)&&m.jsx("img",{className:"ftree-thumb",src:Np(e,o.path),alt:"",loading:"lazy"}),m.jsx("span",{className:"ftree-name",children:o.name})]}),f,m.jsx("span",{className:"ftree-size",children:ns(o.size)})]},o.path)})})}function FL(e){const t=[],n=[],r=[];for(const a of e)a.isDir&&a.name===jL?t.push(a):a.isDir&&a.experiment?n.push(a):r.push(a);return{project:t,experiments:n,other:r}}function PL({project:e,files:t,onChanged:n,onOpenStorage:r}){const[a,l]=V.useState(null),[u,o]=V.useState(new Set),c=a&&t?Yp(t.entries,a):null;V.useEffect(()=>{var b;a&&t&&!((b=Yp(t.entries,a))!=null&&b.reportTitle)&&l(null)},[a,t]);const f=b=>o(S=>{const x=new Set(S);return x.has(b)?x.delete(b):x.add(b),x}),p=b=>{oT(e.id,b).catch(()=>{}).finally(n)};if(c!=null&&c.reportTitle)return m.jsx(zL,{projectId:e.id,entry:c,onBack:()=>l(null),onDelete:()=>{p(c.path),l(null)}});if(!t)return m.jsx("div",{className:"files-tab",children:m.jsx("div",{className:"files-col",children:m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading files…"]})})});const{project:d,experiments:_,other:v}=FL(t.entries),w=b=>m.jsx(Dw,{projectId:e.id,entries:b,depth:0,expanded:u,onToggle:f,onOpenReport:l,onDelete:p}),C=`https://github.com/${e.githubOwner}/${e.githubRepo}`;return m.jsx("div",{className:"files-tab",children:m.jsxs("div",{className:"files-col",children:[m.jsxs("div",{className:"files-meta",children:[m.jsxs("a",{className:"files-pill",href:C,target:"_blank",rel:"noopener noreferrer",children:[m.jsxs("code",{children:[e.githubOwner,"/",e.githubRepo]}),m.jsx(PS,{size:12})]}),m.jsx(HL,{dir:t.dir}),m.jsx("button",{type:"button",className:"files-pill files-pill-link",onClick:r,children:"Change storage location →"})]}),m.jsxs("p",{className:"files-hint",children:["An explorer over this folder — the agent writes each experiment's reports and figures into the folder named for its slug (project-wide reports under ",m.jsx("code",{children:"project/"}),"), and you can drop in your own files."]}),t.entries.length===0?m.jsxs("p",{className:"files-empty",children:["Nothing here yet. Ask the agent for a write-up of its findings — it saves each experiment's report folder (",m.jsx("code",{children:"report.md"})," + images) into the folder above."]}):m.jsxs("div",{className:"files-card",children:[w(d),w(_),v.length>0&&(_.length>0||d.length>0)&&m.jsx("div",{className:"ftree-divider",children:"Not linked to an experiment"}),w(v),t.truncated&&m.jsx("p",{className:"files-truncated",children:"Listing truncated — the folder has more files."})]})]})})}function Gc({active:e,label:t,icon:n,onSelect:r,onClose:a}){return m.jsxs("button",{className:`tab closable ${e?"active":""}`,onClick:r,title:t,children:[n,m.jsx("span",{className:"tab-label",children:t}),m.jsx("span",{role:"button",className:"tab-close",title:"Close tab",onClick:l=>{l.stopPropagation(),a()},children:m.jsx(Fo,{size:12})})]})}function UL({owner:e,repo:t,branch:n}){return m.jsxs("a",{className:"files-pill",href:xg(e,t,n),target:"_blank",rel:"noopener noreferrer",title:`Open ${n} on GitHub`,children:[m.jsx("code",{children:n}),m.jsx(pm,{size:12})]})}function W1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function lt(e){for(var t=1;t=0||(p[c]=u[c]);return p})(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Je(e,t){return jw(e)||(function(n,r){var a=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(a!=null){var l,u,o,c,f=[],p=!0,d=!1;try{if(o=(a=a.call(n)).next,r===0){if(Object(a)!==a)return;p=!1}else for(;!(p=(l=o.call(a)).done)&&(f.push(l.value),f.length!==r);p=!0);}catch(_){d=!0,u=_}finally{try{if(!p&&a.return!=null&&(c=a.return(),Object(c)!==c))return}finally{if(d)throw u}}return f}})(e,t)||nh(e,t)||Ow()}function Mw(e){return jw(e)||Lw(e)||nh(e)||Ow()}function Rn(e){return(function(t){if(Array.isArray(t))return Xp(t)})(e)||Lw(e)||nh(e)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function jw(e){if(Array.isArray(e))return e}function Lw(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function nh(e,t){if(e){if(typeof e=="string")return Xp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xp(e,t):void 0}}function Xp(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(c){throw c},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var l,u=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var c=n.next();return u=c.done,c},e:function(c){o=!0,l=c},f:function(){try{u||n.return==null||n.return()}finally{if(o)throw l}}}}var qc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fl(e,t){return e(t={exports:{}},t.exports),t.exports}var Nn=fl((function(e){/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a-1?S.slice(0,y):E;switch(E){case"diff":C--;break e;case"deleted":case"new":var R=S.slice(y+1);R.indexOf("file mode")===0&&(u[E==="new"?"newMode":"oldMode"]=R.slice(10));break;case"similarity":u.similarity=parseInt(S.split(" ")[2],10);break;case"index":var N=S.slice(y+1).split(" "),D=N[0].split("..");u.oldRevision=D[0],u.newRevision=D[1],N[1]&&(u.oldMode=u.newMode=N[1]);break;case"copy":case"rename":var T=S.slice(y+1);T.indexOf("from")===0?u.oldPath=T.slice(5):u.newPath=T.slice(3),x=E;break;case"---":var j=S.slice(y+1),B=v[++C].slice(4);j==="/dev/null"?(B=B.slice(2),x="add"):B==="/dev/null"?(j=j.slice(2),x="delete"):(x="modify",j=j.slice(2),B=B.slice(2)),j&&(u.oldPath=j),B&&(u.newPath=B),_=5;break e}}u.type=x||"modify"}else if(b.indexOf("Binary")===0)u.isBinary=!0,u.type=b.indexOf("/dev/null and")>=0?"add":b.indexOf("and /dev/null")>=0?"delete":"modify",_=2,u=null;else if(_===5)if(b.indexOf("@@")===0){var F=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(b);o={content:b,oldStart:F[1]-0,newStart:F[4]-0,oldLines:F[3]-0||1,newLines:F[6]-0||1,changes:[]},u.hunks.push(o),c=o.oldStart,f=o.newStart}else{var Y=b.slice(0,1),H={content:b.slice(1)};switch(Y){case"+":H.type="insert",H.isInsert=!0,H.lineNumber=f,f++;break;case"-":H.type="delete",H.isDelete=!0,H.lineNumber=c,c++;break;case" ":H.type="normal",H.isNormal=!0,H.oldLineNumber=c,H.newLineNumber=f,c++,f++;break;case"\\":var z=o.changes[o.changes.length-1];z.isDelete||(u.newEndingNewLine=!1),z.isInsert||(u.oldEndingNewLine=!1)}H.type&&o.changes.push(H)}C++}return d}};e.exports=a})()}));function Tr(e){return e.type==="insert"}function Dn(e){return e.type==="delete"}function $i(e){return e.type==="normal"}function XL(e,t){var n=t.nearbySequences==="zip"?(function(r){var a=r.reduce((function(l,u,o){var c=Je(l,3),f=c[0],p=c[1],d=c[2];return p?Tr(u)&&d>=0?(f.splice(d+1,0,u),[f,u,d+2]):(f.push(u),[f,u,Dn(u)&&Dn(p)?d:o]):(f.push(u),[f,u,Dn(u)?o:-1])}),[[],null,-1]);return Je(a,1)[0]})(e.changes):e.changes;return lt(lt({},e),{},{isPlain:!1,changes:n})}function KL(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=(function(r){if(r.startsWith("diff --git"))return r;var a=r.indexOf(` +*/(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a-1?S.slice(0,y):E;switch(E){case"diff":C--;break e;case"deleted":case"new":var R=S.slice(y+1);R.indexOf("file mode")===0&&(u[E==="new"?"newMode":"oldMode"]=R.slice(10));break;case"similarity":u.similarity=parseInt(S.split(" ")[2],10);break;case"index":var N=S.slice(y+1).split(" "),D=N[0].split("..");u.oldRevision=D[0],u.newRevision=D[1],N[1]&&(u.oldMode=u.newMode=N[1]);break;case"copy":case"rename":var T=S.slice(y+1);T.indexOf("from")===0?u.oldPath=T.slice(5):u.newPath=T.slice(3),x=E;break;case"---":var j=S.slice(y+1),B=v[++C].slice(4);j==="/dev/null"?(B=B.slice(2),x="add"):B==="/dev/null"?(j=j.slice(2),x="delete"):(x="modify",j=j.slice(2),B=B.slice(2)),j&&(u.oldPath=j),B&&(u.newPath=B),_=5;break e}}u.type=x||"modify"}else if(b.indexOf("Binary")===0)u.isBinary=!0,u.type=b.indexOf("/dev/null and")>=0?"add":b.indexOf("and /dev/null")>=0?"delete":"modify",_=2,u=null;else if(_===5)if(b.indexOf("@@")===0){var z=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(b);o={content:b,oldStart:z[1]-0,newStart:z[4]-0,oldLines:z[3]-0||1,newLines:z[6]-0||1,changes:[]},u.hunks.push(o),c=o.oldStart,f=o.newStart}else{var G=b.slice(0,1),U={content:b.slice(1)};switch(G){case"+":U.type="insert",U.isInsert=!0,U.lineNumber=f,f++;break;case"-":U.type="delete",U.isDelete=!0,U.lineNumber=c,c++;break;case" ":U.type="normal",U.isNormal=!0,U.oldLineNumber=c,U.newLineNumber=f,c++,f++;break;case"\\":var H=o.changes[o.changes.length-1];H.isDelete||(u.newEndingNewLine=!1),H.isInsert||(u.oldEndingNewLine=!1)}U.type&&o.changes.push(U)}C++}return d}};e.exports=a})()}));function Tr(e){return e.type==="insert"}function Dn(e){return e.type==="delete"}function Ui(e){return e.type==="normal"}function VL(e,t){var n=t.nearbySequences==="zip"?(function(r){var a=r.reduce((function(l,u,o){var c=Je(l,3),f=c[0],p=c[1],d=c[2];return p?Tr(u)&&d>=0?(f.splice(d+1,0,u),[f,u,d+2]):(f.push(u),[f,u,Dn(u)&&Dn(p)?d:o]):(f.push(u),[f,u,Dn(u)?o:-1])}),[[],null,-1]);return Je(a,1)[0]})(e.changes):e.changes;return lt(lt({},e),{},{isPlain:!1,changes:n})}function YL(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=(function(r){if(r.startsWith("diff --git"))return r;var a=r.indexOf(` `),l=r.indexOf(` `,a+1),u=r.slice(0,a),o=r.slice(a+1,l),c=u.split(" ").slice(1,-3).join(" "),f=o.split(" ").slice(1,-3).join(" ");return["diff --git a/".concat(c," b/").concat(f),"index 1111111..2222222 100644","--- a/".concat(c),"+++ b/".concat(f),r.slice(l+1)].join(` -`)})(e.trimStart());return WL.parse(n).map((function(r){return(function(a,l){var u=a.hunks.map((function(o){return XL(o,l)}));return lt(lt({},a),{},{hunks:u})})(r,t)}))}function ZL(e){return e[0]}function QL(e){return e[e.length-1]}function Kp(e){return["".concat(e,"Start"),"".concat(e,"Lines")]}function Yo(e){return e==="old"?function(t){return Tr(t)?-1:$i(t)?t.oldLineNumber:t.lineNumber}:function(t){return Dn(t)?-1:$i(t)?t.newLineNumber:t.lineNumber}}function Fw(e,t){return function(n,r){var a=n[e],l=a+n[t];return r>=a&&r=l&&a-1},aO=function(e,t){var n=this.__data__,r=ih(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function ia(e){var t=-1,n=e==null?0:e.length;for(this.clear();++to))return!1;var f=l.get(e),p=l.get(t);if(f&&p)return f==t&&p==e;var d=-1,_=!0,v=2&n?new $O:void 0;for(l.set(e,t),l.set(t,e);++d-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},wt={};wt["[object Float32Array]"]=wt["[object Float64Array]"]=wt["[object Int8Array]"]=wt["[object Int16Array]"]=wt["[object Int32Array]"]=wt["[object Uint8Array]"]=wt["[object Uint8ClampedArray]"]=wt["[object Uint16Array]"]=wt["[object Uint32Array]"]=!0,wt["[object Arguments]"]=wt["[object Array]"]=wt["[object ArrayBuffer]"]=wt["[object Boolean]"]=wt["[object DataView]"]=wt["[object Date]"]=wt["[object Error]"]=wt["[object Function]"]=wt["[object Map]"]=wt["[object Number]"]=wt["[object Object]"]=wt["[object RegExp]"]=wt["[object Set]"]=wt["[object String]"]=wt["[object WeakMap]"]=!1;var s6=function(e){return da(e)&&_m(e.length)&&!!wt[Ea(e)]},a6=function(e){return function(t){return e(t)}},nb=fl((function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,a=r&&r.exports===n&&$w.process,l=(function(){try{var u=r&&r.require&&r.require("util").types;return u||a&&a.binding&&a.binding("util")}catch{}})();e.exports=l})),ib=nb&&nb.isTypedArray,vm=ib?a6(ib):s6,o6=Object.prototype.hasOwnProperty,l6=function(e,t){var n=Mn(e),r=!n&&oh(e),a=!n&&!r&&Au(e),l=!n&&!r&&!a&&vm(e),u=n||r||a||l,o=u?e6(e.length,String):[],c=o.length;for(var f in e)!o6.call(e,f)||u&&(f=="length"||a&&(f=="offset"||f=="parent")||l&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Xw(f,c))||o.push(f);return o},c6=Object.prototype,Kw=function(e){var t=e&&e.constructor;return e===(typeof t=="function"&&t.prototype||c6)},u6=(function(e,t){return function(n){return e(t(n))}})(Object.keys,Object),h6=Object.prototype.hasOwnProperty,Zw=function(e){if(!Kw(e))return u6(e);var t=[];for(var n in Object(e))h6.call(e,n)&&n!="constructor"&&t.push(n);return t},lh=function(e){return e!=null&&_m(e.length)&&!qw(e)},ym=function(e){return lh(e)?l6(e):Zw(e)},rb=function(e){return XO(e,ym,JO)},f6=Object.prototype.hasOwnProperty,d6=function(e,t,n,r,a,l){var u=1&n,o=rb(e),c=o.length;if(c!=rb(t).length&&!u)return!1;for(var f=c;f--;){var p=o[f];if(!(u?p in t:f6.call(t,p)))return!1}var d=l.get(e),_=l.get(t);if(d&&_)return d==t&&_==e;var v=!0;l.set(e,t),l.set(t,e);for(var w=u;++f1)return!1;if(e.length===1){var t=Je(e,1)[0];return t.type==="text"&&!t.value}return!0}function t8(e){var t=e.changeKey,n=e.text,r=e.tokens,a=e.renderToken,l=Ar(e,J6),u=a?function(o,c){return a(o,cb,c)}:cb;return m.jsx("td",lt(lt({},l),{},{"data-change-key":t,children:r?e8(r)?" ":r.map(u):n||" "}))}var sC=q.memo(t8);function aC(e,t){return function(){var n=t==="old"?dh(e):ph(e);return n===-1?void 0:n}}function oC(e,t){return function(n){return e&&n?m.jsx("a",{href:t?"#"+t:void 0,children:n}):n}}function Nu(e,t){return t?function(n){e(),t(n)}:e}function ub(e,t,n,r){return q.useMemo((function(){var a=rC(e,(function(l){return function(u){return l&&l(t,u)}}));return a.onMouseEnter=Nu(n,a.onMouseEnter),a.onMouseLeave=Nu(r,a.onMouseLeave),a}),[e,n,r,t])}function hb(e,t,n,r,a,l,u,o,c){var f={change:t,side:r,inHoverState:o,renderDefault:aC(t,r),wrapInAnchor:oC(a,l)};return m.jsx("td",lt(lt({className:e},u),{},{"data-change-key":n,children:c(f)}))}function n8(e){var t,n,r,a=e.change,l=e.selected,u=e.tokens,o=e.className,c=e.generateLineClassName,f=e.gutterClassName,p=e.codeClassName,d=e.gutterEvents,_=e.codeEvents,v=e.hideGutter,w=e.gutterAnchor,C=e.generateAnchorID,b=e.renderToken,S=e.renderGutter,x=a.type,y=a.content,E=kr(a),R=(t=Je(q.useState(!1),2),n=t[0],r=t[1],[n,q.useCallback((function(){return r(!0)}),[]),q.useCallback((function(){return r(!1)}),[])]),N=Je(R,3),D=N[0],T=N[1],j=N[2],B=q.useMemo((function(){return{change:a}}),[a]),F=ub(d,B,T,j),Y=ub(_,B,T,j),H=C(a),z=c({changes:[a],defaultGenerate:function(){return o}}),V=Nn("diff-gutter","diff-gutter-".concat(x),f,{"diff-gutter-selected":l}),G=Nn("diff-code","diff-code-".concat(x),p,{"diff-code-selected":l});return m.jsxs("tr",{id:H,className:Nn("diff-line",z),children:[!v&&hb(V,a,E,"old",w,H,F,D,S),!v&&hb(V,a,E,"new",w,H,F,D,S),m.jsx(sC,lt({className:G,changeKey:E,text:y,tokens:u,renderToken:b},Y))]})}var i8=q.memo(n8);function r8(e){var t=e.hideGutter,n=e.element;return m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?1:3,className:"diff-widget-content",children:n})})}var s8=["hideGutter","selectedChanges","tokens","lineClassName"],a8=["hunk","widgets","className"];function o8(e){var t=e.hunk,n=e.widgets,r=e.className,a=Ar(e,a8),l=(function(u,o){return u.reduce((function(c,f){var p=kr(f);c.push(["change",p,f]);var d=o[p];return d&&c.push(["widget",p,d]),c}),[])})(t.changes,n);return m.jsx("tbody",{className:Nn("diff-hunk",r),children:l.map((function(u){return(function(o,c){var f=Je(o,3),p=f[0],d=f[1],_=f[2],v=c.hideGutter,w=c.selectedChanges,C=c.tokens,b=c.lineClassName,S=Ar(c,s8);if(p==="change"){var x=Dn(_)?"old":"new",y=Dn(_)?dh(_):ph(_),E=C?C[x][y-1]:null;return m.jsx(i8,lt({className:b,change:_,hideGutter:v,selected:w.includes(d),tokens:E},S),"change".concat(d))}return p==="widget"?m.jsx(r8,{hideGutter:v,element:_},"widget".concat(d)):null})(u,a)}))})}var lC=0;function Yc(e,t,n,r){var a=q.useCallback((function(){return t(e)}),[e,t]),l=q.useCallback((function(){return t("")}),[t]);return q.useMemo((function(){var u=rC(r,(function(o){return function(c){return o&&o({side:e,change:n},c)}}));return u.onMouseEnter=Nu(a,u.onMouseEnter),u.onMouseLeave=Nu(l,u.onMouseLeave),u}),[n,r,a,e,l])}function hp(e){var t=e.change,n=e.side,r=e.selected,a=e.tokens,l=e.gutterClassName,u=e.codeClassName,o=e.gutterEvents,c=e.codeEvents,f=e.anchorID,p=e.gutterAnchor,d=e.gutterAnchorTarget,_=e.hideGutter,v=e.hover,w=e.renderToken,C=e.renderGutter;if(!t){var b=Nn("diff-gutter","diff-gutter-omit",l),S=Nn("diff-code","diff-code-omit",u);return[!_&&m.jsx("td",{className:b},"gutter"),m.jsx("td",{className:S},"code")]}var x=t.type,y=t.content,E=kr(t),R=n===lC?"old":"new",N=lt({id:f||void 0,className:Nn("diff-gutter","diff-gutter-".concat(x),Wp({"diff-gutter-selected":r},"diff-line-hover-"+R,v),l),children:C({change:t,side:R,inHoverState:v,renderDefault:aC(t,R),wrapInAnchor:oC(p,d)})},o),D=Nn("diff-code","diff-code-".concat(x),Wp({"diff-code-selected":r},"diff-line-hover-"+R,v),u);return[!_&&m.jsx("td",lt(lt({},N),{},{"data-change-key":E}),"gutter"),m.jsx(sC,lt({className:D,changeKey:E,text:y,tokens:a,renderToken:w},c),"code")]}function l8(e){var t=e.className,n=e.oldChange,r=e.newChange,a=e.oldSelected,l=e.newSelected,u=e.oldTokens,o=e.newTokens,c=e.monotonous,f=e.gutterClassName,p=e.codeClassName,d=e.gutterEvents,_=e.codeEvents,v=e.hideGutter,w=e.generateAnchorID,C=e.generateLineClassName,b=e.gutterAnchor,S=e.renderToken,x=e.renderGutter,y=Je(q.useState(""),2),E=y[0],R=y[1],N=Yc("old",R,n,d),D=Yc("new",R,r,d),T=Yc("old",R,n,_),j=Yc("new",R,r,_),B=n&&w(n),F=r&&w(r),Y=C({changes:[n,r],defaultGenerate:function(){return t}}),H={monotonous:c,hideGutter:v,gutterClassName:f,codeClassName:p,gutterEvents:d,codeEvents:_,renderToken:S,renderGutter:x},z=lt(lt({},H),{},{change:n,side:lC,selected:a,tokens:u,gutterEvents:N,codeEvents:T,anchorID:B,gutterAnchor:b,gutterAnchorTarget:B,hover:E==="old"}),V=lt(lt({},H),{},{change:r,side:1,selected:l,tokens:o,gutterEvents:D,codeEvents:j,anchorID:n===r?null:F,gutterAnchor:b,gutterAnchorTarget:n===r?B:F,hover:E==="new"});if(c)return m.jsx("tr",{className:Nn("diff-line",Y),children:hp(n?z:V)});var G=(function(X,K){return X&&!K?"diff-line-old-only":!X&&K?"diff-line-new-only":X===K?"diff-line-normal":"diff-line-compare"})(n,r);return m.jsxs("tr",{className:Nn("diff-line",G,Y),children:[hp(z),hp(V)]})}var c8=q.memo(l8);function u8(e){var t=e.hideGutter,n=e.oldElement,r=e.newElement;return e.monotonous?m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n||r})}):n===r?m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?2:4,className:"diff-widget-content",children:n})}):m.jsxs("tr",{className:"diff-widget",children:[m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n}),m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:r})]})}var h8=["selectedChanges","monotonous","hideGutter","tokens","lineClassName"],f8=["hunk","widgets","className"];function Wc(e,t){return(e?kr(e):"00")+(t?kr(t):"00")}function d8(e){var t=e.hunk,n=e.widgets,r=e.className,a=Ar(e,f8),l=(function(u,o){for(var c=function(S){if(!S)return null;var x=kr(S);return o[x]||null},f=[],p=0;p=a&&r=l&&a-1},iO=function(e,t){var n=this.__data__,r=ih(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function ia(e){var t=-1,n=e==null?0:e.length;for(this.clear();++to))return!1;var f=l.get(e),p=l.get(t);if(f&&p)return f==t&&p==e;var d=-1,_=!0,v=2&n?new FO:void 0;for(l.set(e,t),l.set(t,e);++d-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},wt={};wt["[object Float32Array]"]=wt["[object Float64Array]"]=wt["[object Int8Array]"]=wt["[object Int16Array]"]=wt["[object Int32Array]"]=wt["[object Uint8Array]"]=wt["[object Uint8ClampedArray]"]=wt["[object Uint16Array]"]=wt["[object Uint32Array]"]=!0,wt["[object Arguments]"]=wt["[object Array]"]=wt["[object ArrayBuffer]"]=wt["[object Boolean]"]=wt["[object DataView]"]=wt["[object Date]"]=wt["[object Error]"]=wt["[object Function]"]=wt["[object Map]"]=wt["[object Number]"]=wt["[object Object]"]=wt["[object RegExp]"]=wt["[object Set]"]=wt["[object String]"]=wt["[object WeakMap]"]=!1;var n6=function(e){return da(e)&&_m(e.length)&&!!wt[Ea(e)]},i6=function(e){return function(t){return e(t)}},nb=fl((function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,a=r&&r.exports===n&&Fw.process,l=(function(){try{var u=r&&r.require&&r.require("util").types;return u||a&&a.binding&&a.binding("util")}catch{}})();e.exports=l})),ib=nb&&nb.isTypedArray,vm=ib?i6(ib):n6,r6=Object.prototype.hasOwnProperty,s6=function(e,t){var n=Mn(e),r=!n&&oh(e),a=!n&&!r&&Au(e),l=!n&&!r&&!a&&vm(e),u=n||r||a||l,o=u?ZO(e.length,String):[],c=o.length;for(var f in e)!r6.call(e,f)||u&&(f=="length"||a&&(f=="offset"||f=="parent")||l&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Vw(f,c))||o.push(f);return o},a6=Object.prototype,Yw=function(e){var t=e&&e.constructor;return e===(typeof t=="function"&&t.prototype||a6)},o6=(function(e,t){return function(n){return e(t(n))}})(Object.keys,Object),l6=Object.prototype.hasOwnProperty,Ww=function(e){if(!Yw(e))return o6(e);var t=[];for(var n in Object(e))l6.call(e,n)&&n!="constructor"&&t.push(n);return t},lh=function(e){return e!=null&&_m(e.length)&&!Uw(e)},ym=function(e){return lh(e)?s6(e):Ww(e)},rb=function(e){return VO(e,ym,KO)},c6=Object.prototype.hasOwnProperty,u6=function(e,t,n,r,a,l){var u=1&n,o=rb(e),c=o.length;if(c!=rb(t).length&&!u)return!1;for(var f=c;f--;){var p=o[f];if(!(u?p in t:c6.call(t,p)))return!1}var d=l.get(e),_=l.get(t);if(d&&_)return d==t&&_==e;var v=!0;l.set(e,t),l.set(t,e);for(var w=u;++f1)return!1;if(e.length===1){var t=Je(e,1)[0];return t.type==="text"&&!t.value}return!0}function Q6(e){var t=e.changeKey,n=e.text,r=e.tokens,a=e.renderToken,l=Ar(e,K6),u=a?function(o,c){return a(o,cb,c)}:cb;return m.jsx("td",lt(lt({},l),{},{"data-change-key":t,children:r?Z6(r)?" ":r.map(u):n||" "}))}var nC=V.memo(Q6);function iC(e,t){return function(){var n=t==="old"?dh(e):ph(e);return n===-1?void 0:n}}function rC(e,t){return function(n){return e&&n?m.jsx("a",{href:t?"#"+t:void 0,children:n}):n}}function Nu(e,t){return t?function(n){e(),t(n)}:e}function ub(e,t,n,r){return V.useMemo((function(){var a=tC(e,(function(l){return function(u){return l&&l(t,u)}}));return a.onMouseEnter=Nu(n,a.onMouseEnter),a.onMouseLeave=Nu(r,a.onMouseLeave),a}),[e,n,r,t])}function hb(e,t,n,r,a,l,u,o,c){var f={change:t,side:r,inHoverState:o,renderDefault:iC(t,r),wrapInAnchor:rC(a,l)};return m.jsx("td",lt(lt({className:e},u),{},{"data-change-key":n,children:c(f)}))}function J6(e){var t,n,r,a=e.change,l=e.selected,u=e.tokens,o=e.className,c=e.generateLineClassName,f=e.gutterClassName,p=e.codeClassName,d=e.gutterEvents,_=e.codeEvents,v=e.hideGutter,w=e.gutterAnchor,C=e.generateAnchorID,b=e.renderToken,S=e.renderGutter,x=a.type,y=a.content,E=kr(a),R=(t=Je(V.useState(!1),2),n=t[0],r=t[1],[n,V.useCallback((function(){return r(!0)}),[]),V.useCallback((function(){return r(!1)}),[])]),N=Je(R,3),D=N[0],T=N[1],j=N[2],B=V.useMemo((function(){return{change:a}}),[a]),z=ub(d,B,T,j),G=ub(_,B,T,j),U=C(a),H=c({changes:[a],defaultGenerate:function(){return o}}),Y=Nn("diff-gutter","diff-gutter-".concat(x),f,{"diff-gutter-selected":l}),q=Nn("diff-code","diff-code-".concat(x),p,{"diff-code-selected":l});return m.jsxs("tr",{id:U,className:Nn("diff-line",H),children:[!v&&hb(Y,a,E,"old",w,U,z,D,S),!v&&hb(Y,a,E,"new",w,U,z,D,S),m.jsx(nC,lt({className:q,changeKey:E,text:y,tokens:u,renderToken:b},G))]})}var e8=V.memo(J6);function t8(e){var t=e.hideGutter,n=e.element;return m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?1:3,className:"diff-widget-content",children:n})})}var n8=["hideGutter","selectedChanges","tokens","lineClassName"],i8=["hunk","widgets","className"];function r8(e){var t=e.hunk,n=e.widgets,r=e.className,a=Ar(e,i8),l=(function(u,o){return u.reduce((function(c,f){var p=kr(f);c.push(["change",p,f]);var d=o[p];return d&&c.push(["widget",p,d]),c}),[])})(t.changes,n);return m.jsx("tbody",{className:Nn("diff-hunk",r),children:l.map((function(u){return(function(o,c){var f=Je(o,3),p=f[0],d=f[1],_=f[2],v=c.hideGutter,w=c.selectedChanges,C=c.tokens,b=c.lineClassName,S=Ar(c,n8);if(p==="change"){var x=Dn(_)?"old":"new",y=Dn(_)?dh(_):ph(_),E=C?C[x][y-1]:null;return m.jsx(e8,lt({className:b,change:_,hideGutter:v,selected:w.includes(d),tokens:E},S),"change".concat(d))}return p==="widget"?m.jsx(t8,{hideGutter:v,element:_},"widget".concat(d)):null})(u,a)}))})}var sC=0;function Yc(e,t,n,r){var a=V.useCallback((function(){return t(e)}),[e,t]),l=V.useCallback((function(){return t("")}),[t]);return V.useMemo((function(){var u=tC(r,(function(o){return function(c){return o&&o({side:e,change:n},c)}}));return u.onMouseEnter=Nu(a,u.onMouseEnter),u.onMouseLeave=Nu(l,u.onMouseLeave),u}),[n,r,a,e,l])}function hp(e){var t=e.change,n=e.side,r=e.selected,a=e.tokens,l=e.gutterClassName,u=e.codeClassName,o=e.gutterEvents,c=e.codeEvents,f=e.anchorID,p=e.gutterAnchor,d=e.gutterAnchorTarget,_=e.hideGutter,v=e.hover,w=e.renderToken,C=e.renderGutter;if(!t){var b=Nn("diff-gutter","diff-gutter-omit",l),S=Nn("diff-code","diff-code-omit",u);return[!_&&m.jsx("td",{className:b},"gutter"),m.jsx("td",{className:S},"code")]}var x=t.type,y=t.content,E=kr(t),R=n===sC?"old":"new",N=lt({id:f||void 0,className:Nn("diff-gutter","diff-gutter-".concat(x),Wp({"diff-gutter-selected":r},"diff-line-hover-"+R,v),l),children:C({change:t,side:R,inHoverState:v,renderDefault:iC(t,R),wrapInAnchor:rC(p,d)})},o),D=Nn("diff-code","diff-code-".concat(x),Wp({"diff-code-selected":r},"diff-line-hover-"+R,v),u);return[!_&&m.jsx("td",lt(lt({},N),{},{"data-change-key":E}),"gutter"),m.jsx(nC,lt({className:D,changeKey:E,text:y,tokens:a,renderToken:w},c),"code")]}function s8(e){var t=e.className,n=e.oldChange,r=e.newChange,a=e.oldSelected,l=e.newSelected,u=e.oldTokens,o=e.newTokens,c=e.monotonous,f=e.gutterClassName,p=e.codeClassName,d=e.gutterEvents,_=e.codeEvents,v=e.hideGutter,w=e.generateAnchorID,C=e.generateLineClassName,b=e.gutterAnchor,S=e.renderToken,x=e.renderGutter,y=Je(V.useState(""),2),E=y[0],R=y[1],N=Yc("old",R,n,d),D=Yc("new",R,r,d),T=Yc("old",R,n,_),j=Yc("new",R,r,_),B=n&&w(n),z=r&&w(r),G=C({changes:[n,r],defaultGenerate:function(){return t}}),U={monotonous:c,hideGutter:v,gutterClassName:f,codeClassName:p,gutterEvents:d,codeEvents:_,renderToken:S,renderGutter:x},H=lt(lt({},U),{},{change:n,side:sC,selected:a,tokens:u,gutterEvents:N,codeEvents:T,anchorID:B,gutterAnchor:b,gutterAnchorTarget:B,hover:E==="old"}),Y=lt(lt({},U),{},{change:r,side:1,selected:l,tokens:o,gutterEvents:D,codeEvents:j,anchorID:n===r?null:z,gutterAnchor:b,gutterAnchorTarget:n===r?B:z,hover:E==="new"});if(c)return m.jsx("tr",{className:Nn("diff-line",G),children:hp(n?H:Y)});var q=(function(X,K){return X&&!K?"diff-line-old-only":!X&&K?"diff-line-new-only":X===K?"diff-line-normal":"diff-line-compare"})(n,r);return m.jsxs("tr",{className:Nn("diff-line",q,G),children:[hp(H),hp(Y)]})}var a8=V.memo(s8);function o8(e){var t=e.hideGutter,n=e.oldElement,r=e.newElement;return e.monotonous?m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n||r})}):n===r?m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?2:4,className:"diff-widget-content",children:n})}):m.jsxs("tr",{className:"diff-widget",children:[m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n}),m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:r})]})}var l8=["selectedChanges","monotonous","hideGutter","tokens","lineClassName"],c8=["hunk","widgets","className"];function Wc(e,t){return(e?kr(e):"00")+(t?kr(t):"00")}function u8(e){var t=e.hunk,n=e.widgets,r=e.className,a=Ar(e,c8),l=(function(u,o){for(var c=function(S){if(!S)return null;var x=kr(S);return o[x]||null},f=[],p=0;p=(l==null?void 0:l.value.length))return[e];var o=function(d,_){var v=l.value.slice(d,_);return[].concat(Rn(a),[lt(lt({},l),{},{value:v})])};if(t>0){var c=o(0,t);u.push(oa(c))}var f=o(Math.max(t,0),n);if(u.push(r?(function(d,_){return[_].concat(Rn(oa(d)))})(f,r):oa(f)),n1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(e.children){var r=e.children,a=Ar(e,j8);n.push(a);var l,u=gm(r);try{for(u.s();!(l=u.n()).done;)fC(l.value,t,n)}catch(o){u.e(o)}finally{u.f()}n.pop()}else t.push(oa([].concat(Rn(n.slice(1)),[e])));return t}function L8(e){return e.reduce((function(t,n){var r=t[t.length-1],a=(function(c){var f=Cm(c);return f.value.includes(` +`)})(t.oldSource,e),r=t.highlight?function(c){return t.refractor.highlight(c,t.language)}:function(c){return[{type:"text",value:c}]};return[Xc(r(t.oldSource)),Xc(r(n))]}var a=Je(E8(e),2),l=a[0],u=a[1],o=t.highlight?function(c){return Xc(t.refractor.highlight(c,t.language))}:function(c){return Xc([{type:"text",value:c}])};return[o(l),o(u)]}function oa(e){return e.map((function(t){return lt({},t)}))}function A8(e,t){return[].concat(Rn(oa(e.slice(0,-1))),[t])}function N8(e){return e.type==="text"}function Cm(e){var t=e[e.length-1];if(N8(t))return t;throw new Error("Invalid token path with leaf of type ".concat(t.type))}function T8(e,t,n,r){var a=e.slice(0,-1),l=Cm(e),u=[];if(n<=0||t>=(l==null?void 0:l.value.length))return[e];var o=function(d,_){var v=l.value.slice(d,_);return[].concat(Rn(a),[lt(lt({},l),{},{value:v})])};if(t>0){var c=o(0,t);u.push(oa(c))}var f=o(Math.max(t,0),n);if(u.push(r?(function(d,_){return[_].concat(Rn(oa(d)))})(f,r):oa(f)),n1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(e.children){var r=e.children,a=Ar(e,R8);n.push(a);var l,u=gm(r);try{for(u.s();!(l=u.n()).done;)cC(l.value,t,n)}catch(o){u.e(o)}finally{u.f()}n.pop()}else t.push(oa([].concat(Rn(n.slice(1)),[e])));return t}function D8(e){return e.reduce((function(t,n){var r=t[t.length-1],a=(function(c){var f=Cm(c);return f.value.includes(` `)?f.value.split(` -`).map((function(p){return R8(c,lt(lt({},f),{},{value:p}))})):[c]})(n),l=Ow(a),u=l[0],o=l.slice(1);return[].concat(Rn(t.slice(0,-1)),[[].concat(Rn(r),[u])],Rn(o.map((function(c){return[c]}))))}),[[]])}function gb(e){return L8(fC(e))}var O8=function(e,t,n){var r=(n=typeof n=="function"?n:void 0)?n(e,t):void 0;return r===void 0?ch(e,t,void 0,n):!!r},B8=function(e,t){return ch(e,t)},I8=function(e){var t=e==null?0:e.length;return t?e[t-1]:void 0};function z8(e,t){if(!e.children)throw new Error("parent node missing children property");var n,r,a=I8(e.children);return a&&(r=t,(n=a).type===r.type&&(n.type==="text"||n.children&&r.children&&O8(n,r,(function(l,u,o){return o==="chlidren"||B8(l,u)}))))?e.children[e.children.length-1]=(function(l,u){return"value"in l&&"value"in u?lt(lt({},l),{},{value:"".concat(l.value).concat(u.value)}):l})(a,t):e.children.push(t),e.children[e.children.length-1]}function mb(e){var t,n={type:"root",children:[]},r=gm(e);try{var a=function(){var l=t.value;l.reduce((function(u,o,c){return z8(u,c===l.length-1?lt({},o):lt(lt({},o),{},{children:[]}))}),n)};for(r.s();!(t=r.n()).done;)a()}catch(l){r.e(l)}finally{r.f()}return n}var H8=Object.prototype.hasOwnProperty,F8=uC((function(e,t,n){H8.call(e,n)?e[n].push(t):xm(e,n,[t])})),P8=Object.prototype.hasOwnProperty,U8=function(e){if(e==null)return!0;if(lh(e)&&(Mn(e)||typeof e=="string"||typeof e.splice=="function"||Au(e)||vm(e)||oh(e)))return!e.length;var t=tg(e);if(t=="[object Map]"||t=="[object Set]")return!e.size;if(Kw(e))return!Zw(e).length;for(var n in e)if(P8.call(e,n))return!1;return!0},$8=function(e,t){var n=t.start,r=t.length,a=n+r,l=e.reduce((function(u,o){var c=Je(u,2),f=c[0],p=c[1],d=p+Cm(o).value.length;if(p>a||dr.length?n:r,c=n.length>r.length?r:n,f=o.indexOf(c);if(f!=-1)return u=[new t.Diff(1,o.substring(0,f)),new t.Diff(0,c),new t.Diff(1,o.substring(f+c.length))],n.length>r.length&&(u[0][0]=u[2][0]=-1),u;if(c.length==1)return[new t.Diff(-1,n),new t.Diff(1,r)];var p=this.diff_halfMatch_(n,r);if(p){var d=p[0],_=p[1],v=p[2],w=p[3],C=p[4],b=this.diff_main(d,v,a,l),S=this.diff_main(_,w,a,l);return b.concat([new t.Diff(0,C)],S)}return a&&n.length>100&&r.length>100?this.diff_lineMode_(n,r,l):this.diff_bisect_(n,r,l)},t.prototype.diff_lineMode_=function(n,r,a){var l=this.diff_linesToChars_(n,r);n=l.chars1,r=l.chars2;var u=l.lineArray,o=this.diff_main(n,r,!1,a);this.diff_charsToLines_(o,u),this.diff_cleanupSemantic(o),o.push(new t.Diff(0,""));for(var c=0,f=0,p=0,d="",_="";c=1&&p>=1){o.splice(c-f-p,f+p),c=c-f-p;for(var v=this.diff_main(d,_,!1,a),w=v.length-1;w>=0;w--)o.splice(c,0,v[w]);c+=v.length}p=0,f=0,d="",_=""}c++}return o.pop(),o},t.prototype.diff_bisect_=function(n,r,a){for(var l=n.length,u=r.length,o=Math.ceil((l+u)/2),c=o,f=2*o,p=new Array(f),d=new Array(f),_=0;_a);y++){for(var E=-y+C;E<=y-b;E+=2){for(var R=c+E,N=(F=E==-y||E!=y&&p[R-1]l)b+=2;else if(N>u)C+=2;else if(w&&(j=c+v-E)>=0&&j=(T=l-d[j]))return this.diff_bisectSplit_(n,r,F,N,a)}for(var D=-y+S;D<=y-x;D+=2){for(var T,j=c+D,B=(T=D==-y||D!=y&&d[j-1]l)x+=2;else if(B>u)S+=2;else if(!w&&(R=c+v-D)>=0&&R=(T=l-T))return this.diff_bisectSplit_(n,r,F,N,a)}}}return[new t.Diff(-1,n),new t.Diff(1,r)]},t.prototype.diff_bisectSplit_=function(n,r,a,l,u){var o=n.substring(0,a),c=r.substring(0,l),f=n.substring(a),p=r.substring(l),d=this.diff_main(o,c,!1,u),_=this.diff_main(f,p,!1,u);return d.concat(_)},t.prototype.diff_linesToChars_=function(n,r){var a=[],l={};function u(f){for(var p="",d=0,_=-1,v=a.length;_a||dr.length?n:r,c=n.length>r.length?r:n,f=o.indexOf(c);if(f!=-1)return u=[new t.Diff(1,o.substring(0,f)),new t.Diff(0,c),new t.Diff(1,o.substring(f+c.length))],n.length>r.length&&(u[0][0]=u[2][0]=-1),u;if(c.length==1)return[new t.Diff(-1,n),new t.Diff(1,r)];var p=this.diff_halfMatch_(n,r);if(p){var d=p[0],_=p[1],v=p[2],w=p[3],C=p[4],b=this.diff_main(d,v,a,l),S=this.diff_main(_,w,a,l);return b.concat([new t.Diff(0,C)],S)}return a&&n.length>100&&r.length>100?this.diff_lineMode_(n,r,l):this.diff_bisect_(n,r,l)},t.prototype.diff_lineMode_=function(n,r,a){var l=this.diff_linesToChars_(n,r);n=l.chars1,r=l.chars2;var u=l.lineArray,o=this.diff_main(n,r,!1,a);this.diff_charsToLines_(o,u),this.diff_cleanupSemantic(o),o.push(new t.Diff(0,""));for(var c=0,f=0,p=0,d="",_="";c=1&&p>=1){o.splice(c-f-p,f+p),c=c-f-p;for(var v=this.diff_main(d,_,!1,a),w=v.length-1;w>=0;w--)o.splice(c,0,v[w]);c+=v.length}p=0,f=0,d="",_=""}c++}return o.pop(),o},t.prototype.diff_bisect_=function(n,r,a){for(var l=n.length,u=r.length,o=Math.ceil((l+u)/2),c=o,f=2*o,p=new Array(f),d=new Array(f),_=0;_a);y++){for(var E=-y+C;E<=y-b;E+=2){for(var R=c+E,N=(z=E==-y||E!=y&&p[R-1]l)b+=2;else if(N>u)C+=2;else if(w&&(j=c+v-E)>=0&&j=(T=l-d[j]))return this.diff_bisectSplit_(n,r,z,N,a)}for(var D=-y+S;D<=y-x;D+=2){for(var T,j=c+D,B=(T=D==-y||D!=y&&d[j-1]l)x+=2;else if(B>u)S+=2;else if(!w&&(R=c+v-D)>=0&&R=(T=l-T))return this.diff_bisectSplit_(n,r,z,N,a)}}}return[new t.Diff(-1,n),new t.Diff(1,r)]},t.prototype.diff_bisectSplit_=function(n,r,a,l,u){var o=n.substring(0,a),c=r.substring(0,l),f=n.substring(a),p=r.substring(l),d=this.diff_main(o,c,!1,u),_=this.diff_main(f,p,!1,u);return d.concat(_)},t.prototype.diff_linesToChars_=function(n,r){var a=[],l={};function u(f){for(var p="",d=0,_=-1,v=a.length;_l?n=n.substring(a-l):ar.length?n:r,l=n.length>r.length?r:n;if(a.length<4||2*l.length=C.length?[x,y,E,R,T]:null}var c,f,p,d,_,v=o(a,l,Math.ceil(a.length/4)),w=o(a,l,Math.ceil(a.length/2));return v||w?(c=w?v&&v[4].length>w[4].length?v:w:v,n.length>r.length?(f=c[0],p=c[1],d=c[2],_=c[3]):(d=c[0],_=c[1],f=c[2],p=c[3]),[f,p,d,_,c[4]]):null},t.prototype.diff_cleanupSemantic=function(n){for(var r=!1,a=[],l=0,u=null,o=0,c=0,f=0,p=0,d=0;o0?a[l-1]:-1,c=0,f=0,p=0,d=0,u=null,r=!0)),o++;for(r&&this.diff_cleanupMerge(n),this.diff_cleanupSemanticLossless(n),o=1;o=C?(w>=_.length/2||w>=v.length/2)&&(n.splice(o,0,new t.Diff(0,v.substring(0,w))),n[o-1][1]=_.substring(0,_.length-w),n[o+1][1]=v.substring(w),o++):(C>=_.length/2||C>=v.length/2)&&(n.splice(o,0,new t.Diff(0,_.substring(0,C))),n[o-1][0]=1,n[o-1][1]=v.substring(0,v.length-C),n[o+1][0]=-1,n[o+1][1]=_.substring(C),o++),o++}o++}},t.prototype.diff_cleanupSemanticLossless=function(n){function r(C,b){if(!C||!b)return 6;var S=C.charAt(C.length-1),x=b.charAt(0),y=S.match(t.nonAlphaNumericRegex_),E=x.match(t.nonAlphaNumericRegex_),R=y&&S.match(t.whitespaceRegex_),N=E&&x.match(t.whitespaceRegex_),D=R&&S.match(t.linebreakRegex_),T=N&&x.match(t.linebreakRegex_),j=D&&C.match(t.blanklineEndRegex_),B=T&&b.match(t.blanklineStartRegex_);return j||B?5:D||T?4:y&&!R&&N?3:R||N?2:y||E?1:0}for(var a=1;a=v&&(v=w,p=l,d=u,_=o)}n[a-1][1]!=p&&(p?n[a-1][1]=p:(n.splice(a-1,1),a--),n[a][1]=d,_?n[a+1][1]=_:(n.splice(a+1,1),a--))}a++}},t.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,t.whitespaceRegex_=/\s/,t.linebreakRegex_=/[\r\n]/,t.blanklineEndRegex_=/\n\r?\n$/,t.blanklineStartRegex_=/^\r?\n\r?\n/,t.prototype.diff_cleanupEfficiency=function(n){for(var r=!1,a=[],l=0,u=null,o=0,c=!1,f=!1,p=!1,d=!1;o0?a[l-1]:-1,p=d=!1),r=!0)),o++;r&&this.diff_cleanupMerge(n)},t.prototype.diff_cleanupMerge=function(n){n.push(new t.Diff(0,""));for(var r,a=0,l=0,u=0,o="",c="";a1?(l!==0&&u!==0&&((r=this.diff_commonPrefix(c,o))!==0&&(a-l-u>0&&n[a-l-u-1][0]==0?n[a-l-u-1][1]+=c.substring(0,r):(n.splice(0,0,new t.Diff(0,c.substring(0,r))),a++),c=c.substring(r),o=o.substring(r)),(r=this.diff_commonSuffix(c,o))!==0&&(n[a][1]=c.substring(c.length-r)+n[a][1],c=c.substring(0,c.length-r),o=o.substring(0,o.length-r))),a-=l+u,n.splice(a,l+u),o.length&&(n.splice(a,0,new t.Diff(-1,o)),a++),c.length&&(n.splice(a,0,new t.Diff(1,c)),a++),a++):a!==0&&n[a-1][0]==0?(n[a-1][1]+=n[a][1],n.splice(a,1)):a++,u=0,l=0,o="",c=""}n[n.length-1][1]===""&&n.pop();var f=!1;for(a=1;ar));a++)o=l,c=u;return n.length!=a&&n[a][0]===-1?c:c+(r-o)},t.prototype.diff_prettyHtml=function(n){for(var r=[],a=/&/g,l=//g,o=/\n/g,c=0;c");switch(f){case 1:r[c]=''+p+"";break;case-1:r[c]=''+p+"";break;case 0:r[c]=""+p+""}}return r.join("")},t.prototype.diff_text1=function(n){for(var r=[],a=0;athis.Match_MaxBits)throw new Error("Pattern too long for this browser.");var l=this.match_alphabet_(r),u=this;function o(N,D){var T=N/r.length,j=Math.abs(a-D);return u.Match_Distance?T+j/u.Match_Distance:j?1:T}var c=this.Match_Threshold,f=n.indexOf(r,a);f!=-1&&(c=Math.min(o(0,f),c),(f=n.lastIndexOf(r,a+r.length))!=-1&&(c=Math.min(o(0,f),c)));var p,d,_=1<=b;y--){var E=l[n.charAt(y-1)];if(x[y]=C===0?(x[y+1]<<1|1)&E:(x[y+1]<<1|1)&E|(v[y+1]|v[y])<<1|1|v[y+1],x[y]&_){var R=o(C,y-1);if(R<=c){if(c=R,!((f=y-1)>a))break;b=Math.max(1,2*a-f)}}}if(o(C+1,a)>c)break;v=x}return f},t.prototype.match_alphabet_=function(n){for(var r={},a=0;a2&&(this.diff_cleanupSemantic(u),this.diff_cleanupEfficiency(u));else if(n&&typeof n=="object"&&r===void 0&&a===void 0)u=n,l=this.diff_text1(u);else if(typeof n=="string"&&r&&typeof r=="object"&&a===void 0)l=n,u=r;else{if(typeof n!="string"||typeof r!="string"||!a||typeof a!="object")throw new Error("Unknown call format to patch_make.");l=n,u=a}if(u.length===0)return[];for(var o=[],c=new t.patch_obj,f=0,p=0,d=0,_=l,v=l,w=0;w=2*this.Patch_Margin&&f&&(this.patch_addContext_(c,_),o.push(c),c=new t.patch_obj,f=0,_=v,p=d)}C!==1&&(p+=b.length),C!==-1&&(d+=b.length)}return f&&(this.patch_addContext_(c,_),o.push(c)),o},t.prototype.patch_deepCopy=function(n){for(var r=[],a=0;athis.Match_MaxBits?(c=this.match_main(r,d.substring(0,this.Match_MaxBits),p))!=-1&&((_=this.match_main(r,d.substring(d.length-this.Match_MaxBits),p+d.length-this.Match_MaxBits))==-1||c>=_)&&(c=-1):c=this.match_main(r,d,p),c==-1)u[o]=!1,l-=n[o].length2-n[o].length1;else if(u[o]=!0,l=c-p,d==(f=_==-1?r.substring(c,c+d.length):r.substring(c,_+this.Match_MaxBits)))r=r.substring(0,c)+this.diff_text2(n[o].diffs)+r.substring(c+d.length);else{var v=this.diff_main(d,f,!1);if(d.length>this.Match_MaxBits&&this.diff_levenshtein(v)/d.length>this.Patch_DeleteThreshold)u[o]=!1;else{this.diff_cleanupSemanticLossless(v);for(var w,C=0,b=0;bo[0][1].length){var c=r-o[0][1].length;o[0][1]=a.substring(o[0][1].length)+o[0][1],u.start1-=c,u.start2-=c,u.length1+=c,u.length2+=c}return(o=(u=n[n.length-1]).diffs).length==0||o[o.length-1][0]!=0?(o.push(new t.Diff(0,a)),u.length1+=r,u.length2+=r):r>o[o.length-1][1].length&&(c=r-o[o.length-1][1].length,o[o.length-1][1]+=a.substring(0,c),u.length1+=c,u.length2+=c),a},t.prototype.patch_splitMax=function(n){for(var r=this.Match_MaxBits,a=0;a2*r?(f.length1+=_.length,u+=_.length,p=!1,f.diffs.push(new t.Diff(d,_)),l.diffs.shift()):(_=_.substring(0,r-f.length1-this.Patch_Margin),f.length1+=_.length,u+=_.length,d===0?(f.length2+=_.length,o+=_.length):p=!1,f.diffs.push(new t.Diff(d,_)),_==l.diffs[0][1]?l.diffs.shift():l.diffs[0][1]=l.diffs[0][1].substring(_.length))}c=(c=this.diff_text2(f.diffs)).substring(c.length-this.Patch_Margin);var v=this.diff_text1(l.diffs).substring(0,this.Patch_Margin);v!==""&&(f.length1+=v.length,f.length2+=v.length,f.diffs.length!==0&&f.diffs[f.diffs.length-1][0]===0?f.diffs[f.diffs.length-1][1]+=v:f.diffs.push(new t.Diff(0,v))),p||n.splice(++a,0,f)}}},t.prototype.patch_toText=function(n){for(var r=[],a=0;a1&&arguments[1]!==void 0?arguments[1]:{}).type,n=(t===void 0?"block":t)==="block"?X8:K8,r=wm(e.map((function(o){return o.changes})),dC).map(n).reduce((function(o,c){var f=Je(o,2),p=f[0],d=f[1],_=Je(c,2),v=_[0],w=_[1];return[p.concat(v),d.concat(w)]}),[[],[]]),a=Je(r,2),l=a[0],u=a[1];return G8(vb(l),vb(u))}var Q8=["enhancers"],xb=function(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.enhancers,a=r===void 0?[]:r,l=Je(T8(e,Ar(n,Q8)),2),u=l[0],o=l[1],c=[gb(u),gb(o)],f=(t=[c[0],c[1]],a.reduce((function(C,b){return b(C)}),t)),p=Je(f,2),d=p[0],_=p[1],v=[d.map(mb),_.map(mb)],w=v[1];return{old:v[0].map((function(C){var b;return(b=C.children)!==null&&b!==void 0?b:[]})),new:w.map((function(C){var b;return(b=C.children)!==null&&b!==void 0?b:[]}))}};const J8=2e3,eB={highlight(e,t){return je.highlight(e,t).children}};function tB(e){return e.type==="normal"?e.newLineNumber:e.lineNumber}function nB(e){let t=0,n=0;for(const r of e.hunks)for(const a of r.changes)a.type==="insert"?t++:a.type==="delete"&&n++;return{additions:t,deletions:n}}function iB(e){return e.newPath==="/dev/null"?e.oldPath:(e.oldPath==="/dev/null",e.newPath)}function rB(e){switch(e.type){case"delete":return e.oldPath;case"add":case"modify":return e.newPath;case"rename":case"copy":return`${e.oldPath} → ${e.newPath}`}}function sB(e){const t=[Z8(e.hunks,{type:"line"})],n=pw(iB(e));return n&&je.registered(n)?xb(e.hunks,{enhancers:t,highlight:!0,language:n,refractor:eB}):xb(e.hunks,{enhancers:t,highlight:!1})}const aB=({change:e,side:t})=>t==="old"?null:tB(e);function wb(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/1024).toFixed(1)} KB`}function oB({bytesRead:e,byteLimit:t}){return m.jsxs("div",{className:"truncated-notice",children:[m.jsx("h4",{children:"Diff too large to display"}),m.jsxs("p",{children:["This diff is larger than ",wb(t)," (",wb(e)," read). View it locally with git."]})]})}function lB({file:e,defaultExpanded:t}){const[n,r]=q.useState(t),{additions:a,deletions:l}=q.useMemo(()=>nB(e),[e]),u=n&&a+l<=J8,o=q.useMemo(()=>{if(u)try{return sB(e)}catch{return}},[e,u]);return m.jsxs("section",{className:"diff-file-card",children:[m.jsxs("button",{className:"diff-file-header",onClick:()=>r(c=>!c),children:[m.jsx("span",{className:"chev",children:n?m.jsx(cs,{size:14}):m.jsx(Uu,{size:14})}),m.jsx("span",{className:"path",children:m.jsx("code",{children:rB(e)})}),m.jsxs("span",{className:"stats",children:[m.jsxs("span",{className:"diff-stat-add",children:["+",a]}),m.jsxs("span",{className:"diff-stat-del",children:["−",l]})]})]}),n&&(e.hunks.length===0?m.jsx("div",{className:"diff-empty",children:"No textual diff for this file."}):m.jsx(y8,{className:"openresearch-diff-file",diffType:e.type,gutterType:"default",hunks:e.hunks,renderGutter:aB,tokens:o,viewType:"unified"}))]})}function gC({diff:e,className:t}){const n=q.useMemo(()=>{if(!e.trim())return[];try{return KL(e,{nearbySequences:"zip"})}catch{return[]}},[e]);return n.length===0?m.jsx("div",{className:"diff-empty",children:"No changes."}):m.jsx("div",{className:t?`openresearch-diff ${t}`:"openresearch-diff",children:n.map((r,a)=>m.jsx(lB,{file:r,defaultExpanded:a===0},`${r.oldPath}→${r.newPath}#${a}`))})}var fp={exports:{}},Cb;function cB(){return Cb||(Cb=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(a){this._terminal=a}dispose(){}fit(){const a=this.proposeDimensions();if(!a||!this._terminal||isNaN(a.cols)||isNaN(a.rows))return;const l=this._terminal._core;this._terminal.rows===a.rows&&this._terminal.cols===a.cols||(l._renderService.clear(),this._terminal.resize(a.cols,a.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const a=this._terminal._core,l=a._renderService.dimensions;if(l.css.cell.width===0||l.css.cell.height===0)return;const u=this._terminal.options.scrollback===0?0:a.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),c=parseInt(o.getPropertyValue("height")),f=Math.max(0,parseInt(o.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),d=c-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),_=f-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-u;return{cols:Math.max(2,Math.floor(_/l.css.cell.width)),rows:Math.max(1,Math.floor(d/l.css.cell.height))}}}})(),n})()))})(fp)),fp.exports}var uB=cB(),dp={exports:{}},Eb;function hB(){return Eb||(Eb=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(u,o,c){var f=this&&this.__decorate||function(x,y,E,R){var N,D=arguments.length,T=D<3?y:R===null?R=Object.getOwnPropertyDescriptor(y,E):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,y,E,R);else for(var j=x.length-1;j>=0;j--)(N=x[j])&&(T=(D<3?N(T):D>3?N(y,E,T):N(y,E))||T);return D>3&&T&&Object.defineProperty(y,E,T),T},p=this&&this.__param||function(x,y){return function(E,R){y(E,R,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=c(9042),_=c(9924),v=c(844),w=c(4725),C=c(2585),b=c(3656);let S=o.AccessibilityManager=class extends v.Disposable{constructor(x,y,E,R){super(),this._terminal=x,this._coreBrowserService=E,this._renderService=R,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let N=0;Nthis._handleBoundaryFocus(N,0),this._bottomBoundaryFocusListener=N=>this._handleBoundaryFocus(N,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new _.TimeBasedDebouncer(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((N=>this._handleResize(N.rows)))),this.register(this._terminal.onRender((N=>this._refreshRows(N.start,N.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((N=>this._handleChar(N)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(` +`:"")+p.content]}),["",""]),n=Je(t,2),r=Je(hC(n[0],n[1]),2),a=r[0],l=r[1];if(a.length===0&&l.length===0)return[[],[]];var u=function(f){if(f&&!Ui(f))return f.lineNumber},o=u(e.find(Dn)),c=u(e.find(Tr));if(o===void 0||c===void 0)throw new Error("Could not find start line number for edit");return[Sb(bb(a),o),Sb(bb(l),c)]}function Y8(e){var t=e.reduce((function(r,a){var l=Je(r,3),u=l[0],o=l[1],c=l[2];if(!c||!Dn(c)||!Tr(a))return[u,o,a];var f=Je(hC(c.content,a.content),2),p=f[0],d=f[1];return[u.concat(ng(p,c.lineNumber)),o.concat(ng(d,a.lineNumber)),a]}),[[],[],null]),n=Je(t,2);return[n[0],n[1]]}function W8(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).type,n=(t===void 0?"block":t)==="block"?V8:Y8,r=wm(e.map((function(o){return o.changes})),uC).map(n).reduce((function(o,c){var f=Je(o,2),p=f[0],d=f[1],_=Je(c,2),v=_[0],w=_[1];return[p.concat(v),d.concat(w)]}),[[],[]]),a=Je(r,2),l=a[0],u=a[1];return P8(vb(l),vb(u))}var X8=["enhancers"],xb=function(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.enhancers,a=r===void 0?[]:r,l=Je(k8(e,Ar(n,X8)),2),u=l[0],o=l[1],c=[gb(u),gb(o)],f=(t=[c[0],c[1]],a.reduce((function(C,b){return b(C)}),t)),p=Je(f,2),d=p[0],_=p[1],v=[d.map(mb),_.map(mb)],w=v[1];return{old:v[0].map((function(C){var b;return(b=C.children)!==null&&b!==void 0?b:[]})),new:w.map((function(C){var b;return(b=C.children)!==null&&b!==void 0?b:[]}))}};const K8=2e3,Z8={highlight(e,t){return je.highlight(e,t).children}};function Q8(e){return e.type==="normal"?e.newLineNumber:e.lineNumber}function J8(e){let t=0,n=0;for(const r of e.hunks)for(const a of r.changes)a.type==="insert"?t++:a.type==="delete"&&n++;return{additions:t,deletions:n}}function eB(e){return e.newPath==="/dev/null"?e.oldPath:(e.oldPath==="/dev/null",e.newPath)}function tB(e){switch(e.type){case"delete":return e.oldPath;case"add":case"modify":return e.newPath;case"rename":case"copy":return`${e.oldPath} → ${e.newPath}`}}function nB(e){const t=[W8(e.hunks,{type:"line"})],n=hw(eB(e));return n&&je.registered(n)?xb(e.hunks,{enhancers:t,highlight:!0,language:n,refractor:Z8}):xb(e.hunks,{enhancers:t,highlight:!1})}const iB=({change:e,side:t})=>t==="old"?null:Q8(e);function wb(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/1024).toFixed(1)} KB`}function rB({bytesRead:e,byteLimit:t}){return m.jsxs("div",{className:"truncated-notice",children:[m.jsx("h4",{children:"Diff too large to display"}),m.jsxs("p",{children:["This diff is larger than ",wb(t)," (",wb(e)," read). View it locally with git."]})]})}function sB({file:e,defaultExpanded:t}){const[n,r]=V.useState(t),{additions:a,deletions:l}=V.useMemo(()=>J8(e),[e]),u=n&&a+l<=K8,o=V.useMemo(()=>{if(u)try{return nB(e)}catch{return}},[e,u]);return m.jsxs("section",{className:"diff-file-card",children:[m.jsxs("button",{className:"diff-file-header",onClick:()=>r(c=>!c),children:[m.jsx("span",{className:"chev",children:n?m.jsx(cs,{size:14}):m.jsx(Uu,{size:14})}),m.jsx("span",{className:"path",children:m.jsx("code",{children:tB(e)})}),m.jsxs("span",{className:"stats",children:[m.jsxs("span",{className:"diff-stat-add",children:["+",a]}),m.jsxs("span",{className:"diff-stat-del",children:["−",l]})]})]}),n&&(e.hunks.length===0?m.jsx("div",{className:"diff-empty",children:"No textual diff for this file."}):m.jsx(m8,{className:"openresearch-diff-file",diffType:e.type,gutterType:"default",hunks:e.hunks,renderGutter:iB,tokens:o,viewType:"unified"}))]})}function fC({diff:e,className:t}){const n=V.useMemo(()=>{if(!e.trim())return[];try{return YL(e,{nearbySequences:"zip"})}catch{return[]}},[e]);return n.length===0?m.jsx("div",{className:"diff-empty",children:"No changes."}):m.jsx("div",{className:t?`openresearch-diff ${t}`:"openresearch-diff",children:n.map((r,a)=>m.jsx(sB,{file:r,defaultExpanded:a===0},`${r.oldPath}→${r.newPath}#${a}`))})}var fp={exports:{}},Cb;function aB(){return Cb||(Cb=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(a){this._terminal=a}dispose(){}fit(){const a=this.proposeDimensions();if(!a||!this._terminal||isNaN(a.cols)||isNaN(a.rows))return;const l=this._terminal._core;this._terminal.rows===a.rows&&this._terminal.cols===a.cols||(l._renderService.clear(),this._terminal.resize(a.cols,a.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const a=this._terminal._core,l=a._renderService.dimensions;if(l.css.cell.width===0||l.css.cell.height===0)return;const u=this._terminal.options.scrollback===0?0:a.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),c=parseInt(o.getPropertyValue("height")),f=Math.max(0,parseInt(o.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),d=c-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),_=f-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-u;return{cols:Math.max(2,Math.floor(_/l.css.cell.width)),rows:Math.max(1,Math.floor(d/l.css.cell.height))}}}})(),n})()))})(fp)),fp.exports}var oB=aB(),dp={exports:{}},Eb;function lB(){return Eb||(Eb=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(u,o,c){var f=this&&this.__decorate||function(x,y,E,R){var N,D=arguments.length,T=D<3?y:R===null?R=Object.getOwnPropertyDescriptor(y,E):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,y,E,R);else for(var j=x.length-1;j>=0;j--)(N=x[j])&&(T=(D<3?N(T):D>3?N(y,E,T):N(y,E))||T);return D>3&&T&&Object.defineProperty(y,E,T),T},p=this&&this.__param||function(x,y){return function(E,R){y(E,R,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=c(9042),_=c(9924),v=c(844),w=c(4725),C=c(2585),b=c(3656);let S=o.AccessibilityManager=class extends v.Disposable{constructor(x,y,E,R){super(),this._terminal=x,this._coreBrowserService=E,this._renderService=R,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let N=0;Nthis._handleBoundaryFocus(N,0),this._bottomBoundaryFocusListener=N=>this._handleBoundaryFocus(N,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new _.TimeBasedDebouncer(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((N=>this._handleResize(N.rows)))),this.register(this._terminal.onRender((N=>this._refreshRows(N.start,N.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((N=>this._handleChar(N)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(` `)))),this.register(this._terminal.onA11yTab((N=>this._handleTab(N)))),this.register(this._terminal.onKey((N=>this._handleKey(N.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,b.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,v.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let y=0;y0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===` -`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(x){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(x)||this._charsToConsume.push(x)}_refreshRows(x,y){this._liveRegionDebouncer.refresh(x,y,this._terminal.rows)}_renderRows(x,y){const E=this._terminal.buffer,R=E.lines.length.toString();for(let N=x;N<=y;N++){const D=E.lines.get(E.ydisp+N),T=[],j=(D==null?void 0:D.translateToString(!0,void 0,void 0,T))||"",B=(E.ydisp+N+1).toString(),F=this._rowElements[N];F&&(j.length===0?(F.innerText=" ",this._rowColumns.set(F,[0,1])):(F.textContent=j,this._rowColumns.set(F,T)),F.setAttribute("aria-posinset",B),F.setAttribute("aria-setsize",R))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,y){const E=x.target,R=this._rowElements[y===0?1:this._rowElements.length-2];if(E.getAttribute("aria-posinset")===(y===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==R)return;let N,D;if(y===0?(N=E,D=this._rowElements.pop(),this._rowContainer.removeChild(D)):(N=this._rowElements.shift(),D=E,this._rowContainer.removeChild(N)),N.removeEventListener("focus",this._topBoundaryFocusListener),D.removeEventListener("focus",this._bottomBoundaryFocusListener),y===0){const T=this._createAccessibilityTreeNode();this._rowElements.unshift(T),this._rowContainer.insertAdjacentElement("afterbegin",T)}else{const T=this._createAccessibilityTreeNode();this._rowElements.push(T),this._rowContainer.appendChild(T)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(y===0?-1:1),this._rowElements[y===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var j;if(this._rowElements.length===0)return;const x=document.getSelection();if(!x)return;if(x.isCollapsed)return void(this._rowContainer.contains(x.anchorNode)&&this._terminal.clearSelection());if(!x.anchorNode||!x.focusNode)return void console.error("anchorNode and/or focusNode are null");let y={node:x.anchorNode,offset:x.anchorOffset},E={node:x.focusNode,offset:x.focusOffset};if((y.node.compareDocumentPosition(E.node)&Node.DOCUMENT_POSITION_PRECEDING||y.node===E.node&&y.offset>E.offset)&&([y,E]=[E,y]),y.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(y={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(y.node))return;const R=this._rowElements.slice(-1)[0];if(E.node.compareDocumentPosition(R)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(E={node:R,offset:((j=R.textContent)==null?void 0:j.length)??0}),!this._rowContainer.contains(E.node))return;const N=({node:B,offset:F})=>{const Y=B instanceof Text?B.parentNode:B;let H=parseInt(Y==null?void 0:Y.getAttribute("aria-posinset"),10)-1;if(isNaN(H))return console.warn("row is invalid. Race condition?"),null;const z=this._rowColumns.get(Y);if(!z)return console.warn("columns is null. Race condition?"),null;let V=F=this._terminal.cols&&(++H,V=0),{row:H,column:V}},D=N(y),T=N(E);if(D&&T){if(D.row>T.row||D.row===T.row&&D.column>=T.column)throw new Error("invalid range");this._terminal.select(D.column,D.row,(T.row-D.row)*this._terminal.cols-D.column+T.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let y=this._rowContainer.children.length;yx;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const x=this._coreBrowserService.mainDocument.createElement("div");return x.setAttribute("role","listitem"),x.tabIndex=-1,this._refreshRowDimensions(x),x}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let x=0;x{function c(_){return _.replace(/\r?\n/g,"\r")}function f(_,v){return v?"\x1B[200~"+_+"\x1B[201~":_}function p(_,v,w,C){_=f(_=c(_),w.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),w.triggerDataEvent(_,!0),v.value=""}function d(_,v,w){const C=w.getBoundingClientRect(),b=_.clientX-C.left-10,S=_.clientY-C.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${b}px`,v.style.top=`${S}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=c,o.bracketTextForPaste=f,o.copyHandler=function(_,v){_.clipboardData&&_.clipboardData.setData("text/plain",v.selectionText),_.preventDefault()},o.handlePasteEvent=function(_,v,w,C){_.stopPropagation(),_.clipboardData&&p(_.clipboardData.getData("text/plain"),v,w,C)},o.paste=p,o.moveTextAreaUnderMouseCursor=d,o.rightClickHandler=function(_,v,w,C,b){d(_,v,w),b&&C.rightClickSelect(_),v.value=C.selectionText,v.select()}},7239:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const f=c(1505);o.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(p,d,_){this._css.set(p,d,_)}getCss(p,d){return this._css.get(p,d)}setColor(p,d,_){this._color.set(p,d,_)}getColor(p,d){return this._color.get(p,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(c,f,p,d){c.addEventListener(f,p,d);let _=!1;return{dispose:()=>{_||(_=!0,c.removeEventListener(f,p,d))}}}},3551:function(u,o,c){var f=this&&this.__decorate||function(S,x,y,E){var R,N=arguments.length,D=N<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,y):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(S,x,y,E);else for(var T=S.length-1;T>=0;T--)(R=S[T])&&(D=(N<3?R(D):N>3?R(x,y,D):R(x,y))||D);return N>3&&D&&Object.defineProperty(x,y,D),D},p=this&&this.__param||function(S,x){return function(y,E){x(y,E,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const d=c(3656),_=c(8460),v=c(844),w=c(2585),C=c(4725);let b=o.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(S,x,y,E,R){super(),this._element=S,this._mouseService=x,this._renderService=y,this._bufferService=E,this._linkProviderService=R,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)((()=>{var N;this._lastMouseEvent=void 0,(N=this._activeProviderReplies)==null||N.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(S){this._lastMouseEvent=S;const x=this._positionFromMouseEvent(S,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const y=S.composedPath();for(let E=0;E{N==null||N.forEach((D=>{D.link.dispose&&D.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=S.y);let y=!1;for(const[N,D]of this._linkProviderService.linkProviders.entries())x?(R=this._activeProviderReplies)!=null&&R.get(N)&&(y=this._checkLinkProviderResult(N,S,y)):D.provideLinks(S.y,(T=>{var B,F;if(this._isMouseOut)return;const j=T==null?void 0:T.map((Y=>({link:Y})));(B=this._activeProviderReplies)==null||B.set(N,j),y=this._checkLinkProviderResult(N,S,y),((F=this._activeProviderReplies)==null?void 0:F.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(S.y,this._activeProviderReplies)}))}_removeIntersectingLinks(S,x){const y=new Set;for(let E=0;ES?this._bufferService.cols:D.link.range.end.x;for(let B=T;B<=j;B++){if(y.has(B)){R.splice(N--,1);break}y.add(B)}}}}_checkLinkProviderResult(S,x,y){var N;if(!this._activeProviderReplies)return y;const E=this._activeProviderReplies.get(S);let R=!1;for(let D=0;Dthis._linkAtPosition(T.link,x)));D&&(y=!0,this._handleNewLink(D))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!y)for(let D=0;Dthis._linkAtPosition(j.link,x)));if(T){y=!0,this._handleNewLink(T);break}}return y}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(S){if(!this._currentLink)return;const x=this._positionFromMouseEvent(S,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(S,this._currentLink.link.text)}_clearCurrentLink(S,x){this._currentLink&&this._lastMouseEvent&&(!S||!x||this._currentLink.link.range.start.y>=S&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(S){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(S.link,x)&&(this._currentLink=S,this._currentLink.state={decorations:{underline:S.link.decorations===void 0||S.link.decorations.underline,pointerCursor:S.link.decorations===void 0||S.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,S.link,this._lastMouseEvent),S.link.decorations={},Object.defineProperties(S.link.decorations,{pointerCursor:{get:()=>{var y,E;return(E=(y=this._currentLink)==null?void 0:y.state)==null?void 0:E.decorations.pointerCursor},set:y=>{var E;(E=this._currentLink)!=null&&E.state&&this._currentLink.state.decorations.pointerCursor!==y&&(this._currentLink.state.decorations.pointerCursor=y,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",y))}},underline:{get:()=>{var y,E;return(E=(y=this._currentLink)==null?void 0:y.state)==null?void 0:E.decorations.underline},set:y=>{var E,R,N;(E=this._currentLink)!=null&&E.state&&((N=(R=this._currentLink)==null?void 0:R.state)==null?void 0:N.decorations.underline)!==y&&(this._currentLink.state.decorations.underline=y,this._currentLink.state.isHovered&&this._fireUnderlineEvent(S.link,y))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((y=>{if(!this._currentLink)return;const E=y.start===0?0:y.start+1+this._bufferService.buffer.ydisp,R=this._bufferService.buffer.ydisp+1+y.end;if(this._currentLink.link.range.start.y>=E&&this._currentLink.link.range.end.y<=R&&(this._clearCurrentLink(E,R),this._lastMouseEvent)){const N=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);N&&this._askForLink(N,!1)}}))))}_linkHover(S,x,y){var E;(E=this._currentLink)!=null&&E.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&S.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(y,x.text)}_fireUnderlineEvent(S,x){const y=S.range,E=this._bufferService.buffer.ydisp,R=this._createLinkUnderlineEvent(y.start.x-1,y.start.y-E-1,y.end.x,y.end.y-E-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(R)}_linkLeave(S,x,y){var E;(E=this._currentLink)!=null&&E.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&S.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(y,x.text)}_linkAtPosition(S,x){const y=S.range.start.y*this._bufferService.cols+S.range.start.x,E=S.range.end.y*this._bufferService.cols+S.range.end.x,R=x.y*this._bufferService.cols+x.x;return y<=R&&R<=E}_positionFromMouseEvent(S,x,y){const E=y.getCoords(S,x,this._bufferService.cols,this._bufferService.rows);if(E)return{x:E[0],y:E[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(S,x,y,E,R){return{x1:S,y1:x,x2:y,y2:E,cols:this._bufferService.cols,fg:R}}};o.Linkifier=b=f([p(1,C.IMouseService),p(2,C.IRenderService),p(3,w.IBufferService),p(4,C.ILinkProviderService)],b)},9042:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(u,o,c){var f=this&&this.__decorate||function(C,b,S,x){var y,E=arguments.length,R=E<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,S):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(C,b,S,x);else for(var N=C.length-1;N>=0;N--)(y=C[N])&&(R=(E<3?y(R):E>3?y(b,S,R):y(b,S))||R);return E>3&&R&&Object.defineProperty(b,S,R),R},p=this&&this.__param||function(C,b){return function(S,x){b(S,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const d=c(511),_=c(2585);let v=o.OscLinkProvider=class{constructor(C,b,S){this._bufferService=C,this._optionsService=b,this._oscLinkService=S}provideLinks(C,b){var j;const S=this._bufferService.buffer.lines.get(C-1);if(!S)return void b(void 0);const x=[],y=this._optionsService.rawOptions.linkHandler,E=new d.CellData,R=S.getTrimmedLength();let N=-1,D=-1,T=!1;for(let B=0;By?y.activate(z,V,Y):w(0,V),hover:(z,V)=>{var G;return(G=y==null?void 0:y.hover)==null?void 0:G.call(y,z,V,Y)},leave:(z,V)=>{var G;return(G=y==null?void 0:y.leave)==null?void 0:G.call(y,z,V,Y)}})}T=!1,E.hasExtendedAttrs()&&E.extended.urlId?(D=B,N=E.extended.urlId):(D=-1,N=-1)}}b(x)}};function w(C,b){if(confirm(`Do you want to navigate to ${b}? +`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(x){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(x)||this._charsToConsume.push(x)}_refreshRows(x,y){this._liveRegionDebouncer.refresh(x,y,this._terminal.rows)}_renderRows(x,y){const E=this._terminal.buffer,R=E.lines.length.toString();for(let N=x;N<=y;N++){const D=E.lines.get(E.ydisp+N),T=[],j=(D==null?void 0:D.translateToString(!0,void 0,void 0,T))||"",B=(E.ydisp+N+1).toString(),z=this._rowElements[N];z&&(j.length===0?(z.innerText=" ",this._rowColumns.set(z,[0,1])):(z.textContent=j,this._rowColumns.set(z,T)),z.setAttribute("aria-posinset",B),z.setAttribute("aria-setsize",R))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,y){const E=x.target,R=this._rowElements[y===0?1:this._rowElements.length-2];if(E.getAttribute("aria-posinset")===(y===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==R)return;let N,D;if(y===0?(N=E,D=this._rowElements.pop(),this._rowContainer.removeChild(D)):(N=this._rowElements.shift(),D=E,this._rowContainer.removeChild(N)),N.removeEventListener("focus",this._topBoundaryFocusListener),D.removeEventListener("focus",this._bottomBoundaryFocusListener),y===0){const T=this._createAccessibilityTreeNode();this._rowElements.unshift(T),this._rowContainer.insertAdjacentElement("afterbegin",T)}else{const T=this._createAccessibilityTreeNode();this._rowElements.push(T),this._rowContainer.appendChild(T)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(y===0?-1:1),this._rowElements[y===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var j;if(this._rowElements.length===0)return;const x=document.getSelection();if(!x)return;if(x.isCollapsed)return void(this._rowContainer.contains(x.anchorNode)&&this._terminal.clearSelection());if(!x.anchorNode||!x.focusNode)return void console.error("anchorNode and/or focusNode are null");let y={node:x.anchorNode,offset:x.anchorOffset},E={node:x.focusNode,offset:x.focusOffset};if((y.node.compareDocumentPosition(E.node)&Node.DOCUMENT_POSITION_PRECEDING||y.node===E.node&&y.offset>E.offset)&&([y,E]=[E,y]),y.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(y={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(y.node))return;const R=this._rowElements.slice(-1)[0];if(E.node.compareDocumentPosition(R)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(E={node:R,offset:((j=R.textContent)==null?void 0:j.length)??0}),!this._rowContainer.contains(E.node))return;const N=({node:B,offset:z})=>{const G=B instanceof Text?B.parentNode:B;let U=parseInt(G==null?void 0:G.getAttribute("aria-posinset"),10)-1;if(isNaN(U))return console.warn("row is invalid. Race condition?"),null;const H=this._rowColumns.get(G);if(!H)return console.warn("columns is null. Race condition?"),null;let Y=z=this._terminal.cols&&(++U,Y=0),{row:U,column:Y}},D=N(y),T=N(E);if(D&&T){if(D.row>T.row||D.row===T.row&&D.column>=T.column)throw new Error("invalid range");this._terminal.select(D.column,D.row,(T.row-D.row)*this._terminal.cols-D.column+T.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let y=this._rowContainer.children.length;yx;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const x=this._coreBrowserService.mainDocument.createElement("div");return x.setAttribute("role","listitem"),x.tabIndex=-1,this._refreshRowDimensions(x),x}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let x=0;x{function c(_){return _.replace(/\r?\n/g,"\r")}function f(_,v){return v?"\x1B[200~"+_+"\x1B[201~":_}function p(_,v,w,C){_=f(_=c(_),w.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),w.triggerDataEvent(_,!0),v.value=""}function d(_,v,w){const C=w.getBoundingClientRect(),b=_.clientX-C.left-10,S=_.clientY-C.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${b}px`,v.style.top=`${S}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=c,o.bracketTextForPaste=f,o.copyHandler=function(_,v){_.clipboardData&&_.clipboardData.setData("text/plain",v.selectionText),_.preventDefault()},o.handlePasteEvent=function(_,v,w,C){_.stopPropagation(),_.clipboardData&&p(_.clipboardData.getData("text/plain"),v,w,C)},o.paste=p,o.moveTextAreaUnderMouseCursor=d,o.rightClickHandler=function(_,v,w,C,b){d(_,v,w),b&&C.rightClickSelect(_),v.value=C.selectionText,v.select()}},7239:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const f=c(1505);o.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(p,d,_){this._css.set(p,d,_)}getCss(p,d){return this._css.get(p,d)}setColor(p,d,_){this._color.set(p,d,_)}getColor(p,d){return this._color.get(p,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(c,f,p,d){c.addEventListener(f,p,d);let _=!1;return{dispose:()=>{_||(_=!0,c.removeEventListener(f,p,d))}}}},3551:function(u,o,c){var f=this&&this.__decorate||function(S,x,y,E){var R,N=arguments.length,D=N<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,y):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(S,x,y,E);else for(var T=S.length-1;T>=0;T--)(R=S[T])&&(D=(N<3?R(D):N>3?R(x,y,D):R(x,y))||D);return N>3&&D&&Object.defineProperty(x,y,D),D},p=this&&this.__param||function(S,x){return function(y,E){x(y,E,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const d=c(3656),_=c(8460),v=c(844),w=c(2585),C=c(4725);let b=o.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(S,x,y,E,R){super(),this._element=S,this._mouseService=x,this._renderService=y,this._bufferService=E,this._linkProviderService=R,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)((()=>{var N;this._lastMouseEvent=void 0,(N=this._activeProviderReplies)==null||N.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(S){this._lastMouseEvent=S;const x=this._positionFromMouseEvent(S,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const y=S.composedPath();for(let E=0;E{N==null||N.forEach((D=>{D.link.dispose&&D.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=S.y);let y=!1;for(const[N,D]of this._linkProviderService.linkProviders.entries())x?(R=this._activeProviderReplies)!=null&&R.get(N)&&(y=this._checkLinkProviderResult(N,S,y)):D.provideLinks(S.y,(T=>{var B,z;if(this._isMouseOut)return;const j=T==null?void 0:T.map((G=>({link:G})));(B=this._activeProviderReplies)==null||B.set(N,j),y=this._checkLinkProviderResult(N,S,y),((z=this._activeProviderReplies)==null?void 0:z.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(S.y,this._activeProviderReplies)}))}_removeIntersectingLinks(S,x){const y=new Set;for(let E=0;ES?this._bufferService.cols:D.link.range.end.x;for(let B=T;B<=j;B++){if(y.has(B)){R.splice(N--,1);break}y.add(B)}}}}_checkLinkProviderResult(S,x,y){var N;if(!this._activeProviderReplies)return y;const E=this._activeProviderReplies.get(S);let R=!1;for(let D=0;Dthis._linkAtPosition(T.link,x)));D&&(y=!0,this._handleNewLink(D))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!y)for(let D=0;Dthis._linkAtPosition(j.link,x)));if(T){y=!0,this._handleNewLink(T);break}}return y}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(S){if(!this._currentLink)return;const x=this._positionFromMouseEvent(S,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(S,this._currentLink.link.text)}_clearCurrentLink(S,x){this._currentLink&&this._lastMouseEvent&&(!S||!x||this._currentLink.link.range.start.y>=S&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(S){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(S.link,x)&&(this._currentLink=S,this._currentLink.state={decorations:{underline:S.link.decorations===void 0||S.link.decorations.underline,pointerCursor:S.link.decorations===void 0||S.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,S.link,this._lastMouseEvent),S.link.decorations={},Object.defineProperties(S.link.decorations,{pointerCursor:{get:()=>{var y,E;return(E=(y=this._currentLink)==null?void 0:y.state)==null?void 0:E.decorations.pointerCursor},set:y=>{var E;(E=this._currentLink)!=null&&E.state&&this._currentLink.state.decorations.pointerCursor!==y&&(this._currentLink.state.decorations.pointerCursor=y,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",y))}},underline:{get:()=>{var y,E;return(E=(y=this._currentLink)==null?void 0:y.state)==null?void 0:E.decorations.underline},set:y=>{var E,R,N;(E=this._currentLink)!=null&&E.state&&((N=(R=this._currentLink)==null?void 0:R.state)==null?void 0:N.decorations.underline)!==y&&(this._currentLink.state.decorations.underline=y,this._currentLink.state.isHovered&&this._fireUnderlineEvent(S.link,y))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((y=>{if(!this._currentLink)return;const E=y.start===0?0:y.start+1+this._bufferService.buffer.ydisp,R=this._bufferService.buffer.ydisp+1+y.end;if(this._currentLink.link.range.start.y>=E&&this._currentLink.link.range.end.y<=R&&(this._clearCurrentLink(E,R),this._lastMouseEvent)){const N=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);N&&this._askForLink(N,!1)}}))))}_linkHover(S,x,y){var E;(E=this._currentLink)!=null&&E.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&S.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(y,x.text)}_fireUnderlineEvent(S,x){const y=S.range,E=this._bufferService.buffer.ydisp,R=this._createLinkUnderlineEvent(y.start.x-1,y.start.y-E-1,y.end.x,y.end.y-E-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(R)}_linkLeave(S,x,y){var E;(E=this._currentLink)!=null&&E.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&S.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(y,x.text)}_linkAtPosition(S,x){const y=S.range.start.y*this._bufferService.cols+S.range.start.x,E=S.range.end.y*this._bufferService.cols+S.range.end.x,R=x.y*this._bufferService.cols+x.x;return y<=R&&R<=E}_positionFromMouseEvent(S,x,y){const E=y.getCoords(S,x,this._bufferService.cols,this._bufferService.rows);if(E)return{x:E[0],y:E[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(S,x,y,E,R){return{x1:S,y1:x,x2:y,y2:E,cols:this._bufferService.cols,fg:R}}};o.Linkifier=b=f([p(1,C.IMouseService),p(2,C.IRenderService),p(3,w.IBufferService),p(4,C.ILinkProviderService)],b)},9042:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(u,o,c){var f=this&&this.__decorate||function(C,b,S,x){var y,E=arguments.length,R=E<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,S):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(C,b,S,x);else for(var N=C.length-1;N>=0;N--)(y=C[N])&&(R=(E<3?y(R):E>3?y(b,S,R):y(b,S))||R);return E>3&&R&&Object.defineProperty(b,S,R),R},p=this&&this.__param||function(C,b){return function(S,x){b(S,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const d=c(511),_=c(2585);let v=o.OscLinkProvider=class{constructor(C,b,S){this._bufferService=C,this._optionsService=b,this._oscLinkService=S}provideLinks(C,b){var j;const S=this._bufferService.buffer.lines.get(C-1);if(!S)return void b(void 0);const x=[],y=this._optionsService.rawOptions.linkHandler,E=new d.CellData,R=S.getTrimmedLength();let N=-1,D=-1,T=!1;for(let B=0;By?y.activate(H,Y,G):w(0,Y),hover:(H,Y)=>{var q;return(q=y==null?void 0:y.hover)==null?void 0:q.call(y,H,Y,G)},leave:(H,Y)=>{var q;return(q=y==null?void 0:y.leave)==null?void 0:q.call(y,H,Y,G)}})}T=!1,E.hasExtendedAttrs()&&E.extended.urlId?(D=B,N=E.extended.urlId):(D=-1,N=-1)}}b(x)}};function w(C,b){if(confirm(`Do you want to navigate to ${b}? -WARNING: This link could potentially be dangerous`)){const S=window.open();if(S){try{S.opener=null}catch{}S.location.href=b}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=v=f([p(0,_.IBufferService),p(1,_.IOptionsService),p(2,_.IOscLinkService)],v)},6193:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderDebouncer=void 0,o.RenderDebouncer=class{constructor(c,f){this._renderCallback=c,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(c){return this._refreshCallbacks.push(c),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(c,f,p){this._rowCount=p,c=c!==void 0?c:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,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)return void this._runRefreshCallbacks();const c=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const c of this._refreshCallbacks)c(0);this._refreshCallbacks=[]}}},3236:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const f=c(3614),p=c(3656),d=c(3551),_=c(9042),v=c(3730),w=c(1680),C=c(3107),b=c(5744),S=c(2950),x=c(1296),y=c(428),E=c(4269),R=c(5114),N=c(8934),D=c(3230),T=c(9312),j=c(4725),B=c(6731),F=c(8055),Y=c(8969),H=c(8460),z=c(844),V=c(6114),G=c(8437),X=c(2584),K=c(7399),L=c(5941),M=c(9074),O=c(2585),$=c(5435),U=c(4567),Q=c(779);class re extends Y.CoreTerminal{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}constructor(Z={}){super(Z),this.browser=V,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new z.MutableDisposable),this._onCursorMove=this.register(new H.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new H.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new H.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new H.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new H.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new H.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new H.EventEmitter),this._onBlur=this.register(new H.EventEmitter),this._onA11yCharEmitter=this.register(new H.EventEmitter),this._onA11yTabEmitter=this.register(new H.EventEmitter),this._onWillOpen=this.register(new H.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(M.DecorationService),this._instantiationService.setService(O.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Q.LinkProviderService),this._instantiationService.setService(j.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((P,ee)=>this.refresh(P,ee)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((P=>this._reportWindowsOptions(P)))),this.register(this._inputHandler.onColor((P=>this._handleColorEvent(P)))),this.register((0,H.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,H.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,H.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,H.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((P=>this._afterResize(P.cols,P.rows)))),this.register((0,z.toDisposable)((()=>{var P,ee;this._customKeyEventHandler=void 0,(ee=(P=this.element)==null?void 0:P.parentNode)==null||ee.removeChild(this.element)})))}_handleColorEvent(Z){if(this._themeService)for(const P of Z){let ee,ne="";switch(P.index){case 256:ee="foreground",ne="10";break;case 257:ee="background",ne="11";break;case 258:ee="cursor",ne="12";break;default:ee="ansi",ne="4;"+P.index}switch(P.type){case 0:const ge=F.color.toColorRGB(ee==="ansi"?this._themeService.colors.ansi[P.index]:this._themeService.colors[ee]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${ne};${(0,L.toRgbString)(ge)}${X.C1_ESCAPED.ST}`);break;case 1:if(ee==="ansi")this._themeService.modifyColors((he=>he.ansi[P.index]=F.channels.toColor(...P.color)));else{const he=ee;this._themeService.modifyColors((ye=>ye[he]=F.channels.toColor(...P.color)))}break;case 2:this._themeService.restoreColor(P.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Z){Z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Z;return(Z=this.textarea)==null?void 0:Z.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const Z=this.buffer.ybase+this.buffer.y,P=this.buffer.lines.get(Z);if(!P)return;const ee=Math.min(this.buffer.x,this.cols-1),ne=this._renderService.dimensions.css.cell.height,ge=P.getWidth(ee),he=this._renderService.dimensions.css.cell.width*ge,ye=this.buffer.y*this._renderService.dimensions.css.cell.height,be=ee*this._renderService.dimensions.css.cell.width;this.textarea.style.left=be+"px",this.textarea.style.top=ye+"px",this.textarea.style.width=he+"px",this.textarea.style.height=ne+"px",this.textarea.style.lineHeight=ne+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",(P=>{this.hasSelection()&&(0,f.copyHandler)(P,this._selectionService)})));const Z=P=>(0,f.handlePasteEvent)(P,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",Z)),this.register((0,p.addDisposableDomListener)(this.element,"paste",Z)),V.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(P=>{P.button===2&&(0,f.rightClickHandler)(P,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",(P=>{(0,f.rightClickHandler)(P,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),V.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",(P=>{P.button===1&&(0,f.moveTextAreaUnderMouseCursor)(P,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",(Z=>this._keyUp(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",(Z=>this._keyDown(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",(Z=>this._keyPress(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",(Z=>this._compositionHelper.compositionupdate(Z)))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,p.addDisposableDomListener)(this.textarea,"input",(Z=>this._inputEvent(Z)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Z){var ee;if(!Z)throw new Error("Terminal requires a parent element.");if(Z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ee=this.element)==null?void 0:ee.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Z.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"),Z.appendChild(this.element);const P=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),P.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,p.addDisposableDomListener)(this.screenElement,"mousemove",(ne=>this.updateCursorStyle(ne)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),P.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),V.isChromeOS||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._coreBrowserService=this.register(this._instantiationService.createInstance(R.CoreBrowserService,this.textarea,Z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(j.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",(ne=>this._handleTextAreaFocus(ne)))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(y.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(j.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(B.ThemeService),this._instantiationService.setService(j.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(E.CharacterJoinerService),this._instantiationService.setService(j.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(D.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(j.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ne=>this._onRender.fire(ne)))),this.onResize((ne=>this._renderService.resize(ne.cols,ne.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(S.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(N.MouseService),this._instantiationService.setService(j.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(d.Linkifier,this.screenElement)),this.element.appendChild(P);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(w.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ne=>this.scrollLines(ne.amount,ne.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),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.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(T.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(j.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ne=>this.scrollLines(ne.amount,ne.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ne=>this._renderService.handleSelectionChanged(ne.start,ne.end,ne.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ne=>{this.textarea.value=ne,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ne=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(C.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(ne=>this._selectionService.handleMouseDown(ne)))),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(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ne=>this._handleScreenReaderModeOptionChange(ne)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ne=>{!this._overviewRulerRenderer&&ne&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(x.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Z=this,P=this.element;function ee(he){const ye=Z._mouseService.getMouseReportCoords(he,Z.screenElement);if(!ye)return!1;let be,ke;switch(he.overrideType||he.type){case"mousemove":ke=32,he.buttons===void 0?(be=3,he.button!==void 0&&(be=he.button<3?he.button:3)):be=1&he.buttons?0:4&he.buttons?1:2&he.buttons?2:3;break;case"mouseup":ke=0,be=he.button<3?he.button:3;break;case"mousedown":ke=1,be=he.button<3?he.button:3;break;case"wheel":if(Z._customWheelEventHandler&&Z._customWheelEventHandler(he)===!1||Z.viewport.getLinesScrolled(he)===0)return!1;ke=he.deltaY<0?0:1,be=4;break;default:return!1}return!(ke===void 0||be===void 0||be>4)&&Z.coreMouseService.triggerMouseEvent({col:ye.col,row:ye.row,x:ye.x,y:ye.y,button:be,action:ke,ctrl:he.ctrlKey,alt:he.altKey,shift:he.shiftKey})}const ne={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ge={mouseup:he=>(ee(he),he.buttons||(this._document.removeEventListener("mouseup",ne.mouseup),ne.mousedrag&&this._document.removeEventListener("mousemove",ne.mousedrag)),this.cancel(he)),wheel:he=>(ee(he),this.cancel(he,!0)),mousedrag:he=>{he.buttons&&ee(he)},mousemove:he=>{he.buttons||ee(he)}};this.register(this.coreMouseService.onProtocolChange((he=>{he?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(he)),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()),8&he?ne.mousemove||(P.addEventListener("mousemove",ge.mousemove),ne.mousemove=ge.mousemove):(P.removeEventListener("mousemove",ne.mousemove),ne.mousemove=null),16&he?ne.wheel||(P.addEventListener("wheel",ge.wheel,{passive:!1}),ne.wheel=ge.wheel):(P.removeEventListener("wheel",ne.wheel),ne.wheel=null),2&he?ne.mouseup||(ne.mouseup=ge.mouseup):(this._document.removeEventListener("mouseup",ne.mouseup),ne.mouseup=null),4&he?ne.mousedrag||(ne.mousedrag=ge.mousedrag):(this._document.removeEventListener("mousemove",ne.mousedrag),ne.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(P,"mousedown",(he=>{if(he.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(he))return ee(he),ne.mouseup&&this._document.addEventListener("mouseup",ne.mouseup),ne.mousedrag&&this._document.addEventListener("mousemove",ne.mousedrag),this.cancel(he)}))),this.register((0,p.addDisposableDomListener)(P,"wheel",(he=>{if(!ne.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(he)===!1)return!1;if(!this.buffer.hasScrollback){const ye=this.viewport.getLinesScrolled(he);if(ye===0)return;const be=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(he.deltaY<0?"A":"B");let ke="";for(let Ee=0;Ee{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(he),this.cancel(he)}),{passive:!0})),this.register((0,p.addDisposableDomListener)(P,"touchmove",(he=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(he)?void 0:this.cancel(he)}),{passive:!1}))}refresh(Z,P){var ee;(ee=this._renderService)==null||ee.refreshRows(Z,P)}updateCursorStyle(Z){var P;(P=this._selectionService)!=null&&P.shouldColumnSelect(Z)?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(Z,P,ee=0){var ne;ee===1?(super.scrollLines(Z,P,ee),this.refresh(0,this.rows-1)):(ne=this.viewport)==null||ne.scrollLines(Z)}paste(Z){(0,f.paste)(Z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Z){this._customKeyEventHandler=Z}attachCustomWheelEventHandler(Z){this._customWheelEventHandler=Z}registerLinkProvider(Z){return this._linkProviderService.registerLinkProvider(Z)}registerCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const P=this._characterJoinerService.register(Z);return this.refresh(0,this.rows-1),P}deregisterCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Z)}registerDecoration(Z){return this._decorationService.registerDecoration(Z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Z,P,ee){this._selectionService.setSelection(Z,P,ee)}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(){var Z;(Z=this._selectionService)==null||Z.clearSelection()}selectAll(){var Z;(Z=this._selectionService)==null||Z.selectAll()}selectLines(Z,P){var ee;(ee=this._selectionService)==null||ee.selectLines(Z,P)}_keyDown(Z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;const P=this.browser.isMac&&this.options.macOptionIsMeta&&Z.altKey;if(!P&&!this._compositionHelper.keydown(Z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;P||Z.key!=="Dead"&&Z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ee=(0,K.evaluateKeyboardEvent)(Z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Z),ee.type===3||ee.type===2){const ne=this.rows-1;return this.scrollLines(ee.type===2?-ne:ne),this.cancel(Z,!0)}return ee.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Z)||(ee.cancel&&this.cancel(Z,!0),!ee.key||!!(Z.key&&!Z.ctrlKey&&!Z.altKey&&!Z.metaKey&&Z.key.length===1&&Z.key.charCodeAt(0)>=65&&Z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ee.key!==X.C0.ETX&&ee.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ee.key,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(ee.key,!0),!this.optionsService.rawOptions.screenReaderMode||Z.altKey||Z.ctrlKey?this.cancel(Z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Z,P){const ee=Z.isMac&&!this.options.macOptionIsMeta&&P.altKey&&!P.ctrlKey&&!P.metaKey||Z.isWindows&&P.altKey&&P.ctrlKey&&!P.metaKey||Z.isWindows&&P.getModifierState("AltGraph");return P.type==="keypress"?ee:ee&&(!P.keyCode||P.keyCode>47)}_keyUp(Z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1||((function(P){return P.keyCode===16||P.keyCode===17||P.keyCode===18})(Z)||this.focus(),this.updateCursorStyle(Z),this._keyPressHandled=!1)}_keyPress(Z){let P;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;if(this.cancel(Z),Z.charCode)P=Z.charCode;else if(Z.which===null||Z.which===void 0)P=Z.keyCode;else{if(Z.which===0||Z.charCode===0)return!1;P=Z.which}return!(!P||(Z.altKey||Z.ctrlKey||Z.metaKey)&&!this._isThirdLevelShift(this.browser,Z)||(P=String.fromCharCode(P),this._onKey.fire({key:P,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(P,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Z){if(Z.data&&Z.inputType==="insertText"&&(!Z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const P=Z.data;return this.coreService.triggerDataEvent(P,!0),this.cancel(Z),!0}return!1}resize(Z,P){Z!==this.cols||P!==this.rows?super.resize(Z,P):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Z,P){var ee,ne;(ee=this._charSizeService)==null||ee.measure(),(ne=this.viewport)==null||ne.syncScrollArea(!0)}clear(){var Z;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 P=1;P{Object.defineProperty(o,"__esModule",{value:!0}),o.TimeBasedDebouncer=void 0,o.TimeBasedDebouncer=class{constructor(c,f=1e3){this._renderCallback=c,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(c,f,p){this._rowCount=p,c=c!==void 0?c:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const _=d-this._lastRefreshMs,v=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const c=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,f)}}},1680:function(u,o,c){var f=this&&this.__decorate||function(S,x,y,E){var R,N=arguments.length,D=N<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,y):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(S,x,y,E);else for(var T=S.length-1;T>=0;T--)(R=S[T])&&(D=(N<3?R(D):N>3?R(x,y,D):R(x,y))||D);return N>3&&D&&Object.defineProperty(x,y,D),D},p=this&&this.__param||function(S,x){return function(y,E){x(y,E,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const d=c(3656),_=c(4725),v=c(8460),w=c(844),C=c(2585);let b=o.Viewport=class extends w.Disposable{constructor(S,x,y,E,R,N,D,T){super(),this._viewportElement=S,this._scrollArea=x,this._bufferService=y,this._optionsService=E,this._charSizeService=R,this._renderService=N,this._coreBrowserService=D,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((j=>this._activeBuffer=j.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((j=>this._renderDimensions=j))),this._handleThemeChange(T.colors),this.register(T.onChangeColors((j=>this._handleThemeChange(j)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(S){this._viewportElement.style.backgroundColor=S.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(S){if(S)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const x=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==x&&(this._lastRecordedBufferHeight=x,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const S=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==S&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=S),this._refreshAnimationFrame=null}syncScrollArea(S=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(S);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(S)}_handleScroll(S){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const x=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:x,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const S=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(S*(this._smoothScrollState.target-this._smoothScrollState.origin)),S<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(S,x){const y=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&y0&&(y=Y),E=""}}return{bufferElements:R,cursorElement:y}}getLinesScrolled(S){if(S.deltaY===0||S.shiftKey)return 0;let x=this._applyScrollModifier(S.deltaY,S);return S.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(x/=this._currentRowHeight+0,this._wheelPartialScroll+=x,x=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):S.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(S,x){const y=this._optionsService.rawOptions.fastScrollModifier;return y==="alt"&&x.altKey||y==="ctrl"&&x.ctrlKey||y==="shift"&&x.shiftKey?S*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:S*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(S){this._lastTouchY=S.touches[0].pageY}handleTouchMove(S){const x=this._lastTouchY-S.touches[0].pageY;return this._lastTouchY=S.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(S,x))}};o.Viewport=b=f([p(2,C.IBufferService),p(3,C.IOptionsService),p(4,_.ICharSizeService),p(5,_.IRenderService),p(6,_.ICoreBrowserService),p(7,_.IThemeService)],b)},3107:function(u,o,c){var f=this&&this.__decorate||function(C,b,S,x){var y,E=arguments.length,R=E<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,S):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(C,b,S,x);else for(var N=C.length-1;N>=0;N--)(y=C[N])&&(R=(E<3?y(R):E>3?y(b,S,R):y(b,S))||R);return E>3&&R&&Object.defineProperty(b,S,R),R},p=this&&this.__param||function(C,b){return function(S,x){b(S,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const d=c(4725),_=c(844),v=c(2585);let w=o.BufferDecorationRenderer=class extends _.Disposable{constructor(C,b,S,x,y){super(),this._screenElement=C,this._bufferService=b,this._coreBrowserService=S,this._decorationService=x,this._renderService=y,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((E=>this._removeDecoration(E)))),this.register((0,_.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var x;const b=this._coreBrowserService.mainDocument.createElement("div");b.classList.add("xterm-decoration"),b.classList.toggle("xterm-decoration-top-layer",((x=C==null?void 0:C.options)==null?void 0:x.layer)==="top"),b.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,b.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",b.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",b.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const S=C.options.x??0;return S&&S>this._bufferService.cols&&(b.style.display="none"),this._refreshXPosition(C,b),b}_refreshStyle(C){const b=C.marker.line-this._bufferService.buffers.active.ydisp;if(b<0||b>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let S=this._decorationElements.get(C);S||(S=this._createElement(C),C.element=S,this._decorationElements.set(C,S),this._container.appendChild(S),C.onDispose((()=>{this._decorationElements.delete(C),S.remove()}))),S.style.top=b*this._renderService.dimensions.css.cell.height+"px",S.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(S)}}_refreshXPosition(C,b=C.element){if(!b)return;const S=C.options.x??0;(C.options.anchor||"left")==="right"?b.style.right=S?S*this._renderService.dimensions.css.cell.width+"px":"":b.style.left=S?S*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var b;(b=this._decorationElements.get(C))==null||b.remove(),this._decorationElements.delete(C),C.dispose()}};o.BufferDecorationRenderer=w=f([p(1,v.IBufferService),p(2,d.ICoreBrowserService),p(3,v.IDecorationService),p(4,d.IRenderService)],w)},5871:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorZoneStore=void 0,o.ColorZoneStore=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(c){if(c.options.overviewRulerOptions){for(const f of this._zones)if(f.color===c.options.overviewRulerOptions.color&&f.position===c.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,c.marker.line))return;if(this._lineAdjacentToZone(f,c.marker.line,c.options.overviewRulerOptions.position))return void this._addLineToZone(f,c.marker.line)}if(this._zonePoolIndex=c.startBufferLine&&f<=c.endBufferLine}_lineAdjacentToZone(c,f,p){return f>=c.startBufferLine-this._linePadding[p||"full"]&&f<=c.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(c,f){c.startBufferLine=Math.min(c.startBufferLine,f),c.endBufferLine=Math.max(c.endBufferLine,f)}}},5744:function(u,o,c){var f=this&&this.__decorate||function(y,E,R,N){var D,T=arguments.length,j=T<3?E:N===null?N=Object.getOwnPropertyDescriptor(E,R):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(y,E,R,N);else for(var B=y.length-1;B>=0;B--)(D=y[B])&&(j=(T<3?D(j):T>3?D(E,R,j):D(E,R))||j);return T>3&&j&&Object.defineProperty(E,R,j),j},p=this&&this.__param||function(y,E){return function(R,N){E(R,N,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const d=c(5871),_=c(4725),v=c(844),w=c(2585),C={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0},S={full:0,left:0,center:0,right:0};let x=o.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(y,E,R,N,D,T,j){var F;super(),this._viewportElement=y,this._screenElement=E,this._bufferService=R,this._decorationService=N,this._renderService=D,this._optionsService=T,this._coreBrowserService=j,this._colorZoneStore=new d.ColorZoneStore,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(),(F=this._viewportElement.parentElement)==null||F.insertBefore(this._canvas,this._viewportElement);const B=this._canvas.getContext("2d");if(!B)throw new Error("Ctx cannot be null");this._ctx=B,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)((()=>{var Y;(Y=this._canvas)==null||Y.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){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())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const y=Math.floor(this._canvas.width/3),E=Math.ceil(this._canvas.width/3);b.full=this._canvas.width,b.left=y,b.center=E,b.right=y,this._refreshDrawHeightConstants(),S.full=0,S.left=0,S.center=b.left,S.right=b.left+b.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const y=this._canvas.height/this._bufferService.buffer.lines.length,E=Math.round(Math.max(Math.min(y,12),6)*this._coreBrowserService.dpr);C.left=E,C.center=E,C.right=E}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.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(const E of this._decorationService.decorations)this._colorZoneStore.addDecoration(E);this._ctx.lineWidth=1;const y=this._colorZoneStore.zones;for(const E of y)E.position!=="full"&&this._renderColorZone(E);for(const E of y)E.position==="full"&&this._renderColorZone(E);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(y){this._ctx.fillStyle=y.color,this._ctx.fillRect(S[y.position||"full"],Math.round((this._canvas.height-1)*(y.startBufferLine/this._bufferService.buffers.active.lines.length)-C[y.position||"full"]/2),b[y.position||"full"],Math.round((this._canvas.height-1)*((y.endBufferLine-y.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[y.position||"full"]))}_queueRefresh(y,E){this._shouldUpdateDimensions=y||this._shouldUpdateDimensions,this._shouldUpdateAnchor=E||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};o.OverviewRulerRenderer=x=f([p(2,w.IBufferService),p(3,w.IDecorationService),p(4,_.IRenderService),p(5,w.IOptionsService),p(6,_.ICoreBrowserService)],x)},2950:function(u,o,c){var f=this&&this.__decorate||function(C,b,S,x){var y,E=arguments.length,R=E<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,S):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(C,b,S,x);else for(var N=C.length-1;N>=0;N--)(y=C[N])&&(R=(E<3?y(R):E>3?y(b,S,R):y(b,S))||R);return E>3&&R&&Object.defineProperty(b,S,R),R},p=this&&this.__param||function(C,b){return function(S,x){b(S,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const d=c(4725),_=c(2585),v=c(2584);let w=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,b,S,x,y,E){this._textarea=C,this._compositionView=b,this._bufferService=S,this._optionsService=x,this._coreService=y,this._renderService=E,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const b={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let S;this._isSendingComposition=!1,b.start+=this._dataAlreadySent.length,S=this._isComposing?this._textarea.value.substring(b.start,b.end):this._textarea.value.substring(b.start),S.length>0&&this._coreService.triggerDataEvent(S,!0)}}),0)}else{this._isSendingComposition=!1;const b=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(b,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const b=this._textarea.value,S=b.replace(C,"");this._dataAlreadySent=S,b.length>C.length?this._coreService.triggerDataEvent(S,!0):b.lengththis.updateCompositionElements(!0)),0)}}};o.CompositionHelper=w=f([p(2,_.IBufferService),p(3,_.IOptionsService),p(4,_.ICoreService),p(5,d.IRenderService)],w)},9806:(u,o)=>{function c(f,p,d){const _=d.getBoundingClientRect(),v=f.getComputedStyle(d),w=parseInt(v.getPropertyValue("padding-left")),C=parseInt(v.getPropertyValue("padding-top"));return[p.clientX-_.left-w,p.clientY-_.top-C]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=c,o.getCoords=function(f,p,d,_,v,w,C,b,S){if(!w)return;const x=c(f,p,d);return x?(x[0]=Math.ceil((x[0]+(S?C/2:0))/C),x[1]=Math.ceil(x[1]/b),x[0]=Math.min(Math.max(x[0],1),_+(S?1:0)),x[1]=Math.min(Math.max(x[1],1),v),x):void 0}},9504:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const f=c(2584);function p(b,S,x,y){const E=b-d(b,x),R=S-d(S,x),N=Math.abs(E-R)-(function(D,T,j){let B=0;const F=D-d(D,j),Y=T-d(T,j);for(let H=0;H=0&&bS?"A":"B"}function v(b,S,x,y,E,R){let N=b,D=S,T="";for(;N!==x||D!==y;)N+=E?1:-1,E&&N>R.cols-1?(T+=R.buffer.translateBufferLineToString(D,!1,b,N),N=0,b=0,D++):!E&&N<0&&(T+=R.buffer.translateBufferLineToString(D,!1,0,b+1),N=R.cols-1,b=N,D--);return T+R.buffer.translateBufferLineToString(D,!1,b,N)}function w(b,S){const x=S?"O":"[";return f.C0.ESC+x+b}function C(b,S){b=Math.floor(b);let x="";for(let y=0;y0?F-d(F,Y):j;const V=F,G=(function(X,K,L,M,O,$){let U;return U=p(L,M,O,$).length>0?M-d(M,O):K,X=L&&Ub?"D":"C",C(Math.abs(E-b),w(N,y));N=R>S?"D":"C";const D=Math.abs(R-S);return C((function(T,j){return j.cols-T})(R>S?b:E,x)+(D-1)*x.cols+1+((R>S?E:b)-1),w(N,y))}},1296:function(u,o,c){var f=this&&this.__decorate||function(H,z,V,G){var X,K=arguments.length,L=K<3?z:G===null?G=Object.getOwnPropertyDescriptor(z,V):G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(H,z,V,G);else for(var M=H.length-1;M>=0;M--)(X=H[M])&&(L=(K<3?X(L):K>3?X(z,V,L):X(z,V))||L);return K>3&&L&&Object.defineProperty(z,V,L),L},p=this&&this.__param||function(H,z){return function(V,G){z(V,G,H)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const d=c(3787),_=c(2550),v=c(2223),w=c(6171),C=c(6052),b=c(4725),S=c(8055),x=c(8460),y=c(844),E=c(2585),R="xterm-dom-renderer-owner-",N="xterm-rows",D="xterm-fg-",T="xterm-bg-",j="xterm-focus",B="xterm-selection";let F=1,Y=o.DomRenderer=class extends y.Disposable{constructor(H,z,V,G,X,K,L,M,O,$,U,Q,re){super(),this._terminal=H,this._document=z,this._element=V,this._screenElement=G,this._viewportElement=X,this._helperContainer=K,this._linkifier2=L,this._charSizeService=O,this._optionsService=$,this._bufferService=U,this._coreBrowserService=Q,this._themeService=re,this._terminalClass=F++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(N),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(B),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,w.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ae=>this._injectCss(ae)))),this._injectCss(this._themeService.colors),this._rowFactory=M.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(R+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ae=>this._handleLinkHover(ae)))),this.register(this._linkifier2.onHideLinkUnderline((ae=>this._handleLinkLeave(ae)))),this.register((0,y.toDisposable)((()=>{this._element.classList.remove(R+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new _.WidthCache(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(){const H=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*H,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*H),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/H),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/H),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(const V of this._rowElements)V.style.width=`${this.dimensions.css.canvas.width}px`,V.style.height=`${this.dimensions.css.cell.height}px`,V.style.lineHeight=`${this.dimensions.css.cell.height}px`,V.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const z=`${this._terminalSelector} .${N} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=z,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(H){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let z=`${this._terminalSelector} .${N} { color: ${H.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;z+=`${this._terminalSelector} .${N} .xterm-dim { color: ${S.color.multiplyOpacity(H.foreground,.5).css};}`,z+=`${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;}`;const V=`blink_underline_${this._terminalClass}`,G=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;z+=`@keyframes ${V} { 50% { border-bottom-style: hidden; }}`,z+=`@keyframes ${G} { 50% { box-shadow: none; }}`,z+=`@keyframes ${X} { 0% { background-color: ${H.cursor.css}; color: ${H.cursorAccent.css}; } 50% { background-color: inherit; color: ${H.cursor.css}; }}`,z+=`${this._terminalSelector} .${N}.${j} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${V} 1s step-end infinite;}${this._terminalSelector} .${N}.${j} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${N}.${j} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block { background-color: ${H.cursor.css}; color: ${H.cursorAccent.css};}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${H.cursor.css} !important; color: ${H.cursorAccent.css} !important;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${H.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${H.cursor.css} inset;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${H.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,z+=`${this._terminalSelector} .${B} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${B} div { position: absolute; background-color: ${H.selectionBackgroundOpaque.css};}${this._terminalSelector} .${B} div { position: absolute; background-color: ${H.selectionInactiveBackgroundOpaque.css};}`;for(const[K,L]of H.ansi.entries())z+=`${this._terminalSelector} .${D}${K} { color: ${L.css}; }${this._terminalSelector} .${D}${K}.xterm-dim { color: ${S.color.multiplyOpacity(L,.5).css}; }${this._terminalSelector} .${T}${K} { background-color: ${L.css}; }`;z+=`${this._terminalSelector} .${D}${v.INVERTED_DEFAULT_COLOR} { color: ${S.color.opaque(H.background).css}; }${this._terminalSelector} .${D}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${S.color.multiplyOpacity(S.color.opaque(H.background),.5).css}; }${this._terminalSelector} .${T}${v.INVERTED_DEFAULT_COLOR} { background-color: ${H.foreground.css}; }`,this._themeStyleElement.textContent=z}_setDefaultSpacing(){const H=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${H}px`,this._rowFactory.defaultSpacing=H}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(H,z){for(let V=this._rowElements.length;V<=z;V++){const G=this._document.createElement("div");this._rowContainer.appendChild(G),this._rowElements.push(G)}for(;this._rowElements.length>z;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(H,z){this._refreshRowElements(H,z),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(j),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(j),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(H,z,V){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(H,z,V),this.renderRows(0,this._bufferService.rows-1),!H||!z)return;this._selectionRenderModel.update(this._terminal,H,z,V);const G=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,K=this._selectionRenderModel.viewportCappedStartRow,L=this._selectionRenderModel.viewportCappedEndRow;if(K>=this._bufferService.rows||L<0)return;const M=this._document.createDocumentFragment();if(V){const O=H[0]>z[0];M.appendChild(this._createSelectionElement(K,O?z[0]:H[0],O?H[0]:z[0],L-K+1))}else{const O=G===K?H[0]:0,$=K===X?z[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(K,O,$));const U=L-K-1;if(M.appendChild(this._createSelectionElement(K+1,0,this._bufferService.cols,U)),K!==L){const Q=X===L?z[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(L,0,Q))}}this._selectionContainer.appendChild(M)}_createSelectionElement(H,z,V,G=1){const X=this._document.createElement("div"),K=z*this.dimensions.css.cell.width;let L=this.dimensions.css.cell.width*(V-z);return K+L>this.dimensions.css.canvas.width&&(L=this.dimensions.css.canvas.width-K),X.style.height=G*this.dimensions.css.cell.height+"px",X.style.top=H*this.dimensions.css.cell.height+"px",X.style.left=`${K}px`,X.style.width=`${L}px`,X}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(const H of this._rowElements)H.replaceChildren()}renderRows(H,z){const V=this._bufferService.buffer,G=V.ybase+V.y,X=Math.min(V.x,this._bufferService.cols-1),K=this._optionsService.rawOptions.cursorBlink,L=this._optionsService.rawOptions.cursorStyle,M=this._optionsService.rawOptions.cursorInactiveStyle;for(let O=H;O<=z;O++){const $=O+V.ydisp,U=this._rowElements[O],Q=V.lines.get($);if(!U||!Q)break;U.replaceChildren(...this._rowFactory.createRow(Q,$,$===G,L,M,X,K,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${R}${this._terminalClass}`}_handleLinkHover(H){this._setCellUnderline(H.x1,H.x2,H.y1,H.y2,H.cols,!0)}_handleLinkLeave(H){this._setCellUnderline(H.x1,H.x2,H.y1,H.y2,H.cols,!1)}_setCellUnderline(H,z,V,G,X,K){V<0&&(H=0),G<0&&(z=0);const L=this._bufferService.rows-1;V=Math.max(Math.min(V,L),0),G=Math.max(Math.min(G,L),0),X=Math.min(X,this._bufferService.cols);const M=this._bufferService.buffer,O=M.ybase+M.y,$=Math.min(M.x,X-1),U=this._optionsService.rawOptions.cursorBlink,Q=this._optionsService.rawOptions.cursorStyle,re=this._optionsService.rawOptions.cursorInactiveStyle;for(let ae=V;ae<=G;++ae){const Z=ae+M.ydisp,P=this._rowElements[ae],ee=M.lines.get(Z);if(!P||!ee)break;P.replaceChildren(...this._rowFactory.createRow(ee,Z,Z===O,Q,re,$,U,this.dimensions.css.cell.width,this._widthCache,K?ae===V?H:0:-1,K?(ae===G?z:X)-1:-1))}}};o.DomRenderer=Y=f([p(7,E.IInstantiationService),p(8,b.ICharSizeService),p(9,E.IOptionsService),p(10,E.IBufferService),p(11,b.ICoreBrowserService),p(12,b.IThemeService)],Y)},3787:function(u,o,c){var f=this&&this.__decorate||function(N,D,T,j){var B,F=arguments.length,Y=F<3?D:j===null?j=Object.getOwnPropertyDescriptor(D,T):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(N,D,T,j);else for(var H=N.length-1;H>=0;H--)(B=N[H])&&(Y=(F<3?B(Y):F>3?B(D,T,Y):B(D,T))||Y);return F>3&&Y&&Object.defineProperty(D,T,Y),Y},p=this&&this.__param||function(N,D){return function(T,j){D(T,j,N)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const d=c(2223),_=c(643),v=c(511),w=c(2585),C=c(8055),b=c(4725),S=c(4269),x=c(6171),y=c(3734);let E=o.DomRendererRowFactory=class{constructor(N,D,T,j,B,F,Y){this._document=N,this._characterJoinerService=D,this._optionsService=T,this._coreBrowserService=j,this._coreService=B,this._decorationService=F,this._themeService=Y,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(N,D,T){this._selectionStart=N,this._selectionEnd=D,this._columnSelectMode=T}createRow(N,D,T,j,B,F,Y,H,z,V,G){const X=[],K=this._characterJoinerService.getJoinedCharacters(D),L=this._themeService.colors;let M,O=N.getNoBgTrimmedLength();T&&O0&&ye===K[0][0]){ke=!0;const Ie=K.shift();Ce=new S.JoinedCellData(this._workCell,N.translateToString(!0,Ie[0],Ie[1]),Ie[1]-Ie[0]),Ee=Ie[1]-1,be=Ce.getWidth()}const rt=this._isCellInSelection(ye,D),bt=T&&ye===F,Ge=he&&ye>=V&&ye<=G;let ct=!1;this._decorationService.forEachDecorationAtCell(ye,D,void 0,(Ie=>{ct=!0}));let Pt=Ce.getChars()||_.WHITESPACE_CELL_CHAR;if(Pt===" "&&(Ce.isUnderline()||Ce.isOverline())&&(Pt=" "),ne=be*H-z.get(Pt,Ce.isBold(),Ce.isItalic()),M){if($&&(rt&&ee||!rt&&!ee&&Ce.bg===Q)&&(rt&&ee&&L.selectionForeground||Ce.fg===re)&&Ce.extended.ext===ae&&Ge===Z&&ne===P&&!bt&&!ke&&!ct){Ce.isInvisible()?U+=_.WHITESPACE_CELL_CHAR:U+=Pt,$++;continue}$&&(M.textContent=U),M=this._document.createElement("span"),$=0,U=""}else M=this._document.createElement("span");if(Q=Ce.bg,re=Ce.fg,ae=Ce.extended.ext,Z=Ge,P=ne,ee=rt,ke&&F>=ye&&F<=Ee&&(F=ye),!this._coreService.isCursorHidden&&bt&&this._coreService.isCursorInitialized){if(ge.push("xterm-cursor"),this._coreBrowserService.isFocused)Y&&ge.push("xterm-cursor-blink"),ge.push(j==="bar"?"xterm-cursor-bar":j==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(B)switch(B){case"outline":ge.push("xterm-cursor-outline");break;case"block":ge.push("xterm-cursor-block");break;case"bar":ge.push("xterm-cursor-bar");break;case"underline":ge.push("xterm-cursor-underline")}}if(Ce.isBold()&&ge.push("xterm-bold"),Ce.isItalic()&&ge.push("xterm-italic"),Ce.isDim()&&ge.push("xterm-dim"),U=Ce.isInvisible()?_.WHITESPACE_CELL_CHAR:Ce.getChars()||_.WHITESPACE_CELL_CHAR,Ce.isUnderline()&&(ge.push(`xterm-underline-${Ce.extended.underlineStyle}`),U===" "&&(U=" "),!Ce.isUnderlineColorDefault()))if(Ce.isUnderlineColorRGB())M.style.textDecorationColor=`rgb(${y.AttributeData.toColorRGB(Ce.getUnderlineColor()).join(",")})`;else{let Ie=Ce.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ce.isBold()&&Ie<8&&(Ie+=8),M.style.textDecorationColor=L.ansi[Ie].css}Ce.isOverline()&&(ge.push("xterm-overline"),U===" "&&(U=" ")),Ce.isStrikethrough()&&ge.push("xterm-strikethrough"),Ge&&(M.style.textDecoration="underline");let ht=Ce.getFgColor(),Fe=Ce.getFgColorMode(),fe=Ce.getBgColor(),ie=Ce.getBgColorMode();const de=!!Ce.isInverse();if(de){const Ie=ht;ht=fe,fe=Ie;const Nt=Fe;Fe=ie,ie=Nt}let Se,Ae,De,Ve=!1;switch(this._decorationService.forEachDecorationAtCell(ye,D,void 0,(Ie=>{Ie.options.layer!=="top"&&Ve||(Ie.backgroundColorRGB&&(ie=50331648,fe=Ie.backgroundColorRGB.rgba>>8&16777215,Se=Ie.backgroundColorRGB),Ie.foregroundColorRGB&&(Fe=50331648,ht=Ie.foregroundColorRGB.rgba>>8&16777215,Ae=Ie.foregroundColorRGB),Ve=Ie.options.layer==="top")})),!Ve&&rt&&(Se=this._coreBrowserService.isFocused?L.selectionBackgroundOpaque:L.selectionInactiveBackgroundOpaque,fe=Se.rgba>>8&16777215,ie=50331648,Ve=!0,L.selectionForeground&&(Fe=50331648,ht=L.selectionForeground.rgba>>8&16777215,Ae=L.selectionForeground)),Ve&&ge.push("xterm-decoration-top"),ie){case 16777216:case 33554432:De=L.ansi[fe],ge.push(`xterm-bg-${fe}`);break;case 50331648:De=C.channels.toColor(fe>>16,fe>>8&255,255&fe),this._addStyle(M,`background-color:#${R((fe>>>0).toString(16),"0",6)}`);break;default:de?(De=L.foreground,ge.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):De=L.background}switch(Se||Ce.isDim()&&(Se=C.color.multiplyOpacity(De,.5)),Fe){case 16777216:case 33554432:Ce.isBold()&&ht<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ht+=8),this._applyMinimumContrast(M,De,L.ansi[ht],Ce,Se,void 0)||ge.push(`xterm-fg-${ht}`);break;case 50331648:const Ie=C.channels.toColor(ht>>16&255,ht>>8&255,255&ht);this._applyMinimumContrast(M,De,Ie,Ce,Se,Ae)||this._addStyle(M,`color:#${R(ht.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(M,De,L.foreground,Ce,Se,Ae)||de&&ge.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}ge.length&&(M.className=ge.join(" "),ge.length=0),bt||ke||ct?M.textContent=U:$++,ne!==this.defaultSpacing&&(M.style.letterSpacing=`${ne}px`),X.push(M),ye=Ee}return M&&$&&(M.textContent=U),X}_applyMinimumContrast(N,D,T,j,B,F){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(j.getCode()))return!1;const Y=this._getContrastCache(j);let H;if(B||F||(H=Y.getColor(D.rgba,T.rgba)),H===void 0){const z=this._optionsService.rawOptions.minimumContrastRatio/(j.isDim()?2:1);H=C.color.ensureContrastRatio(B||D,F||T,z),Y.setColor((B||D).rgba,(F||T).rgba,H??null)}return!!H&&(this._addStyle(N,`color:${H.css}`),!0)}_getContrastCache(N){return N.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(N,D){N.setAttribute("style",`${N.getAttribute("style")||""}${D};`)}_isCellInSelection(N,D){const T=this._selectionStart,j=this._selectionEnd;return!(!T||!j)&&(this._columnSelectMode?T[0]<=j[0]?N>=T[0]&&D>=T[1]&&N=T[1]&&N>=j[0]&&D<=j[1]:D>T[1]&&D=T[0]&&N=T[0])}};function R(N,D,T){for(;N.length{Object.defineProperty(o,"__esModule",{value:!0}),o.WidthCache=void 0,o.WidthCache=class{constructor(c,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=c.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";const p=c.createElement("span");p.classList.add("xterm-char-measure-element");const d=c.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold";const _=c.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";const v=c.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[p,d,_,v],this._container.appendChild(p),this._container.appendChild(d),this._container.appendChild(_),this._container.appendChild(v),f.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(c,f,p,d){c===this._font&&f===this._fontSize&&p===this._weight&&d===this._weightBold||(this._font=c,this._fontSize=f,this._weight=p,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(c,f,p){let d=0;if(!f&&!p&&c.length===1&&(d=c.charCodeAt(0))<256){if(this._flat[d]!==-9999)return this._flat[d];const w=this._measure(c,0);return w>0&&(this._flat[d]=w),w}let _=c;f&&(_+="B"),p&&(_+="I");let v=this._holey.get(_);if(v===void 0){let w=0;f&&(w|=1),p&&(w|=2),v=this._measure(c,w),v>0&&this._holey.set(_,v)}return v}_measure(c,f){const p=this._measureElements[f];return p.textContent=c.repeat(32),p.offsetWidth/32}}},2223:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const f=c(6114);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(u,o)=>{function c(p){return 57508<=p&&p<=57558}function f(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},o.isPowerlineGlyph=c,o.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},o.isEmoji=f,o.allowRescaling=function(p,d,_,v){return d===1&&_>Math.ceil(1.5*v)&&p!==void 0&&p>255&&!f(p)&&!c(p)&&!(function(w){return 57344<=w&&w<=63743})(p)},o.treatGlyphAsBackgroundColor=function(p){return c(p)||(function(d){return 9472<=d&&d<=9631})(p)},o.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},o.computeNextVariantOffset=function(p,d,_=0){return(p-(2*Math.round(d)-_))%(2*Math.round(d))}},6052:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createSelectionRenderModel=void 0;class c{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(p,d,_,v=!1){if(this.selectionStart=d,this.selectionEnd=_,!d||!_||d[0]===_[0]&&d[1]===_[1])return void this.clear();const w=p.buffers.active.ydisp,C=d[1]-w,b=_[1]-w,S=Math.max(C,0),x=Math.min(b,p.rows-1);S>=p.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=C,this.viewportEndRow=b,this.viewportCappedStartRow=S,this.viewportCappedEndRow=x,this.startCol=d[0],this.endCol=_[0])}isCellSelected(p,d,_){return!!this.hasSelection&&(_-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&_>=this.viewportCappedStartRow&&d=this.viewportCappedStartRow&&d>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_=this.startCol&&d=this.startCol)}}o.createSelectionRenderModel=function(){return new c}},456:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionModel=void 0,o.SelectionModel=class{constructor(c){this._bufferService=c,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.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()){const c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?c%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)-1]:[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[c,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[Math.max(c,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const c=this.selectionStart,f=this.selectionEnd;return!(!c||!f)&&(c[1]>f[1]||c[1]===f[1]&&c[0]>f[0])}handleTrim(c){return this.selectionStart&&(this.selectionStart[1]-=c),this.selectionEnd&&(this.selectionEnd[1]-=c),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(u,o,c){var f=this&&this.__decorate||function(x,y,E,R){var N,D=arguments.length,T=D<3?y:R===null?R=Object.getOwnPropertyDescriptor(y,E):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,y,E,R);else for(var j=x.length-1;j>=0;j--)(N=x[j])&&(T=(D<3?N(T):D>3?N(y,E,T):N(y,E))||T);return D>3&&T&&Object.defineProperty(y,E,T),T},p=this&&this.__param||function(x,y){return function(E,R){y(E,R,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const d=c(2585),_=c(8460),v=c(844);let w=o.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,y,E){super(),this._optionsService=E,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new S(this._optionsService))}catch{this._measureStrategy=this.register(new b(x,y,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const x=this._measureStrategy.measure();x.width===this.width&&x.height===this.height||(this.width=x.width,this.height=x.height,this._onCharSizeChange.fire())}};o.CharSizeService=w=f([p(2,d.IOptionsService)],w);class C extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(y,E){y!==void 0&&y>0&&E!==void 0&&E>0&&(this._result.width=y,this._result.height=E)}}class b extends C{constructor(y,E,R){super(),this._document=y,this._parentElement=E,this._optionsService=R,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}}class S extends C{constructor(y){super(),this._optionsService=y,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const E=this._ctx.measureText("W");if(!("width"in E&&"fontBoundingBoxAscent"in E&&"fontBoundingBoxDescent"in E))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const y=this._ctx.measureText("W");return this._validateAndSet(y.width,y.fontBoundingBoxAscent+y.fontBoundingBoxDescent),this._result}}},4269:function(u,o,c){var f=this&&this.__decorate||function(S,x,y,E){var R,N=arguments.length,D=N<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,y):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(S,x,y,E);else for(var T=S.length-1;T>=0;T--)(R=S[T])&&(D=(N<3?R(D):N>3?R(x,y,D):R(x,y))||D);return N>3&&D&&Object.defineProperty(x,y,D),D},p=this&&this.__param||function(S,x){return function(y,E){x(y,E,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const d=c(3734),_=c(643),v=c(511),w=c(2585);class C extends d.AttributeData{constructor(x,y,E){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=y,this._width=E}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(x){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.JoinedCellData=C;let b=o.CharacterJoinerService=class mC{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(x){const y={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(y),y.id}deregister(x){for(let y=0;y1){const Y=this._getJoinedRanges(R,T,D,y,N);for(let H=0;H1){const F=this._getJoinedRanges(R,T,D,y,N);for(let Y=0;Y{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const f=c(844),p=c(8460),d=c(3656);class _ extends f.Disposable{constructor(C,b,S){super(),this._textarea=C,this._window=b,this.mainDocument=S,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((x=>this._screenDprMonitor.setWindow(x)))),this.register((0,p.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(C){this._window!==C&&(this._window=C,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}}o.CoreBrowserService=_;class v extends f.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,f.toDisposable)((()=>this.clearListener())))}setWindow(C){this._parentWindow=C,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,d.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var C;this._outerListener&&((C=this._resolutionMediaMatchList)==null||C.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)}}},779:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkProviderService=void 0;const f=c(844);class p extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{const v=this.linkProviders.indexOf(_);v!==-1&&this.linkProviders.splice(v,1)}}}}o.LinkProviderService=p},8934:function(u,o,c){var f=this&&this.__decorate||function(w,C,b,S){var x,y=arguments.length,E=y<3?C:S===null?S=Object.getOwnPropertyDescriptor(C,b):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(w,C,b,S);else for(var R=w.length-1;R>=0;R--)(x=w[R])&&(E=(y<3?x(E):y>3?x(C,b,E):x(C,b))||E);return y>3&&E&&Object.defineProperty(C,b,E),E},p=this&&this.__param||function(w,C){return function(b,S){C(b,S,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const d=c(4725),_=c(9806);let v=o.MouseService=class{constructor(w,C){this._renderService=w,this._charSizeService=C}getCoords(w,C,b,S,x){return(0,_.getCoords)(window,w,C,b,S,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(w,C){const b=(0,_.getCoordsRelativeToElement)(window,w,C);if(this._charSizeService.hasValidSize)return b[0]=Math.min(Math.max(b[0],0),this._renderService.dimensions.css.canvas.width-1),b[1]=Math.min(Math.max(b[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(b[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(b[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(b[0]),y:Math.floor(b[1])}}};o.MouseService=v=f([p(0,d.IRenderService),p(1,d.ICharSizeService)],v)},3230:function(u,o,c){var f=this&&this.__decorate||function(x,y,E,R){var N,D=arguments.length,T=D<3?y:R===null?R=Object.getOwnPropertyDescriptor(y,E):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,y,E,R);else for(var j=x.length-1;j>=0;j--)(N=x[j])&&(T=(D<3?N(T):D>3?N(y,E,T):N(y,E))||T);return D>3&&T&&Object.defineProperty(y,E,T),T},p=this&&this.__param||function(x,y){return function(E,R){y(E,R,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const d=c(6193),_=c(4725),v=c(8460),w=c(844),C=c(7226),b=c(2585);let S=o.RenderService=class extends w.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,y,E,R,N,D,T,j){super(),this._rowCount=x,this._charSizeService=R,this._renderer=this.register(new w.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new w.MutableDisposable),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 v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(((B,F)=>this._renderRows(B,F)),T),this.register(this._renderDebouncer),this.register(T.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(D.onResize((()=>this._fullRefresh()))),this.register(D.buffers.onBufferActivate((()=>{var B;return(B=this._renderer.value)==null?void 0:B.clear()}))),this.register(E.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(N.onDecorationRegistered((()=>this._fullRefresh()))),this.register(N.onDecorationRemoved((()=>this._fullRefresh()))),this.register(E.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(D.cols,D.rows),this._fullRefresh()}))),this.register(E.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(D.buffer.y,D.buffer.y,!0)))),this.register(j.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(T.window,y),this.register(T.onWindowChange((B=>this._registerIntersectionObserver(B,y))))}_registerIntersectionObserver(x,y){if("IntersectionObserver"in x){const E=new x.IntersectionObserver((R=>this._handleIntersectionChange(R[R.length-1])),{threshold:0});E.observe(y),this._observerDisposable.value=(0,w.toDisposable)((()=>E.disconnect()))}}_handleIntersectionChange(x){this._isPaused=x.isIntersecting===void 0?x.intersectionRatio===0:!x.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(x,y,E=!1){this._isPaused?this._needsFullRefresh=!0:(E||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,y,this._rowCount))}_renderRows(x,y){this._renderer.value&&(x=Math.min(x,this._rowCount-1),y=Math.min(y,this._rowCount-1),this._renderer.value.renderRows(x,y),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:x,end:y}),this._onRender.fire({start:x,end:y}),this._isNextRenderRedrawOnly=!0)}resize(x,y){this._rowCount=y,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(x){this._renderer.value=x,this._renderer.value&&(this._renderer.value.onRequestRedraw((y=>this.refreshRows(y.start,y.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(x){return this._renderDebouncer.addRefreshCallback(x)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var x,y;this._renderer.value&&((y=(x=this._renderer.value).clearTextureAtlas)==null||y.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,y){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var E;return(E=this._renderer.value)==null?void 0:E.handleResize(x,y)})):this._renderer.value.handleResize(x,y),this._fullRefresh())}handleCharSizeChanged(){var x;(x=this._renderer.value)==null||x.handleCharSizeChanged()}handleBlur(){var x;(x=this._renderer.value)==null||x.handleBlur()}handleFocus(){var x;(x=this._renderer.value)==null||x.handleFocus()}handleSelectionChanged(x,y,E){var R;this._selectionState.start=x,this._selectionState.end=y,this._selectionState.columnSelectMode=E,(R=this._renderer.value)==null||R.handleSelectionChanged(x,y,E)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};o.RenderService=S=f([p(2,b.IOptionsService),p(3,_.ICharSizeService),p(4,b.IDecorationService),p(5,b.IBufferService),p(6,_.ICoreBrowserService),p(7,_.IThemeService)],S)},9312:function(u,o,c){var f=this&&this.__decorate||function(T,j,B,F){var Y,H=arguments.length,z=H<3?j:F===null?F=Object.getOwnPropertyDescriptor(j,B):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(T,j,B,F);else for(var V=T.length-1;V>=0;V--)(Y=T[V])&&(z=(H<3?Y(z):H>3?Y(j,B,z):Y(j,B))||z);return H>3&&z&&Object.defineProperty(j,B,z),z},p=this&&this.__param||function(T,j){return function(B,F){j(B,F,T)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const d=c(9806),_=c(9504),v=c(456),w=c(4725),C=c(8460),b=c(844),S=c(6114),x=c(4841),y=c(511),E=c(2585),R=" ",N=new RegExp(R,"g");let D=o.SelectionService=class extends b.Disposable{constructor(T,j,B,F,Y,H,z,V,G){super(),this._element=T,this._screenElement=j,this._linkifier=B,this._bufferService=F,this._coreService=Y,this._mouseService=H,this._optionsService=z,this._renderService=V,this._coreBrowserService=G,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new y.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=X=>this._handleMouseMove(X),this._mouseUpListener=X=>this._handleMouseUp(X),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((X=>this._handleTrim(X))),this.register(this._bufferService.buffers.onBufferActivate((X=>this._handleBufferActivate(X)))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,b.toDisposable)((()=>{this._removeMouseDownListeners()})))}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(){const T=this._model.finalSelectionStart,j=this._model.finalSelectionEnd;return!(!T||!j||T[0]===j[0]&&T[1]===j[1])}get selectionText(){const T=this._model.finalSelectionStart,j=this._model.finalSelectionEnd;if(!T||!j)return"";const B=this._bufferService.buffer,F=[];if(this._activeSelectionMode===3){if(T[0]===j[0])return"";const Y=T[0]Y.replace(N," "))).join(S.isWindows?`\r +WARNING: This link could potentially be dangerous`)){const S=window.open();if(S){try{S.opener=null}catch{}S.location.href=b}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=v=f([p(0,_.IBufferService),p(1,_.IOptionsService),p(2,_.IOscLinkService)],v)},6193:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderDebouncer=void 0,o.RenderDebouncer=class{constructor(c,f){this._renderCallback=c,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(c){return this._refreshCallbacks.push(c),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(c,f,p){this._rowCount=p,c=c!==void 0?c:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,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)return void this._runRefreshCallbacks();const c=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const c of this._refreshCallbacks)c(0);this._refreshCallbacks=[]}}},3236:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const f=c(3614),p=c(3656),d=c(3551),_=c(9042),v=c(3730),w=c(1680),C=c(3107),b=c(5744),S=c(2950),x=c(1296),y=c(428),E=c(4269),R=c(5114),N=c(8934),D=c(3230),T=c(9312),j=c(4725),B=c(6731),z=c(8055),G=c(8969),U=c(8460),H=c(844),Y=c(6114),q=c(8437),X=c(2584),K=c(7399),L=c(5941),M=c(9074),O=c(2585),$=c(5435),F=c(4567),Q=c(779);class re extends G.CoreTerminal{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}constructor(Z={}){super(Z),this.browser=Y,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new H.MutableDisposable),this._onCursorMove=this.register(new U.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new U.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new U.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new U.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new U.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new U.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new U.EventEmitter),this._onBlur=this.register(new U.EventEmitter),this._onA11yCharEmitter=this.register(new U.EventEmitter),this._onA11yTabEmitter=this.register(new U.EventEmitter),this._onWillOpen=this.register(new U.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(M.DecorationService),this._instantiationService.setService(O.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Q.LinkProviderService),this._instantiationService.setService(j.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((P,ee)=>this.refresh(P,ee)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((P=>this._reportWindowsOptions(P)))),this.register(this._inputHandler.onColor((P=>this._handleColorEvent(P)))),this.register((0,U.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,U.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,U.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,U.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((P=>this._afterResize(P.cols,P.rows)))),this.register((0,H.toDisposable)((()=>{var P,ee;this._customKeyEventHandler=void 0,(ee=(P=this.element)==null?void 0:P.parentNode)==null||ee.removeChild(this.element)})))}_handleColorEvent(Z){if(this._themeService)for(const P of Z){let ee,ne="";switch(P.index){case 256:ee="foreground",ne="10";break;case 257:ee="background",ne="11";break;case 258:ee="cursor",ne="12";break;default:ee="ansi",ne="4;"+P.index}switch(P.type){case 0:const ge=z.color.toColorRGB(ee==="ansi"?this._themeService.colors.ansi[P.index]:this._themeService.colors[ee]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${ne};${(0,L.toRgbString)(ge)}${X.C1_ESCAPED.ST}`);break;case 1:if(ee==="ansi")this._themeService.modifyColors((he=>he.ansi[P.index]=z.channels.toColor(...P.color)));else{const he=ee;this._themeService.modifyColors((ye=>ye[he]=z.channels.toColor(...P.color)))}break;case 2:this._themeService.restoreColor(P.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Z){Z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(F.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Z;return(Z=this.textarea)==null?void 0:Z.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const Z=this.buffer.ybase+this.buffer.y,P=this.buffer.lines.get(Z);if(!P)return;const ee=Math.min(this.buffer.x,this.cols-1),ne=this._renderService.dimensions.css.cell.height,ge=P.getWidth(ee),he=this._renderService.dimensions.css.cell.width*ge,ye=this.buffer.y*this._renderService.dimensions.css.cell.height,be=ee*this._renderService.dimensions.css.cell.width;this.textarea.style.left=be+"px",this.textarea.style.top=ye+"px",this.textarea.style.width=he+"px",this.textarea.style.height=ne+"px",this.textarea.style.lineHeight=ne+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",(P=>{this.hasSelection()&&(0,f.copyHandler)(P,this._selectionService)})));const Z=P=>(0,f.handlePasteEvent)(P,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",Z)),this.register((0,p.addDisposableDomListener)(this.element,"paste",Z)),Y.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(P=>{P.button===2&&(0,f.rightClickHandler)(P,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",(P=>{(0,f.rightClickHandler)(P,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),Y.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",(P=>{P.button===1&&(0,f.moveTextAreaUnderMouseCursor)(P,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",(Z=>this._keyUp(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",(Z=>this._keyDown(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",(Z=>this._keyPress(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",(Z=>this._compositionHelper.compositionupdate(Z)))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,p.addDisposableDomListener)(this.textarea,"input",(Z=>this._inputEvent(Z)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Z){var ee;if(!Z)throw new Error("Terminal requires a parent element.");if(Z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ee=this.element)==null?void 0:ee.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Z.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"),Z.appendChild(this.element);const P=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),P.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,p.addDisposableDomListener)(this.screenElement,"mousemove",(ne=>this.updateCursorStyle(ne)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),P.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),Y.isChromeOS||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._coreBrowserService=this.register(this._instantiationService.createInstance(R.CoreBrowserService,this.textarea,Z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(j.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",(ne=>this._handleTextAreaFocus(ne)))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(y.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(j.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(B.ThemeService),this._instantiationService.setService(j.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(E.CharacterJoinerService),this._instantiationService.setService(j.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(D.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(j.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ne=>this._onRender.fire(ne)))),this.onResize((ne=>this._renderService.resize(ne.cols,ne.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(S.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(N.MouseService),this._instantiationService.setService(j.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(d.Linkifier,this.screenElement)),this.element.appendChild(P);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(w.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ne=>this.scrollLines(ne.amount,ne.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),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.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(T.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(j.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ne=>this.scrollLines(ne.amount,ne.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ne=>this._renderService.handleSelectionChanged(ne.start,ne.end,ne.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ne=>{this.textarea.value=ne,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ne=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(C.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(ne=>this._selectionService.handleMouseDown(ne)))),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(F.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ne=>this._handleScreenReaderModeOptionChange(ne)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ne=>{!this._overviewRulerRenderer&&ne&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(x.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Z=this,P=this.element;function ee(he){const ye=Z._mouseService.getMouseReportCoords(he,Z.screenElement);if(!ye)return!1;let be,ke;switch(he.overrideType||he.type){case"mousemove":ke=32,he.buttons===void 0?(be=3,he.button!==void 0&&(be=he.button<3?he.button:3)):be=1&he.buttons?0:4&he.buttons?1:2&he.buttons?2:3;break;case"mouseup":ke=0,be=he.button<3?he.button:3;break;case"mousedown":ke=1,be=he.button<3?he.button:3;break;case"wheel":if(Z._customWheelEventHandler&&Z._customWheelEventHandler(he)===!1||Z.viewport.getLinesScrolled(he)===0)return!1;ke=he.deltaY<0?0:1,be=4;break;default:return!1}return!(ke===void 0||be===void 0||be>4)&&Z.coreMouseService.triggerMouseEvent({col:ye.col,row:ye.row,x:ye.x,y:ye.y,button:be,action:ke,ctrl:he.ctrlKey,alt:he.altKey,shift:he.shiftKey})}const ne={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ge={mouseup:he=>(ee(he),he.buttons||(this._document.removeEventListener("mouseup",ne.mouseup),ne.mousedrag&&this._document.removeEventListener("mousemove",ne.mousedrag)),this.cancel(he)),wheel:he=>(ee(he),this.cancel(he,!0)),mousedrag:he=>{he.buttons&&ee(he)},mousemove:he=>{he.buttons||ee(he)}};this.register(this.coreMouseService.onProtocolChange((he=>{he?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(he)),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()),8&he?ne.mousemove||(P.addEventListener("mousemove",ge.mousemove),ne.mousemove=ge.mousemove):(P.removeEventListener("mousemove",ne.mousemove),ne.mousemove=null),16&he?ne.wheel||(P.addEventListener("wheel",ge.wheel,{passive:!1}),ne.wheel=ge.wheel):(P.removeEventListener("wheel",ne.wheel),ne.wheel=null),2&he?ne.mouseup||(ne.mouseup=ge.mouseup):(this._document.removeEventListener("mouseup",ne.mouseup),ne.mouseup=null),4&he?ne.mousedrag||(ne.mousedrag=ge.mousedrag):(this._document.removeEventListener("mousemove",ne.mousedrag),ne.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(P,"mousedown",(he=>{if(he.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(he))return ee(he),ne.mouseup&&this._document.addEventListener("mouseup",ne.mouseup),ne.mousedrag&&this._document.addEventListener("mousemove",ne.mousedrag),this.cancel(he)}))),this.register((0,p.addDisposableDomListener)(P,"wheel",(he=>{if(!ne.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(he)===!1)return!1;if(!this.buffer.hasScrollback){const ye=this.viewport.getLinesScrolled(he);if(ye===0)return;const be=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(he.deltaY<0?"A":"B");let ke="";for(let Ee=0;Ee{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(he),this.cancel(he)}),{passive:!0})),this.register((0,p.addDisposableDomListener)(P,"touchmove",(he=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(he)?void 0:this.cancel(he)}),{passive:!1}))}refresh(Z,P){var ee;(ee=this._renderService)==null||ee.refreshRows(Z,P)}updateCursorStyle(Z){var P;(P=this._selectionService)!=null&&P.shouldColumnSelect(Z)?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(Z,P,ee=0){var ne;ee===1?(super.scrollLines(Z,P,ee),this.refresh(0,this.rows-1)):(ne=this.viewport)==null||ne.scrollLines(Z)}paste(Z){(0,f.paste)(Z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Z){this._customKeyEventHandler=Z}attachCustomWheelEventHandler(Z){this._customWheelEventHandler=Z}registerLinkProvider(Z){return this._linkProviderService.registerLinkProvider(Z)}registerCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const P=this._characterJoinerService.register(Z);return this.refresh(0,this.rows-1),P}deregisterCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Z)}registerDecoration(Z){return this._decorationService.registerDecoration(Z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Z,P,ee){this._selectionService.setSelection(Z,P,ee)}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(){var Z;(Z=this._selectionService)==null||Z.clearSelection()}selectAll(){var Z;(Z=this._selectionService)==null||Z.selectAll()}selectLines(Z,P){var ee;(ee=this._selectionService)==null||ee.selectLines(Z,P)}_keyDown(Z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;const P=this.browser.isMac&&this.options.macOptionIsMeta&&Z.altKey;if(!P&&!this._compositionHelper.keydown(Z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;P||Z.key!=="Dead"&&Z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ee=(0,K.evaluateKeyboardEvent)(Z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Z),ee.type===3||ee.type===2){const ne=this.rows-1;return this.scrollLines(ee.type===2?-ne:ne),this.cancel(Z,!0)}return ee.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Z)||(ee.cancel&&this.cancel(Z,!0),!ee.key||!!(Z.key&&!Z.ctrlKey&&!Z.altKey&&!Z.metaKey&&Z.key.length===1&&Z.key.charCodeAt(0)>=65&&Z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ee.key!==X.C0.ETX&&ee.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ee.key,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(ee.key,!0),!this.optionsService.rawOptions.screenReaderMode||Z.altKey||Z.ctrlKey?this.cancel(Z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Z,P){const ee=Z.isMac&&!this.options.macOptionIsMeta&&P.altKey&&!P.ctrlKey&&!P.metaKey||Z.isWindows&&P.altKey&&P.ctrlKey&&!P.metaKey||Z.isWindows&&P.getModifierState("AltGraph");return P.type==="keypress"?ee:ee&&(!P.keyCode||P.keyCode>47)}_keyUp(Z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1||((function(P){return P.keyCode===16||P.keyCode===17||P.keyCode===18})(Z)||this.focus(),this.updateCursorStyle(Z),this._keyPressHandled=!1)}_keyPress(Z){let P;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;if(this.cancel(Z),Z.charCode)P=Z.charCode;else if(Z.which===null||Z.which===void 0)P=Z.keyCode;else{if(Z.which===0||Z.charCode===0)return!1;P=Z.which}return!(!P||(Z.altKey||Z.ctrlKey||Z.metaKey)&&!this._isThirdLevelShift(this.browser,Z)||(P=String.fromCharCode(P),this._onKey.fire({key:P,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(P,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Z){if(Z.data&&Z.inputType==="insertText"&&(!Z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const P=Z.data;return this.coreService.triggerDataEvent(P,!0),this.cancel(Z),!0}return!1}resize(Z,P){Z!==this.cols||P!==this.rows?super.resize(Z,P):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Z,P){var ee,ne;(ee=this._charSizeService)==null||ee.measure(),(ne=this.viewport)==null||ne.syncScrollArea(!0)}clear(){var Z;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 P=1;P{Object.defineProperty(o,"__esModule",{value:!0}),o.TimeBasedDebouncer=void 0,o.TimeBasedDebouncer=class{constructor(c,f=1e3){this._renderCallback=c,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(c,f,p){this._rowCount=p,c=c!==void 0?c:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const _=d-this._lastRefreshMs,v=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const c=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,f)}}},1680:function(u,o,c){var f=this&&this.__decorate||function(S,x,y,E){var R,N=arguments.length,D=N<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,y):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(S,x,y,E);else for(var T=S.length-1;T>=0;T--)(R=S[T])&&(D=(N<3?R(D):N>3?R(x,y,D):R(x,y))||D);return N>3&&D&&Object.defineProperty(x,y,D),D},p=this&&this.__param||function(S,x){return function(y,E){x(y,E,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const d=c(3656),_=c(4725),v=c(8460),w=c(844),C=c(2585);let b=o.Viewport=class extends w.Disposable{constructor(S,x,y,E,R,N,D,T){super(),this._viewportElement=S,this._scrollArea=x,this._bufferService=y,this._optionsService=E,this._charSizeService=R,this._renderService=N,this._coreBrowserService=D,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((j=>this._activeBuffer=j.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((j=>this._renderDimensions=j))),this._handleThemeChange(T.colors),this.register(T.onChangeColors((j=>this._handleThemeChange(j)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(S){this._viewportElement.style.backgroundColor=S.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(S){if(S)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const x=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==x&&(this._lastRecordedBufferHeight=x,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const S=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==S&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=S),this._refreshAnimationFrame=null}syncScrollArea(S=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(S);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(S)}_handleScroll(S){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const x=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:x,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const S=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(S*(this._smoothScrollState.target-this._smoothScrollState.origin)),S<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(S,x){const y=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&y0&&(y=G),E=""}}return{bufferElements:R,cursorElement:y}}getLinesScrolled(S){if(S.deltaY===0||S.shiftKey)return 0;let x=this._applyScrollModifier(S.deltaY,S);return S.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(x/=this._currentRowHeight+0,this._wheelPartialScroll+=x,x=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):S.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(S,x){const y=this._optionsService.rawOptions.fastScrollModifier;return y==="alt"&&x.altKey||y==="ctrl"&&x.ctrlKey||y==="shift"&&x.shiftKey?S*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:S*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(S){this._lastTouchY=S.touches[0].pageY}handleTouchMove(S){const x=this._lastTouchY-S.touches[0].pageY;return this._lastTouchY=S.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(S,x))}};o.Viewport=b=f([p(2,C.IBufferService),p(3,C.IOptionsService),p(4,_.ICharSizeService),p(5,_.IRenderService),p(6,_.ICoreBrowserService),p(7,_.IThemeService)],b)},3107:function(u,o,c){var f=this&&this.__decorate||function(C,b,S,x){var y,E=arguments.length,R=E<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,S):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(C,b,S,x);else for(var N=C.length-1;N>=0;N--)(y=C[N])&&(R=(E<3?y(R):E>3?y(b,S,R):y(b,S))||R);return E>3&&R&&Object.defineProperty(b,S,R),R},p=this&&this.__param||function(C,b){return function(S,x){b(S,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const d=c(4725),_=c(844),v=c(2585);let w=o.BufferDecorationRenderer=class extends _.Disposable{constructor(C,b,S,x,y){super(),this._screenElement=C,this._bufferService=b,this._coreBrowserService=S,this._decorationService=x,this._renderService=y,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((E=>this._removeDecoration(E)))),this.register((0,_.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var x;const b=this._coreBrowserService.mainDocument.createElement("div");b.classList.add("xterm-decoration"),b.classList.toggle("xterm-decoration-top-layer",((x=C==null?void 0:C.options)==null?void 0:x.layer)==="top"),b.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,b.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",b.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",b.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const S=C.options.x??0;return S&&S>this._bufferService.cols&&(b.style.display="none"),this._refreshXPosition(C,b),b}_refreshStyle(C){const b=C.marker.line-this._bufferService.buffers.active.ydisp;if(b<0||b>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let S=this._decorationElements.get(C);S||(S=this._createElement(C),C.element=S,this._decorationElements.set(C,S),this._container.appendChild(S),C.onDispose((()=>{this._decorationElements.delete(C),S.remove()}))),S.style.top=b*this._renderService.dimensions.css.cell.height+"px",S.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(S)}}_refreshXPosition(C,b=C.element){if(!b)return;const S=C.options.x??0;(C.options.anchor||"left")==="right"?b.style.right=S?S*this._renderService.dimensions.css.cell.width+"px":"":b.style.left=S?S*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var b;(b=this._decorationElements.get(C))==null||b.remove(),this._decorationElements.delete(C),C.dispose()}};o.BufferDecorationRenderer=w=f([p(1,v.IBufferService),p(2,d.ICoreBrowserService),p(3,v.IDecorationService),p(4,d.IRenderService)],w)},5871:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorZoneStore=void 0,o.ColorZoneStore=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(c){if(c.options.overviewRulerOptions){for(const f of this._zones)if(f.color===c.options.overviewRulerOptions.color&&f.position===c.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,c.marker.line))return;if(this._lineAdjacentToZone(f,c.marker.line,c.options.overviewRulerOptions.position))return void this._addLineToZone(f,c.marker.line)}if(this._zonePoolIndex=c.startBufferLine&&f<=c.endBufferLine}_lineAdjacentToZone(c,f,p){return f>=c.startBufferLine-this._linePadding[p||"full"]&&f<=c.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(c,f){c.startBufferLine=Math.min(c.startBufferLine,f),c.endBufferLine=Math.max(c.endBufferLine,f)}}},5744:function(u,o,c){var f=this&&this.__decorate||function(y,E,R,N){var D,T=arguments.length,j=T<3?E:N===null?N=Object.getOwnPropertyDescriptor(E,R):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(y,E,R,N);else for(var B=y.length-1;B>=0;B--)(D=y[B])&&(j=(T<3?D(j):T>3?D(E,R,j):D(E,R))||j);return T>3&&j&&Object.defineProperty(E,R,j),j},p=this&&this.__param||function(y,E){return function(R,N){E(R,N,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const d=c(5871),_=c(4725),v=c(844),w=c(2585),C={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0},S={full:0,left:0,center:0,right:0};let x=o.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(y,E,R,N,D,T,j){var z;super(),this._viewportElement=y,this._screenElement=E,this._bufferService=R,this._decorationService=N,this._renderService=D,this._optionsService=T,this._coreBrowserService=j,this._colorZoneStore=new d.ColorZoneStore,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(),(z=this._viewportElement.parentElement)==null||z.insertBefore(this._canvas,this._viewportElement);const B=this._canvas.getContext("2d");if(!B)throw new Error("Ctx cannot be null");this._ctx=B,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)((()=>{var G;(G=this._canvas)==null||G.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){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())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const y=Math.floor(this._canvas.width/3),E=Math.ceil(this._canvas.width/3);b.full=this._canvas.width,b.left=y,b.center=E,b.right=y,this._refreshDrawHeightConstants(),S.full=0,S.left=0,S.center=b.left,S.right=b.left+b.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const y=this._canvas.height/this._bufferService.buffer.lines.length,E=Math.round(Math.max(Math.min(y,12),6)*this._coreBrowserService.dpr);C.left=E,C.center=E,C.right=E}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.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(const E of this._decorationService.decorations)this._colorZoneStore.addDecoration(E);this._ctx.lineWidth=1;const y=this._colorZoneStore.zones;for(const E of y)E.position!=="full"&&this._renderColorZone(E);for(const E of y)E.position==="full"&&this._renderColorZone(E);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(y){this._ctx.fillStyle=y.color,this._ctx.fillRect(S[y.position||"full"],Math.round((this._canvas.height-1)*(y.startBufferLine/this._bufferService.buffers.active.lines.length)-C[y.position||"full"]/2),b[y.position||"full"],Math.round((this._canvas.height-1)*((y.endBufferLine-y.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[y.position||"full"]))}_queueRefresh(y,E){this._shouldUpdateDimensions=y||this._shouldUpdateDimensions,this._shouldUpdateAnchor=E||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};o.OverviewRulerRenderer=x=f([p(2,w.IBufferService),p(3,w.IDecorationService),p(4,_.IRenderService),p(5,w.IOptionsService),p(6,_.ICoreBrowserService)],x)},2950:function(u,o,c){var f=this&&this.__decorate||function(C,b,S,x){var y,E=arguments.length,R=E<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,S):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(C,b,S,x);else for(var N=C.length-1;N>=0;N--)(y=C[N])&&(R=(E<3?y(R):E>3?y(b,S,R):y(b,S))||R);return E>3&&R&&Object.defineProperty(b,S,R),R},p=this&&this.__param||function(C,b){return function(S,x){b(S,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const d=c(4725),_=c(2585),v=c(2584);let w=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,b,S,x,y,E){this._textarea=C,this._compositionView=b,this._bufferService=S,this._optionsService=x,this._coreService=y,this._renderService=E,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const b={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let S;this._isSendingComposition=!1,b.start+=this._dataAlreadySent.length,S=this._isComposing?this._textarea.value.substring(b.start,b.end):this._textarea.value.substring(b.start),S.length>0&&this._coreService.triggerDataEvent(S,!0)}}),0)}else{this._isSendingComposition=!1;const b=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(b,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const b=this._textarea.value,S=b.replace(C,"");this._dataAlreadySent=S,b.length>C.length?this._coreService.triggerDataEvent(S,!0):b.lengththis.updateCompositionElements(!0)),0)}}};o.CompositionHelper=w=f([p(2,_.IBufferService),p(3,_.IOptionsService),p(4,_.ICoreService),p(5,d.IRenderService)],w)},9806:(u,o)=>{function c(f,p,d){const _=d.getBoundingClientRect(),v=f.getComputedStyle(d),w=parseInt(v.getPropertyValue("padding-left")),C=parseInt(v.getPropertyValue("padding-top"));return[p.clientX-_.left-w,p.clientY-_.top-C]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=c,o.getCoords=function(f,p,d,_,v,w,C,b,S){if(!w)return;const x=c(f,p,d);return x?(x[0]=Math.ceil((x[0]+(S?C/2:0))/C),x[1]=Math.ceil(x[1]/b),x[0]=Math.min(Math.max(x[0],1),_+(S?1:0)),x[1]=Math.min(Math.max(x[1],1),v),x):void 0}},9504:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const f=c(2584);function p(b,S,x,y){const E=b-d(b,x),R=S-d(S,x),N=Math.abs(E-R)-(function(D,T,j){let B=0;const z=D-d(D,j),G=T-d(T,j);for(let U=0;U=0&&bS?"A":"B"}function v(b,S,x,y,E,R){let N=b,D=S,T="";for(;N!==x||D!==y;)N+=E?1:-1,E&&N>R.cols-1?(T+=R.buffer.translateBufferLineToString(D,!1,b,N),N=0,b=0,D++):!E&&N<0&&(T+=R.buffer.translateBufferLineToString(D,!1,0,b+1),N=R.cols-1,b=N,D--);return T+R.buffer.translateBufferLineToString(D,!1,b,N)}function w(b,S){const x=S?"O":"[";return f.C0.ESC+x+b}function C(b,S){b=Math.floor(b);let x="";for(let y=0;y0?z-d(z,G):j;const Y=z,q=(function(X,K,L,M,O,$){let F;return F=p(L,M,O,$).length>0?M-d(M,O):K,X=L&&Fb?"D":"C",C(Math.abs(E-b),w(N,y));N=R>S?"D":"C";const D=Math.abs(R-S);return C((function(T,j){return j.cols-T})(R>S?b:E,x)+(D-1)*x.cols+1+((R>S?E:b)-1),w(N,y))}},1296:function(u,o,c){var f=this&&this.__decorate||function(U,H,Y,q){var X,K=arguments.length,L=K<3?H:q===null?q=Object.getOwnPropertyDescriptor(H,Y):q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(U,H,Y,q);else for(var M=U.length-1;M>=0;M--)(X=U[M])&&(L=(K<3?X(L):K>3?X(H,Y,L):X(H,Y))||L);return K>3&&L&&Object.defineProperty(H,Y,L),L},p=this&&this.__param||function(U,H){return function(Y,q){H(Y,q,U)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const d=c(3787),_=c(2550),v=c(2223),w=c(6171),C=c(6052),b=c(4725),S=c(8055),x=c(8460),y=c(844),E=c(2585),R="xterm-dom-renderer-owner-",N="xterm-rows",D="xterm-fg-",T="xterm-bg-",j="xterm-focus",B="xterm-selection";let z=1,G=o.DomRenderer=class extends y.Disposable{constructor(U,H,Y,q,X,K,L,M,O,$,F,Q,re){super(),this._terminal=U,this._document=H,this._element=Y,this._screenElement=q,this._viewportElement=X,this._helperContainer=K,this._linkifier2=L,this._charSizeService=O,this._optionsService=$,this._bufferService=F,this._coreBrowserService=Q,this._themeService=re,this._terminalClass=z++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(N),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(B),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,w.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ae=>this._injectCss(ae)))),this._injectCss(this._themeService.colors),this._rowFactory=M.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(R+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ae=>this._handleLinkHover(ae)))),this.register(this._linkifier2.onHideLinkUnderline((ae=>this._handleLinkLeave(ae)))),this.register((0,y.toDisposable)((()=>{this._element.classList.remove(R+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new _.WidthCache(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(){const U=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*U,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*U),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/U),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/U),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(const Y of this._rowElements)Y.style.width=`${this.dimensions.css.canvas.width}px`,Y.style.height=`${this.dimensions.css.cell.height}px`,Y.style.lineHeight=`${this.dimensions.css.cell.height}px`,Y.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const H=`${this._terminalSelector} .${N} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=H,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(U){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let H=`${this._terminalSelector} .${N} { color: ${U.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;H+=`${this._terminalSelector} .${N} .xterm-dim { color: ${S.color.multiplyOpacity(U.foreground,.5).css};}`,H+=`${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;}`;const Y=`blink_underline_${this._terminalClass}`,q=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;H+=`@keyframes ${Y} { 50% { border-bottom-style: hidden; }}`,H+=`@keyframes ${q} { 50% { box-shadow: none; }}`,H+=`@keyframes ${X} { 0% { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css}; } 50% { background-color: inherit; color: ${U.cursor.css}; }}`,H+=`${this._terminalSelector} .${N}.${j} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${N}.${j} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${N}.${j} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css};}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${U.cursor.css} !important; color: ${U.cursorAccent.css} !important;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${U.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${U.cursor.css} inset;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${U.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,H+=`${this._terminalSelector} .${B} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${B} div { position: absolute; background-color: ${U.selectionBackgroundOpaque.css};}${this._terminalSelector} .${B} div { position: absolute; background-color: ${U.selectionInactiveBackgroundOpaque.css};}`;for(const[K,L]of U.ansi.entries())H+=`${this._terminalSelector} .${D}${K} { color: ${L.css}; }${this._terminalSelector} .${D}${K}.xterm-dim { color: ${S.color.multiplyOpacity(L,.5).css}; }${this._terminalSelector} .${T}${K} { background-color: ${L.css}; }`;H+=`${this._terminalSelector} .${D}${v.INVERTED_DEFAULT_COLOR} { color: ${S.color.opaque(U.background).css}; }${this._terminalSelector} .${D}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${S.color.multiplyOpacity(S.color.opaque(U.background),.5).css}; }${this._terminalSelector} .${T}${v.INVERTED_DEFAULT_COLOR} { background-color: ${U.foreground.css}; }`,this._themeStyleElement.textContent=H}_setDefaultSpacing(){const U=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${U}px`,this._rowFactory.defaultSpacing=U}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(U,H){for(let Y=this._rowElements.length;Y<=H;Y++){const q=this._document.createElement("div");this._rowContainer.appendChild(q),this._rowElements.push(q)}for(;this._rowElements.length>H;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(U,H){this._refreshRowElements(U,H),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(j),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(j),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(U,H,Y){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(U,H,Y),this.renderRows(0,this._bufferService.rows-1),!U||!H)return;this._selectionRenderModel.update(this._terminal,U,H,Y);const q=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,K=this._selectionRenderModel.viewportCappedStartRow,L=this._selectionRenderModel.viewportCappedEndRow;if(K>=this._bufferService.rows||L<0)return;const M=this._document.createDocumentFragment();if(Y){const O=U[0]>H[0];M.appendChild(this._createSelectionElement(K,O?H[0]:U[0],O?U[0]:H[0],L-K+1))}else{const O=q===K?U[0]:0,$=K===X?H[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(K,O,$));const F=L-K-1;if(M.appendChild(this._createSelectionElement(K+1,0,this._bufferService.cols,F)),K!==L){const Q=X===L?H[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(L,0,Q))}}this._selectionContainer.appendChild(M)}_createSelectionElement(U,H,Y,q=1){const X=this._document.createElement("div"),K=H*this.dimensions.css.cell.width;let L=this.dimensions.css.cell.width*(Y-H);return K+L>this.dimensions.css.canvas.width&&(L=this.dimensions.css.canvas.width-K),X.style.height=q*this.dimensions.css.cell.height+"px",X.style.top=U*this.dimensions.css.cell.height+"px",X.style.left=`${K}px`,X.style.width=`${L}px`,X}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(const U of this._rowElements)U.replaceChildren()}renderRows(U,H){const Y=this._bufferService.buffer,q=Y.ybase+Y.y,X=Math.min(Y.x,this._bufferService.cols-1),K=this._optionsService.rawOptions.cursorBlink,L=this._optionsService.rawOptions.cursorStyle,M=this._optionsService.rawOptions.cursorInactiveStyle;for(let O=U;O<=H;O++){const $=O+Y.ydisp,F=this._rowElements[O],Q=Y.lines.get($);if(!F||!Q)break;F.replaceChildren(...this._rowFactory.createRow(Q,$,$===q,L,M,X,K,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${R}${this._terminalClass}`}_handleLinkHover(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!0)}_handleLinkLeave(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!1)}_setCellUnderline(U,H,Y,q,X,K){Y<0&&(U=0),q<0&&(H=0);const L=this._bufferService.rows-1;Y=Math.max(Math.min(Y,L),0),q=Math.max(Math.min(q,L),0),X=Math.min(X,this._bufferService.cols);const M=this._bufferService.buffer,O=M.ybase+M.y,$=Math.min(M.x,X-1),F=this._optionsService.rawOptions.cursorBlink,Q=this._optionsService.rawOptions.cursorStyle,re=this._optionsService.rawOptions.cursorInactiveStyle;for(let ae=Y;ae<=q;++ae){const Z=ae+M.ydisp,P=this._rowElements[ae],ee=M.lines.get(Z);if(!P||!ee)break;P.replaceChildren(...this._rowFactory.createRow(ee,Z,Z===O,Q,re,$,F,this.dimensions.css.cell.width,this._widthCache,K?ae===Y?U:0:-1,K?(ae===q?H:X)-1:-1))}}};o.DomRenderer=G=f([p(7,E.IInstantiationService),p(8,b.ICharSizeService),p(9,E.IOptionsService),p(10,E.IBufferService),p(11,b.ICoreBrowserService),p(12,b.IThemeService)],G)},3787:function(u,o,c){var f=this&&this.__decorate||function(N,D,T,j){var B,z=arguments.length,G=z<3?D:j===null?j=Object.getOwnPropertyDescriptor(D,T):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(N,D,T,j);else for(var U=N.length-1;U>=0;U--)(B=N[U])&&(G=(z<3?B(G):z>3?B(D,T,G):B(D,T))||G);return z>3&&G&&Object.defineProperty(D,T,G),G},p=this&&this.__param||function(N,D){return function(T,j){D(T,j,N)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const d=c(2223),_=c(643),v=c(511),w=c(2585),C=c(8055),b=c(4725),S=c(4269),x=c(6171),y=c(3734);let E=o.DomRendererRowFactory=class{constructor(N,D,T,j,B,z,G){this._document=N,this._characterJoinerService=D,this._optionsService=T,this._coreBrowserService=j,this._coreService=B,this._decorationService=z,this._themeService=G,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(N,D,T){this._selectionStart=N,this._selectionEnd=D,this._columnSelectMode=T}createRow(N,D,T,j,B,z,G,U,H,Y,q){const X=[],K=this._characterJoinerService.getJoinedCharacters(D),L=this._themeService.colors;let M,O=N.getNoBgTrimmedLength();T&&O0&&ye===K[0][0]){ke=!0;const Ie=K.shift();Ce=new S.JoinedCellData(this._workCell,N.translateToString(!0,Ie[0],Ie[1]),Ie[1]-Ie[0]),Ee=Ie[1]-1,be=Ce.getWidth()}const rt=this._isCellInSelection(ye,D),bt=T&&ye===z,Ge=he&&ye>=Y&&ye<=q;let ct=!1;this._decorationService.forEachDecorationAtCell(ye,D,void 0,(Ie=>{ct=!0}));let Pt=Ce.getChars()||_.WHITESPACE_CELL_CHAR;if(Pt===" "&&(Ce.isUnderline()||Ce.isOverline())&&(Pt=" "),ne=be*U-H.get(Pt,Ce.isBold(),Ce.isItalic()),M){if($&&(rt&&ee||!rt&&!ee&&Ce.bg===Q)&&(rt&&ee&&L.selectionForeground||Ce.fg===re)&&Ce.extended.ext===ae&&Ge===Z&&ne===P&&!bt&&!ke&&!ct){Ce.isInvisible()?F+=_.WHITESPACE_CELL_CHAR:F+=Pt,$++;continue}$&&(M.textContent=F),M=this._document.createElement("span"),$=0,F=""}else M=this._document.createElement("span");if(Q=Ce.bg,re=Ce.fg,ae=Ce.extended.ext,Z=Ge,P=ne,ee=rt,ke&&z>=ye&&z<=Ee&&(z=ye),!this._coreService.isCursorHidden&&bt&&this._coreService.isCursorInitialized){if(ge.push("xterm-cursor"),this._coreBrowserService.isFocused)G&&ge.push("xterm-cursor-blink"),ge.push(j==="bar"?"xterm-cursor-bar":j==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(B)switch(B){case"outline":ge.push("xterm-cursor-outline");break;case"block":ge.push("xterm-cursor-block");break;case"bar":ge.push("xterm-cursor-bar");break;case"underline":ge.push("xterm-cursor-underline")}}if(Ce.isBold()&&ge.push("xterm-bold"),Ce.isItalic()&&ge.push("xterm-italic"),Ce.isDim()&&ge.push("xterm-dim"),F=Ce.isInvisible()?_.WHITESPACE_CELL_CHAR:Ce.getChars()||_.WHITESPACE_CELL_CHAR,Ce.isUnderline()&&(ge.push(`xterm-underline-${Ce.extended.underlineStyle}`),F===" "&&(F=" "),!Ce.isUnderlineColorDefault()))if(Ce.isUnderlineColorRGB())M.style.textDecorationColor=`rgb(${y.AttributeData.toColorRGB(Ce.getUnderlineColor()).join(",")})`;else{let Ie=Ce.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ce.isBold()&&Ie<8&&(Ie+=8),M.style.textDecorationColor=L.ansi[Ie].css}Ce.isOverline()&&(ge.push("xterm-overline"),F===" "&&(F=" ")),Ce.isStrikethrough()&&ge.push("xterm-strikethrough"),Ge&&(M.style.textDecoration="underline");let ht=Ce.getFgColor(),Fe=Ce.getFgColorMode(),fe=Ce.getBgColor(),ie=Ce.getBgColorMode();const de=!!Ce.isInverse();if(de){const Ie=ht;ht=fe,fe=Ie;const Nt=Fe;Fe=ie,ie=Nt}let Se,Ae,De,Ve=!1;switch(this._decorationService.forEachDecorationAtCell(ye,D,void 0,(Ie=>{Ie.options.layer!=="top"&&Ve||(Ie.backgroundColorRGB&&(ie=50331648,fe=Ie.backgroundColorRGB.rgba>>8&16777215,Se=Ie.backgroundColorRGB),Ie.foregroundColorRGB&&(Fe=50331648,ht=Ie.foregroundColorRGB.rgba>>8&16777215,Ae=Ie.foregroundColorRGB),Ve=Ie.options.layer==="top")})),!Ve&&rt&&(Se=this._coreBrowserService.isFocused?L.selectionBackgroundOpaque:L.selectionInactiveBackgroundOpaque,fe=Se.rgba>>8&16777215,ie=50331648,Ve=!0,L.selectionForeground&&(Fe=50331648,ht=L.selectionForeground.rgba>>8&16777215,Ae=L.selectionForeground)),Ve&&ge.push("xterm-decoration-top"),ie){case 16777216:case 33554432:De=L.ansi[fe],ge.push(`xterm-bg-${fe}`);break;case 50331648:De=C.channels.toColor(fe>>16,fe>>8&255,255&fe),this._addStyle(M,`background-color:#${R((fe>>>0).toString(16),"0",6)}`);break;default:de?(De=L.foreground,ge.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):De=L.background}switch(Se||Ce.isDim()&&(Se=C.color.multiplyOpacity(De,.5)),Fe){case 16777216:case 33554432:Ce.isBold()&&ht<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ht+=8),this._applyMinimumContrast(M,De,L.ansi[ht],Ce,Se,void 0)||ge.push(`xterm-fg-${ht}`);break;case 50331648:const Ie=C.channels.toColor(ht>>16&255,ht>>8&255,255&ht);this._applyMinimumContrast(M,De,Ie,Ce,Se,Ae)||this._addStyle(M,`color:#${R(ht.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(M,De,L.foreground,Ce,Se,Ae)||de&&ge.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}ge.length&&(M.className=ge.join(" "),ge.length=0),bt||ke||ct?M.textContent=F:$++,ne!==this.defaultSpacing&&(M.style.letterSpacing=`${ne}px`),X.push(M),ye=Ee}return M&&$&&(M.textContent=F),X}_applyMinimumContrast(N,D,T,j,B,z){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(j.getCode()))return!1;const G=this._getContrastCache(j);let U;if(B||z||(U=G.getColor(D.rgba,T.rgba)),U===void 0){const H=this._optionsService.rawOptions.minimumContrastRatio/(j.isDim()?2:1);U=C.color.ensureContrastRatio(B||D,z||T,H),G.setColor((B||D).rgba,(z||T).rgba,U??null)}return!!U&&(this._addStyle(N,`color:${U.css}`),!0)}_getContrastCache(N){return N.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(N,D){N.setAttribute("style",`${N.getAttribute("style")||""}${D};`)}_isCellInSelection(N,D){const T=this._selectionStart,j=this._selectionEnd;return!(!T||!j)&&(this._columnSelectMode?T[0]<=j[0]?N>=T[0]&&D>=T[1]&&N=T[1]&&N>=j[0]&&D<=j[1]:D>T[1]&&D=T[0]&&N=T[0])}};function R(N,D,T){for(;N.length{Object.defineProperty(o,"__esModule",{value:!0}),o.WidthCache=void 0,o.WidthCache=class{constructor(c,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=c.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";const p=c.createElement("span");p.classList.add("xterm-char-measure-element");const d=c.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold";const _=c.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";const v=c.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[p,d,_,v],this._container.appendChild(p),this._container.appendChild(d),this._container.appendChild(_),this._container.appendChild(v),f.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(c,f,p,d){c===this._font&&f===this._fontSize&&p===this._weight&&d===this._weightBold||(this._font=c,this._fontSize=f,this._weight=p,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(c,f,p){let d=0;if(!f&&!p&&c.length===1&&(d=c.charCodeAt(0))<256){if(this._flat[d]!==-9999)return this._flat[d];const w=this._measure(c,0);return w>0&&(this._flat[d]=w),w}let _=c;f&&(_+="B"),p&&(_+="I");let v=this._holey.get(_);if(v===void 0){let w=0;f&&(w|=1),p&&(w|=2),v=this._measure(c,w),v>0&&this._holey.set(_,v)}return v}_measure(c,f){const p=this._measureElements[f];return p.textContent=c.repeat(32),p.offsetWidth/32}}},2223:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const f=c(6114);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(u,o)=>{function c(p){return 57508<=p&&p<=57558}function f(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},o.isPowerlineGlyph=c,o.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},o.isEmoji=f,o.allowRescaling=function(p,d,_,v){return d===1&&_>Math.ceil(1.5*v)&&p!==void 0&&p>255&&!f(p)&&!c(p)&&!(function(w){return 57344<=w&&w<=63743})(p)},o.treatGlyphAsBackgroundColor=function(p){return c(p)||(function(d){return 9472<=d&&d<=9631})(p)},o.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},o.computeNextVariantOffset=function(p,d,_=0){return(p-(2*Math.round(d)-_))%(2*Math.round(d))}},6052:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createSelectionRenderModel=void 0;class c{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(p,d,_,v=!1){if(this.selectionStart=d,this.selectionEnd=_,!d||!_||d[0]===_[0]&&d[1]===_[1])return void this.clear();const w=p.buffers.active.ydisp,C=d[1]-w,b=_[1]-w,S=Math.max(C,0),x=Math.min(b,p.rows-1);S>=p.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=C,this.viewportEndRow=b,this.viewportCappedStartRow=S,this.viewportCappedEndRow=x,this.startCol=d[0],this.endCol=_[0])}isCellSelected(p,d,_){return!!this.hasSelection&&(_-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&_>=this.viewportCappedStartRow&&d=this.viewportCappedStartRow&&d>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_=this.startCol&&d=this.startCol)}}o.createSelectionRenderModel=function(){return new c}},456:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionModel=void 0,o.SelectionModel=class{constructor(c){this._bufferService=c,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.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()){const c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?c%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)-1]:[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[c,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[Math.max(c,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const c=this.selectionStart,f=this.selectionEnd;return!(!c||!f)&&(c[1]>f[1]||c[1]===f[1]&&c[0]>f[0])}handleTrim(c){return this.selectionStart&&(this.selectionStart[1]-=c),this.selectionEnd&&(this.selectionEnd[1]-=c),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(u,o,c){var f=this&&this.__decorate||function(x,y,E,R){var N,D=arguments.length,T=D<3?y:R===null?R=Object.getOwnPropertyDescriptor(y,E):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,y,E,R);else for(var j=x.length-1;j>=0;j--)(N=x[j])&&(T=(D<3?N(T):D>3?N(y,E,T):N(y,E))||T);return D>3&&T&&Object.defineProperty(y,E,T),T},p=this&&this.__param||function(x,y){return function(E,R){y(E,R,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const d=c(2585),_=c(8460),v=c(844);let w=o.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,y,E){super(),this._optionsService=E,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new S(this._optionsService))}catch{this._measureStrategy=this.register(new b(x,y,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const x=this._measureStrategy.measure();x.width===this.width&&x.height===this.height||(this.width=x.width,this.height=x.height,this._onCharSizeChange.fire())}};o.CharSizeService=w=f([p(2,d.IOptionsService)],w);class C extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(y,E){y!==void 0&&y>0&&E!==void 0&&E>0&&(this._result.width=y,this._result.height=E)}}class b extends C{constructor(y,E,R){super(),this._document=y,this._parentElement=E,this._optionsService=R,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}}class S extends C{constructor(y){super(),this._optionsService=y,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const E=this._ctx.measureText("W");if(!("width"in E&&"fontBoundingBoxAscent"in E&&"fontBoundingBoxDescent"in E))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const y=this._ctx.measureText("W");return this._validateAndSet(y.width,y.fontBoundingBoxAscent+y.fontBoundingBoxDescent),this._result}}},4269:function(u,o,c){var f=this&&this.__decorate||function(S,x,y,E){var R,N=arguments.length,D=N<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,y):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(S,x,y,E);else for(var T=S.length-1;T>=0;T--)(R=S[T])&&(D=(N<3?R(D):N>3?R(x,y,D):R(x,y))||D);return N>3&&D&&Object.defineProperty(x,y,D),D},p=this&&this.__param||function(S,x){return function(y,E){x(y,E,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const d=c(3734),_=c(643),v=c(511),w=c(2585);class C extends d.AttributeData{constructor(x,y,E){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=y,this._width=E}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(x){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.JoinedCellData=C;let b=o.CharacterJoinerService=class dC{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(x){const y={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(y),y.id}deregister(x){for(let y=0;y1){const G=this._getJoinedRanges(R,T,D,y,N);for(let U=0;U1){const z=this._getJoinedRanges(R,T,D,y,N);for(let G=0;G{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const f=c(844),p=c(8460),d=c(3656);class _ extends f.Disposable{constructor(C,b,S){super(),this._textarea=C,this._window=b,this.mainDocument=S,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((x=>this._screenDprMonitor.setWindow(x)))),this.register((0,p.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(C){this._window!==C&&(this._window=C,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}}o.CoreBrowserService=_;class v extends f.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,f.toDisposable)((()=>this.clearListener())))}setWindow(C){this._parentWindow=C,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,d.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var C;this._outerListener&&((C=this._resolutionMediaMatchList)==null||C.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)}}},779:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkProviderService=void 0;const f=c(844);class p extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{const v=this.linkProviders.indexOf(_);v!==-1&&this.linkProviders.splice(v,1)}}}}o.LinkProviderService=p},8934:function(u,o,c){var f=this&&this.__decorate||function(w,C,b,S){var x,y=arguments.length,E=y<3?C:S===null?S=Object.getOwnPropertyDescriptor(C,b):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(w,C,b,S);else for(var R=w.length-1;R>=0;R--)(x=w[R])&&(E=(y<3?x(E):y>3?x(C,b,E):x(C,b))||E);return y>3&&E&&Object.defineProperty(C,b,E),E},p=this&&this.__param||function(w,C){return function(b,S){C(b,S,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const d=c(4725),_=c(9806);let v=o.MouseService=class{constructor(w,C){this._renderService=w,this._charSizeService=C}getCoords(w,C,b,S,x){return(0,_.getCoords)(window,w,C,b,S,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(w,C){const b=(0,_.getCoordsRelativeToElement)(window,w,C);if(this._charSizeService.hasValidSize)return b[0]=Math.min(Math.max(b[0],0),this._renderService.dimensions.css.canvas.width-1),b[1]=Math.min(Math.max(b[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(b[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(b[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(b[0]),y:Math.floor(b[1])}}};o.MouseService=v=f([p(0,d.IRenderService),p(1,d.ICharSizeService)],v)},3230:function(u,o,c){var f=this&&this.__decorate||function(x,y,E,R){var N,D=arguments.length,T=D<3?y:R===null?R=Object.getOwnPropertyDescriptor(y,E):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,y,E,R);else for(var j=x.length-1;j>=0;j--)(N=x[j])&&(T=(D<3?N(T):D>3?N(y,E,T):N(y,E))||T);return D>3&&T&&Object.defineProperty(y,E,T),T},p=this&&this.__param||function(x,y){return function(E,R){y(E,R,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const d=c(6193),_=c(4725),v=c(8460),w=c(844),C=c(7226),b=c(2585);let S=o.RenderService=class extends w.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,y,E,R,N,D,T,j){super(),this._rowCount=x,this._charSizeService=R,this._renderer=this.register(new w.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new w.MutableDisposable),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 v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(((B,z)=>this._renderRows(B,z)),T),this.register(this._renderDebouncer),this.register(T.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(D.onResize((()=>this._fullRefresh()))),this.register(D.buffers.onBufferActivate((()=>{var B;return(B=this._renderer.value)==null?void 0:B.clear()}))),this.register(E.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(N.onDecorationRegistered((()=>this._fullRefresh()))),this.register(N.onDecorationRemoved((()=>this._fullRefresh()))),this.register(E.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(D.cols,D.rows),this._fullRefresh()}))),this.register(E.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(D.buffer.y,D.buffer.y,!0)))),this.register(j.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(T.window,y),this.register(T.onWindowChange((B=>this._registerIntersectionObserver(B,y))))}_registerIntersectionObserver(x,y){if("IntersectionObserver"in x){const E=new x.IntersectionObserver((R=>this._handleIntersectionChange(R[R.length-1])),{threshold:0});E.observe(y),this._observerDisposable.value=(0,w.toDisposable)((()=>E.disconnect()))}}_handleIntersectionChange(x){this._isPaused=x.isIntersecting===void 0?x.intersectionRatio===0:!x.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(x,y,E=!1){this._isPaused?this._needsFullRefresh=!0:(E||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,y,this._rowCount))}_renderRows(x,y){this._renderer.value&&(x=Math.min(x,this._rowCount-1),y=Math.min(y,this._rowCount-1),this._renderer.value.renderRows(x,y),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:x,end:y}),this._onRender.fire({start:x,end:y}),this._isNextRenderRedrawOnly=!0)}resize(x,y){this._rowCount=y,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(x){this._renderer.value=x,this._renderer.value&&(this._renderer.value.onRequestRedraw((y=>this.refreshRows(y.start,y.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(x){return this._renderDebouncer.addRefreshCallback(x)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var x,y;this._renderer.value&&((y=(x=this._renderer.value).clearTextureAtlas)==null||y.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,y){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var E;return(E=this._renderer.value)==null?void 0:E.handleResize(x,y)})):this._renderer.value.handleResize(x,y),this._fullRefresh())}handleCharSizeChanged(){var x;(x=this._renderer.value)==null||x.handleCharSizeChanged()}handleBlur(){var x;(x=this._renderer.value)==null||x.handleBlur()}handleFocus(){var x;(x=this._renderer.value)==null||x.handleFocus()}handleSelectionChanged(x,y,E){var R;this._selectionState.start=x,this._selectionState.end=y,this._selectionState.columnSelectMode=E,(R=this._renderer.value)==null||R.handleSelectionChanged(x,y,E)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};o.RenderService=S=f([p(2,b.IOptionsService),p(3,_.ICharSizeService),p(4,b.IDecorationService),p(5,b.IBufferService),p(6,_.ICoreBrowserService),p(7,_.IThemeService)],S)},9312:function(u,o,c){var f=this&&this.__decorate||function(T,j,B,z){var G,U=arguments.length,H=U<3?j:z===null?z=Object.getOwnPropertyDescriptor(j,B):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(T,j,B,z);else for(var Y=T.length-1;Y>=0;Y--)(G=T[Y])&&(H=(U<3?G(H):U>3?G(j,B,H):G(j,B))||H);return U>3&&H&&Object.defineProperty(j,B,H),H},p=this&&this.__param||function(T,j){return function(B,z){j(B,z,T)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const d=c(9806),_=c(9504),v=c(456),w=c(4725),C=c(8460),b=c(844),S=c(6114),x=c(4841),y=c(511),E=c(2585),R=" ",N=new RegExp(R,"g");let D=o.SelectionService=class extends b.Disposable{constructor(T,j,B,z,G,U,H,Y,q){super(),this._element=T,this._screenElement=j,this._linkifier=B,this._bufferService=z,this._coreService=G,this._mouseService=U,this._optionsService=H,this._renderService=Y,this._coreBrowserService=q,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new y.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=X=>this._handleMouseMove(X),this._mouseUpListener=X=>this._handleMouseUp(X),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((X=>this._handleTrim(X))),this.register(this._bufferService.buffers.onBufferActivate((X=>this._handleBufferActivate(X)))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,b.toDisposable)((()=>{this._removeMouseDownListeners()})))}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(){const T=this._model.finalSelectionStart,j=this._model.finalSelectionEnd;return!(!T||!j||T[0]===j[0]&&T[1]===j[1])}get selectionText(){const T=this._model.finalSelectionStart,j=this._model.finalSelectionEnd;if(!T||!j)return"";const B=this._bufferService.buffer,z=[];if(this._activeSelectionMode===3){if(T[0]===j[0])return"";const G=T[0]G.replace(N," "))).join(S.isWindows?`\r `:` -`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(T){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),S.isLinux&&T&&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(T){const j=this._getMouseBufferCoords(T),B=this._model.finalSelectionStart,F=this._model.finalSelectionEnd;return!!(B&&F&&j)&&this._areCoordsInSelection(j,B,F)}isCellInSelection(T,j){const B=this._model.finalSelectionStart,F=this._model.finalSelectionEnd;return!(!B||!F)&&this._areCoordsInSelection([T,j],B,F)}_areCoordsInSelection(T,j,B){return T[1]>j[1]&&T[1]=j[0]&&T[0]=j[0]}_selectWordAtCursor(T,j){var Y,H;const B=(H=(Y=this._linkifier.currentLink)==null?void 0:Y.link)==null?void 0:H.range;if(B)return this._model.selectionStart=[B.start.x-1,B.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(B,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const F=this._getMouseBufferCoords(T);return!!F&&(this._selectWordAt(F,j),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(T,j){this._model.clearSelection(),T=Math.max(T,0),j=Math.min(j,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,T],this._model.selectionEnd=[this._bufferService.cols,j],this.refresh(),this._onSelectionChange.fire()}_handleTrim(T){this._model.handleTrim(T)&&this.refresh()}_getMouseBufferCoords(T){const j=this._mouseService.getCoords(T,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(j)return j[0]--,j[1]--,j[1]+=this._bufferService.buffer.ydisp,j}_getMouseEventScrollAmount(T){let j=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,T,this._screenElement)[1];const B=this._renderService.dimensions.css.canvas.height;return j>=0&&j<=B?0:(j>B&&(j-=B),j=Math.min(Math.max(j,-50),50),j/=50,j/Math.abs(j)+Math.round(14*j))}shouldForceSelection(T){return S.isMac?T.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:T.shiftKey}handleMouseDown(T){if(this._mouseDownTimeStamp=T.timeStamp,(T.button!==2||!this.hasSelection)&&T.button===0){if(!this._enabled){if(!this.shouldForceSelection(T))return;T.stopPropagation()}T.preventDefault(),this._dragScrollAmount=0,this._enabled&&T.shiftKey?this._handleIncrementalClick(T):T.detail===1?this._handleSingleClick(T):T.detail===2?this._handleDoubleClick(T):T.detail===3&&this._handleTripleClick(T),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()),50)}_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(T){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(T))}_handleSingleClick(T){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(T)?3:0,this._model.selectionStart=this._getMouseBufferCoords(T),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const j=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);j&&j.length!==this._model.selectionStart[0]&&j.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(T){this._selectWordAtCursor(T,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(T){const j=this._getMouseBufferCoords(T);j&&(this._activeSelectionMode=2,this._selectLineAt(j[1]))}shouldColumnSelect(T){return T.altKey&&!(S.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(T){if(T.stopImmediatePropagation(),!this._model.selectionStart)return;const j=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(T),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const B=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(T.ydisp+this._bufferService.rows,T.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=T.ydisp),this.refresh()}}_handleMouseUp(T){const j=T.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&j<500&&T.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const B=this._mouseService.getCoords(T,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(B&&B[0]!==void 0&&B[1]!==void 0){const F=(0,_.moveToCellSequence)(B[0]-1,B[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(F,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const T=this._model.finalSelectionStart,j=this._model.finalSelectionEnd,B=!(!T||!j||T[0]===j[0]&&T[1]===j[1]);B?T&&j&&(this._oldSelectionStart&&this._oldSelectionEnd&&T[0]===this._oldSelectionStart[0]&&T[1]===this._oldSelectionStart[1]&&j[0]===this._oldSelectionEnd[0]&&j[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(T,j,B)):this._oldHasSelection&&this._fireOnSelectionChange(T,j,B)}_fireOnSelectionChange(T,j,B){this._oldSelectionStart=T,this._oldSelectionEnd=j,this._oldHasSelection=B,this._onSelectionChange.fire()}_handleBufferActivate(T){this.clearSelection(),this._trimListener.dispose(),this._trimListener=T.activeBuffer.lines.onTrim((j=>this._handleTrim(j)))}_convertViewportColToCharacterIndex(T,j){let B=j;for(let F=0;j>=F;F++){const Y=T.loadCell(F,this._workCell).getChars().length;this._workCell.getWidth()===0?B--:Y>1&&j!==F&&(B+=Y-1)}return B}setSelection(T,j,B){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[T,j],this._model.selectionStartLength=B,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(T){this._isClickInSelection(T)||(this._selectWordAtCursor(T,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(T,j,B=!0,F=!0){if(T[0]>=this._bufferService.cols)return;const Y=this._bufferService.buffer,H=Y.lines.get(T[1]);if(!H)return;const z=Y.translateBufferLineToString(T[1],!1);let V=this._convertViewportColToCharacterIndex(H,T[0]),G=V;const X=T[0]-V;let K=0,L=0,M=0,O=0;if(z.charAt(V)===" "){for(;V>0&&z.charAt(V-1)===" ";)V--;for(;G1&&(O+=ae-1,G+=ae-1);Q>0&&V>0&&!this._isCharWordSeparator(H.loadCell(Q-1,this._workCell));){H.loadCell(Q-1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===0?(K++,Q--):Z>1&&(M+=Z-1,V-=Z-1),V--,Q--}for(;re1&&(O+=Z-1,G+=Z-1),G++,re++}}G++;let $=V+X-K+M,U=Math.min(this._bufferService.cols,G-V+K+L-M-O);if(j||z.slice(V,G).trim()!==""){if(B&&$===0&&H.getCodePoint(0)!==32){const Q=Y.lines.get(T[1]-1);if(Q&&H.isWrapped&&Q.getCodePoint(this._bufferService.cols-1)!==32){const re=this._getWordAt([this._bufferService.cols-1,T[1]-1],!1,!0,!1);if(re){const ae=this._bufferService.cols-re.start;$-=ae,U+=ae}}}if(F&&$+U===this._bufferService.cols&&H.getCodePoint(this._bufferService.cols-1)!==32){const Q=Y.lines.get(T[1]+1);if(Q!=null&&Q.isWrapped&&Q.getCodePoint(0)!==32){const re=this._getWordAt([0,T[1]+1],!1,!1,!0);re&&(U+=re.length)}}return{start:$,length:U}}}_selectWordAt(T,j){const B=this._getWordAt(T,j);if(B){for(;B.start<0;)B.start+=this._bufferService.cols,T[1]--;this._model.selectionStart=[B.start,T[1]],this._model.selectionStartLength=B.length}}_selectToWordAt(T){const j=this._getWordAt(T,!0);if(j){let B=T[1];for(;j.start<0;)j.start+=this._bufferService.cols,B--;if(!this._model.areSelectionValuesReversed())for(;j.start+j.length>this._bufferService.cols;)j.length-=this._bufferService.cols,B++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?j.start:j.start+j.length,B]}}_isCharWordSeparator(T){return T.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(T.getChars())>=0}_selectLineAt(T){const j=this._bufferService.buffer.getWrappedRangeForLine(T),B={start:{x:0,y:j.first},end:{x:this._bufferService.cols-1,y:j.last}};this._model.selectionStart=[0,j.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(B,this._bufferService.cols)}};o.SelectionService=D=f([p(3,E.IBufferService),p(4,E.ICoreService),p(5,w.IMouseService),p(6,E.IOptionsService),p(7,w.IRenderService),p(8,w.ICoreBrowserService)],D)},4725:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ILinkProviderService=o.IThemeService=o.ICharacterJoinerService=o.ISelectionService=o.IRenderService=o.IMouseService=o.ICoreBrowserService=o.ICharSizeService=void 0;const f=c(8343);o.ICharSizeService=(0,f.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),o.IMouseService=(0,f.createDecorator)("MouseService"),o.IRenderService=(0,f.createDecorator)("RenderService"),o.ISelectionService=(0,f.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,f.createDecorator)("ThemeService"),o.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(u,o,c){var f=this&&this.__decorate||function(D,T,j,B){var F,Y=arguments.length,H=Y<3?T:B===null?B=Object.getOwnPropertyDescriptor(T,j):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(D,T,j,B);else for(var z=D.length-1;z>=0;z--)(F=D[z])&&(H=(Y<3?F(H):Y>3?F(T,j,H):F(T,j))||H);return Y>3&&H&&Object.defineProperty(T,j,H),H},p=this&&this.__param||function(D,T){return function(j,B){T(j,B,D)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const d=c(7239),_=c(8055),v=c(8460),w=c(844),C=c(2585),b=_.css.toColor("#ffffff"),S=_.css.toColor("#000000"),x=_.css.toColor("#ffffff"),y=_.css.toColor("#000000"),E={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const D=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],T=[0,95,135,175,215,255];for(let j=0;j<216;j++){const B=T[j/36%6|0],F=T[j/6%6|0],Y=T[j%6];D.push({css:_.channels.toCss(B,F,Y),rgba:_.channels.toRgba(B,F,Y)})}for(let j=0;j<24;j++){const B=8+10*j;D.push({css:_.channels.toCss(B,B,B),rgba:_.channels.toRgba(B,B,B)})}return D})());let R=o.ThemeService=class extends w.Disposable{get colors(){return this._colors}constructor(D){super(),this._optionsService=D,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:b,background:S,cursor:x,cursorAccent:y,selectionForeground:void 0,selectionBackgroundTransparent:E,selectionBackgroundOpaque:_.color.blend(S,E),selectionInactiveBackgroundTransparent:E,selectionInactiveBackgroundOpaque:_.color.blend(S,E),ansi:o.DEFAULT_ANSI_COLORS.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))))}_setTheme(D={}){const T=this._colors;if(T.foreground=N(D.foreground,b),T.background=N(D.background,S),T.cursor=N(D.cursor,x),T.cursorAccent=N(D.cursorAccent,y),T.selectionBackgroundTransparent=N(D.selectionBackground,E),T.selectionBackgroundOpaque=_.color.blend(T.background,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundTransparent=N(D.selectionInactiveBackground,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundOpaque=_.color.blend(T.background,T.selectionInactiveBackgroundTransparent),T.selectionForeground=D.selectionForeground?N(D.selectionForeground,_.NULL_COLOR):void 0,T.selectionForeground===_.NULL_COLOR&&(T.selectionForeground=void 0),_.color.isOpaque(T.selectionBackgroundTransparent)&&(T.selectionBackgroundTransparent=_.color.opacity(T.selectionBackgroundTransparent,.3)),_.color.isOpaque(T.selectionInactiveBackgroundTransparent)&&(T.selectionInactiveBackgroundTransparent=_.color.opacity(T.selectionInactiveBackgroundTransparent,.3)),T.ansi=o.DEFAULT_ANSI_COLORS.slice(),T.ansi[0]=N(D.black,o.DEFAULT_ANSI_COLORS[0]),T.ansi[1]=N(D.red,o.DEFAULT_ANSI_COLORS[1]),T.ansi[2]=N(D.green,o.DEFAULT_ANSI_COLORS[2]),T.ansi[3]=N(D.yellow,o.DEFAULT_ANSI_COLORS[3]),T.ansi[4]=N(D.blue,o.DEFAULT_ANSI_COLORS[4]),T.ansi[5]=N(D.magenta,o.DEFAULT_ANSI_COLORS[5]),T.ansi[6]=N(D.cyan,o.DEFAULT_ANSI_COLORS[6]),T.ansi[7]=N(D.white,o.DEFAULT_ANSI_COLORS[7]),T.ansi[8]=N(D.brightBlack,o.DEFAULT_ANSI_COLORS[8]),T.ansi[9]=N(D.brightRed,o.DEFAULT_ANSI_COLORS[9]),T.ansi[10]=N(D.brightGreen,o.DEFAULT_ANSI_COLORS[10]),T.ansi[11]=N(D.brightYellow,o.DEFAULT_ANSI_COLORS[11]),T.ansi[12]=N(D.brightBlue,o.DEFAULT_ANSI_COLORS[12]),T.ansi[13]=N(D.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),T.ansi[14]=N(D.brightCyan,o.DEFAULT_ANSI_COLORS[14]),T.ansi[15]=N(D.brightWhite,o.DEFAULT_ANSI_COLORS[15]),D.extendedAnsi){const j=Math.min(T.ansi.length-16,D.extendedAnsi.length);for(let B=0;B{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const f=c(8460),p=c(844);class d extends p.Disposable{constructor(v){super(),this._maxLength=v,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(v){if(this._maxLength===v)return;const w=new Array(v);for(let C=0;Cthis._length)for(let w=this._length;w=v;b--)this._array[this._getCyclicIndex(b+C.length)]=this._array[this._getCyclicIndex(b)];for(let b=0;bthis._maxLength){const b=this._length+C.length-this._maxLength;this._startIndex+=b,this._length=this._maxLength,this.onTrimEmitter.fire(b)}else this._length+=C.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,w,C){if(!(w<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let S=w-1;S>=0;S--)this.set(v+S+C,this.get(v+S));const b=v+w+C-this._length;if(b>0)for(this._length+=b;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let b=0;b{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function c(f,p=5){if(typeof f!="object")return f;const d=Array.isArray(f)?[]:{};for(const _ in f)d[_]=p<=1?f[_]:f[_]&&c(f[_],p-1);return d}},8055:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let c=0,f=0,p=0,d=0;var _,v,w,C,b;function S(y){const E=y.toString(16);return E.length<2?"0"+E:E}function x(y,E){return y>>0},y.toColor=function(E,R,N,D){return{css:y.toCss(E,R,N,D),rgba:y.toRgba(E,R,N,D)}}})(_||(o.channels=_={})),(function(y){function E(R,N){return d=Math.round(255*N),[c,f,p]=b.toChannels(R.rgba),{css:_.toCss(c,f,p,d),rgba:_.toRgba(c,f,p,d)}}y.blend=function(R,N){if(d=(255&N.rgba)/255,d===1)return{css:N.css,rgba:N.rgba};const D=N.rgba>>24&255,T=N.rgba>>16&255,j=N.rgba>>8&255,B=R.rgba>>24&255,F=R.rgba>>16&255,Y=R.rgba>>8&255;return c=B+Math.round((D-B)*d),f=F+Math.round((T-F)*d),p=Y+Math.round((j-Y)*d),{css:_.toCss(c,f,p),rgba:_.toRgba(c,f,p)}},y.isOpaque=function(R){return(255&R.rgba)==255},y.ensureContrastRatio=function(R,N,D){const T=b.ensureContrastRatio(R.rgba,N.rgba,D);if(T)return _.toColor(T>>24&255,T>>16&255,T>>8&255)},y.opaque=function(R){const N=(255|R.rgba)>>>0;return[c,f,p]=b.toChannels(N),{css:_.toCss(c,f,p),rgba:N}},y.opacity=E,y.multiplyOpacity=function(R,N){return d=255&R.rgba,E(R,d*N/255)},y.toColorRGB=function(R){return[R.rgba>>24&255,R.rgba>>16&255,R.rgba>>8&255]}})(v||(o.color=v={})),(function(y){let E,R;try{const N=document.createElement("canvas");N.width=1,N.height=1;const D=N.getContext("2d",{willReadFrequently:!0});D&&(E=D,E.globalCompositeOperation="copy",R=E.createLinearGradient(0,0,1,1))}catch{}y.toColor=function(N){if(N.match(/#[\da-f]{3,8}/i))switch(N.length){case 4:return c=parseInt(N.slice(1,2).repeat(2),16),f=parseInt(N.slice(2,3).repeat(2),16),p=parseInt(N.slice(3,4).repeat(2),16),_.toColor(c,f,p);case 5:return c=parseInt(N.slice(1,2).repeat(2),16),f=parseInt(N.slice(2,3).repeat(2),16),p=parseInt(N.slice(3,4).repeat(2),16),d=parseInt(N.slice(4,5).repeat(2),16),_.toColor(c,f,p,d);case 7:return{css:N,rgba:(parseInt(N.slice(1),16)<<8|255)>>>0};case 9:return{css:N,rgba:parseInt(N.slice(1),16)>>>0}}const D=N.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(D)return c=parseInt(D[1]),f=parseInt(D[2]),p=parseInt(D[3]),d=Math.round(255*(D[5]===void 0?1:parseFloat(D[5]))),_.toColor(c,f,p,d);if(!E||!R)throw new Error("css.toColor: Unsupported css format");if(E.fillStyle=R,E.fillStyle=N,typeof E.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(E.fillRect(0,0,1,1),[c,f,p,d]=E.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(c,f,p,d),css:N}}})(w||(o.css=w={})),(function(y){function E(R,N,D){const T=R/255,j=N/255,B=D/255;return .2126*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.7152*(j<=.03928?j/12.92:Math.pow((j+.055)/1.055,2.4))+.0722*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))}y.relativeLuminance=function(R){return E(R>>16&255,R>>8&255,255&R)},y.relativeLuminance2=E})(C||(o.rgb=C={})),(function(y){function E(N,D,T){const j=N>>24&255,B=N>>16&255,F=N>>8&255;let Y=D>>24&255,H=D>>16&255,z=D>>8&255,V=x(C.relativeLuminance2(Y,H,z),C.relativeLuminance2(j,B,F));for(;V0||H>0||z>0);)Y-=Math.max(0,Math.ceil(.1*Y)),H-=Math.max(0,Math.ceil(.1*H)),z-=Math.max(0,Math.ceil(.1*z)),V=x(C.relativeLuminance2(Y,H,z),C.relativeLuminance2(j,B,F));return(Y<<24|H<<16|z<<8|255)>>>0}function R(N,D,T){const j=N>>24&255,B=N>>16&255,F=N>>8&255;let Y=D>>24&255,H=D>>16&255,z=D>>8&255,V=x(C.relativeLuminance2(Y,H,z),C.relativeLuminance2(j,B,F));for(;V>>0}y.blend=function(N,D){if(d=(255&D)/255,d===1)return D;const T=D>>24&255,j=D>>16&255,B=D>>8&255,F=N>>24&255,Y=N>>16&255,H=N>>8&255;return c=F+Math.round((T-F)*d),f=Y+Math.round((j-Y)*d),p=H+Math.round((B-H)*d),_.toRgba(c,f,p)},y.ensureContrastRatio=function(N,D,T){const j=C.relativeLuminance(N>>8),B=C.relativeLuminance(D>>8);if(x(j,B)>8));if(zx(j,C.relativeLuminance(V>>8))?H:V}return H}const F=R(N,D,T),Y=x(j,C.relativeLuminance(F>>8));if(Yx(j,C.relativeLuminance(H>>8))?F:H}return F}},y.reduceLuminance=E,y.increaseLuminance=R,y.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(b||(o.rgba=b={})),o.toPaddedHex=S,o.contrastRatio=x},8969:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const f=c(844),p=c(2585),d=c(4348),_=c(7866),v=c(744),w=c(7302),C=c(6975),b=c(8460),S=c(1753),x=c(1480),y=c(7994),E=c(9282),R=c(5435),N=c(5981),D=c(2660);let T=!1;class j extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new b.EventEmitter),this._onScroll.event((F=>{var Y;(Y=this._onScrollApi)==null||Y.fire(F.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(F){for(const Y in F)this.optionsService.options[Y]=F[Y]}constructor(F){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new b.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new b.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new b.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new w.OptionsService(F)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(S.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(x.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(y.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(D.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new R.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,b.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,b.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,b.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,b.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((Y=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((Y=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new N.WriteBuffer(((Y,H)=>this._inputHandler.parse(Y,H)))),this.register((0,b.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(F,Y){this._writeBuffer.write(F,Y)}writeSync(F,Y){this._logService.logLevel<=p.LogLevelEnum.WARN&&!T&&(this._logService.warn("writeSync is unreliable and will be removed soon."),T=!0),this._writeBuffer.writeSync(F,Y)}input(F,Y=!0){this.coreService.triggerDataEvent(F,Y)}resize(F,Y){isNaN(F)||isNaN(Y)||(F=Math.max(F,v.MINIMUM_COLS),Y=Math.max(Y,v.MINIMUM_ROWS),this._bufferService.resize(F,Y))}scroll(F,Y=!1){this._bufferService.scroll(F,Y)}scrollLines(F,Y,H){this._bufferService.scrollLines(F,Y,H)}scrollPages(F){this.scrollLines(F*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(F){const Y=F-this._bufferService.buffer.ydisp;Y!==0&&this.scrollLines(Y)}registerEscHandler(F,Y){return this._inputHandler.registerEscHandler(F,Y)}registerDcsHandler(F,Y){return this._inputHandler.registerDcsHandler(F,Y)}registerCsiHandler(F,Y){return this._inputHandler.registerCsiHandler(F,Y)}registerOscHandler(F,Y){return this._inputHandler.registerOscHandler(F,Y)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let F=!1;const Y=this.optionsService.rawOptions.windowsPty;Y&&Y.buildNumber!==void 0&&Y.buildNumber!==void 0?F=Y.backend==="conpty"&&Y.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(F=!0),F?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const F=[];F.push(this.onLineFeed(E.updateWindowsModeWrappedState.bind(null,this._bufferService))),F.push(this.registerCsiHandler({final:"H"},(()=>((0,E.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const Y of F)Y.dispose()}))}}}o.CoreTerminal=j},8460:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=c=>(this._listeners.push(c),{dispose:()=>{if(!this._disposed){for(let f=0;ff.fire(p)))},o.runAndSubscribe=function(c,f){return f(void 0),c((p=>f(p)))}},5435:function(u,o,c){var f=this&&this.__decorate||function(K,L,M,O){var $,U=arguments.length,Q=U<3?L:O===null?O=Object.getOwnPropertyDescriptor(L,M):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Q=Reflect.decorate(K,L,M,O);else for(var re=K.length-1;re>=0;re--)($=K[re])&&(Q=(U<3?$(Q):U>3?$(L,M,Q):$(L,M))||Q);return U>3&&Q&&Object.defineProperty(L,M,Q),Q},p=this&&this.__param||function(K,L){return function(M,O){L(M,O,K)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const d=c(2584),_=c(7116),v=c(2015),w=c(844),C=c(482),b=c(8437),S=c(8460),x=c(643),y=c(511),E=c(3734),R=c(2585),N=c(1480),D=c(6242),T=c(6351),j=c(5941),B={"(":0,")":1,"*":2,"+":3,"-":1,".":2},F=131072;function Y(K,L){if(K>24)return L.setWinLines||!1;switch(K){case 1:return!!L.restoreWin;case 2:return!!L.minimizeWin;case 3:return!!L.setWinPosition;case 4:return!!L.setWinSizePixels;case 5:return!!L.raiseWin;case 6:return!!L.lowerWin;case 7:return!!L.refreshWin;case 8:return!!L.setWinSizeChars;case 9:return!!L.maximizeWin;case 10:return!!L.fullscreenWin;case 11:return!!L.getWinState;case 13:return!!L.getWinPosition;case 14:return!!L.getWinSizePixels;case 15:return!!L.getScreenSizePixels;case 16:return!!L.getCellSizePixels;case 18:return!!L.getWinSizeChars;case 19:return!!L.getScreenSizeChars;case 20:return!!L.getIconTitle;case 21:return!!L.getWinTitle;case 22:return!!L.pushTitle;case 23:return!!L.popTitle;case 24:return!!L.setWinLines}return!1}var H;(function(K){K[K.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",K[K.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(H||(o.WindowsOptionsReportType=H={}));let z=0;class V extends w.Disposable{getAttrData(){return this._curAttrData}constructor(L,M,O,$,U,Q,re,ae,Z=new v.EscapeSequenceParser){super(),this._bufferService=L,this._charsetService=M,this._coreService=O,this._logService=$,this._optionsService=U,this._oscLinkService=Q,this._coreMouseService=re,this._unicodeService=ae,this._parser=Z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new y.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new S.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new S.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new S.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new S.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new S.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new S.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new S.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new S.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new S.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new S.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new S.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new S.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new S.EventEmitter),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 G(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((P=>this._activeBuffer=P.activeBuffer))),this._parser.setCsiHandlerFallback(((P,ee)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(P),params:ee.toArray()})})),this._parser.setEscHandlerFallback((P=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(P)})})),this._parser.setExecuteHandlerFallback((P=>{this._logService.debug("Unknown EXECUTE code: ",{code:P})})),this._parser.setOscHandlerFallback(((P,ee,ne)=>{this._logService.debug("Unknown OSC code: ",{identifier:P,action:ee,data:ne})})),this._parser.setDcsHandlerFallback(((P,ee,ne)=>{ee==="HOOK"&&(ne=ne.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(P),action:ee,payload:ne})})),this._parser.setPrintHandler(((P,ee,ne)=>this.print(P,ee,ne))),this._parser.registerCsiHandler({final:"@"},(P=>this.insertChars(P))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(P=>this.scrollLeft(P))),this._parser.registerCsiHandler({final:"A"},(P=>this.cursorUp(P))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(P=>this.scrollRight(P))),this._parser.registerCsiHandler({final:"B"},(P=>this.cursorDown(P))),this._parser.registerCsiHandler({final:"C"},(P=>this.cursorForward(P))),this._parser.registerCsiHandler({final:"D"},(P=>this.cursorBackward(P))),this._parser.registerCsiHandler({final:"E"},(P=>this.cursorNextLine(P))),this._parser.registerCsiHandler({final:"F"},(P=>this.cursorPrecedingLine(P))),this._parser.registerCsiHandler({final:"G"},(P=>this.cursorCharAbsolute(P))),this._parser.registerCsiHandler({final:"H"},(P=>this.cursorPosition(P))),this._parser.registerCsiHandler({final:"I"},(P=>this.cursorForwardTab(P))),this._parser.registerCsiHandler({final:"J"},(P=>this.eraseInDisplay(P,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(P=>this.eraseInDisplay(P,!0))),this._parser.registerCsiHandler({final:"K"},(P=>this.eraseInLine(P,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(P=>this.eraseInLine(P,!0))),this._parser.registerCsiHandler({final:"L"},(P=>this.insertLines(P))),this._parser.registerCsiHandler({final:"M"},(P=>this.deleteLines(P))),this._parser.registerCsiHandler({final:"P"},(P=>this.deleteChars(P))),this._parser.registerCsiHandler({final:"S"},(P=>this.scrollUp(P))),this._parser.registerCsiHandler({final:"T"},(P=>this.scrollDown(P))),this._parser.registerCsiHandler({final:"X"},(P=>this.eraseChars(P))),this._parser.registerCsiHandler({final:"Z"},(P=>this.cursorBackwardTab(P))),this._parser.registerCsiHandler({final:"`"},(P=>this.charPosAbsolute(P))),this._parser.registerCsiHandler({final:"a"},(P=>this.hPositionRelative(P))),this._parser.registerCsiHandler({final:"b"},(P=>this.repeatPrecedingCharacter(P))),this._parser.registerCsiHandler({final:"c"},(P=>this.sendDeviceAttributesPrimary(P))),this._parser.registerCsiHandler({prefix:">",final:"c"},(P=>this.sendDeviceAttributesSecondary(P))),this._parser.registerCsiHandler({final:"d"},(P=>this.linePosAbsolute(P))),this._parser.registerCsiHandler({final:"e"},(P=>this.vPositionRelative(P))),this._parser.registerCsiHandler({final:"f"},(P=>this.hVPosition(P))),this._parser.registerCsiHandler({final:"g"},(P=>this.tabClear(P))),this._parser.registerCsiHandler({final:"h"},(P=>this.setMode(P))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(P=>this.setModePrivate(P))),this._parser.registerCsiHandler({final:"l"},(P=>this.resetMode(P))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(P=>this.resetModePrivate(P))),this._parser.registerCsiHandler({final:"m"},(P=>this.charAttributes(P))),this._parser.registerCsiHandler({final:"n"},(P=>this.deviceStatus(P))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(P=>this.deviceStatusPrivate(P))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(P=>this.softReset(P))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(P=>this.setCursorStyle(P))),this._parser.registerCsiHandler({final:"r"},(P=>this.setScrollRegion(P))),this._parser.registerCsiHandler({final:"s"},(P=>this.saveCursor(P))),this._parser.registerCsiHandler({final:"t"},(P=>this.windowOptions(P))),this._parser.registerCsiHandler({final:"u"},(P=>this.restoreCursor(P))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(P=>this.insertColumns(P))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(P=>this.deleteColumns(P))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(P=>this.selectProtected(P))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(P=>this.requestMode(P,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(P=>this.requestMode(P,!1))),this._parser.setExecuteHandler(d.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(d.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(d.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(d.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(d.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(d.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(d.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(d.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(d.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new D.OscHandler((P=>(this.setTitle(P),this.setIconName(P),!0)))),this._parser.registerOscHandler(1,new D.OscHandler((P=>this.setIconName(P)))),this._parser.registerOscHandler(2,new D.OscHandler((P=>this.setTitle(P)))),this._parser.registerOscHandler(4,new D.OscHandler((P=>this.setOrReportIndexedColor(P)))),this._parser.registerOscHandler(8,new D.OscHandler((P=>this.setHyperlink(P)))),this._parser.registerOscHandler(10,new D.OscHandler((P=>this.setOrReportFgColor(P)))),this._parser.registerOscHandler(11,new D.OscHandler((P=>this.setOrReportBgColor(P)))),this._parser.registerOscHandler(12,new D.OscHandler((P=>this.setOrReportCursorColor(P)))),this._parser.registerOscHandler(104,new D.OscHandler((P=>this.restoreIndexedColor(P)))),this._parser.registerOscHandler(110,new D.OscHandler((P=>this.restoreFgColor(P)))),this._parser.registerOscHandler(111,new D.OscHandler((P=>this.restoreBgColor(P)))),this._parser.registerOscHandler(112,new D.OscHandler((P=>this.restoreCursorColor(P)))),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(const P in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:P},(()=>this.selectCharset("("+P))),this._parser.registerEscHandler({intermediates:")",final:P},(()=>this.selectCharset(")"+P))),this._parser.registerEscHandler({intermediates:"*",final:P},(()=>this.selectCharset("*"+P))),this._parser.registerEscHandler({intermediates:"+",final:P},(()=>this.selectCharset("+"+P))),this._parser.registerEscHandler({intermediates:"-",final:P},(()=>this.selectCharset("-"+P))),this._parser.registerEscHandler({intermediates:".",final:P},(()=>this.selectCharset("."+P))),this._parser.registerEscHandler({intermediates:"/",final:P},(()=>this.selectCharset("/"+P)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((P=>(this._logService.error("Parsing error: ",P),P))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new T.DcsHandler(((P,ee)=>this.requestStatusString(P,ee))))}_preserveStack(L,M,O,$){this._parseStack.paused=!0,this._parseStack.cursorStartX=L,this._parseStack.cursorStartY=M,this._parseStack.decodedLength=O,this._parseStack.position=$}_logSlowResolvingAsync(L){this._logService.logLevel<=R.LogLevelEnum.WARN&&Promise.race([L,new Promise(((M,O)=>setTimeout((()=>O("#SLOW_TIMEOUT")),5e3)))]).catch((M=>{if(M!=="#SLOW_TIMEOUT")throw M;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(L,M){let O,$=this._activeBuffer.x,U=this._activeBuffer.y,Q=0;const re=this._parseStack.paused;if(re){if(O=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,M))return this._logSlowResolvingAsync(O),O;$=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,L.length>F&&(Q=this._parseStack.position+F)}if(this._logService.logLevel<=R.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof L=="string"?` "${L}"`:` "${Array.prototype.map.call(L,(P=>String.fromCharCode(P))).join("")}"`),typeof L=="string"?L.split("").map((P=>P.charCodeAt(0))):L),this._parseBuffer.lengthF)for(let P=Q;P0&&ne.getWidth(this._activeBuffer.x-1)===2&&ne.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ee);let ge=this._parser.precedingJoinState;for(let he=M;heae){if(Z){const Ee=ne;let Ce=this._activeBuffer.x-ke;for(this._activeBuffer.x=ke,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),ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ke>0&&ne instanceof b.BufferLine&&ne.copyCellsFrom(Ee,Ce,0,ke,!1);Ce=0;)ne.setCellFromCodepoint(this._activeBuffer.x++,0,0,ee)}else if(P&&(ne.insertCells(this._activeBuffer.x,U-ke,this._activeBuffer.getNullCell(ee)),ne.getWidth(ae-1)===2&&ne.setCellFromCodepoint(ae-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,ee)),ne.setCellFromCodepoint(this._activeBuffer.x++,$,U,ee),U>0)for(;--U;)ne.setCellFromCodepoint(this._activeBuffer.x++,0,0,ee)}this._parser.precedingJoinState=ge,this._activeBuffer.x0&&ne.getWidth(this._activeBuffer.x)===0&&!ne.hasContent(this._activeBuffer.x)&&ne.setCellFromCodepoint(this._activeBuffer.x,0,1,ee),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(L,M){return L.final!=="t"||L.prefix||L.intermediates?this._parser.registerCsiHandler(L,M):this._parser.registerCsiHandler(L,(O=>!Y(O.params[0],this._optionsService.rawOptions.windowOptions)||M(O)))}registerDcsHandler(L,M){return this._parser.registerDcsHandler(L,new T.DcsHandler(M))}registerEscHandler(L,M){return this._parser.registerEscHandler(L,M)}registerOscHandler(L,M){return this._parser.registerOscHandler(L,new D.OscHandler(M))}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(){var L;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&&((L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&L.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);M.hasWidth(this._activeBuffer.x)&&!M.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const L=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-L),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(L=this._bufferService.cols-1){this._activeBuffer.x=Math.min(L,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(L,M){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=L,this._activeBuffer.y=this._activeBuffer.scrollTop+M):(this._activeBuffer.x=L,this._activeBuffer.y=M),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(L,M){this._restrictCursor(),this._setCursor(this._activeBuffer.x+L,this._activeBuffer.y+M)}cursorUp(L){const M=this._activeBuffer.y-this._activeBuffer.scrollTop;return M>=0?this._moveCursor(0,-Math.min(M,L.params[0]||1)):this._moveCursor(0,-(L.params[0]||1)),!0}cursorDown(L){const M=this._activeBuffer.scrollBottom-this._activeBuffer.y;return M>=0?this._moveCursor(0,Math.min(M,L.params[0]||1)):this._moveCursor(0,L.params[0]||1),!0}cursorForward(L){return this._moveCursor(L.params[0]||1,0),!0}cursorBackward(L){return this._moveCursor(-(L.params[0]||1),0),!0}cursorNextLine(L){return this.cursorDown(L),this._activeBuffer.x=0,!0}cursorPrecedingLine(L){return this.cursorUp(L),this._activeBuffer.x=0,!0}cursorCharAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(L){return this._setCursor(L.length>=2?(L.params[1]||1)-1:0,(L.params[0]||1)-1),!0}charPosAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(L){return this._moveCursor(L.params[0]||1,0),!0}linePosAbsolute(L){return this._setCursor(this._activeBuffer.x,(L.params[0]||1)-1),!0}vPositionRelative(L){return this._moveCursor(0,L.params[0]||1),!0}hVPosition(L){return this.cursorPosition(L),!0}tabClear(L){const M=L.params[0];return M===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:M===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=L.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=L.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(L){const M=L.params[0];return M===1&&(this._curAttrData.bg|=536870912),M!==2&&M!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(L,M,O,$=!1,U=!1){const Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);Q.replaceCells(M,O,this._activeBuffer.getNullCell(this._eraseAttrData()),U),$&&(Q.isWrapped=!1)}_resetBufferLine(L,M=!1){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);O&&(O.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),M),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+L),O.isWrapped=!1)}eraseInDisplay(L,M=!1){let O;switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:for(O=this._activeBuffer.y,this._dirtyRowTracker.markDirty(O),this._eraseInBufferLine(O++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);O=this._bufferService.cols&&(this._activeBuffer.lines.get(O+1).isWrapped=!1);O--;)this._resetBufferLine(O,M);this._dirtyRowTracker.markDirty(0);break;case 2:for(O=this._bufferService.rows,this._dirtyRowTracker.markDirty(O-1);O--;)this._resetBufferLine(O,M);this._dirtyRowTracker.markDirty(0);break;case 3:const $=this._activeBuffer.lines.length-this._bufferService.rows;$>0&&(this._activeBuffer.lines.trimStart($),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-$,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-$,0),this._onScroll.fire(0))}return!0}eraseInLine(L,M=!1){switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,M);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,M)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(L){this._restrictCursor();let M=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let Z=ae;for(let P=1;P0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(L){return L.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(L.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(L){return(this._optionsService.rawOptions.termName+"").indexOf(L)===0}setMode(L){for(let M=0;Mbe?1:2,ge=L.params[0];return he=ge,ye=M?ge===2?4:ge===4?ne(Q.modes.insertMode):ge===12?3:ge===20?ne(ee.convertEol):0:ge===1?ne(O.applicationCursorKeys):ge===3?ee.windowOptions.setWinLines?ae===80?2:ae===132?1:0:0:ge===6?ne(O.origin):ge===7?ne(O.wraparound):ge===8?3:ge===9?ne($==="X10"):ge===12?ne(ee.cursorBlink):ge===25?ne(!Q.isCursorHidden):ge===45?ne(O.reverseWraparound):ge===66?ne(O.applicationKeypad):ge===67?4:ge===1e3?ne($==="VT200"):ge===1002?ne($==="DRAG"):ge===1003?ne($==="ANY"):ge===1004?ne(O.sendFocus):ge===1005?4:ge===1006?ne(U==="SGR"):ge===1015?4:ge===1016?ne(U==="SGR_PIXELS"):ge===1048?1:ge===47||ge===1047||ge===1049?ne(Z===P):ge===2004?ne(O.bracketedPasteMode):0,Q.triggerDataEvent(`${d.C0.ESC}[${M?"":"?"}${he};${ye}$y`),!0;var he,ye}_updateAttrColor(L,M,O,$,U){return M===2?(L|=50331648,L&=-16777216,L|=E.AttributeData.fromColorRGB([O,$,U])):M===5&&(L&=-50331904,L|=33554432|255&O),L}_extractColor(L,M,O){const $=[0,0,-1,0,0,0];let U=0,Q=0;do{if($[Q+U]=L.params[M+Q],L.hasSubParams(M+Q)){const re=L.getSubParams(M+Q);let ae=0;do $[1]===5&&(U=1),$[Q+ae+1+U]=re[ae];while(++ae=2||$[1]===2&&Q+U>=5)break;$[1]&&(U=1)}while(++Q+M5)&&(L=1),M.extended.underlineStyle=L,M.fg|=268435456,L===0&&(M.fg&=-268435457),M.updateExtended()}_processSGR0(L){L.fg=b.DEFAULT_ATTR_DATA.fg,L.bg=b.DEFAULT_ATTR_DATA.bg,L.extended=L.extended.clone(),L.extended.underlineStyle=0,L.extended.underlineColor&=-67108864,L.updateExtended()}charAttributes(L){if(L.length===1&&L.params[0]===0)return this._processSGR0(this._curAttrData),!0;const M=L.length;let O;const $=this._curAttrData;for(let U=0;U=30&&O<=37?($.fg&=-50331904,$.fg|=16777216|O-30):O>=40&&O<=47?($.bg&=-50331904,$.bg|=16777216|O-40):O>=90&&O<=97?($.fg&=-50331904,$.fg|=16777224|O-90):O>=100&&O<=107?($.bg&=-50331904,$.bg|=16777224|O-100):O===0?this._processSGR0($):O===1?$.fg|=134217728:O===3?$.bg|=67108864:O===4?($.fg|=268435456,this._processUnderline(L.hasSubParams(U)?L.getSubParams(U)[0]:1,$)):O===5?$.fg|=536870912:O===7?$.fg|=67108864:O===8?$.fg|=1073741824:O===9?$.fg|=2147483648:O===2?$.bg|=134217728:O===21?this._processUnderline(2,$):O===22?($.fg&=-134217729,$.bg&=-134217729):O===23?$.bg&=-67108865:O===24?($.fg&=-268435457,this._processUnderline(0,$)):O===25?$.fg&=-536870913:O===27?$.fg&=-67108865:O===28?$.fg&=-1073741825:O===29?$.fg&=2147483647:O===39?($.fg&=-67108864,$.fg|=16777215&b.DEFAULT_ATTR_DATA.fg):O===49?($.bg&=-67108864,$.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):O===38||O===48||O===58?U+=this._extractColor(L,U,$):O===53?$.bg|=1073741824:O===55?$.bg&=-1073741825:O===59?($.extended=$.extended.clone(),$.extended.underlineColor=-1,$.updateExtended()):O===100?($.fg&=-67108864,$.fg|=16777215&b.DEFAULT_ATTR_DATA.fg,$.bg&=-67108864,$.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",O);return!0}deviceStatus(L){switch(L.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const M=this._activeBuffer.y+1,O=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${M};${O}R`)}return!0}deviceStatusPrivate(L){if(L.params[0]===6){const M=this._activeBuffer.y+1,O=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${M};${O}R`)}return!0}softReset(L){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=b.DEFAULT_ATTR_DATA.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(L){const M=L.params[0]||1;switch(M){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const O=M%2==1;return this._optionsService.options.cursorBlink=O,!0}setScrollRegion(L){const M=L.params[0]||1;let O;return(L.length<2||(O=L.params[1])>this._bufferService.rows||O===0)&&(O=this._bufferService.rows),O>M&&(this._activeBuffer.scrollTop=M-1,this._activeBuffer.scrollBottom=O-1,this._setCursor(0,0)),!0}windowOptions(L){if(!Y(L.params[0],this._optionsService.rawOptions.windowOptions))return!0;const M=L.length>1?L.params[1]:0;switch(L.params[0]){case 14:M!==2&&this._onRequestWindowsOptionsReport.fire(H.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(H.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${d.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:M!==0&&M!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),M!==0&&M!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:M!==0&&M!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),M!==0&&M!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(L){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(L){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(L){return this._windowTitle=L,this._onTitleChange.fire(L),!0}setIconName(L){return this._iconName=L,!0}setOrReportIndexedColor(L){const M=[],O=L.split(";");for(;O.length>1;){const $=O.shift(),U=O.shift();if(/^\d+$/.exec($)){const Q=parseInt($);if(X(Q))if(U==="?")M.push({type:0,index:Q});else{const re=(0,j.parseColor)(U);re&&M.push({type:1,index:Q,color:re})}}}return M.length&&this._onColor.fire(M),!0}setHyperlink(L){const M=L.split(";");return!(M.length<2)&&(M[1]?this._createHyperlink(M[0],M[1]):!M[0]&&this._finishHyperlink())}_createHyperlink(L,M){this._getCurrentLinkId()&&this._finishHyperlink();const O=L.split(":");let $;const U=O.findIndex((Q=>Q.startsWith("id=")));return U!==-1&&($=O[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:$,uri:M}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(L,M){const O=L.split(";");for(let $=0;$=this._specialColors.length);++$,++M)if(O[$]==="?")this._onColor.fire([{type:0,index:this._specialColors[M]}]);else{const U=(0,j.parseColor)(O[$]);U&&this._onColor.fire([{type:1,index:this._specialColors[M],color:U}])}return!0}setOrReportFgColor(L){return this._setOrReportSpecialColor(L,0)}setOrReportBgColor(L){return this._setOrReportSpecialColor(L,1)}setOrReportCursorColor(L){return this._setOrReportSpecialColor(L,2)}restoreIndexedColor(L){if(!L)return this._onColor.fire([{type:2}]),!0;const M=[],O=L.split(";");for(let $=0;$=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){const L=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,L,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=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(L){return this._charsetService.setgLevel(L),!0}screenAlignmentPattern(){const L=new y.CellData;L.content=4194373,L.fg=this._curAttrData.fg,L.bg=this._curAttrData.bg,this._setCursor(0,0);for(let M=0;M(this._coreService.triggerDataEvent(`${d.C0.ESC}${U}${d.C0.ESC}\\`),!0))(L==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:L==='"p'?'P1$r61;1"p':L==="r"?`P1$r${O.scrollTop+1};${O.scrollBottom+1}r`:L==="m"?"P1$r0m":L===" q"?`P1$r${{block:2,underline:4,bar:6}[$.cursorStyle]-($.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(L,M){this._dirtyRowTracker.markRangeDirty(L,M)}}o.InputHandler=V;let G=class{constructor(K){this._bufferService=K,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(K){Kthis.end&&(this.end=K)}markRangeDirty(K,L){K>L&&(z=K,K=L,L=z),Kthis.end&&(this.end=L)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(K){return 0<=K&&K<256}G=f([p(0,R.IBufferService)],G)},844:(u,o)=>{function c(f){for(const p of f)p.dispose();f.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const p=this._disposables.indexOf(f);p!==-1&&this._disposables.splice(p,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var p;this._isDisposed||f===this._value||((p=this._value)==null||p.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},o.toDisposable=function(f){return{dispose:f}},o.disposeArray=c,o.getDisposeArrayDisposable=function(f){return{dispose:()=>c(f)}}},1505:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class c{constructor(){this._data={}}set(p,d,_){this._data[p]||(this._data[p]={}),this._data[p][d]=_}get(p,d){return this._data[p]?this._data[p][d]:void 0}clear(){this._data={}}}o.TwoKeyMap=c,o.FourKeyMap=class{constructor(){this._data=new c}set(f,p,d,_,v){this._data.get(f,p)||this._data.set(f,p,new c),this._data.get(f,p).set(d,_,v)}get(f,p,d,_){var v;return(v=this._data.get(f,p))==null?void 0:v.get(d,_)}clear(){this._data.clear()}}},6114:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const c=o.isNode?"node":navigator.userAgent,f=o.isNode?"node":navigator.platform;o.isFirefox=c.includes("Firefox"),o.isLegacyEdge=c.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(c),o.getSafariVersion=function(){if(!o.isSafari)return 0;const p=c.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),o.isIpad=f==="iPad",o.isIphone=f==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),o.isLinux=f.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(c)},6106:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let c=0;o.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(c=this._search(this._getKey(f)),this._array.splice(c,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const p=this._getKey(f);if(p===void 0||(c=this._search(p),c===-1)||this._getKey(this._array[c])!==p)return!1;do if(this._array[c]===f)return this._array.splice(c,1),!0;while(++c=this._array.length)&&this._getKey(this._array[c])===f))do yield this._array[c];while(++c=this._array.length)&&this._getKey(this._array[c])===f))do p(this._array[c]);while(++c=p;){let _=p+d>>1;const v=this._getKey(this._array[_]);if(v>f)d=_-1;else{if(!(v0&&this._getKey(this._array[_-1])===f;)_--;return _}p=_+1}}return p}}},7226:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const f=c(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),this._start()}flush(){for(;this._iS)return b-w<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(b-w))}ms`),void this._start();b=S}this.clear()}}class d extends p{_requestCallback(v){return setTimeout((()=>v(this._createDeadline(16))))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const w=Date.now()+v;return{timeRemaining:()=>Math.max(0,w-Date.now())}}}o.PriorityTaskQueue=d,o.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:d,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const f=c(643);o.updateWindowsModeWrappedState=function(p){const d=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),_=d==null?void 0:d.get(p.cols-1),v=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);v&&_&&(v.isWrapped=_[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&_[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new f}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new c;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}o.AttributeData=c;class f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}get underlineVariantOffset(){const d=(3758096384&this._ext)>>29;return d<0?4294967288^d:d}set underlineVariantOffset(d){this._ext&=536870911,this._ext|=d<<29&3758096384}constructor(d=0,_=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=_}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=f},9092:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const f=c(6349),p=c(7226),d=c(3734),_=c(8437),v=c(4634),w=c(511),C=c(643),b=c(4863),S=c(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(x,y,E){this._hasScrollback=x,this._optionsService=y,this._bufferService=E,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=S.DEFAULT_CHARSET,this.markers=[],this._nullCell=w.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,C.WHITESPACE_CELL_CHAR,C.WHITESPACE_CELL_WIDTH,C.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(x){return x?(this._nullCell.fg=x.fg,this._nullCell.bg=x.bg,this._nullCell.extended=x.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(x){return x?(this._whitespaceCell.fg=x.fg,this._whitespaceCell.bg=x.bg,this._whitespaceCell.extended=x.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(x,y){return new _.BufferLine(this._bufferService.cols,this.getNullCell(x),y)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const x=this.ybase+this.y-this.ydisp;return x>=0&&xo.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:y}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=_.DEFAULT_ATTR_DATA);let y=this._rows;for(;y--;)this.lines.push(this.getBlankLine(x))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(x,y){const E=this.getNullCell(_.DEFAULT_ATTR_DATA);let R=0;const N=this._getCorrectBufferLength(y);if(N>this.lines.maxLength&&(this.lines.maxLength=N),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+D+1?(this.ybase--,D++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(x,E)));else for(let T=this._rows;T>y;T--)this.lines.length>y+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(N0&&(this.lines.trimStart(T),this.ybase=Math.max(this.ybase-T,0),this.ydisp=Math.max(this.ydisp-T,0),this.savedY=Math.max(this.savedY-T,0)),this.lines.maxLength=N}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,y-1),D&&(this.y+=D),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=y-1,this._isReflowEnabled&&(this._reflow(x,y),this._cols>x))for(let D=0;D.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let x=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,x=!1);let y=0;for(;this._memoryCleanupPosition100)return!0;return x}get _isReflowEnabled(){const x=this._optionsService.rawOptions.windowsPty;return x&&x.buildNumber?this._hasScrollback&&x.backend==="conpty"&&x.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(x,y){this._cols!==x&&(x>this._cols?this._reflowLarger(x,y):this._reflowSmaller(x,y))}_reflowLarger(x,y){const E=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(E.length>0){const R=(0,v.reflowLargerCreateNewLayout)(this.lines,E);(0,v.reflowLargerApplyNewLayout)(this.lines,R.layout),this._reflowLargerAdjustViewport(x,y,R.countRemoved)}}_reflowLargerAdjustViewport(x,y,E){const R=this.getNullCell(_.DEFAULT_ATTR_DATA);let N=E;for(;N-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;D--){let T=this.lines.get(D);if(!T||!T.isWrapped&&T.getTrimmedLength()<=x)continue;const j=[T];for(;T.isWrapped&&D>0;)T=this.lines.get(--D),j.unshift(T);const B=this.ybase+this.y;if(B>=D&&B0&&(R.push({start:D+j.length+N,newLines:V}),N+=V.length),j.push(...V);let G=Y.length-1,X=Y[G];X===0&&(G--,X=Y[G]);let K=j.length-H-1,L=F;for(;K>=0;){const O=Math.min(L,X);if(j[G]===void 0)break;if(j[G].copyCellsFrom(j[K],L-O,X-O,O,!0),X-=O,X===0&&(G--,X=Y[G]),L-=O,L===0){K--;const $=Math.max(K,0);L=(0,v.getWrappedLineTrimmedLength)(j,$,this._cols)}}for(let O=0;O0;)this.ybase===0?this.y0){const D=[],T=[];for(let G=0;G=0;G--)if(Y&&Y.start>B+H){for(let X=Y.newLines.length-1;X>=0;X--)this.lines.set(G--,Y.newLines[X]);G++,D.push({index:B+1,amount:Y.newLines.length}),H+=Y.newLines.length,Y=R[++F]}else this.lines.set(G,T[B--]);let z=0;for(let G=D.length-1;G>=0;G--)D[G].index+=z,this.lines.onInsertEmitter.fire(D[G]),z+=D[G].amount;const V=Math.max(0,j+N-this.lines.maxLength);V>0&&this.lines.onTrimEmitter.fire(V)}}translateBufferLineToString(x,y,E=0,R){const N=this.lines.get(x);return N?N.translateToString(y,E,R):""}getWrappedRangeForLine(x){let y=x,E=x;for(;y>0&&this.lines.get(y).isWrapped;)y--;for(;E+10;);return x>=this._cols?this._cols-1:x<0?0:x}nextStop(x){for(x==null&&(x=this.x);!this.tabs[++x]&&x=this._cols?this._cols-1:x<0?0:x}clearMarkers(x){this._isClearing=!0;for(let y=0;y{y.line-=E,y.line<0&&y.dispose()}))),y.register(this.lines.onInsert((E=>{y.line>=E.index&&(y.line+=E.amount)}))),y.register(this.lines.onDelete((E=>{y.line>=E.index&&y.lineE.index&&(y.line-=E.amount)}))),y.register(y.onDispose((()=>this._removeMarker(y)))),y}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const f=c(3734),p=c(511),d=c(643),_=c(482);o.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let v=0;class w{constructor(b,S,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*b);const y=S||p.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let E=0;E>22,2097152&S?this._combined[b].charCodeAt(this._combined[b].length-1):x]}set(b,S){this._data[3*b+1]=S[d.CHAR_DATA_ATTR_INDEX],S[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[b]=S[1],this._data[3*b+0]=2097152|b|S[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*b+0]=S[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(b){return this._data[3*b+0]>>22}hasWidth(b){return 12582912&this._data[3*b+0]}getFg(b){return this._data[3*b+1]}getBg(b){return this._data[3*b+2]}hasContent(b){return 4194303&this._data[3*b+0]}getCodePoint(b){const S=this._data[3*b+0];return 2097152&S?this._combined[b].charCodeAt(this._combined[b].length-1):2097151&S}isCombined(b){return 2097152&this._data[3*b+0]}getString(b){const S=this._data[3*b+0];return 2097152&S?this._combined[b]:2097151&S?(0,_.stringFromCodePoint)(2097151&S):""}isProtected(b){return 536870912&this._data[3*b+2]}loadCell(b,S){return v=3*b,S.content=this._data[v+0],S.fg=this._data[v+1],S.bg=this._data[v+2],2097152&S.content&&(S.combinedData=this._combined[b]),268435456&S.bg&&(S.extended=this._extendedAttrs[b]),S}setCell(b,S){2097152&S.content&&(this._combined[b]=S.combinedData),268435456&S.bg&&(this._extendedAttrs[b]=S.extended),this._data[3*b+0]=S.content,this._data[3*b+1]=S.fg,this._data[3*b+2]=S.bg}setCellFromCodepoint(b,S,x,y){268435456&y.bg&&(this._extendedAttrs[b]=y.extended),this._data[3*b+0]=S|x<<22,this._data[3*b+1]=y.fg,this._data[3*b+2]=y.bg}addCodepointToCell(b,S,x){let y=this._data[3*b+0];2097152&y?this._combined[b]+=(0,_.stringFromCodePoint)(S):2097151&y?(this._combined[b]=(0,_.stringFromCodePoint)(2097151&y)+(0,_.stringFromCodePoint)(S),y&=-2097152,y|=2097152):y=S|4194304,x&&(y&=-12582913,y|=x<<22),this._data[3*b+0]=y}insertCells(b,S,x){if((b%=this.length)&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,x),S=0;--E)this.setCell(b+S+E,this.loadCell(b+E,y));for(let E=0;Ethis.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const y=new Uint32Array(x);y.set(this._data),this._data=y}for(let y=this.length;y=b&&delete this._combined[N]}const E=Object.keys(this._extendedAttrs);for(let R=0;R=b&&delete this._extendedAttrs[N]}}return this.length=b,4*x*2=0;--b)if(4194303&this._data[3*b+0])return b+(this._data[3*b+0]>>22);return 0}getNoBgTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0]||50331648&this._data[3*b+2])return b+(this._data[3*b+0]>>22);return 0}copyCellsFrom(b,S,x,y,E){const R=b._data;if(E)for(let D=y-1;D>=0;D--){for(let T=0;T<3;T++)this._data[3*(x+D)+T]=R[3*(S+D)+T];268435456&R[3*(S+D)+2]&&(this._extendedAttrs[x+D]=b._extendedAttrs[S+D])}else for(let D=0;D=S&&(this._combined[T-S+x]=b._combined[T])}}translateToString(b,S,x,y){S=S??0,x=x??this.length,b&&(x=Math.min(x,this.getTrimmedLength())),y&&(y.length=0);let E="";for(;S>22||1}return y&&y.push(S),E}}o.BufferLine=w},4841:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.getRangeLength=function(c,f){if(c.start.y>c.end.y)throw new Error(`Buffer range end (${c.end.x}, ${c.end.y}) cannot be before start (${c.start.x}, ${c.start.y})`);return f*(c.end.y-c.start.y)+(c.end.x-c.start.x+1)}},4634:(u,o)=>{function c(f,p,d){if(p===f.length-1)return f[p].getTrimmedLength();const _=!f[p].hasContent(d-1)&&f[p].getWidth(d-1)===1,v=f[p+1].getWidth(0)===2;return _&&v?d-1:d}Object.defineProperty(o,"__esModule",{value:!0}),o.getWrappedLineTrimmedLength=o.reflowSmallerGetNewLineLengths=o.reflowLargerApplyNewLayout=o.reflowLargerCreateNewLayout=o.reflowLargerGetLinesToRemove=void 0,o.reflowLargerGetLinesToRemove=function(f,p,d,_,v){const w=[];for(let C=0;C=C&&_0&&(T>y||x[T].getTrimmedLength()===0);T--)D++;D>0&&(w.push(C+x.length-D),w.push(D)),C+=x.length-1}return w},o.reflowLargerCreateNewLayout=function(f,p){const d=[];let _=0,v=p[_],w=0;for(let C=0;Cc(f,x,p))).reduce(((S,x)=>S+x));let w=0,C=0,b=0;for(;bS&&(w-=S,C++);const x=f[C].getWidth(w-1)===2;x&&w--;const y=x?d-1:d;_.push(y),b+=y}return _},o.getWrappedLineTrimmedLength=c},5295:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const f=c(8460),p=c(844),d=c(9092);class _ extends p.Disposable{constructor(w,C){super(),this._optionsService=w,this._bufferService=C,this._onBufferActivate=this.register(new f.EventEmitter),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 d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.Buffer(!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(w){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(w),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(w,C){this._normal.resize(w,C),this._alt.resize(w,C),this.setupTabStops(w)}setupTabStops(w){this._normal.setupTabStops(w),this._alt.setupTabStops(w)}}o.BufferSet=_},511:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const f=c(482),p=c(643),d=c(3734);class _ extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(w){const C=new _;return C.setFromCharData(w),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(w){this.fg=w[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(w[p.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(w[p.CHAR_DATA_CHAR_INDEX].length===2){const b=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=b&&b<=56319){const S=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=S&&S<=57343?this.content=1024*(b-55296)+S-56320+65536|w[p.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|w[p.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=w[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|w[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=_},643:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},4863:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const f=c(8460),p=c(844);class d{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}o.Marker=d,d._nextId=1},7116:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DEFAULT_CHARSET=o.CHARSETS=void 0,o.CHARSETS={},o.DEFAULT_CHARSET=o.CHARSETS.B,o.CHARSETS[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:"≥","{":"π","|":"≠","}":"£","~":"·"},o.CHARSETS.A={"#":"£"},o.CHARSETS.B=void 0,o.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},o.CHARSETS.C=o.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},o.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},o.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},o.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},o.CHARSETS.E=o.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},o.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},o.CHARSETS.H=o.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(u,o)=>{var c,f,p;Object.defineProperty(o,"__esModule",{value:!0}),o.C1_ESCAPED=o.C1=o.C0=void 0,(function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=` -`,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL=""})(c||(o.C0=c={})),(function(d){d.PAD="€",d.HOP="",d.BPH="‚",d.NBH="ƒ",d.IND="„",d.NEL="…",d.SSA="†",d.ESA="‡",d.HTS="ˆ",d.HTJ="‰",d.VTS="Š",d.PLD="‹",d.PLU="Œ",d.RI="",d.SS2="Ž",d.SS3="",d.DCS="",d.PU1="‘",d.PU2="’",d.STS="“",d.CCH="”",d.MW="•",d.SPA="–",d.EPA="—",d.SOS="˜",d.SGCI="™",d.SCI="š",d.CSI="›",d.ST="œ",d.OSC="",d.PM="ž",d.APC="Ÿ"})(f||(o.C1=f={})),(function(d){d.ST=`${c.ESC}\\`})(p||(o.C1_ESCAPED=p={}))},7399:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const f=c(2584),p={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:["'",'"']};o.evaluateKeyboardEvent=function(d,_,v,w){const C={type:0,cancel:!1,key:void 0},b=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?C.key=_?f.C0.ESC+"OA":f.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?C.key=_?f.C0.ESC+"OD":f.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?C.key=_?f.C0.ESC+"OC":f.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(C.key=_?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:C.key=d.ctrlKey?"\b":f.C0.DEL,d.altKey&&(C.key=f.C0.ESC+C.key);break;case 9:if(d.shiftKey){C.key=f.C0.ESC+"[Z";break}C.key=f.C0.HT,C.cancel=!0;break;case 13:C.key=d.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,C.cancel=!0;break;case 27:C.key=f.C0.ESC,d.altKey&&(C.key=f.C0.ESC+f.C0.ESC),C.cancel=!0;break;case 37:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"D",C.key===f.C0.ESC+"[1;3D"&&(C.key=f.C0.ESC+(v?"b":"[1;5D"))):C.key=_?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"C",C.key===f.C0.ESC+"[1;3C"&&(C.key=f.C0.ESC+(v?"f":"[1;5C"))):C.key=_?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"A",v||C.key!==f.C0.ESC+"[1;3A"||(C.key=f.C0.ESC+"[1;5A")):C.key=_?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"B",v||C.key!==f.C0.ESC+"[1;3B"||(C.key=f.C0.ESC+"[1;5B")):C.key=_?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(C.key=f.C0.ESC+"[2~");break;case 46:C.key=b?f.C0.ESC+"[3;"+(b+1)+"~":f.C0.ESC+"[3~";break;case 36:C.key=b?f.C0.ESC+"[1;"+(b+1)+"H":_?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:C.key=b?f.C0.ESC+"[1;"+(b+1)+"F":_?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:d.shiftKey?C.type=2:d.ctrlKey?C.key=f.C0.ESC+"[5;"+(b+1)+"~":C.key=f.C0.ESC+"[5~";break;case 34:d.shiftKey?C.type=3:d.ctrlKey?C.key=f.C0.ESC+"[6;"+(b+1)+"~":C.key=f.C0.ESC+"[6~";break;case 112:C.key=b?f.C0.ESC+"[1;"+(b+1)+"P":f.C0.ESC+"OP";break;case 113:C.key=b?f.C0.ESC+"[1;"+(b+1)+"Q":f.C0.ESC+"OQ";break;case 114:C.key=b?f.C0.ESC+"[1;"+(b+1)+"R":f.C0.ESC+"OR";break;case 115:C.key=b?f.C0.ESC+"[1;"+(b+1)+"S":f.C0.ESC+"OS";break;case 116:C.key=b?f.C0.ESC+"[15;"+(b+1)+"~":f.C0.ESC+"[15~";break;case 117:C.key=b?f.C0.ESC+"[17;"+(b+1)+"~":f.C0.ESC+"[17~";break;case 118:C.key=b?f.C0.ESC+"[18;"+(b+1)+"~":f.C0.ESC+"[18~";break;case 119:C.key=b?f.C0.ESC+"[19;"+(b+1)+"~":f.C0.ESC+"[19~";break;case 120:C.key=b?f.C0.ESC+"[20;"+(b+1)+"~":f.C0.ESC+"[20~";break;case 121:C.key=b?f.C0.ESC+"[21;"+(b+1)+"~":f.C0.ESC+"[21~";break;case 122:C.key=b?f.C0.ESC+"[23;"+(b+1)+"~":f.C0.ESC+"[23~";break;case 123:C.key=b?f.C0.ESC+"[24;"+(b+1)+"~":f.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(v&&!w||!d.altKey||d.metaKey)!v||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?C.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(C.key=f.C0.US),d.key==="@"&&(C.key=f.C0.NUL)):d.keyCode===65&&(C.type=1);else{const S=p[d.keyCode],x=S==null?void 0:S[d.shiftKey?1:0];if(x)C.key=f.C0.ESC+x;else if(d.keyCode>=65&&d.keyCode<=90){const y=d.ctrlKey?d.keyCode-64:d.keyCode+32;let E=String.fromCharCode(y);d.shiftKey&&(E=E.toUpperCase()),C.key=f.C0.ESC+E}else if(d.keyCode===32)C.key=f.C0.ESC+(d.ctrlKey?f.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let y=d.code.slice(3,4);d.shiftKey||(y=y.toLowerCase()),C.key=f.C0.ESC+y,C.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?C.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?C.key=f.C0.NUL:d.keyCode>=51&&d.keyCode<=55?C.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?C.key=f.C0.DEL:d.keyCode===219?C.key=f.C0.ESC:d.keyCode===220?C.key=f.C0.FS:d.keyCode===221&&(C.key=f.C0.GS)}return C}},482:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},o.utf32ToString=function(c,f=0,p=c.length){let d="";for(let _=f;_65535?(v-=65536,d+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):d+=String.fromCharCode(v)}return d},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,f){const p=c.length;if(!p)return 0;let d=0,_=0;if(this._interim){const v=c.charCodeAt(_++);56320<=v&&v<=57343?f[d++]=1024*(this._interim-55296)+v-56320+65536:(f[d++]=this._interim,f[d++]=v),this._interim=0}for(let v=_;v=p)return this._interim=w,d;const C=c.charCodeAt(v);56320<=C&&C<=57343?f[d++]=1024*(w-55296)+C-56320+65536:(f[d++]=w,f[d++]=C)}else w!==65279&&(f[d++]=w)}return d}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,f){const p=c.length;if(!p)return 0;let d,_,v,w,C=0,b=0,S=0;if(this.interim[0]){let E=!1,R=this.interim[0];R&=(224&R)==192?31:(240&R)==224?15:7;let N,D=0;for(;(N=63&this.interim[++D])&&D<4;)R<<=6,R|=N;const T=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,j=T-D;for(;S=p)return 0;if(N=c[S++],(192&N)!=128){S--,E=!0;break}this.interim[D++]=N,R<<=6,R|=63&N}E||(T===2?R<128?S--:f[C++]=R:T===3?R<2048||R>=55296&&R<=57343||R===65279||(f[C++]=R):R<65536||R>1114111||(f[C++]=R)),this.interim.fill(0)}const x=p-4;let y=S;for(;y=p)return this.interim[0]=d,C;if(_=c[y++],(192&_)!=128){y--;continue}if(b=(31&d)<<6|63&_,b<128){y--;continue}f[C++]=b}else if((240&d)==224){if(y>=p)return this.interim[0]=d,C;if(_=c[y++],(192&_)!=128){y--;continue}if(y>=p)return this.interim[0]=d,this.interim[1]=_,C;if(v=c[y++],(192&v)!=128){y--;continue}if(b=(15&d)<<12|(63&_)<<6|63&v,b<2048||b>=55296&&b<=57343||b===65279)continue;f[C++]=b}else if((248&d)==240){if(y>=p)return this.interim[0]=d,C;if(_=c[y++],(192&_)!=128){y--;continue}if(y>=p)return this.interim[0]=d,this.interim[1]=_,C;if(v=c[y++],(192&v)!=128){y--;continue}if(y>=p)return this.interim[0]=d,this.interim[1]=_,this.interim[2]=v,C;if(w=c[y++],(192&w)!=128){y--;continue}if(b=(7&d)<<18|(63&_)<<12|(63&v)<<6|63&w,b<65536||b>1114111)continue;f[C++]=b}}return C}}},225:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const f=c(1480),p=[[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]],d=[[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]];let _;o.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let v=0;vC[x][1])return!1;for(;x>=S;)if(b=S+x>>1,w>C[b][1])S=b+1;else{if(!(w=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,w){let C=this.wcwidth(v),b=C===0&&w!==0;if(b){const S=f.UnicodeService.extractWidth(w);S===0?b=!1:S>C&&(C=S)}return f.UnicodeService.createPropertyValue(0,C,b)}}},5981:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const f=c(8460),p=c(844);class d extends p.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,w){if(w!==void 0&&this._syncCalls>w)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const b=this._callbacks.shift();b&&b()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,w){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(w),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(w)}_innerWrite(v=0,w=!0){const C=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const b=this._writeBuffer[this._bufferOffset],S=this._action(b,w);if(S){const y=E=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,E))):this._innerWrite(C,E);return void S.catch((E=>(queueMicrotask((()=>{throw E})),Promise.resolve(!1)))).then(y)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=b.length,Date.now()-C>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(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()}}o.WriteBuffer=d},5941:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.parseColor=void 0;const c=/^([\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})$/,f=/^[\da-f]+$/;function p(d,_){const v=d.toString(16),w=v.length<2?"0"+v:v;switch(_){case 4:return v[0];case 8:return w;case 12:return(w+w).slice(0,3);default:return w+w}}o.parseColor=function(d){if(!d)return;let _=d.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);const v=c.exec(_);if(v){const w=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/w*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/w*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/w*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),f.exec(_)&&[3,6,9,12].includes(_.length))){const v=_.length/3,w=[0,0,0];for(let C=0;C<3;++C){const b=parseInt(_.slice(v*C,v*C+v),16);w[C]=v===1?b<<4:v===2?b:v===3?b>>4:b>>8}return w}},o.toRgbString=function(d,_=16){const[v,w,C]=d;return`rgb:${p(v,_)}/${p(w,_)}/${p(C,_)}`}},5770:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const f=c(482),p=c(8742),d=c(5770),_=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(w,C){this._handlers[w]===void 0&&(this._handlers[w]=[]);const b=this._handlers[w];return b.push(C),{dispose:()=>{const S=b.indexOf(C);S!==-1&&b.splice(S,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}reset(){if(this._active.length)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(w,C){if(this.reset(),this._ident=w,this._active=this._handlers[w]||_,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(w,C,b){if(this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].put(w,C,b);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(w,C,b))}unhook(w,C=!0){if(this._active.length){let b=!1,S=this._active.length-1,x=!1;if(this._stack.paused&&(S=this._stack.loopPosition-1,b=C,x=this._stack.fallThrough,this._stack.paused=!1),!x&&b===!1){for(;S>=0&&(b=this._active[S].unhook(w),b!==!0);S--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!1,b;S--}for(;S>=0;S--)if(b=this._active[S].unhook(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!0,b}else this._handlerFb(this._ident,"UNHOOK",w);this._active=_,this._ident=0}};const v=new p.Params;v.addParam(0),o.DcsHandler=class{constructor(w){this._handler=w,this._data="",this._params=v,this._hitLimit=!1}hook(w){this._params=w.length>1||w.params[0]?w.clone():v,this._data="",this._hitLimit=!1}put(w,C,b){this._hitLimit||(this._data+=(0,f.utf32ToString)(w,C,b),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(w){let C=!1;if(this._hitLimit)C=!1;else if(w&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((b=>(this._params=v,this._data="",this._hitLimit=!1,b)));return this._params=v,this._data="",this._hitLimit=!1,C}}},2015:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const f=c(844),p=c(8742),d=c(6242),_=c(6351);class v{constructor(S){this.table=new Uint8Array(S)}setDefault(S,x){this.table.fill(S<<4|x)}add(S,x,y,E){this.table[x<<8|S]=y<<4|E}addMany(S,x,y,E){for(let R=0;RT)),x=(D,T)=>S.slice(D,T),y=x(32,127),E=x(0,24);E.push(25),E.push.apply(E,x(28,32));const R=x(0,14);let N;for(N in b.setDefault(1,0),b.addMany(y,0,2,0),R)b.addMany([24,26,153,154],N,3,0),b.addMany(x(128,144),N,3,0),b.addMany(x(144,152),N,3,0),b.add(156,N,0,0),b.add(27,N,11,1),b.add(157,N,4,8),b.addMany([152,158,159],N,0,7),b.add(155,N,11,3),b.add(144,N,11,9);return b.addMany(E,0,3,0),b.addMany(E,1,3,1),b.add(127,1,0,1),b.addMany(E,8,0,8),b.addMany(E,3,3,3),b.add(127,3,0,3),b.addMany(E,4,3,4),b.add(127,4,0,4),b.addMany(E,6,3,6),b.addMany(E,5,3,5),b.add(127,5,0,5),b.addMany(E,2,3,2),b.add(127,2,0,2),b.add(93,1,4,8),b.addMany(y,8,5,8),b.add(127,8,5,8),b.addMany([156,27,24,26,7],8,6,0),b.addMany(x(28,32),8,0,8),b.addMany([88,94,95],1,0,7),b.addMany(y,7,0,7),b.addMany(E,7,0,7),b.add(156,7,0,0),b.add(127,7,0,7),b.add(91,1,11,3),b.addMany(x(64,127),3,7,0),b.addMany(x(48,60),3,8,4),b.addMany([60,61,62,63],3,9,4),b.addMany(x(48,60),4,8,4),b.addMany(x(64,127),4,7,0),b.addMany([60,61,62,63],4,0,6),b.addMany(x(32,64),6,0,6),b.add(127,6,0,6),b.addMany(x(64,127),6,0,0),b.addMany(x(32,48),3,9,5),b.addMany(x(32,48),5,9,5),b.addMany(x(48,64),5,0,6),b.addMany(x(64,127),5,7,0),b.addMany(x(32,48),4,9,5),b.addMany(x(32,48),1,9,2),b.addMany(x(32,48),2,9,2),b.addMany(x(48,127),2,10,0),b.addMany(x(48,80),1,10,0),b.addMany(x(81,88),1,10,0),b.addMany([89,90,92],1,10,0),b.addMany(x(96,127),1,10,0),b.add(80,1,11,9),b.addMany(E,9,0,9),b.add(127,9,0,9),b.addMany(x(28,32),9,0,9),b.addMany(x(32,48),9,9,12),b.addMany(x(48,60),9,8,10),b.addMany([60,61,62,63],9,9,10),b.addMany(E,11,0,11),b.addMany(x(32,128),11,0,11),b.addMany(x(28,32),11,0,11),b.addMany(E,10,0,10),b.add(127,10,0,10),b.addMany(x(28,32),10,0,10),b.addMany(x(48,60),10,8,10),b.addMany([60,61,62,63],10,0,11),b.addMany(x(32,48),10,9,12),b.addMany(E,12,0,12),b.add(127,12,0,12),b.addMany(x(28,32),12,0,12),b.addMany(x(32,48),12,9,12),b.addMany(x(48,64),12,0,11),b.addMany(x(64,127),12,12,13),b.addMany(x(64,127),10,12,13),b.addMany(x(64,127),9,12,13),b.addMany(E,13,13,13),b.addMany(y,13,13,13),b.add(127,13,0,13),b.addMany([27,156,24,26],13,14,0),b.add(w,0,2,0),b.add(w,8,5,8),b.add(w,6,0,6),b.add(w,11,0,11),b.add(w,13,13,13),b})();class C extends f.Disposable{constructor(S=o.VT500_TRANSITION_TABLE){super(),this._transitions=S,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(x,y,E)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,y)=>{},this._escHandlerFb=x=>{},this._errorHandlerFb=x=>x,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,f.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new d.OscParser),this._dcsParser=this.register(new _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(S,x=[64,126]){let y=0;if(S.prefix){if(S.prefix.length>1)throw new Error("only one byte as prefix supported");if(y=S.prefix.charCodeAt(0),y&&60>y||y>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(S.intermediates){if(S.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let R=0;RN||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");y<<=8,y|=N}}if(S.final.length!==1)throw new Error("final must be a single byte");const E=S.final.charCodeAt(0);if(x[0]>E||E>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return y<<=8,y|=E,y}identToString(S){const x=[];for(;S;)x.push(String.fromCharCode(255&S)),S>>=8;return x.reverse().join("")}setPrintHandler(S){this._printHandler=S}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(S,x){const y=this._identifier(S,[48,126]);this._escHandlers[y]===void 0&&(this._escHandlers[y]=[]);const E=this._escHandlers[y];return E.push(x),{dispose:()=>{const R=E.indexOf(x);R!==-1&&E.splice(R,1)}}}clearEscHandler(S){this._escHandlers[this._identifier(S,[48,126])]&&delete this._escHandlers[this._identifier(S,[48,126])]}setEscHandlerFallback(S){this._escHandlerFb=S}setExecuteHandler(S,x){this._executeHandlers[S.charCodeAt(0)]=x}clearExecuteHandler(S){this._executeHandlers[S.charCodeAt(0)]&&delete this._executeHandlers[S.charCodeAt(0)]}setExecuteHandlerFallback(S){this._executeHandlerFb=S}registerCsiHandler(S,x){const y=this._identifier(S);this._csiHandlers[y]===void 0&&(this._csiHandlers[y]=[]);const E=this._csiHandlers[y];return E.push(x),{dispose:()=>{const R=E.indexOf(x);R!==-1&&E.splice(R,1)}}}clearCsiHandler(S){this._csiHandlers[this._identifier(S)]&&delete this._csiHandlers[this._identifier(S)]}setCsiHandlerFallback(S){this._csiHandlerFb=S}registerDcsHandler(S,x){return this._dcsParser.registerHandler(this._identifier(S),x)}clearDcsHandler(S){this._dcsParser.clearHandler(this._identifier(S))}setDcsHandlerFallback(S){this._dcsParser.setHandlerFallback(S)}registerOscHandler(S,x){return this._oscParser.registerHandler(S,x)}clearOscHandler(S){this._oscParser.clearHandler(S)}setOscHandlerFallback(S){this._oscParser.setHandlerFallback(S)}setErrorHandler(S){this._errorHandler=S}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(S,x,y,E,R){this._parseStack.state=S,this._parseStack.handlers=x,this._parseStack.handlerPos=y,this._parseStack.transition=E,this._parseStack.chunkPos=R}parse(S,x,y){let E,R=0,N=0,D=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,D=this._parseStack.chunkPos+1;else{if(y===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const T=this._parseStack.handlers;let j=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(y===!1&&j>-1){for(;j>=0&&(E=T[j](this._params),E!==!0);j--)if(E instanceof Promise)return this._parseStack.handlerPos=j,E}this._parseStack.handlers=[];break;case 4:if(y===!1&&j>-1){for(;j>=0&&(E=T[j](),E!==!0);j--)if(E instanceof Promise)return this._parseStack.handlerPos=j,E}this._parseStack.handlers=[];break;case 6:if(R=S[this._parseStack.chunkPos],E=this._dcsParser.unhook(R!==24&&R!==26,y),E)return E;R===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(R=S[this._parseStack.chunkPos],E=this._oscParser.end(R!==24&&R!==26,y),E)return E;R===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,D=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let T=D;T>4){case 2:for(let H=T+1;;++H){if(H>=x||(R=S[H])<32||R>126&&R=x||(R=S[H])<32||R>126&&R=x||(R=S[H])<32||R>126&&R=x||(R=S[H])<32||R>126&&R=0&&(E=j[B](this._params),E!==!0);B--)if(E instanceof Promise)return this._preserveStack(3,j,B,N,T),E;B<0&&this._csiHandlerFb(this._collect<<8|R,this._params),this.precedingJoinState=0;break;case 8:do switch(R){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(R-48)}while(++T47&&R<60);T--;break;case 9:this._collect<<=8,this._collect|=R;break;case 10:const F=this._escHandlers[this._collect<<8|R];let Y=F?F.length-1:-1;for(;Y>=0&&(E=F[Y](),E!==!0);Y--)if(E instanceof Promise)return this._preserveStack(4,F,Y,N,T),E;Y<0&&this._escHandlerFb(this._collect<<8|R),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|R,this._params);break;case 13:for(let H=T+1;;++H)if(H>=x||(R=S[H])===24||R===26||R===27||R>127&&R=x||(R=S[H])<32||R>127&&R{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const f=c(5770),p=c(482),d=[];o.OscParser=class{constructor(){this._state=0,this._active=d,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(_,v){this._handlers[_]===void 0&&(this._handlers[_]=[]);const w=this._handlers[_];return w.push(v),{dispose:()=>{const C=w.indexOf(v);C!==-1&&w.splice(C,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].end(!1);this._stack.paused=!1,this._active=d,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||d,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,v,w){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(_,v,w);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(_,v,w))}start(){this.reset(),this._state=1}put(_,v,w){if(this._state!==3){if(this._state===1)for(;v0&&this._put(_,v,w)}}end(_,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let w=!1,C=this._active.length-1,b=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,w=v,b=this._stack.fallThrough,this._stack.paused=!1),!b&&w===!1){for(;C>=0&&(w=this._active[C].end(_),w!==!0);C--)if(w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,w;C--}for(;C>=0;C--)if(w=this._active[C].end(!1),w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,w}else this._handlerFb(this._id,"END",_);this._active=d,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,v,w){this._hitLimit||(this._data+=(0,p.utf32ToString)(_,v,w),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let v=!1;if(this._hitLimit)v=!1;else if(_&&(v=this._handler(this._data),v instanceof Promise))return v.then((w=>(this._data="",this._hitLimit=!1,w)));return this._data="",this._hitLimit=!1,v}}},8742:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const c=2147483647;class f{static fromArray(d){const _=new f;if(!d.length)return _;for(let v=Array.isArray(d[0])?1:0;v256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new f(this.maxLength,this.maxSubParamsLength);return d.params.set(this.params),d.length=this.length,d._subParams.set(this._subParams),d._subParamsLength=this._subParamsLength,d._subParamsIdx.set(this._subParamsIdx),d._rejectDigits=this._rejectDigits,d._rejectSubDigits=this._rejectSubDigits,d._digitIsSub=this._digitIsSub,d}toArray(){const d=[];for(let _=0;_>8,w=255&this._subParamsIdx[_];w-v>0&&d.push(Array.prototype.slice.call(this._subParams,v,w))}return d}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(d){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=d>c?c:d}}addSubParam(d){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=d>c?c:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const _=this._subParamsIdx[d]>>8,v=255&this._subParamsIdx[d];return v-_>0?this._subParams.subarray(_,v):null}getSubParamsAll(){const d={};for(let _=0;_>8,w=255&this._subParamsIdx[_];w-v>0&&(d[_]=this._subParams.slice(v,w))}return d}addDigit(d){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,w=v[_-1];v[_-1]=~w?Math.min(10*w+d,c):d}}o.Params=f},5741:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let c=this._addons.length-1;c>=0;c--)this._addons[c].instance.dispose()}loadAddon(c,f){const p={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(p),f.dispose=()=>this._wrappedAddonDispose(p),f.activate(c)}_wrappedAddonDispose(c){if(c.isDisposed)return;let f=-1;for(let p=0;p{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const f=c(3785),p=c(511);o.BufferApiView=class{constructor(d,_){this._buffer=d,this.type=_}init(d){return this._buffer=d,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(d){const _=this._buffer.lines.get(d);if(_)return new f.BufferLineApiView(_)}getNullCell(){return new p.CellData}}},3785:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const f=c(511);o.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,d){if(!(p<0||p>=this._line.length))return d?(this._line.loadCell(p,d),d):this._line.loadCell(p,new f.CellData)}translateToString(p,d,_){return this._line.translateToString(p,d,_)}}},8285:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const f=c(8771),p=c(8460),d=c(844);class _ extends d.Disposable{constructor(w){super(),this._core=w,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.BufferApiView(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)}}o.BufferNamespaceApi=_},7975:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(c){this._core=c}registerCsiHandler(c,f){return this._core.registerCsiHandler(c,(p=>f(p.toArray())))}addCsiHandler(c,f){return this.registerCsiHandler(c,f)}registerDcsHandler(c,f){return this._core.registerDcsHandler(c,((p,d)=>f(p,d.toArray())))}addDcsHandler(c,f){return this.registerDcsHandler(c,f)}registerEscHandler(c,f){return this._core.registerEscHandler(c,f)}addEscHandler(c,f){return this.registerEscHandler(c,f)}registerOscHandler(c,f){return this._core.registerOscHandler(c,f)}addOscHandler(c,f){return this.registerOscHandler(c,f)}}},7090:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.UnicodeApi=class{constructor(c){this._core=c}register(c){this._core.unicodeService.register(c)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(c){this._core.unicodeService.activeVersion=c}}},744:function(u,o,c){var f=this&&this.__decorate||function(b,S,x,y){var E,R=arguments.length,N=R<3?S:y===null?y=Object.getOwnPropertyDescriptor(S,x):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,S,x,y);else for(var D=b.length-1;D>=0;D--)(E=b[D])&&(N=(R<3?E(N):R>3?E(S,x,N):E(S,x))||N);return R>3&&N&&Object.defineProperty(S,x,N),N},p=this&&this.__param||function(b,S){return function(x,y){S(x,y,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const d=c(8460),_=c(844),v=c(5295),w=c(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let C=o.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(b){super(),this.isUserScrolling=!1,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(b.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(b.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(b,this))}resize(b,S){this.cols=b,this.rows=S,this.buffers.resize(b,S),this._onResize.fire({cols:b,rows:S})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(b,S=!1){const x=this.buffer;let y;y=this._cachedBlankLine,y&&y.length===this.cols&&y.getFg(0)===b.fg&&y.getBg(0)===b.bg||(y=x.getBlankLine(b,S),this._cachedBlankLine=y),y.isWrapped=S;const E=x.ybase+x.scrollTop,R=x.ybase+x.scrollBottom;if(x.scrollTop===0){const N=x.lines.isFull;R===x.lines.length-1?N?x.lines.recycle().copyFrom(y):x.lines.push(y.clone()):x.lines.splice(R+1,0,y.clone()),N?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const N=R-E+1;x.lines.shiftElements(E+1,N-1,-1),x.lines.set(R,y.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(b,S,x){const y=this.buffer;if(b<0){if(y.ydisp===0)return;this.isUserScrolling=!0}else b+y.ydisp>=y.ybase&&(this.isUserScrolling=!1);const E=y.ydisp;y.ydisp=Math.max(Math.min(y.ydisp+b,y.ybase),0),E!==y.ydisp&&(S||this._onScroll.fire(y.ydisp))}};o.BufferService=C=f([p(0,w.IOptionsService)],C)},7994:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CharsetService=void 0,o.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(c){this.glevel=c,this.charset=this._charsets[c]}setgCharset(c,f){this._charsets[c]=f,this.glevel===c&&(this.charset=f)}}},1753:function(u,o,c){var f=this&&this.__decorate||function(y,E,R,N){var D,T=arguments.length,j=T<3?E:N===null?N=Object.getOwnPropertyDescriptor(E,R):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(y,E,R,N);else for(var B=y.length-1;B>=0;B--)(D=y[B])&&(j=(T<3?D(j):T>3?D(E,R,j):D(E,R))||j);return T>3&&j&&Object.defineProperty(E,R,j),j},p=this&&this.__param||function(y,E){return function(R,N){E(R,N,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const d=c(2585),_=c(8460),v=c(844),w={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:y=>y.button!==4&&y.action===1&&(y.ctrl=!1,y.alt=!1,y.shift=!1,!0)},VT200:{events:19,restrict:y=>y.action!==32},DRAG:{events:23,restrict:y=>y.action!==32||y.button!==3},ANY:{events:31,restrict:y=>!0}};function C(y,E){let R=(y.ctrl?16:0)|(y.shift?4:0)|(y.alt?8:0);return y.button===4?(R|=64,R|=y.action):(R|=3&y.button,4&y.button&&(R|=64),8&y.button&&(R|=128),y.action===32?R|=32:y.action!==0||E||(R|=3)),R}const b=String.fromCharCode,S={DEFAULT:y=>{const E=[C(y,!1)+32,y.col+32,y.row+32];return E[0]>255||E[1]>255||E[2]>255?"":`\x1B[M${b(E[0])}${b(E[1])}${b(E[2])}`},SGR:y=>{const E=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.col};${y.row}${E}`},SGR_PIXELS:y=>{const E=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.x};${y.y}${E}`}};let x=o.CoreMouseService=class extends v.Disposable{constructor(y,E){super(),this._bufferService=y,this._coreService=E,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const R of Object.keys(w))this.addProtocol(R,w[R]);for(const R of Object.keys(S))this.addEncoding(R,S[R]);this.reset()}addProtocol(y,E){this._protocols[y]=E}addEncoding(y,E){this._encodings[y]=E}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(y){if(!this._protocols[y])throw new Error(`unknown protocol "${y}"`);this._activeProtocol=y,this._onProtocolChange.fire(this._protocols[y].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(y){if(!this._encodings[y])throw new Error(`unknown encoding "${y}"`);this._activeEncoding=y}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(y){if(y.col<0||y.col>=this._bufferService.cols||y.row<0||y.row>=this._bufferService.rows||y.button===4&&y.action===32||y.button===3&&y.action!==32||y.button!==4&&(y.action===2||y.action===3)||(y.col++,y.row++,y.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,y,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(y))return!1;const E=this._encodings[this._activeEncoding](y);return E&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(E):this._coreService.triggerDataEvent(E,!0)),this._lastEvent=y,!0}explainEvents(y){return{down:!!(1&y),up:!!(2&y),drag:!!(4&y),move:!!(8&y),wheel:!!(16&y)}}_equalEvents(y,E,R){if(R){if(y.x!==E.x||y.y!==E.y)return!1}else if(y.col!==E.col||y.row!==E.row)return!1;return y.button===E.button&&y.action===E.action&&y.ctrl===E.ctrl&&y.alt===E.alt&&y.shift===E.shift}};o.CoreMouseService=x=f([p(0,d.IBufferService),p(1,d.ICoreService)],x)},6975:function(u,o,c){var f=this&&this.__decorate||function(x,y,E,R){var N,D=arguments.length,T=D<3?y:R===null?R=Object.getOwnPropertyDescriptor(y,E):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,y,E,R);else for(var j=x.length-1;j>=0;j--)(N=x[j])&&(T=(D<3?N(T):D>3?N(y,E,T):N(y,E))||T);return D>3&&T&&Object.defineProperty(y,E,T),T},p=this&&this.__param||function(x,y){return function(E,R){y(E,R,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const d=c(1439),_=c(8460),v=c(844),w=c(2585),C=Object.freeze({insertMode:!1}),b=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let S=o.CoreService=class extends v.Disposable{constructor(x,y,E){super(),this._bufferService=x,this._logService=y,this._optionsService=E,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(C),this.decPrivateModes=(0,d.clone)(b)}reset(){this.modes=(0,d.clone)(C),this.decPrivateModes=(0,d.clone)(b)}triggerDataEvent(x,y=!1){if(this._optionsService.rawOptions.disableStdin)return;const E=this._bufferService.buffer;y&&this._optionsService.rawOptions.scrollOnUserInput&&E.ybase!==E.ydisp&&this._onRequestScrollToBottom.fire(),y&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((R=>R.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((y=>y.charCodeAt(0))))),this._onBinary.fire(x))}};o.CoreService=S=f([p(0,w.IBufferService),p(1,w.ILogService),p(2,w.IOptionsService)],S)},9074:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const f=c(8055),p=c(8460),d=c(844),_=c(6106);let v=0,w=0;class C extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((x=>x==null?void 0:x.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const y=new b(x);if(y){const E=y.marker.onDispose((()=>y.dispose()));y.onDispose((()=>{y&&(this._decorations.delete(y)&&this._onDecorationRemoved.fire(y),E.dispose())})),this._decorations.insert(y),this._onDecorationRegistered.fire(y)}return y}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,y,E){let R=0,N=0;for(const D of this._decorations.getKeyIterator(y))R=D.options.x??0,N=R+(D.options.width??1),x>=R&&x{v=N.options.x??0,w=v+(N.options.width??1),x>=v&&x{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const f=c(2585),p=c(8343);class d{constructor(...v){this._entries=new Map;for(const[w,C]of v)this.set(w,C)}set(v,w){const C=this._entries.get(v);return this._entries.set(v,w),C}forEach(v){for(const[w,C]of this._entries.entries())v(w,C)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}o.ServiceCollection=d,o.InstantiationService=class{constructor(){this._services=new d,this._services.set(f.IInstantiationService,this)}setService(_,v){this._services.set(_,v)}getService(_){return this._services.get(_)}createInstance(_,...v){const w=(0,p.getServiceDependencies)(_).sort(((S,x)=>S.index-x.index)),C=[];for(const S of w){const x=this._services.get(S.id);if(!x)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${S.id}.`);C.push(x)}const b=w.length>0?w[0].index:v.length;if(v.length!==b)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${b+1} conflicts with ${v.length} static arguments`);return new _(...v,...C)}}},7866:function(u,o,c){var f=this&&this.__decorate||function(b,S,x,y){var E,R=arguments.length,N=R<3?S:y===null?y=Object.getOwnPropertyDescriptor(S,x):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,S,x,y);else for(var D=b.length-1;D>=0;D--)(E=b[D])&&(N=(R<3?E(N):R>3?E(S,x,N):E(S,x))||N);return R>3&&N&&Object.defineProperty(S,x,N),N},p=this&&this.__param||function(b,S){return function(x,y){S(x,y,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const d=c(844),_=c(2585),v={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF};let w,C=o.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(b){super(),this._optionsService=b,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),w=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(b){for(let S=0;SJSON.stringify(N))).join(", ")})`);const R=y.apply(this,E);return w.trace(`GlyphRenderer#${y.name} return`,R),R}}},7302:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const f=c(8460),p=c(844),d=c(6114);o.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:d.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const _=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends p.Disposable{constructor(C){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const b={...o.DEFAULT_OPTIONS};for(const S in C)if(S in b)try{const x=C[S];b[S]=this._sanitizeAndValidateOption(S,x)}catch(x){console.error(x)}this.rawOptions=b,this.options={...b},this._setupOptions(),this.register((0,p.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,b){return this.onOptionChange((S=>{S===C&&b(this.rawOptions[C])}))}onMultipleOptionChange(C,b){return this.onOptionChange((S=>{C.indexOf(S)!==-1&&b()}))}_setupOptions(){const C=S=>{if(!(S in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${S}"`);return this.rawOptions[S]},b=(S,x)=>{if(!(S in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${S}"`);x=this._sanitizeAndValidateOption(S,x),this.rawOptions[S]!==x&&(this.rawOptions[S]=x,this._onOptionChange.fire(S))};for(const S in this.rawOptions){const x={get:C.bind(this,S),set:b.bind(this,S)};Object.defineProperty(this.options,S,x)}}_sanitizeAndValidateOption(C,b){switch(C){case"cursorStyle":if(b||(b=o.DEFAULT_OPTIONS[C]),!(function(S){return S==="block"||S==="underline"||S==="bar"})(b))throw new Error(`"${b}" is not a valid value for ${C}`);break;case"wordSeparator":b||(b=o.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof b=="number"&&1<=b&&b<=1e3)break;b=_.includes(b)?b:o.DEFAULT_OPTIONS[C];break;case"cursorWidth":b=Math.floor(b);case"lineHeight":case"tabStopWidth":if(b<1)throw new Error(`${C} cannot be less than 1, value: ${b}`);break;case"minimumContrastRatio":b=Math.max(1,Math.min(21,Math.round(10*b)/10));break;case"scrollback":if((b=Math.min(b,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${b}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(b<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${b}`);break;case"rows":case"cols":if(!b&&b!==0)throw new Error(`${C} must be numeric, value: ${b}`);break;case"windowsPty":b=b??{}}return b}}o.OptionsService=v},2660:function(u,o,c){var f=this&&this.__decorate||function(v,w,C,b){var S,x=arguments.length,y=x<3?w:b===null?b=Object.getOwnPropertyDescriptor(w,C):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(v,w,C,b);else for(var E=v.length-1;E>=0;E--)(S=v[E])&&(y=(x<3?S(y):x>3?S(w,C,y):S(w,C))||y);return x>3&&y&&Object.defineProperty(w,C,y),y},p=this&&this.__param||function(v,w){return function(C,b){w(C,b,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const d=c(2585);let _=o.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const w=this._bufferService.buffer;if(v.id===void 0){const E=w.addMarker(w.ybase+w.y),R={data:v,id:this._nextId++,lines:[E]};return E.onDispose((()=>this._removeMarkerFromLink(R,E))),this._dataByLinkId.set(R.id,R),R.id}const C=v,b=this._getEntryIdKey(C),S=this._entriesWithId.get(b);if(S)return this.addLineToLink(S.id,w.ybase+w.y),S.id;const x=w.addMarker(w.ybase+w.y),y={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(y,x))),this._entriesWithId.set(y.key,y),this._dataByLinkId.set(y.id,y),y.id}addLineToLink(v,w){const C=this._dataByLinkId.get(v);if(C&&C.lines.every((b=>b.line!==w))){const b=this._bufferService.buffer.addMarker(w);C.lines.push(b),b.onDispose((()=>this._removeMarkerFromLink(C,b)))}}getLinkData(v){var w;return(w=this._dataByLinkId.get(v))==null?void 0:w.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,w){const C=v.lines.indexOf(w);C!==-1&&(v.lines.splice(C,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};o.OscLinkService=_=f([p(0,d.IBufferService)],_)},8343:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const c="di$target",f="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(p){return p[f]||[]},o.createDecorator=function(p){if(o.serviceRegistry.has(p))return o.serviceRegistry.get(p);const d=function(_,v,w){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,b,S){b[c]===b?b[f].push({id:C,index:S}):(b[f]=[{id:C,index:S}],b[c]=b)})(d,_,w)};return d.toString=()=>p,o.serviceRegistry.set(p,d),d}},2585:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const f=c(8343);var p;o.IBufferService=(0,f.createDecorator)("BufferService"),o.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),o.ICoreService=(0,f.createDecorator)("CoreService"),o.ICharsetService=(0,f.createDecorator)("CharsetService"),o.IInstantiationService=(0,f.createDecorator)("InstantiationService"),(function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"})(p||(o.LogLevelEnum=p={})),o.ILogService=(0,f.createDecorator)("LogService"),o.IOptionsService=(0,f.createDecorator)("OptionsService"),o.IOscLinkService=(0,f.createDecorator)("OscLinkService"),o.IUnicodeService=(0,f.createDecorator)("UnicodeService"),o.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const f=c(8460),p=c(225);class d{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,w,C=!1){return(16777215&v)<<3|(3&w)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const v=new p.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let w=0,C=0;const b=v.length;for(let S=0;S=b)return w+this.wcwidth(x);const R=v.charCodeAt(S);56320<=R&&R<=57343?x=1024*(x-55296)+R-56320+65536:w+=this.wcwidth(R)}const y=this.charProperties(x,C);let E=d.extractWidth(y);d.extractShouldJoin(y)&&(E-=d.extractWidth(C)),w+=E,C=y}return w}charProperties(v,w){return this._activeProvider.charProperties(v,w)}}o.UnicodeService=d}},r={};function a(u){var o=r[u];if(o!==void 0)return o.exports;var c=r[u]={exports:{}};return n[u].call(c.exports,c,c.exports,a),c.exports}var l={};return(()=>{var u=l;Object.defineProperty(u,"__esModule",{value:!0}),u.Terminal=void 0;const o=a(9042),c=a(3236),f=a(844),p=a(5741),d=a(8285),_=a(7975),v=a(7090),w=["cols","rows"];class C extends f.Disposable{constructor(S){super(),this._core=this.register(new c.Terminal(S)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const x=E=>this._core.options[E],y=(E,R)=>{this._checkReadonlyOptions(E),this._core.options[E]=R};for(const E in this._core.options){const R={get:x.bind(this,E),set:y.bind(this,E)};Object.defineProperty(this._publicOptions,E,R)}}_checkReadonlyOptions(S){if(w.includes(S))throw new Error(`Option "${S}" 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 _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.UnicodeApi(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 d.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const S=this._core.coreService.decPrivateModes;let x="none";switch(this._core.coreMouseService.activeProtocol){case"X10":x="x10";break;case"VT200":x="vt200";break;case"DRAG":x="drag";break;case"ANY":x="any"}return{applicationCursorKeysMode:S.applicationCursorKeys,applicationKeypadMode:S.applicationKeypad,bracketedPasteMode:S.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:S.origin,reverseWraparoundMode:S.reverseWraparound,sendFocusMode:S.sendFocus,wraparoundMode:S.wraparound}}get options(){return this._publicOptions}set options(S){for(const x in S)this._publicOptions[x]=S[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(S,x=!0){this._core.input(S,x)}resize(S,x){this._verifyIntegers(S,x),this._core.resize(S,x)}open(S){this._core.open(S)}attachCustomKeyEventHandler(S){this._core.attachCustomKeyEventHandler(S)}attachCustomWheelEventHandler(S){this._core.attachCustomWheelEventHandler(S)}registerLinkProvider(S){return this._core.registerLinkProvider(S)}registerCharacterJoiner(S){return this._checkProposedApi(),this._core.registerCharacterJoiner(S)}deregisterCharacterJoiner(S){this._checkProposedApi(),this._core.deregisterCharacterJoiner(S)}registerMarker(S=0){return this._verifyIntegers(S),this._core.registerMarker(S)}registerDecoration(S){return this._checkProposedApi(),this._verifyPositiveIntegers(S.x??0,S.width??0,S.height??0),this._core.registerDecoration(S)}hasSelection(){return this._core.hasSelection()}select(S,x,y){this._verifyIntegers(S,x,y),this._core.select(S,x,y)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(S,x){this._verifyIntegers(S,x),this._core.selectLines(S,x)}dispose(){super.dispose()}scrollLines(S){this._verifyIntegers(S),this._core.scrollLines(S)}scrollPages(S){this._verifyIntegers(S),this._core.scrollPages(S)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(S){this._verifyIntegers(S),this._core.scrollToLine(S)}clear(){this._core.clear()}write(S,x){this._core.write(S,x)}writeln(S,x){this._core.write(S),this._core.write(`\r -`,x)}paste(S){this._core.paste(S)}refresh(S,x){this._verifyIntegers(S,x),this._core.refresh(S,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(S){this._addonManager.loadAddon(this,S)}static get strings(){return o}_verifyIntegers(...S){for(const x of S)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...S){for(const x of S)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}u.Terminal=C})(),l})()))})(dp)),dp.exports}var fB=hB();function kb(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r{const n=t.current;if(!n)return;const r=new fB.Terminal({convertEol:!0,disableStdin:!0,fontSize:12,fontFamily:'ui-monospace, "SF Mono", Menlo, Consolas, monospace',scrollback:2e4,theme:{background:"#1a1a1a",foreground:"#e6e1e0",cursor:"#1a1a1a",selectionBackground:"#2c3441"}}),a=new uB.FitAddon;r.loadAddon(a),r.open(n);try{a.fit()}catch{}const l=new ResizeObserver(()=>{try{a.fit()}catch{}});l.observe(n);let u=!1,o=0,c=!1,f=!1;async function p(){if(c){f=!0;return}c=!0;try{for(;;){const _=await FN(e,o);if(u)return;if(_.dataBase64&&r.write(kb(_.dataBase64)),o=_.nextOffset,_.eof)break}}catch{}finally{c=!1,f&&!u&&(f=!1,p())}}const d=AT(e,_=>{if(u)return;const v=kb(_.dataBase64);!c&&_.offset===o?(r.write(v),o+=v.length):_.offset+v.length>o&&p()});return p(),()=>{u=!0,d(),l.disconnect(),r.dispose()}},[e]),m.jsx("div",{ref:t,style:{width:"100%",height:"100%"}})}const ea="__uncommitted__";function pB({state:e}){return!e||e.loading?m.jsx("div",{className:"changes-note",children:"Loading diff…"}):e.error?m.jsx("div",{className:"error",children:e.error}):e.payload?e.payload.truncated?m.jsx(oB,{bytesRead:e.payload.bytesRead,byteLimit:e.payload.byteLimit}):m.jsx(gC,{diff:e.payload.diff}):m.jsx("div",{className:"diff-empty",children:"No changes."})}function gB({experiment:e,project:t,view:n,runs:r,selectedRunId:a,onSelectRun:l}){const u=r.filter(o=>o.experimentId===e.id).sort((o,c)=>c.createdAt-o.createdAt);return n==="terminal"?m.jsx(mB,{experiment:e,expRuns:u,selectedRunId:a,onSelectRun:l}):m.jsx(_B,{experiment:e,project:t})}function mB({experiment:e,expRuns:t,selectedRunId:n,onSelectRun:r}){const[a,l]=q.useState(null),[u,o]=q.useState(!1),c=q.useRef(null),f=n&&t.find(w=>w.id===n)||t[0]||null,p=(f==null?void 0:f.status)==="running"||(f==null?void 0:f.status)==="starting",d=w=>{const C=t.findIndex(b=>b.id===w);return C===-1?t.length:t.length-C},_=q.useRef(null);q.useEffect(()=>{if(_.current===null){_.current=new Set(t.map(C=>C.id));return}const w=t.find(C=>!_.current.has(C.id));for(const C of t)_.current.add(C.id);w&&r(w.id)},[t,r]),q.useEffect(()=>{if(!u)return;const w=C=>{var b;(b=c.current)!=null&&b.contains(C.target)||o(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[u]);async function v(){if(f){l(null);try{await ZS(f.id)}catch(w){l(w instanceof Error?w.message:String(w))}}}return m.jsxs("div",{className:"term-view",children:[m.jsxs("div",{className:"term-bar",children:[m.jsx("div",{className:"term-title",title:e.title||e.slug,children:e.title||e.slug}),m.jsx("span",{style:{flex:1}}),a&&m.jsx("span",{className:"error",children:a}),p&&m.jsxs("button",{className:"btn sm ghost",onClick:()=>void v(),children:[m.jsx(BA,{size:13}),"Stop"]}),t.length>0&&f&&m.jsxs("div",{className:"run-history",ref:c,children:[m.jsxs("button",{className:"run-picker",title:"Switch run",onClick:()=>o(w=>!w),children:[m.jsxs("span",{className:"run-label",children:["Run ",d(f.id)]}),m.jsx(Vo,{status:f.status}),m.jsx(cs,{size:14,className:"run-picker-chev"})]}),u&&m.jsx("div",{className:"history-menu",children:t.map(w=>m.jsxs("button",{className:`history-item ${w.id===(f==null?void 0:f.id)?"active":""}`,onClick:()=>{r(w.id),o(!1)},children:[m.jsxs("span",{className:"run-label",children:["Run ",d(w.id)]}),m.jsx(Vo,{status:w.status}),m.jsx("span",{className:"when",children:Sa(w.createdAt)})]},w.id))})]})]}),m.jsx("div",{className:"term-fill",children:f?m.jsx(dB,{runId:f.id},f.id):m.jsx("div",{className:"term-empty",children:"No runs yet — ask the agent to launch one."})})]})}function _B({experiment:e,project:t}){const[n,r]=q.useState(null),[a,l]=q.useState(null),[u,o]=q.useState(null),[c,f]=q.useState(null),[p,d]=q.useState({}),_=!!(u&&u.diff.trim()!==""&&u.experimentId===e.id);async function v(){l(null);try{const[C,b]=await Promise.all([PN(e.id),By(e.projectId)]);r(C),o(b),f(S=>{var y;return S!==null?S:b.diff.trim()!==""&&b.experimentId===e.id?ea:((y=C[0])==null?void 0:y.sha)??null})}catch(C){l(C instanceof Error?C.message:String(C))}}q.useEffect(()=>{n===null&&!a&&v()},[n,a,e.id]),q.useEffect(()=>{const C=setInterval(()=>{By(e.projectId).then(o).catch(()=>{})},5e3);return()=>clearInterval(C)},[e.projectId]),q.useEffect(()=>{var C;c===ea&&u&&!_&&f(((C=n==null?void 0:n[0])==null?void 0:C.sha)??null)},[c,u,_,n]),q.useEffect(()=>{if(!c||c===ea||p[c])return;const C=c;d(b=>({...b,[C]:{loading:!0}})),UN(e.id,C).then(b=>d(S=>({...S,[C]:{loading:!1,payload:b}}))).catch(b=>d(S=>({...S,[C]:{loading:!1,error:b instanceof Error?b.message:String(b)}})))},[c,p,e.id]);const w=!_&&((n==null?void 0:n.length)??0)===0;return m.jsx("div",{className:"drawer",children:m.jsx("div",{className:"drawer-body",children:m.jsxs("div",{className:"drawer-section",children:[m.jsxs("div",{className:"changes-branch",children:[m.jsx("span",{className:"ctl-label",children:"Branch"}),m.jsx(qL,{owner:t.githubOwner,repo:t.githubRepo,branch:e.branchName})]}),a?m.jsx("div",{className:"error",children:a}):n===null?m.jsx("div",{className:"changes-note",children:"Loading changes…"}):w?m.jsx("div",{className:"changes-note",children:"No changes yet — the agent hasn't committed on this branch."}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"commit-picker",children:[m.jsx("span",{className:"ctl-label",children:"Commit"}),c===ea&&m.jsx("span",{className:"uncommitted-dot"}),m.jsxs("select",{className:"input sm",value:c??"",onChange:C=>f(C.target.value),children:[_&&m.jsx("option",{value:ea,children:"● Uncommitted changes"}),n.map(C=>m.jsxs("option",{value:C.sha,children:[C.sha.slice(0,7)," — ",C.subject]},C.sha))]}),m.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:()=>void v(),children:m.jsx(Sg,{size:14})})]}),m.jsx("div",{style:{marginTop:10},children:c===ea&&u?u.truncated?m.jsxs("div",{className:"truncated-notice",children:[m.jsx("h4",{children:"Diff too large to display"}),m.jsx("p",{children:"The uncommitted diff is too large to display. View it locally with git."})]}):m.jsx(gC,{diff:u.diff}):c?m.jsx(pB,{state:p[c]}):m.jsx("div",{className:"changes-note",children:"Select a commit to view its diff."})})]})]})})})}function vB(e,t){return Sw(e,pw(t))}function yB({projectId:e,path:t,sessionId:n,gitRef:r,onOpenFile:a}){const[l,u]=q.useState(null),[o,c]=q.useState(null),[f,p]=q.useState(!0),[d,_]=q.useState(0),v=/\.(md|mdx|markdown)$/i.test(t),[w,C]=q.useState(!1);q.useEffect(()=>{let y=!1;return p(!0),$N(e,t,{sessionId:n,ref:r}).then(E=>{y||(u(E),c(null))}).catch(E=>{y||c(E.message)}).finally(()=>{y||p(!1)}),()=>{y=!0}},[e,t,n,r,d]);const b=q.useMemo(()=>l&&!l.notFound?vB(l.content,t):null,[l,t]),S=l&&!l.notFound&&l.content?l.content.split(` +`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(T){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),S.isLinux&&T&&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(T){const j=this._getMouseBufferCoords(T),B=this._model.finalSelectionStart,z=this._model.finalSelectionEnd;return!!(B&&z&&j)&&this._areCoordsInSelection(j,B,z)}isCellInSelection(T,j){const B=this._model.finalSelectionStart,z=this._model.finalSelectionEnd;return!(!B||!z)&&this._areCoordsInSelection([T,j],B,z)}_areCoordsInSelection(T,j,B){return T[1]>j[1]&&T[1]=j[0]&&T[0]=j[0]}_selectWordAtCursor(T,j){var G,U;const B=(U=(G=this._linkifier.currentLink)==null?void 0:G.link)==null?void 0:U.range;if(B)return this._model.selectionStart=[B.start.x-1,B.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(B,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const z=this._getMouseBufferCoords(T);return!!z&&(this._selectWordAt(z,j),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(T,j){this._model.clearSelection(),T=Math.max(T,0),j=Math.min(j,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,T],this._model.selectionEnd=[this._bufferService.cols,j],this.refresh(),this._onSelectionChange.fire()}_handleTrim(T){this._model.handleTrim(T)&&this.refresh()}_getMouseBufferCoords(T){const j=this._mouseService.getCoords(T,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(j)return j[0]--,j[1]--,j[1]+=this._bufferService.buffer.ydisp,j}_getMouseEventScrollAmount(T){let j=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,T,this._screenElement)[1];const B=this._renderService.dimensions.css.canvas.height;return j>=0&&j<=B?0:(j>B&&(j-=B),j=Math.min(Math.max(j,-50),50),j/=50,j/Math.abs(j)+Math.round(14*j))}shouldForceSelection(T){return S.isMac?T.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:T.shiftKey}handleMouseDown(T){if(this._mouseDownTimeStamp=T.timeStamp,(T.button!==2||!this.hasSelection)&&T.button===0){if(!this._enabled){if(!this.shouldForceSelection(T))return;T.stopPropagation()}T.preventDefault(),this._dragScrollAmount=0,this._enabled&&T.shiftKey?this._handleIncrementalClick(T):T.detail===1?this._handleSingleClick(T):T.detail===2?this._handleDoubleClick(T):T.detail===3&&this._handleTripleClick(T),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()),50)}_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(T){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(T))}_handleSingleClick(T){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(T)?3:0,this._model.selectionStart=this._getMouseBufferCoords(T),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const j=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);j&&j.length!==this._model.selectionStart[0]&&j.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(T){this._selectWordAtCursor(T,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(T){const j=this._getMouseBufferCoords(T);j&&(this._activeSelectionMode=2,this._selectLineAt(j[1]))}shouldColumnSelect(T){return T.altKey&&!(S.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(T){if(T.stopImmediatePropagation(),!this._model.selectionStart)return;const j=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(T),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const B=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(T.ydisp+this._bufferService.rows,T.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=T.ydisp),this.refresh()}}_handleMouseUp(T){const j=T.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&j<500&&T.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const B=this._mouseService.getCoords(T,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(B&&B[0]!==void 0&&B[1]!==void 0){const z=(0,_.moveToCellSequence)(B[0]-1,B[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(z,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const T=this._model.finalSelectionStart,j=this._model.finalSelectionEnd,B=!(!T||!j||T[0]===j[0]&&T[1]===j[1]);B?T&&j&&(this._oldSelectionStart&&this._oldSelectionEnd&&T[0]===this._oldSelectionStart[0]&&T[1]===this._oldSelectionStart[1]&&j[0]===this._oldSelectionEnd[0]&&j[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(T,j,B)):this._oldHasSelection&&this._fireOnSelectionChange(T,j,B)}_fireOnSelectionChange(T,j,B){this._oldSelectionStart=T,this._oldSelectionEnd=j,this._oldHasSelection=B,this._onSelectionChange.fire()}_handleBufferActivate(T){this.clearSelection(),this._trimListener.dispose(),this._trimListener=T.activeBuffer.lines.onTrim((j=>this._handleTrim(j)))}_convertViewportColToCharacterIndex(T,j){let B=j;for(let z=0;j>=z;z++){const G=T.loadCell(z,this._workCell).getChars().length;this._workCell.getWidth()===0?B--:G>1&&j!==z&&(B+=G-1)}return B}setSelection(T,j,B){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[T,j],this._model.selectionStartLength=B,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(T){this._isClickInSelection(T)||(this._selectWordAtCursor(T,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(T,j,B=!0,z=!0){if(T[0]>=this._bufferService.cols)return;const G=this._bufferService.buffer,U=G.lines.get(T[1]);if(!U)return;const H=G.translateBufferLineToString(T[1],!1);let Y=this._convertViewportColToCharacterIndex(U,T[0]),q=Y;const X=T[0]-Y;let K=0,L=0,M=0,O=0;if(H.charAt(Y)===" "){for(;Y>0&&H.charAt(Y-1)===" ";)Y--;for(;q1&&(O+=ae-1,q+=ae-1);Q>0&&Y>0&&!this._isCharWordSeparator(U.loadCell(Q-1,this._workCell));){U.loadCell(Q-1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===0?(K++,Q--):Z>1&&(M+=Z-1,Y-=Z-1),Y--,Q--}for(;re1&&(O+=Z-1,q+=Z-1),q++,re++}}q++;let $=Y+X-K+M,F=Math.min(this._bufferService.cols,q-Y+K+L-M-O);if(j||H.slice(Y,q).trim()!==""){if(B&&$===0&&U.getCodePoint(0)!==32){const Q=G.lines.get(T[1]-1);if(Q&&U.isWrapped&&Q.getCodePoint(this._bufferService.cols-1)!==32){const re=this._getWordAt([this._bufferService.cols-1,T[1]-1],!1,!0,!1);if(re){const ae=this._bufferService.cols-re.start;$-=ae,F+=ae}}}if(z&&$+F===this._bufferService.cols&&U.getCodePoint(this._bufferService.cols-1)!==32){const Q=G.lines.get(T[1]+1);if(Q!=null&&Q.isWrapped&&Q.getCodePoint(0)!==32){const re=this._getWordAt([0,T[1]+1],!1,!1,!0);re&&(F+=re.length)}}return{start:$,length:F}}}_selectWordAt(T,j){const B=this._getWordAt(T,j);if(B){for(;B.start<0;)B.start+=this._bufferService.cols,T[1]--;this._model.selectionStart=[B.start,T[1]],this._model.selectionStartLength=B.length}}_selectToWordAt(T){const j=this._getWordAt(T,!0);if(j){let B=T[1];for(;j.start<0;)j.start+=this._bufferService.cols,B--;if(!this._model.areSelectionValuesReversed())for(;j.start+j.length>this._bufferService.cols;)j.length-=this._bufferService.cols,B++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?j.start:j.start+j.length,B]}}_isCharWordSeparator(T){return T.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(T.getChars())>=0}_selectLineAt(T){const j=this._bufferService.buffer.getWrappedRangeForLine(T),B={start:{x:0,y:j.first},end:{x:this._bufferService.cols-1,y:j.last}};this._model.selectionStart=[0,j.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(B,this._bufferService.cols)}};o.SelectionService=D=f([p(3,E.IBufferService),p(4,E.ICoreService),p(5,w.IMouseService),p(6,E.IOptionsService),p(7,w.IRenderService),p(8,w.ICoreBrowserService)],D)},4725:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ILinkProviderService=o.IThemeService=o.ICharacterJoinerService=o.ISelectionService=o.IRenderService=o.IMouseService=o.ICoreBrowserService=o.ICharSizeService=void 0;const f=c(8343);o.ICharSizeService=(0,f.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),o.IMouseService=(0,f.createDecorator)("MouseService"),o.IRenderService=(0,f.createDecorator)("RenderService"),o.ISelectionService=(0,f.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,f.createDecorator)("ThemeService"),o.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(u,o,c){var f=this&&this.__decorate||function(D,T,j,B){var z,G=arguments.length,U=G<3?T:B===null?B=Object.getOwnPropertyDescriptor(T,j):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(D,T,j,B);else for(var H=D.length-1;H>=0;H--)(z=D[H])&&(U=(G<3?z(U):G>3?z(T,j,U):z(T,j))||U);return G>3&&U&&Object.defineProperty(T,j,U),U},p=this&&this.__param||function(D,T){return function(j,B){T(j,B,D)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const d=c(7239),_=c(8055),v=c(8460),w=c(844),C=c(2585),b=_.css.toColor("#ffffff"),S=_.css.toColor("#000000"),x=_.css.toColor("#ffffff"),y=_.css.toColor("#000000"),E={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const D=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],T=[0,95,135,175,215,255];for(let j=0;j<216;j++){const B=T[j/36%6|0],z=T[j/6%6|0],G=T[j%6];D.push({css:_.channels.toCss(B,z,G),rgba:_.channels.toRgba(B,z,G)})}for(let j=0;j<24;j++){const B=8+10*j;D.push({css:_.channels.toCss(B,B,B),rgba:_.channels.toRgba(B,B,B)})}return D})());let R=o.ThemeService=class extends w.Disposable{get colors(){return this._colors}constructor(D){super(),this._optionsService=D,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:b,background:S,cursor:x,cursorAccent:y,selectionForeground:void 0,selectionBackgroundTransparent:E,selectionBackgroundOpaque:_.color.blend(S,E),selectionInactiveBackgroundTransparent:E,selectionInactiveBackgroundOpaque:_.color.blend(S,E),ansi:o.DEFAULT_ANSI_COLORS.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))))}_setTheme(D={}){const T=this._colors;if(T.foreground=N(D.foreground,b),T.background=N(D.background,S),T.cursor=N(D.cursor,x),T.cursorAccent=N(D.cursorAccent,y),T.selectionBackgroundTransparent=N(D.selectionBackground,E),T.selectionBackgroundOpaque=_.color.blend(T.background,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundTransparent=N(D.selectionInactiveBackground,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundOpaque=_.color.blend(T.background,T.selectionInactiveBackgroundTransparent),T.selectionForeground=D.selectionForeground?N(D.selectionForeground,_.NULL_COLOR):void 0,T.selectionForeground===_.NULL_COLOR&&(T.selectionForeground=void 0),_.color.isOpaque(T.selectionBackgroundTransparent)&&(T.selectionBackgroundTransparent=_.color.opacity(T.selectionBackgroundTransparent,.3)),_.color.isOpaque(T.selectionInactiveBackgroundTransparent)&&(T.selectionInactiveBackgroundTransparent=_.color.opacity(T.selectionInactiveBackgroundTransparent,.3)),T.ansi=o.DEFAULT_ANSI_COLORS.slice(),T.ansi[0]=N(D.black,o.DEFAULT_ANSI_COLORS[0]),T.ansi[1]=N(D.red,o.DEFAULT_ANSI_COLORS[1]),T.ansi[2]=N(D.green,o.DEFAULT_ANSI_COLORS[2]),T.ansi[3]=N(D.yellow,o.DEFAULT_ANSI_COLORS[3]),T.ansi[4]=N(D.blue,o.DEFAULT_ANSI_COLORS[4]),T.ansi[5]=N(D.magenta,o.DEFAULT_ANSI_COLORS[5]),T.ansi[6]=N(D.cyan,o.DEFAULT_ANSI_COLORS[6]),T.ansi[7]=N(D.white,o.DEFAULT_ANSI_COLORS[7]),T.ansi[8]=N(D.brightBlack,o.DEFAULT_ANSI_COLORS[8]),T.ansi[9]=N(D.brightRed,o.DEFAULT_ANSI_COLORS[9]),T.ansi[10]=N(D.brightGreen,o.DEFAULT_ANSI_COLORS[10]),T.ansi[11]=N(D.brightYellow,o.DEFAULT_ANSI_COLORS[11]),T.ansi[12]=N(D.brightBlue,o.DEFAULT_ANSI_COLORS[12]),T.ansi[13]=N(D.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),T.ansi[14]=N(D.brightCyan,o.DEFAULT_ANSI_COLORS[14]),T.ansi[15]=N(D.brightWhite,o.DEFAULT_ANSI_COLORS[15]),D.extendedAnsi){const j=Math.min(T.ansi.length-16,D.extendedAnsi.length);for(let B=0;B{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const f=c(8460),p=c(844);class d extends p.Disposable{constructor(v){super(),this._maxLength=v,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(v){if(this._maxLength===v)return;const w=new Array(v);for(let C=0;Cthis._length)for(let w=this._length;w=v;b--)this._array[this._getCyclicIndex(b+C.length)]=this._array[this._getCyclicIndex(b)];for(let b=0;bthis._maxLength){const b=this._length+C.length-this._maxLength;this._startIndex+=b,this._length=this._maxLength,this.onTrimEmitter.fire(b)}else this._length+=C.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,w,C){if(!(w<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let S=w-1;S>=0;S--)this.set(v+S+C,this.get(v+S));const b=v+w+C-this._length;if(b>0)for(this._length+=b;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let b=0;b{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function c(f,p=5){if(typeof f!="object")return f;const d=Array.isArray(f)?[]:{};for(const _ in f)d[_]=p<=1?f[_]:f[_]&&c(f[_],p-1);return d}},8055:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let c=0,f=0,p=0,d=0;var _,v,w,C,b;function S(y){const E=y.toString(16);return E.length<2?"0"+E:E}function x(y,E){return y>>0},y.toColor=function(E,R,N,D){return{css:y.toCss(E,R,N,D),rgba:y.toRgba(E,R,N,D)}}})(_||(o.channels=_={})),(function(y){function E(R,N){return d=Math.round(255*N),[c,f,p]=b.toChannels(R.rgba),{css:_.toCss(c,f,p,d),rgba:_.toRgba(c,f,p,d)}}y.blend=function(R,N){if(d=(255&N.rgba)/255,d===1)return{css:N.css,rgba:N.rgba};const D=N.rgba>>24&255,T=N.rgba>>16&255,j=N.rgba>>8&255,B=R.rgba>>24&255,z=R.rgba>>16&255,G=R.rgba>>8&255;return c=B+Math.round((D-B)*d),f=z+Math.round((T-z)*d),p=G+Math.round((j-G)*d),{css:_.toCss(c,f,p),rgba:_.toRgba(c,f,p)}},y.isOpaque=function(R){return(255&R.rgba)==255},y.ensureContrastRatio=function(R,N,D){const T=b.ensureContrastRatio(R.rgba,N.rgba,D);if(T)return _.toColor(T>>24&255,T>>16&255,T>>8&255)},y.opaque=function(R){const N=(255|R.rgba)>>>0;return[c,f,p]=b.toChannels(N),{css:_.toCss(c,f,p),rgba:N}},y.opacity=E,y.multiplyOpacity=function(R,N){return d=255&R.rgba,E(R,d*N/255)},y.toColorRGB=function(R){return[R.rgba>>24&255,R.rgba>>16&255,R.rgba>>8&255]}})(v||(o.color=v={})),(function(y){let E,R;try{const N=document.createElement("canvas");N.width=1,N.height=1;const D=N.getContext("2d",{willReadFrequently:!0});D&&(E=D,E.globalCompositeOperation="copy",R=E.createLinearGradient(0,0,1,1))}catch{}y.toColor=function(N){if(N.match(/#[\da-f]{3,8}/i))switch(N.length){case 4:return c=parseInt(N.slice(1,2).repeat(2),16),f=parseInt(N.slice(2,3).repeat(2),16),p=parseInt(N.slice(3,4).repeat(2),16),_.toColor(c,f,p);case 5:return c=parseInt(N.slice(1,2).repeat(2),16),f=parseInt(N.slice(2,3).repeat(2),16),p=parseInt(N.slice(3,4).repeat(2),16),d=parseInt(N.slice(4,5).repeat(2),16),_.toColor(c,f,p,d);case 7:return{css:N,rgba:(parseInt(N.slice(1),16)<<8|255)>>>0};case 9:return{css:N,rgba:parseInt(N.slice(1),16)>>>0}}const D=N.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(D)return c=parseInt(D[1]),f=parseInt(D[2]),p=parseInt(D[3]),d=Math.round(255*(D[5]===void 0?1:parseFloat(D[5]))),_.toColor(c,f,p,d);if(!E||!R)throw new Error("css.toColor: Unsupported css format");if(E.fillStyle=R,E.fillStyle=N,typeof E.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(E.fillRect(0,0,1,1),[c,f,p,d]=E.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(c,f,p,d),css:N}}})(w||(o.css=w={})),(function(y){function E(R,N,D){const T=R/255,j=N/255,B=D/255;return .2126*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.7152*(j<=.03928?j/12.92:Math.pow((j+.055)/1.055,2.4))+.0722*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))}y.relativeLuminance=function(R){return E(R>>16&255,R>>8&255,255&R)},y.relativeLuminance2=E})(C||(o.rgb=C={})),(function(y){function E(N,D,T){const j=N>>24&255,B=N>>16&255,z=N>>8&255;let G=D>>24&255,U=D>>16&255,H=D>>8&255,Y=x(C.relativeLuminance2(G,U,H),C.relativeLuminance2(j,B,z));for(;Y0||U>0||H>0);)G-=Math.max(0,Math.ceil(.1*G)),U-=Math.max(0,Math.ceil(.1*U)),H-=Math.max(0,Math.ceil(.1*H)),Y=x(C.relativeLuminance2(G,U,H),C.relativeLuminance2(j,B,z));return(G<<24|U<<16|H<<8|255)>>>0}function R(N,D,T){const j=N>>24&255,B=N>>16&255,z=N>>8&255;let G=D>>24&255,U=D>>16&255,H=D>>8&255,Y=x(C.relativeLuminance2(G,U,H),C.relativeLuminance2(j,B,z));for(;Y>>0}y.blend=function(N,D){if(d=(255&D)/255,d===1)return D;const T=D>>24&255,j=D>>16&255,B=D>>8&255,z=N>>24&255,G=N>>16&255,U=N>>8&255;return c=z+Math.round((T-z)*d),f=G+Math.round((j-G)*d),p=U+Math.round((B-U)*d),_.toRgba(c,f,p)},y.ensureContrastRatio=function(N,D,T){const j=C.relativeLuminance(N>>8),B=C.relativeLuminance(D>>8);if(x(j,B)>8));if(Hx(j,C.relativeLuminance(Y>>8))?U:Y}return U}const z=R(N,D,T),G=x(j,C.relativeLuminance(z>>8));if(Gx(j,C.relativeLuminance(U>>8))?z:U}return z}},y.reduceLuminance=E,y.increaseLuminance=R,y.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(b||(o.rgba=b={})),o.toPaddedHex=S,o.contrastRatio=x},8969:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const f=c(844),p=c(2585),d=c(4348),_=c(7866),v=c(744),w=c(7302),C=c(6975),b=c(8460),S=c(1753),x=c(1480),y=c(7994),E=c(9282),R=c(5435),N=c(5981),D=c(2660);let T=!1;class j extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new b.EventEmitter),this._onScroll.event((z=>{var G;(G=this._onScrollApi)==null||G.fire(z.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(z){for(const G in z)this.optionsService.options[G]=z[G]}constructor(z){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new b.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new b.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new b.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new w.OptionsService(z)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(S.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(x.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(y.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(D.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new R.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,b.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,b.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,b.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,b.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((G=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((G=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new N.WriteBuffer(((G,U)=>this._inputHandler.parse(G,U)))),this.register((0,b.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(z,G){this._writeBuffer.write(z,G)}writeSync(z,G){this._logService.logLevel<=p.LogLevelEnum.WARN&&!T&&(this._logService.warn("writeSync is unreliable and will be removed soon."),T=!0),this._writeBuffer.writeSync(z,G)}input(z,G=!0){this.coreService.triggerDataEvent(z,G)}resize(z,G){isNaN(z)||isNaN(G)||(z=Math.max(z,v.MINIMUM_COLS),G=Math.max(G,v.MINIMUM_ROWS),this._bufferService.resize(z,G))}scroll(z,G=!1){this._bufferService.scroll(z,G)}scrollLines(z,G,U){this._bufferService.scrollLines(z,G,U)}scrollPages(z){this.scrollLines(z*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(z){const G=z-this._bufferService.buffer.ydisp;G!==0&&this.scrollLines(G)}registerEscHandler(z,G){return this._inputHandler.registerEscHandler(z,G)}registerDcsHandler(z,G){return this._inputHandler.registerDcsHandler(z,G)}registerCsiHandler(z,G){return this._inputHandler.registerCsiHandler(z,G)}registerOscHandler(z,G){return this._inputHandler.registerOscHandler(z,G)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let z=!1;const G=this.optionsService.rawOptions.windowsPty;G&&G.buildNumber!==void 0&&G.buildNumber!==void 0?z=G.backend==="conpty"&&G.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(z=!0),z?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const z=[];z.push(this.onLineFeed(E.updateWindowsModeWrappedState.bind(null,this._bufferService))),z.push(this.registerCsiHandler({final:"H"},(()=>((0,E.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const G of z)G.dispose()}))}}}o.CoreTerminal=j},8460:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=c=>(this._listeners.push(c),{dispose:()=>{if(!this._disposed){for(let f=0;ff.fire(p)))},o.runAndSubscribe=function(c,f){return f(void 0),c((p=>f(p)))}},5435:function(u,o,c){var f=this&&this.__decorate||function(K,L,M,O){var $,F=arguments.length,Q=F<3?L:O===null?O=Object.getOwnPropertyDescriptor(L,M):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Q=Reflect.decorate(K,L,M,O);else for(var re=K.length-1;re>=0;re--)($=K[re])&&(Q=(F<3?$(Q):F>3?$(L,M,Q):$(L,M))||Q);return F>3&&Q&&Object.defineProperty(L,M,Q),Q},p=this&&this.__param||function(K,L){return function(M,O){L(M,O,K)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const d=c(2584),_=c(7116),v=c(2015),w=c(844),C=c(482),b=c(8437),S=c(8460),x=c(643),y=c(511),E=c(3734),R=c(2585),N=c(1480),D=c(6242),T=c(6351),j=c(5941),B={"(":0,")":1,"*":2,"+":3,"-":1,".":2},z=131072;function G(K,L){if(K>24)return L.setWinLines||!1;switch(K){case 1:return!!L.restoreWin;case 2:return!!L.minimizeWin;case 3:return!!L.setWinPosition;case 4:return!!L.setWinSizePixels;case 5:return!!L.raiseWin;case 6:return!!L.lowerWin;case 7:return!!L.refreshWin;case 8:return!!L.setWinSizeChars;case 9:return!!L.maximizeWin;case 10:return!!L.fullscreenWin;case 11:return!!L.getWinState;case 13:return!!L.getWinPosition;case 14:return!!L.getWinSizePixels;case 15:return!!L.getScreenSizePixels;case 16:return!!L.getCellSizePixels;case 18:return!!L.getWinSizeChars;case 19:return!!L.getScreenSizeChars;case 20:return!!L.getIconTitle;case 21:return!!L.getWinTitle;case 22:return!!L.pushTitle;case 23:return!!L.popTitle;case 24:return!!L.setWinLines}return!1}var U;(function(K){K[K.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",K[K.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(U||(o.WindowsOptionsReportType=U={}));let H=0;class Y extends w.Disposable{getAttrData(){return this._curAttrData}constructor(L,M,O,$,F,Q,re,ae,Z=new v.EscapeSequenceParser){super(),this._bufferService=L,this._charsetService=M,this._coreService=O,this._logService=$,this._optionsService=F,this._oscLinkService=Q,this._coreMouseService=re,this._unicodeService=ae,this._parser=Z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new y.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new S.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new S.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new S.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new S.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new S.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new S.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new S.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new S.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new S.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new S.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new S.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new S.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new S.EventEmitter),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 q(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((P=>this._activeBuffer=P.activeBuffer))),this._parser.setCsiHandlerFallback(((P,ee)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(P),params:ee.toArray()})})),this._parser.setEscHandlerFallback((P=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(P)})})),this._parser.setExecuteHandlerFallback((P=>{this._logService.debug("Unknown EXECUTE code: ",{code:P})})),this._parser.setOscHandlerFallback(((P,ee,ne)=>{this._logService.debug("Unknown OSC code: ",{identifier:P,action:ee,data:ne})})),this._parser.setDcsHandlerFallback(((P,ee,ne)=>{ee==="HOOK"&&(ne=ne.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(P),action:ee,payload:ne})})),this._parser.setPrintHandler(((P,ee,ne)=>this.print(P,ee,ne))),this._parser.registerCsiHandler({final:"@"},(P=>this.insertChars(P))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(P=>this.scrollLeft(P))),this._parser.registerCsiHandler({final:"A"},(P=>this.cursorUp(P))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(P=>this.scrollRight(P))),this._parser.registerCsiHandler({final:"B"},(P=>this.cursorDown(P))),this._parser.registerCsiHandler({final:"C"},(P=>this.cursorForward(P))),this._parser.registerCsiHandler({final:"D"},(P=>this.cursorBackward(P))),this._parser.registerCsiHandler({final:"E"},(P=>this.cursorNextLine(P))),this._parser.registerCsiHandler({final:"F"},(P=>this.cursorPrecedingLine(P))),this._parser.registerCsiHandler({final:"G"},(P=>this.cursorCharAbsolute(P))),this._parser.registerCsiHandler({final:"H"},(P=>this.cursorPosition(P))),this._parser.registerCsiHandler({final:"I"},(P=>this.cursorForwardTab(P))),this._parser.registerCsiHandler({final:"J"},(P=>this.eraseInDisplay(P,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(P=>this.eraseInDisplay(P,!0))),this._parser.registerCsiHandler({final:"K"},(P=>this.eraseInLine(P,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(P=>this.eraseInLine(P,!0))),this._parser.registerCsiHandler({final:"L"},(P=>this.insertLines(P))),this._parser.registerCsiHandler({final:"M"},(P=>this.deleteLines(P))),this._parser.registerCsiHandler({final:"P"},(P=>this.deleteChars(P))),this._parser.registerCsiHandler({final:"S"},(P=>this.scrollUp(P))),this._parser.registerCsiHandler({final:"T"},(P=>this.scrollDown(P))),this._parser.registerCsiHandler({final:"X"},(P=>this.eraseChars(P))),this._parser.registerCsiHandler({final:"Z"},(P=>this.cursorBackwardTab(P))),this._parser.registerCsiHandler({final:"`"},(P=>this.charPosAbsolute(P))),this._parser.registerCsiHandler({final:"a"},(P=>this.hPositionRelative(P))),this._parser.registerCsiHandler({final:"b"},(P=>this.repeatPrecedingCharacter(P))),this._parser.registerCsiHandler({final:"c"},(P=>this.sendDeviceAttributesPrimary(P))),this._parser.registerCsiHandler({prefix:">",final:"c"},(P=>this.sendDeviceAttributesSecondary(P))),this._parser.registerCsiHandler({final:"d"},(P=>this.linePosAbsolute(P))),this._parser.registerCsiHandler({final:"e"},(P=>this.vPositionRelative(P))),this._parser.registerCsiHandler({final:"f"},(P=>this.hVPosition(P))),this._parser.registerCsiHandler({final:"g"},(P=>this.tabClear(P))),this._parser.registerCsiHandler({final:"h"},(P=>this.setMode(P))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(P=>this.setModePrivate(P))),this._parser.registerCsiHandler({final:"l"},(P=>this.resetMode(P))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(P=>this.resetModePrivate(P))),this._parser.registerCsiHandler({final:"m"},(P=>this.charAttributes(P))),this._parser.registerCsiHandler({final:"n"},(P=>this.deviceStatus(P))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(P=>this.deviceStatusPrivate(P))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(P=>this.softReset(P))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(P=>this.setCursorStyle(P))),this._parser.registerCsiHandler({final:"r"},(P=>this.setScrollRegion(P))),this._parser.registerCsiHandler({final:"s"},(P=>this.saveCursor(P))),this._parser.registerCsiHandler({final:"t"},(P=>this.windowOptions(P))),this._parser.registerCsiHandler({final:"u"},(P=>this.restoreCursor(P))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(P=>this.insertColumns(P))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(P=>this.deleteColumns(P))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(P=>this.selectProtected(P))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(P=>this.requestMode(P,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(P=>this.requestMode(P,!1))),this._parser.setExecuteHandler(d.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(d.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(d.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(d.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(d.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(d.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(d.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(d.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(d.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new D.OscHandler((P=>(this.setTitle(P),this.setIconName(P),!0)))),this._parser.registerOscHandler(1,new D.OscHandler((P=>this.setIconName(P)))),this._parser.registerOscHandler(2,new D.OscHandler((P=>this.setTitle(P)))),this._parser.registerOscHandler(4,new D.OscHandler((P=>this.setOrReportIndexedColor(P)))),this._parser.registerOscHandler(8,new D.OscHandler((P=>this.setHyperlink(P)))),this._parser.registerOscHandler(10,new D.OscHandler((P=>this.setOrReportFgColor(P)))),this._parser.registerOscHandler(11,new D.OscHandler((P=>this.setOrReportBgColor(P)))),this._parser.registerOscHandler(12,new D.OscHandler((P=>this.setOrReportCursorColor(P)))),this._parser.registerOscHandler(104,new D.OscHandler((P=>this.restoreIndexedColor(P)))),this._parser.registerOscHandler(110,new D.OscHandler((P=>this.restoreFgColor(P)))),this._parser.registerOscHandler(111,new D.OscHandler((P=>this.restoreBgColor(P)))),this._parser.registerOscHandler(112,new D.OscHandler((P=>this.restoreCursorColor(P)))),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(const P in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:P},(()=>this.selectCharset("("+P))),this._parser.registerEscHandler({intermediates:")",final:P},(()=>this.selectCharset(")"+P))),this._parser.registerEscHandler({intermediates:"*",final:P},(()=>this.selectCharset("*"+P))),this._parser.registerEscHandler({intermediates:"+",final:P},(()=>this.selectCharset("+"+P))),this._parser.registerEscHandler({intermediates:"-",final:P},(()=>this.selectCharset("-"+P))),this._parser.registerEscHandler({intermediates:".",final:P},(()=>this.selectCharset("."+P))),this._parser.registerEscHandler({intermediates:"/",final:P},(()=>this.selectCharset("/"+P)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((P=>(this._logService.error("Parsing error: ",P),P))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new T.DcsHandler(((P,ee)=>this.requestStatusString(P,ee))))}_preserveStack(L,M,O,$){this._parseStack.paused=!0,this._parseStack.cursorStartX=L,this._parseStack.cursorStartY=M,this._parseStack.decodedLength=O,this._parseStack.position=$}_logSlowResolvingAsync(L){this._logService.logLevel<=R.LogLevelEnum.WARN&&Promise.race([L,new Promise(((M,O)=>setTimeout((()=>O("#SLOW_TIMEOUT")),5e3)))]).catch((M=>{if(M!=="#SLOW_TIMEOUT")throw M;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(L,M){let O,$=this._activeBuffer.x,F=this._activeBuffer.y,Q=0;const re=this._parseStack.paused;if(re){if(O=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,M))return this._logSlowResolvingAsync(O),O;$=this._parseStack.cursorStartX,F=this._parseStack.cursorStartY,this._parseStack.paused=!1,L.length>z&&(Q=this._parseStack.position+z)}if(this._logService.logLevel<=R.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof L=="string"?` "${L}"`:` "${Array.prototype.map.call(L,(P=>String.fromCharCode(P))).join("")}"`),typeof L=="string"?L.split("").map((P=>P.charCodeAt(0))):L),this._parseBuffer.lengthz)for(let P=Q;P0&&ne.getWidth(this._activeBuffer.x-1)===2&&ne.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ee);let ge=this._parser.precedingJoinState;for(let he=M;heae){if(Z){const Ee=ne;let Ce=this._activeBuffer.x-ke;for(this._activeBuffer.x=ke,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),ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ke>0&&ne instanceof b.BufferLine&&ne.copyCellsFrom(Ee,Ce,0,ke,!1);Ce=0;)ne.setCellFromCodepoint(this._activeBuffer.x++,0,0,ee)}else if(P&&(ne.insertCells(this._activeBuffer.x,F-ke,this._activeBuffer.getNullCell(ee)),ne.getWidth(ae-1)===2&&ne.setCellFromCodepoint(ae-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,ee)),ne.setCellFromCodepoint(this._activeBuffer.x++,$,F,ee),F>0)for(;--F;)ne.setCellFromCodepoint(this._activeBuffer.x++,0,0,ee)}this._parser.precedingJoinState=ge,this._activeBuffer.x0&&ne.getWidth(this._activeBuffer.x)===0&&!ne.hasContent(this._activeBuffer.x)&&ne.setCellFromCodepoint(this._activeBuffer.x,0,1,ee),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(L,M){return L.final!=="t"||L.prefix||L.intermediates?this._parser.registerCsiHandler(L,M):this._parser.registerCsiHandler(L,(O=>!G(O.params[0],this._optionsService.rawOptions.windowOptions)||M(O)))}registerDcsHandler(L,M){return this._parser.registerDcsHandler(L,new T.DcsHandler(M))}registerEscHandler(L,M){return this._parser.registerEscHandler(L,M)}registerOscHandler(L,M){return this._parser.registerOscHandler(L,new D.OscHandler(M))}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(){var L;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&&((L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&L.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);M.hasWidth(this._activeBuffer.x)&&!M.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const L=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-L),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(L=this._bufferService.cols-1){this._activeBuffer.x=Math.min(L,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(L,M){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=L,this._activeBuffer.y=this._activeBuffer.scrollTop+M):(this._activeBuffer.x=L,this._activeBuffer.y=M),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(L,M){this._restrictCursor(),this._setCursor(this._activeBuffer.x+L,this._activeBuffer.y+M)}cursorUp(L){const M=this._activeBuffer.y-this._activeBuffer.scrollTop;return M>=0?this._moveCursor(0,-Math.min(M,L.params[0]||1)):this._moveCursor(0,-(L.params[0]||1)),!0}cursorDown(L){const M=this._activeBuffer.scrollBottom-this._activeBuffer.y;return M>=0?this._moveCursor(0,Math.min(M,L.params[0]||1)):this._moveCursor(0,L.params[0]||1),!0}cursorForward(L){return this._moveCursor(L.params[0]||1,0),!0}cursorBackward(L){return this._moveCursor(-(L.params[0]||1),0),!0}cursorNextLine(L){return this.cursorDown(L),this._activeBuffer.x=0,!0}cursorPrecedingLine(L){return this.cursorUp(L),this._activeBuffer.x=0,!0}cursorCharAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(L){return this._setCursor(L.length>=2?(L.params[1]||1)-1:0,(L.params[0]||1)-1),!0}charPosAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(L){return this._moveCursor(L.params[0]||1,0),!0}linePosAbsolute(L){return this._setCursor(this._activeBuffer.x,(L.params[0]||1)-1),!0}vPositionRelative(L){return this._moveCursor(0,L.params[0]||1),!0}hVPosition(L){return this.cursorPosition(L),!0}tabClear(L){const M=L.params[0];return M===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:M===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=L.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=L.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(L){const M=L.params[0];return M===1&&(this._curAttrData.bg|=536870912),M!==2&&M!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(L,M,O,$=!1,F=!1){const Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);Q.replaceCells(M,O,this._activeBuffer.getNullCell(this._eraseAttrData()),F),$&&(Q.isWrapped=!1)}_resetBufferLine(L,M=!1){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);O&&(O.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),M),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+L),O.isWrapped=!1)}eraseInDisplay(L,M=!1){let O;switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:for(O=this._activeBuffer.y,this._dirtyRowTracker.markDirty(O),this._eraseInBufferLine(O++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);O=this._bufferService.cols&&(this._activeBuffer.lines.get(O+1).isWrapped=!1);O--;)this._resetBufferLine(O,M);this._dirtyRowTracker.markDirty(0);break;case 2:for(O=this._bufferService.rows,this._dirtyRowTracker.markDirty(O-1);O--;)this._resetBufferLine(O,M);this._dirtyRowTracker.markDirty(0);break;case 3:const $=this._activeBuffer.lines.length-this._bufferService.rows;$>0&&(this._activeBuffer.lines.trimStart($),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-$,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-$,0),this._onScroll.fire(0))}return!0}eraseInLine(L,M=!1){switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,M);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,M)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(L){this._restrictCursor();let M=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let Z=ae;for(let P=1;P0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(L){return L.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(L.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(L){return(this._optionsService.rawOptions.termName+"").indexOf(L)===0}setMode(L){for(let M=0;Mbe?1:2,ge=L.params[0];return he=ge,ye=M?ge===2?4:ge===4?ne(Q.modes.insertMode):ge===12?3:ge===20?ne(ee.convertEol):0:ge===1?ne(O.applicationCursorKeys):ge===3?ee.windowOptions.setWinLines?ae===80?2:ae===132?1:0:0:ge===6?ne(O.origin):ge===7?ne(O.wraparound):ge===8?3:ge===9?ne($==="X10"):ge===12?ne(ee.cursorBlink):ge===25?ne(!Q.isCursorHidden):ge===45?ne(O.reverseWraparound):ge===66?ne(O.applicationKeypad):ge===67?4:ge===1e3?ne($==="VT200"):ge===1002?ne($==="DRAG"):ge===1003?ne($==="ANY"):ge===1004?ne(O.sendFocus):ge===1005?4:ge===1006?ne(F==="SGR"):ge===1015?4:ge===1016?ne(F==="SGR_PIXELS"):ge===1048?1:ge===47||ge===1047||ge===1049?ne(Z===P):ge===2004?ne(O.bracketedPasteMode):0,Q.triggerDataEvent(`${d.C0.ESC}[${M?"":"?"}${he};${ye}$y`),!0;var he,ye}_updateAttrColor(L,M,O,$,F){return M===2?(L|=50331648,L&=-16777216,L|=E.AttributeData.fromColorRGB([O,$,F])):M===5&&(L&=-50331904,L|=33554432|255&O),L}_extractColor(L,M,O){const $=[0,0,-1,0,0,0];let F=0,Q=0;do{if($[Q+F]=L.params[M+Q],L.hasSubParams(M+Q)){const re=L.getSubParams(M+Q);let ae=0;do $[1]===5&&(F=1),$[Q+ae+1+F]=re[ae];while(++ae=2||$[1]===2&&Q+F>=5)break;$[1]&&(F=1)}while(++Q+M5)&&(L=1),M.extended.underlineStyle=L,M.fg|=268435456,L===0&&(M.fg&=-268435457),M.updateExtended()}_processSGR0(L){L.fg=b.DEFAULT_ATTR_DATA.fg,L.bg=b.DEFAULT_ATTR_DATA.bg,L.extended=L.extended.clone(),L.extended.underlineStyle=0,L.extended.underlineColor&=-67108864,L.updateExtended()}charAttributes(L){if(L.length===1&&L.params[0]===0)return this._processSGR0(this._curAttrData),!0;const M=L.length;let O;const $=this._curAttrData;for(let F=0;F=30&&O<=37?($.fg&=-50331904,$.fg|=16777216|O-30):O>=40&&O<=47?($.bg&=-50331904,$.bg|=16777216|O-40):O>=90&&O<=97?($.fg&=-50331904,$.fg|=16777224|O-90):O>=100&&O<=107?($.bg&=-50331904,$.bg|=16777224|O-100):O===0?this._processSGR0($):O===1?$.fg|=134217728:O===3?$.bg|=67108864:O===4?($.fg|=268435456,this._processUnderline(L.hasSubParams(F)?L.getSubParams(F)[0]:1,$)):O===5?$.fg|=536870912:O===7?$.fg|=67108864:O===8?$.fg|=1073741824:O===9?$.fg|=2147483648:O===2?$.bg|=134217728:O===21?this._processUnderline(2,$):O===22?($.fg&=-134217729,$.bg&=-134217729):O===23?$.bg&=-67108865:O===24?($.fg&=-268435457,this._processUnderline(0,$)):O===25?$.fg&=-536870913:O===27?$.fg&=-67108865:O===28?$.fg&=-1073741825:O===29?$.fg&=2147483647:O===39?($.fg&=-67108864,$.fg|=16777215&b.DEFAULT_ATTR_DATA.fg):O===49?($.bg&=-67108864,$.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):O===38||O===48||O===58?F+=this._extractColor(L,F,$):O===53?$.bg|=1073741824:O===55?$.bg&=-1073741825:O===59?($.extended=$.extended.clone(),$.extended.underlineColor=-1,$.updateExtended()):O===100?($.fg&=-67108864,$.fg|=16777215&b.DEFAULT_ATTR_DATA.fg,$.bg&=-67108864,$.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",O);return!0}deviceStatus(L){switch(L.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const M=this._activeBuffer.y+1,O=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${M};${O}R`)}return!0}deviceStatusPrivate(L){if(L.params[0]===6){const M=this._activeBuffer.y+1,O=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${M};${O}R`)}return!0}softReset(L){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=b.DEFAULT_ATTR_DATA.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(L){const M=L.params[0]||1;switch(M){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const O=M%2==1;return this._optionsService.options.cursorBlink=O,!0}setScrollRegion(L){const M=L.params[0]||1;let O;return(L.length<2||(O=L.params[1])>this._bufferService.rows||O===0)&&(O=this._bufferService.rows),O>M&&(this._activeBuffer.scrollTop=M-1,this._activeBuffer.scrollBottom=O-1,this._setCursor(0,0)),!0}windowOptions(L){if(!G(L.params[0],this._optionsService.rawOptions.windowOptions))return!0;const M=L.length>1?L.params[1]:0;switch(L.params[0]){case 14:M!==2&&this._onRequestWindowsOptionsReport.fire(U.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(U.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${d.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:M!==0&&M!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),M!==0&&M!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:M!==0&&M!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),M!==0&&M!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(L){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(L){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(L){return this._windowTitle=L,this._onTitleChange.fire(L),!0}setIconName(L){return this._iconName=L,!0}setOrReportIndexedColor(L){const M=[],O=L.split(";");for(;O.length>1;){const $=O.shift(),F=O.shift();if(/^\d+$/.exec($)){const Q=parseInt($);if(X(Q))if(F==="?")M.push({type:0,index:Q});else{const re=(0,j.parseColor)(F);re&&M.push({type:1,index:Q,color:re})}}}return M.length&&this._onColor.fire(M),!0}setHyperlink(L){const M=L.split(";");return!(M.length<2)&&(M[1]?this._createHyperlink(M[0],M[1]):!M[0]&&this._finishHyperlink())}_createHyperlink(L,M){this._getCurrentLinkId()&&this._finishHyperlink();const O=L.split(":");let $;const F=O.findIndex((Q=>Q.startsWith("id=")));return F!==-1&&($=O[F].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:$,uri:M}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(L,M){const O=L.split(";");for(let $=0;$=this._specialColors.length);++$,++M)if(O[$]==="?")this._onColor.fire([{type:0,index:this._specialColors[M]}]);else{const F=(0,j.parseColor)(O[$]);F&&this._onColor.fire([{type:1,index:this._specialColors[M],color:F}])}return!0}setOrReportFgColor(L){return this._setOrReportSpecialColor(L,0)}setOrReportBgColor(L){return this._setOrReportSpecialColor(L,1)}setOrReportCursorColor(L){return this._setOrReportSpecialColor(L,2)}restoreIndexedColor(L){if(!L)return this._onColor.fire([{type:2}]),!0;const M=[],O=L.split(";");for(let $=0;$=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){const L=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,L,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=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(L){return this._charsetService.setgLevel(L),!0}screenAlignmentPattern(){const L=new y.CellData;L.content=4194373,L.fg=this._curAttrData.fg,L.bg=this._curAttrData.bg,this._setCursor(0,0);for(let M=0;M(this._coreService.triggerDataEvent(`${d.C0.ESC}${F}${d.C0.ESC}\\`),!0))(L==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:L==='"p'?'P1$r61;1"p':L==="r"?`P1$r${O.scrollTop+1};${O.scrollBottom+1}r`:L==="m"?"P1$r0m":L===" q"?`P1$r${{block:2,underline:4,bar:6}[$.cursorStyle]-($.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(L,M){this._dirtyRowTracker.markRangeDirty(L,M)}}o.InputHandler=Y;let q=class{constructor(K){this._bufferService=K,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(K){Kthis.end&&(this.end=K)}markRangeDirty(K,L){K>L&&(H=K,K=L,L=H),Kthis.end&&(this.end=L)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(K){return 0<=K&&K<256}q=f([p(0,R.IBufferService)],q)},844:(u,o)=>{function c(f){for(const p of f)p.dispose();f.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const p=this._disposables.indexOf(f);p!==-1&&this._disposables.splice(p,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var p;this._isDisposed||f===this._value||((p=this._value)==null||p.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},o.toDisposable=function(f){return{dispose:f}},o.disposeArray=c,o.getDisposeArrayDisposable=function(f){return{dispose:()=>c(f)}}},1505:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class c{constructor(){this._data={}}set(p,d,_){this._data[p]||(this._data[p]={}),this._data[p][d]=_}get(p,d){return this._data[p]?this._data[p][d]:void 0}clear(){this._data={}}}o.TwoKeyMap=c,o.FourKeyMap=class{constructor(){this._data=new c}set(f,p,d,_,v){this._data.get(f,p)||this._data.set(f,p,new c),this._data.get(f,p).set(d,_,v)}get(f,p,d,_){var v;return(v=this._data.get(f,p))==null?void 0:v.get(d,_)}clear(){this._data.clear()}}},6114:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const c=o.isNode?"node":navigator.userAgent,f=o.isNode?"node":navigator.platform;o.isFirefox=c.includes("Firefox"),o.isLegacyEdge=c.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(c),o.getSafariVersion=function(){if(!o.isSafari)return 0;const p=c.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),o.isIpad=f==="iPad",o.isIphone=f==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),o.isLinux=f.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(c)},6106:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let c=0;o.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(c=this._search(this._getKey(f)),this._array.splice(c,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const p=this._getKey(f);if(p===void 0||(c=this._search(p),c===-1)||this._getKey(this._array[c])!==p)return!1;do if(this._array[c]===f)return this._array.splice(c,1),!0;while(++c=this._array.length)&&this._getKey(this._array[c])===f))do yield this._array[c];while(++c=this._array.length)&&this._getKey(this._array[c])===f))do p(this._array[c]);while(++c=p;){let _=p+d>>1;const v=this._getKey(this._array[_]);if(v>f)d=_-1;else{if(!(v0&&this._getKey(this._array[_-1])===f;)_--;return _}p=_+1}}return p}}},7226:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const f=c(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),this._start()}flush(){for(;this._iS)return b-w<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(b-w))}ms`),void this._start();b=S}this.clear()}}class d extends p{_requestCallback(v){return setTimeout((()=>v(this._createDeadline(16))))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const w=Date.now()+v;return{timeRemaining:()=>Math.max(0,w-Date.now())}}}o.PriorityTaskQueue=d,o.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:d,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const f=c(643);o.updateWindowsModeWrappedState=function(p){const d=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),_=d==null?void 0:d.get(p.cols-1),v=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);v&&_&&(v.isWrapped=_[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&_[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new f}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new c;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}o.AttributeData=c;class f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}get underlineVariantOffset(){const d=(3758096384&this._ext)>>29;return d<0?4294967288^d:d}set underlineVariantOffset(d){this._ext&=536870911,this._ext|=d<<29&3758096384}constructor(d=0,_=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=_}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=f},9092:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const f=c(6349),p=c(7226),d=c(3734),_=c(8437),v=c(4634),w=c(511),C=c(643),b=c(4863),S=c(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(x,y,E){this._hasScrollback=x,this._optionsService=y,this._bufferService=E,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=S.DEFAULT_CHARSET,this.markers=[],this._nullCell=w.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,C.WHITESPACE_CELL_CHAR,C.WHITESPACE_CELL_WIDTH,C.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(x){return x?(this._nullCell.fg=x.fg,this._nullCell.bg=x.bg,this._nullCell.extended=x.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(x){return x?(this._whitespaceCell.fg=x.fg,this._whitespaceCell.bg=x.bg,this._whitespaceCell.extended=x.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(x,y){return new _.BufferLine(this._bufferService.cols,this.getNullCell(x),y)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const x=this.ybase+this.y-this.ydisp;return x>=0&&xo.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:y}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=_.DEFAULT_ATTR_DATA);let y=this._rows;for(;y--;)this.lines.push(this.getBlankLine(x))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(x,y){const E=this.getNullCell(_.DEFAULT_ATTR_DATA);let R=0;const N=this._getCorrectBufferLength(y);if(N>this.lines.maxLength&&(this.lines.maxLength=N),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+D+1?(this.ybase--,D++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(x,E)));else for(let T=this._rows;T>y;T--)this.lines.length>y+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(N0&&(this.lines.trimStart(T),this.ybase=Math.max(this.ybase-T,0),this.ydisp=Math.max(this.ydisp-T,0),this.savedY=Math.max(this.savedY-T,0)),this.lines.maxLength=N}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,y-1),D&&(this.y+=D),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=y-1,this._isReflowEnabled&&(this._reflow(x,y),this._cols>x))for(let D=0;D.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let x=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,x=!1);let y=0;for(;this._memoryCleanupPosition100)return!0;return x}get _isReflowEnabled(){const x=this._optionsService.rawOptions.windowsPty;return x&&x.buildNumber?this._hasScrollback&&x.backend==="conpty"&&x.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(x,y){this._cols!==x&&(x>this._cols?this._reflowLarger(x,y):this._reflowSmaller(x,y))}_reflowLarger(x,y){const E=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(E.length>0){const R=(0,v.reflowLargerCreateNewLayout)(this.lines,E);(0,v.reflowLargerApplyNewLayout)(this.lines,R.layout),this._reflowLargerAdjustViewport(x,y,R.countRemoved)}}_reflowLargerAdjustViewport(x,y,E){const R=this.getNullCell(_.DEFAULT_ATTR_DATA);let N=E;for(;N-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;D--){let T=this.lines.get(D);if(!T||!T.isWrapped&&T.getTrimmedLength()<=x)continue;const j=[T];for(;T.isWrapped&&D>0;)T=this.lines.get(--D),j.unshift(T);const B=this.ybase+this.y;if(B>=D&&B0&&(R.push({start:D+j.length+N,newLines:Y}),N+=Y.length),j.push(...Y);let q=G.length-1,X=G[q];X===0&&(q--,X=G[q]);let K=j.length-U-1,L=z;for(;K>=0;){const O=Math.min(L,X);if(j[q]===void 0)break;if(j[q].copyCellsFrom(j[K],L-O,X-O,O,!0),X-=O,X===0&&(q--,X=G[q]),L-=O,L===0){K--;const $=Math.max(K,0);L=(0,v.getWrappedLineTrimmedLength)(j,$,this._cols)}}for(let O=0;O0;)this.ybase===0?this.y0){const D=[],T=[];for(let q=0;q=0;q--)if(G&&G.start>B+U){for(let X=G.newLines.length-1;X>=0;X--)this.lines.set(q--,G.newLines[X]);q++,D.push({index:B+1,amount:G.newLines.length}),U+=G.newLines.length,G=R[++z]}else this.lines.set(q,T[B--]);let H=0;for(let q=D.length-1;q>=0;q--)D[q].index+=H,this.lines.onInsertEmitter.fire(D[q]),H+=D[q].amount;const Y=Math.max(0,j+N-this.lines.maxLength);Y>0&&this.lines.onTrimEmitter.fire(Y)}}translateBufferLineToString(x,y,E=0,R){const N=this.lines.get(x);return N?N.translateToString(y,E,R):""}getWrappedRangeForLine(x){let y=x,E=x;for(;y>0&&this.lines.get(y).isWrapped;)y--;for(;E+10;);return x>=this._cols?this._cols-1:x<0?0:x}nextStop(x){for(x==null&&(x=this.x);!this.tabs[++x]&&x=this._cols?this._cols-1:x<0?0:x}clearMarkers(x){this._isClearing=!0;for(let y=0;y{y.line-=E,y.line<0&&y.dispose()}))),y.register(this.lines.onInsert((E=>{y.line>=E.index&&(y.line+=E.amount)}))),y.register(this.lines.onDelete((E=>{y.line>=E.index&&y.lineE.index&&(y.line-=E.amount)}))),y.register(y.onDispose((()=>this._removeMarker(y)))),y}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const f=c(3734),p=c(511),d=c(643),_=c(482);o.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let v=0;class w{constructor(b,S,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*b);const y=S||p.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let E=0;E>22,2097152&S?this._combined[b].charCodeAt(this._combined[b].length-1):x]}set(b,S){this._data[3*b+1]=S[d.CHAR_DATA_ATTR_INDEX],S[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[b]=S[1],this._data[3*b+0]=2097152|b|S[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*b+0]=S[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(b){return this._data[3*b+0]>>22}hasWidth(b){return 12582912&this._data[3*b+0]}getFg(b){return this._data[3*b+1]}getBg(b){return this._data[3*b+2]}hasContent(b){return 4194303&this._data[3*b+0]}getCodePoint(b){const S=this._data[3*b+0];return 2097152&S?this._combined[b].charCodeAt(this._combined[b].length-1):2097151&S}isCombined(b){return 2097152&this._data[3*b+0]}getString(b){const S=this._data[3*b+0];return 2097152&S?this._combined[b]:2097151&S?(0,_.stringFromCodePoint)(2097151&S):""}isProtected(b){return 536870912&this._data[3*b+2]}loadCell(b,S){return v=3*b,S.content=this._data[v+0],S.fg=this._data[v+1],S.bg=this._data[v+2],2097152&S.content&&(S.combinedData=this._combined[b]),268435456&S.bg&&(S.extended=this._extendedAttrs[b]),S}setCell(b,S){2097152&S.content&&(this._combined[b]=S.combinedData),268435456&S.bg&&(this._extendedAttrs[b]=S.extended),this._data[3*b+0]=S.content,this._data[3*b+1]=S.fg,this._data[3*b+2]=S.bg}setCellFromCodepoint(b,S,x,y){268435456&y.bg&&(this._extendedAttrs[b]=y.extended),this._data[3*b+0]=S|x<<22,this._data[3*b+1]=y.fg,this._data[3*b+2]=y.bg}addCodepointToCell(b,S,x){let y=this._data[3*b+0];2097152&y?this._combined[b]+=(0,_.stringFromCodePoint)(S):2097151&y?(this._combined[b]=(0,_.stringFromCodePoint)(2097151&y)+(0,_.stringFromCodePoint)(S),y&=-2097152,y|=2097152):y=S|4194304,x&&(y&=-12582913,y|=x<<22),this._data[3*b+0]=y}insertCells(b,S,x){if((b%=this.length)&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,x),S=0;--E)this.setCell(b+S+E,this.loadCell(b+E,y));for(let E=0;Ethis.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const y=new Uint32Array(x);y.set(this._data),this._data=y}for(let y=this.length;y=b&&delete this._combined[N]}const E=Object.keys(this._extendedAttrs);for(let R=0;R=b&&delete this._extendedAttrs[N]}}return this.length=b,4*x*2=0;--b)if(4194303&this._data[3*b+0])return b+(this._data[3*b+0]>>22);return 0}getNoBgTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0]||50331648&this._data[3*b+2])return b+(this._data[3*b+0]>>22);return 0}copyCellsFrom(b,S,x,y,E){const R=b._data;if(E)for(let D=y-1;D>=0;D--){for(let T=0;T<3;T++)this._data[3*(x+D)+T]=R[3*(S+D)+T];268435456&R[3*(S+D)+2]&&(this._extendedAttrs[x+D]=b._extendedAttrs[S+D])}else for(let D=0;D=S&&(this._combined[T-S+x]=b._combined[T])}}translateToString(b,S,x,y){S=S??0,x=x??this.length,b&&(x=Math.min(x,this.getTrimmedLength())),y&&(y.length=0);let E="";for(;S>22||1}return y&&y.push(S),E}}o.BufferLine=w},4841:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.getRangeLength=function(c,f){if(c.start.y>c.end.y)throw new Error(`Buffer range end (${c.end.x}, ${c.end.y}) cannot be before start (${c.start.x}, ${c.start.y})`);return f*(c.end.y-c.start.y)+(c.end.x-c.start.x+1)}},4634:(u,o)=>{function c(f,p,d){if(p===f.length-1)return f[p].getTrimmedLength();const _=!f[p].hasContent(d-1)&&f[p].getWidth(d-1)===1,v=f[p+1].getWidth(0)===2;return _&&v?d-1:d}Object.defineProperty(o,"__esModule",{value:!0}),o.getWrappedLineTrimmedLength=o.reflowSmallerGetNewLineLengths=o.reflowLargerApplyNewLayout=o.reflowLargerCreateNewLayout=o.reflowLargerGetLinesToRemove=void 0,o.reflowLargerGetLinesToRemove=function(f,p,d,_,v){const w=[];for(let C=0;C=C&&_0&&(T>y||x[T].getTrimmedLength()===0);T--)D++;D>0&&(w.push(C+x.length-D),w.push(D)),C+=x.length-1}return w},o.reflowLargerCreateNewLayout=function(f,p){const d=[];let _=0,v=p[_],w=0;for(let C=0;Cc(f,x,p))).reduce(((S,x)=>S+x));let w=0,C=0,b=0;for(;bS&&(w-=S,C++);const x=f[C].getWidth(w-1)===2;x&&w--;const y=x?d-1:d;_.push(y),b+=y}return _},o.getWrappedLineTrimmedLength=c},5295:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const f=c(8460),p=c(844),d=c(9092);class _ extends p.Disposable{constructor(w,C){super(),this._optionsService=w,this._bufferService=C,this._onBufferActivate=this.register(new f.EventEmitter),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 d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.Buffer(!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(w){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(w),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(w,C){this._normal.resize(w,C),this._alt.resize(w,C),this.setupTabStops(w)}setupTabStops(w){this._normal.setupTabStops(w),this._alt.setupTabStops(w)}}o.BufferSet=_},511:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const f=c(482),p=c(643),d=c(3734);class _ extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(w){const C=new _;return C.setFromCharData(w),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(w){this.fg=w[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(w[p.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(w[p.CHAR_DATA_CHAR_INDEX].length===2){const b=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=b&&b<=56319){const S=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=S&&S<=57343?this.content=1024*(b-55296)+S-56320+65536|w[p.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|w[p.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=w[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|w[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=_},643:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},4863:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const f=c(8460),p=c(844);class d{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}o.Marker=d,d._nextId=1},7116:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DEFAULT_CHARSET=o.CHARSETS=void 0,o.CHARSETS={},o.DEFAULT_CHARSET=o.CHARSETS.B,o.CHARSETS[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:"≥","{":"π","|":"≠","}":"£","~":"·"},o.CHARSETS.A={"#":"£"},o.CHARSETS.B=void 0,o.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},o.CHARSETS.C=o.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},o.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},o.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},o.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},o.CHARSETS.E=o.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},o.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},o.CHARSETS.H=o.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(u,o)=>{var c,f,p;Object.defineProperty(o,"__esModule",{value:!0}),o.C1_ESCAPED=o.C1=o.C0=void 0,(function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=` +`,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL=""})(c||(o.C0=c={})),(function(d){d.PAD="€",d.HOP="",d.BPH="‚",d.NBH="ƒ",d.IND="„",d.NEL="…",d.SSA="†",d.ESA="‡",d.HTS="ˆ",d.HTJ="‰",d.VTS="Š",d.PLD="‹",d.PLU="Œ",d.RI="",d.SS2="Ž",d.SS3="",d.DCS="",d.PU1="‘",d.PU2="’",d.STS="“",d.CCH="”",d.MW="•",d.SPA="–",d.EPA="—",d.SOS="˜",d.SGCI="™",d.SCI="š",d.CSI="›",d.ST="œ",d.OSC="",d.PM="ž",d.APC="Ÿ"})(f||(o.C1=f={})),(function(d){d.ST=`${c.ESC}\\`})(p||(o.C1_ESCAPED=p={}))},7399:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const f=c(2584),p={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:["'",'"']};o.evaluateKeyboardEvent=function(d,_,v,w){const C={type:0,cancel:!1,key:void 0},b=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?C.key=_?f.C0.ESC+"OA":f.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?C.key=_?f.C0.ESC+"OD":f.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?C.key=_?f.C0.ESC+"OC":f.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(C.key=_?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:C.key=d.ctrlKey?"\b":f.C0.DEL,d.altKey&&(C.key=f.C0.ESC+C.key);break;case 9:if(d.shiftKey){C.key=f.C0.ESC+"[Z";break}C.key=f.C0.HT,C.cancel=!0;break;case 13:C.key=d.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,C.cancel=!0;break;case 27:C.key=f.C0.ESC,d.altKey&&(C.key=f.C0.ESC+f.C0.ESC),C.cancel=!0;break;case 37:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"D",C.key===f.C0.ESC+"[1;3D"&&(C.key=f.C0.ESC+(v?"b":"[1;5D"))):C.key=_?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"C",C.key===f.C0.ESC+"[1;3C"&&(C.key=f.C0.ESC+(v?"f":"[1;5C"))):C.key=_?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"A",v||C.key!==f.C0.ESC+"[1;3A"||(C.key=f.C0.ESC+"[1;5A")):C.key=_?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"B",v||C.key!==f.C0.ESC+"[1;3B"||(C.key=f.C0.ESC+"[1;5B")):C.key=_?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(C.key=f.C0.ESC+"[2~");break;case 46:C.key=b?f.C0.ESC+"[3;"+(b+1)+"~":f.C0.ESC+"[3~";break;case 36:C.key=b?f.C0.ESC+"[1;"+(b+1)+"H":_?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:C.key=b?f.C0.ESC+"[1;"+(b+1)+"F":_?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:d.shiftKey?C.type=2:d.ctrlKey?C.key=f.C0.ESC+"[5;"+(b+1)+"~":C.key=f.C0.ESC+"[5~";break;case 34:d.shiftKey?C.type=3:d.ctrlKey?C.key=f.C0.ESC+"[6;"+(b+1)+"~":C.key=f.C0.ESC+"[6~";break;case 112:C.key=b?f.C0.ESC+"[1;"+(b+1)+"P":f.C0.ESC+"OP";break;case 113:C.key=b?f.C0.ESC+"[1;"+(b+1)+"Q":f.C0.ESC+"OQ";break;case 114:C.key=b?f.C0.ESC+"[1;"+(b+1)+"R":f.C0.ESC+"OR";break;case 115:C.key=b?f.C0.ESC+"[1;"+(b+1)+"S":f.C0.ESC+"OS";break;case 116:C.key=b?f.C0.ESC+"[15;"+(b+1)+"~":f.C0.ESC+"[15~";break;case 117:C.key=b?f.C0.ESC+"[17;"+(b+1)+"~":f.C0.ESC+"[17~";break;case 118:C.key=b?f.C0.ESC+"[18;"+(b+1)+"~":f.C0.ESC+"[18~";break;case 119:C.key=b?f.C0.ESC+"[19;"+(b+1)+"~":f.C0.ESC+"[19~";break;case 120:C.key=b?f.C0.ESC+"[20;"+(b+1)+"~":f.C0.ESC+"[20~";break;case 121:C.key=b?f.C0.ESC+"[21;"+(b+1)+"~":f.C0.ESC+"[21~";break;case 122:C.key=b?f.C0.ESC+"[23;"+(b+1)+"~":f.C0.ESC+"[23~";break;case 123:C.key=b?f.C0.ESC+"[24;"+(b+1)+"~":f.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(v&&!w||!d.altKey||d.metaKey)!v||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?C.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(C.key=f.C0.US),d.key==="@"&&(C.key=f.C0.NUL)):d.keyCode===65&&(C.type=1);else{const S=p[d.keyCode],x=S==null?void 0:S[d.shiftKey?1:0];if(x)C.key=f.C0.ESC+x;else if(d.keyCode>=65&&d.keyCode<=90){const y=d.ctrlKey?d.keyCode-64:d.keyCode+32;let E=String.fromCharCode(y);d.shiftKey&&(E=E.toUpperCase()),C.key=f.C0.ESC+E}else if(d.keyCode===32)C.key=f.C0.ESC+(d.ctrlKey?f.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let y=d.code.slice(3,4);d.shiftKey||(y=y.toLowerCase()),C.key=f.C0.ESC+y,C.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?C.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?C.key=f.C0.NUL:d.keyCode>=51&&d.keyCode<=55?C.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?C.key=f.C0.DEL:d.keyCode===219?C.key=f.C0.ESC:d.keyCode===220?C.key=f.C0.FS:d.keyCode===221&&(C.key=f.C0.GS)}return C}},482:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},o.utf32ToString=function(c,f=0,p=c.length){let d="";for(let _=f;_65535?(v-=65536,d+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):d+=String.fromCharCode(v)}return d},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,f){const p=c.length;if(!p)return 0;let d=0,_=0;if(this._interim){const v=c.charCodeAt(_++);56320<=v&&v<=57343?f[d++]=1024*(this._interim-55296)+v-56320+65536:(f[d++]=this._interim,f[d++]=v),this._interim=0}for(let v=_;v=p)return this._interim=w,d;const C=c.charCodeAt(v);56320<=C&&C<=57343?f[d++]=1024*(w-55296)+C-56320+65536:(f[d++]=w,f[d++]=C)}else w!==65279&&(f[d++]=w)}return d}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,f){const p=c.length;if(!p)return 0;let d,_,v,w,C=0,b=0,S=0;if(this.interim[0]){let E=!1,R=this.interim[0];R&=(224&R)==192?31:(240&R)==224?15:7;let N,D=0;for(;(N=63&this.interim[++D])&&D<4;)R<<=6,R|=N;const T=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,j=T-D;for(;S=p)return 0;if(N=c[S++],(192&N)!=128){S--,E=!0;break}this.interim[D++]=N,R<<=6,R|=63&N}E||(T===2?R<128?S--:f[C++]=R:T===3?R<2048||R>=55296&&R<=57343||R===65279||(f[C++]=R):R<65536||R>1114111||(f[C++]=R)),this.interim.fill(0)}const x=p-4;let y=S;for(;y=p)return this.interim[0]=d,C;if(_=c[y++],(192&_)!=128){y--;continue}if(b=(31&d)<<6|63&_,b<128){y--;continue}f[C++]=b}else if((240&d)==224){if(y>=p)return this.interim[0]=d,C;if(_=c[y++],(192&_)!=128){y--;continue}if(y>=p)return this.interim[0]=d,this.interim[1]=_,C;if(v=c[y++],(192&v)!=128){y--;continue}if(b=(15&d)<<12|(63&_)<<6|63&v,b<2048||b>=55296&&b<=57343||b===65279)continue;f[C++]=b}else if((248&d)==240){if(y>=p)return this.interim[0]=d,C;if(_=c[y++],(192&_)!=128){y--;continue}if(y>=p)return this.interim[0]=d,this.interim[1]=_,C;if(v=c[y++],(192&v)!=128){y--;continue}if(y>=p)return this.interim[0]=d,this.interim[1]=_,this.interim[2]=v,C;if(w=c[y++],(192&w)!=128){y--;continue}if(b=(7&d)<<18|(63&_)<<12|(63&v)<<6|63&w,b<65536||b>1114111)continue;f[C++]=b}}return C}}},225:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const f=c(1480),p=[[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]],d=[[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]];let _;o.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let v=0;vC[x][1])return!1;for(;x>=S;)if(b=S+x>>1,w>C[b][1])S=b+1;else{if(!(w=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,w){let C=this.wcwidth(v),b=C===0&&w!==0;if(b){const S=f.UnicodeService.extractWidth(w);S===0?b=!1:S>C&&(C=S)}return f.UnicodeService.createPropertyValue(0,C,b)}}},5981:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const f=c(8460),p=c(844);class d extends p.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,w){if(w!==void 0&&this._syncCalls>w)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const b=this._callbacks.shift();b&&b()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,w){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(w),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(w)}_innerWrite(v=0,w=!0){const C=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const b=this._writeBuffer[this._bufferOffset],S=this._action(b,w);if(S){const y=E=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,E))):this._innerWrite(C,E);return void S.catch((E=>(queueMicrotask((()=>{throw E})),Promise.resolve(!1)))).then(y)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=b.length,Date.now()-C>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(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()}}o.WriteBuffer=d},5941:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.parseColor=void 0;const c=/^([\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})$/,f=/^[\da-f]+$/;function p(d,_){const v=d.toString(16),w=v.length<2?"0"+v:v;switch(_){case 4:return v[0];case 8:return w;case 12:return(w+w).slice(0,3);default:return w+w}}o.parseColor=function(d){if(!d)return;let _=d.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);const v=c.exec(_);if(v){const w=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/w*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/w*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/w*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),f.exec(_)&&[3,6,9,12].includes(_.length))){const v=_.length/3,w=[0,0,0];for(let C=0;C<3;++C){const b=parseInt(_.slice(v*C,v*C+v),16);w[C]=v===1?b<<4:v===2?b:v===3?b>>4:b>>8}return w}},o.toRgbString=function(d,_=16){const[v,w,C]=d;return`rgb:${p(v,_)}/${p(w,_)}/${p(C,_)}`}},5770:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const f=c(482),p=c(8742),d=c(5770),_=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(w,C){this._handlers[w]===void 0&&(this._handlers[w]=[]);const b=this._handlers[w];return b.push(C),{dispose:()=>{const S=b.indexOf(C);S!==-1&&b.splice(S,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}reset(){if(this._active.length)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(w,C){if(this.reset(),this._ident=w,this._active=this._handlers[w]||_,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(w,C,b){if(this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].put(w,C,b);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(w,C,b))}unhook(w,C=!0){if(this._active.length){let b=!1,S=this._active.length-1,x=!1;if(this._stack.paused&&(S=this._stack.loopPosition-1,b=C,x=this._stack.fallThrough,this._stack.paused=!1),!x&&b===!1){for(;S>=0&&(b=this._active[S].unhook(w),b!==!0);S--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!1,b;S--}for(;S>=0;S--)if(b=this._active[S].unhook(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!0,b}else this._handlerFb(this._ident,"UNHOOK",w);this._active=_,this._ident=0}};const v=new p.Params;v.addParam(0),o.DcsHandler=class{constructor(w){this._handler=w,this._data="",this._params=v,this._hitLimit=!1}hook(w){this._params=w.length>1||w.params[0]?w.clone():v,this._data="",this._hitLimit=!1}put(w,C,b){this._hitLimit||(this._data+=(0,f.utf32ToString)(w,C,b),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(w){let C=!1;if(this._hitLimit)C=!1;else if(w&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((b=>(this._params=v,this._data="",this._hitLimit=!1,b)));return this._params=v,this._data="",this._hitLimit=!1,C}}},2015:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const f=c(844),p=c(8742),d=c(6242),_=c(6351);class v{constructor(S){this.table=new Uint8Array(S)}setDefault(S,x){this.table.fill(S<<4|x)}add(S,x,y,E){this.table[x<<8|S]=y<<4|E}addMany(S,x,y,E){for(let R=0;RT)),x=(D,T)=>S.slice(D,T),y=x(32,127),E=x(0,24);E.push(25),E.push.apply(E,x(28,32));const R=x(0,14);let N;for(N in b.setDefault(1,0),b.addMany(y,0,2,0),R)b.addMany([24,26,153,154],N,3,0),b.addMany(x(128,144),N,3,0),b.addMany(x(144,152),N,3,0),b.add(156,N,0,0),b.add(27,N,11,1),b.add(157,N,4,8),b.addMany([152,158,159],N,0,7),b.add(155,N,11,3),b.add(144,N,11,9);return b.addMany(E,0,3,0),b.addMany(E,1,3,1),b.add(127,1,0,1),b.addMany(E,8,0,8),b.addMany(E,3,3,3),b.add(127,3,0,3),b.addMany(E,4,3,4),b.add(127,4,0,4),b.addMany(E,6,3,6),b.addMany(E,5,3,5),b.add(127,5,0,5),b.addMany(E,2,3,2),b.add(127,2,0,2),b.add(93,1,4,8),b.addMany(y,8,5,8),b.add(127,8,5,8),b.addMany([156,27,24,26,7],8,6,0),b.addMany(x(28,32),8,0,8),b.addMany([88,94,95],1,0,7),b.addMany(y,7,0,7),b.addMany(E,7,0,7),b.add(156,7,0,0),b.add(127,7,0,7),b.add(91,1,11,3),b.addMany(x(64,127),3,7,0),b.addMany(x(48,60),3,8,4),b.addMany([60,61,62,63],3,9,4),b.addMany(x(48,60),4,8,4),b.addMany(x(64,127),4,7,0),b.addMany([60,61,62,63],4,0,6),b.addMany(x(32,64),6,0,6),b.add(127,6,0,6),b.addMany(x(64,127),6,0,0),b.addMany(x(32,48),3,9,5),b.addMany(x(32,48),5,9,5),b.addMany(x(48,64),5,0,6),b.addMany(x(64,127),5,7,0),b.addMany(x(32,48),4,9,5),b.addMany(x(32,48),1,9,2),b.addMany(x(32,48),2,9,2),b.addMany(x(48,127),2,10,0),b.addMany(x(48,80),1,10,0),b.addMany(x(81,88),1,10,0),b.addMany([89,90,92],1,10,0),b.addMany(x(96,127),1,10,0),b.add(80,1,11,9),b.addMany(E,9,0,9),b.add(127,9,0,9),b.addMany(x(28,32),9,0,9),b.addMany(x(32,48),9,9,12),b.addMany(x(48,60),9,8,10),b.addMany([60,61,62,63],9,9,10),b.addMany(E,11,0,11),b.addMany(x(32,128),11,0,11),b.addMany(x(28,32),11,0,11),b.addMany(E,10,0,10),b.add(127,10,0,10),b.addMany(x(28,32),10,0,10),b.addMany(x(48,60),10,8,10),b.addMany([60,61,62,63],10,0,11),b.addMany(x(32,48),10,9,12),b.addMany(E,12,0,12),b.add(127,12,0,12),b.addMany(x(28,32),12,0,12),b.addMany(x(32,48),12,9,12),b.addMany(x(48,64),12,0,11),b.addMany(x(64,127),12,12,13),b.addMany(x(64,127),10,12,13),b.addMany(x(64,127),9,12,13),b.addMany(E,13,13,13),b.addMany(y,13,13,13),b.add(127,13,0,13),b.addMany([27,156,24,26],13,14,0),b.add(w,0,2,0),b.add(w,8,5,8),b.add(w,6,0,6),b.add(w,11,0,11),b.add(w,13,13,13),b})();class C extends f.Disposable{constructor(S=o.VT500_TRANSITION_TABLE){super(),this._transitions=S,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(x,y,E)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,y)=>{},this._escHandlerFb=x=>{},this._errorHandlerFb=x=>x,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,f.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new d.OscParser),this._dcsParser=this.register(new _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(S,x=[64,126]){let y=0;if(S.prefix){if(S.prefix.length>1)throw new Error("only one byte as prefix supported");if(y=S.prefix.charCodeAt(0),y&&60>y||y>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(S.intermediates){if(S.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let R=0;RN||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");y<<=8,y|=N}}if(S.final.length!==1)throw new Error("final must be a single byte");const E=S.final.charCodeAt(0);if(x[0]>E||E>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return y<<=8,y|=E,y}identToString(S){const x=[];for(;S;)x.push(String.fromCharCode(255&S)),S>>=8;return x.reverse().join("")}setPrintHandler(S){this._printHandler=S}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(S,x){const y=this._identifier(S,[48,126]);this._escHandlers[y]===void 0&&(this._escHandlers[y]=[]);const E=this._escHandlers[y];return E.push(x),{dispose:()=>{const R=E.indexOf(x);R!==-1&&E.splice(R,1)}}}clearEscHandler(S){this._escHandlers[this._identifier(S,[48,126])]&&delete this._escHandlers[this._identifier(S,[48,126])]}setEscHandlerFallback(S){this._escHandlerFb=S}setExecuteHandler(S,x){this._executeHandlers[S.charCodeAt(0)]=x}clearExecuteHandler(S){this._executeHandlers[S.charCodeAt(0)]&&delete this._executeHandlers[S.charCodeAt(0)]}setExecuteHandlerFallback(S){this._executeHandlerFb=S}registerCsiHandler(S,x){const y=this._identifier(S);this._csiHandlers[y]===void 0&&(this._csiHandlers[y]=[]);const E=this._csiHandlers[y];return E.push(x),{dispose:()=>{const R=E.indexOf(x);R!==-1&&E.splice(R,1)}}}clearCsiHandler(S){this._csiHandlers[this._identifier(S)]&&delete this._csiHandlers[this._identifier(S)]}setCsiHandlerFallback(S){this._csiHandlerFb=S}registerDcsHandler(S,x){return this._dcsParser.registerHandler(this._identifier(S),x)}clearDcsHandler(S){this._dcsParser.clearHandler(this._identifier(S))}setDcsHandlerFallback(S){this._dcsParser.setHandlerFallback(S)}registerOscHandler(S,x){return this._oscParser.registerHandler(S,x)}clearOscHandler(S){this._oscParser.clearHandler(S)}setOscHandlerFallback(S){this._oscParser.setHandlerFallback(S)}setErrorHandler(S){this._errorHandler=S}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(S,x,y,E,R){this._parseStack.state=S,this._parseStack.handlers=x,this._parseStack.handlerPos=y,this._parseStack.transition=E,this._parseStack.chunkPos=R}parse(S,x,y){let E,R=0,N=0,D=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,D=this._parseStack.chunkPos+1;else{if(y===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const T=this._parseStack.handlers;let j=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(y===!1&&j>-1){for(;j>=0&&(E=T[j](this._params),E!==!0);j--)if(E instanceof Promise)return this._parseStack.handlerPos=j,E}this._parseStack.handlers=[];break;case 4:if(y===!1&&j>-1){for(;j>=0&&(E=T[j](),E!==!0);j--)if(E instanceof Promise)return this._parseStack.handlerPos=j,E}this._parseStack.handlers=[];break;case 6:if(R=S[this._parseStack.chunkPos],E=this._dcsParser.unhook(R!==24&&R!==26,y),E)return E;R===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(R=S[this._parseStack.chunkPos],E=this._oscParser.end(R!==24&&R!==26,y),E)return E;R===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,D=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let T=D;T>4){case 2:for(let U=T+1;;++U){if(U>=x||(R=S[U])<32||R>126&&R=x||(R=S[U])<32||R>126&&R=x||(R=S[U])<32||R>126&&R=x||(R=S[U])<32||R>126&&R=0&&(E=j[B](this._params),E!==!0);B--)if(E instanceof Promise)return this._preserveStack(3,j,B,N,T),E;B<0&&this._csiHandlerFb(this._collect<<8|R,this._params),this.precedingJoinState=0;break;case 8:do switch(R){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(R-48)}while(++T47&&R<60);T--;break;case 9:this._collect<<=8,this._collect|=R;break;case 10:const z=this._escHandlers[this._collect<<8|R];let G=z?z.length-1:-1;for(;G>=0&&(E=z[G](),E!==!0);G--)if(E instanceof Promise)return this._preserveStack(4,z,G,N,T),E;G<0&&this._escHandlerFb(this._collect<<8|R),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|R,this._params);break;case 13:for(let U=T+1;;++U)if(U>=x||(R=S[U])===24||R===26||R===27||R>127&&R=x||(R=S[U])<32||R>127&&R{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const f=c(5770),p=c(482),d=[];o.OscParser=class{constructor(){this._state=0,this._active=d,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(_,v){this._handlers[_]===void 0&&(this._handlers[_]=[]);const w=this._handlers[_];return w.push(v),{dispose:()=>{const C=w.indexOf(v);C!==-1&&w.splice(C,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].end(!1);this._stack.paused=!1,this._active=d,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||d,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,v,w){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(_,v,w);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(_,v,w))}start(){this.reset(),this._state=1}put(_,v,w){if(this._state!==3){if(this._state===1)for(;v0&&this._put(_,v,w)}}end(_,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let w=!1,C=this._active.length-1,b=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,w=v,b=this._stack.fallThrough,this._stack.paused=!1),!b&&w===!1){for(;C>=0&&(w=this._active[C].end(_),w!==!0);C--)if(w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,w;C--}for(;C>=0;C--)if(w=this._active[C].end(!1),w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,w}else this._handlerFb(this._id,"END",_);this._active=d,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,v,w){this._hitLimit||(this._data+=(0,p.utf32ToString)(_,v,w),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let v=!1;if(this._hitLimit)v=!1;else if(_&&(v=this._handler(this._data),v instanceof Promise))return v.then((w=>(this._data="",this._hitLimit=!1,w)));return this._data="",this._hitLimit=!1,v}}},8742:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const c=2147483647;class f{static fromArray(d){const _=new f;if(!d.length)return _;for(let v=Array.isArray(d[0])?1:0;v256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new f(this.maxLength,this.maxSubParamsLength);return d.params.set(this.params),d.length=this.length,d._subParams.set(this._subParams),d._subParamsLength=this._subParamsLength,d._subParamsIdx.set(this._subParamsIdx),d._rejectDigits=this._rejectDigits,d._rejectSubDigits=this._rejectSubDigits,d._digitIsSub=this._digitIsSub,d}toArray(){const d=[];for(let _=0;_>8,w=255&this._subParamsIdx[_];w-v>0&&d.push(Array.prototype.slice.call(this._subParams,v,w))}return d}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(d){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=d>c?c:d}}addSubParam(d){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=d>c?c:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const _=this._subParamsIdx[d]>>8,v=255&this._subParamsIdx[d];return v-_>0?this._subParams.subarray(_,v):null}getSubParamsAll(){const d={};for(let _=0;_>8,w=255&this._subParamsIdx[_];w-v>0&&(d[_]=this._subParams.slice(v,w))}return d}addDigit(d){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,w=v[_-1];v[_-1]=~w?Math.min(10*w+d,c):d}}o.Params=f},5741:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let c=this._addons.length-1;c>=0;c--)this._addons[c].instance.dispose()}loadAddon(c,f){const p={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(p),f.dispose=()=>this._wrappedAddonDispose(p),f.activate(c)}_wrappedAddonDispose(c){if(c.isDisposed)return;let f=-1;for(let p=0;p{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const f=c(3785),p=c(511);o.BufferApiView=class{constructor(d,_){this._buffer=d,this.type=_}init(d){return this._buffer=d,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(d){const _=this._buffer.lines.get(d);if(_)return new f.BufferLineApiView(_)}getNullCell(){return new p.CellData}}},3785:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const f=c(511);o.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,d){if(!(p<0||p>=this._line.length))return d?(this._line.loadCell(p,d),d):this._line.loadCell(p,new f.CellData)}translateToString(p,d,_){return this._line.translateToString(p,d,_)}}},8285:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const f=c(8771),p=c(8460),d=c(844);class _ extends d.Disposable{constructor(w){super(),this._core=w,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.BufferApiView(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)}}o.BufferNamespaceApi=_},7975:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(c){this._core=c}registerCsiHandler(c,f){return this._core.registerCsiHandler(c,(p=>f(p.toArray())))}addCsiHandler(c,f){return this.registerCsiHandler(c,f)}registerDcsHandler(c,f){return this._core.registerDcsHandler(c,((p,d)=>f(p,d.toArray())))}addDcsHandler(c,f){return this.registerDcsHandler(c,f)}registerEscHandler(c,f){return this._core.registerEscHandler(c,f)}addEscHandler(c,f){return this.registerEscHandler(c,f)}registerOscHandler(c,f){return this._core.registerOscHandler(c,f)}addOscHandler(c,f){return this.registerOscHandler(c,f)}}},7090:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.UnicodeApi=class{constructor(c){this._core=c}register(c){this._core.unicodeService.register(c)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(c){this._core.unicodeService.activeVersion=c}}},744:function(u,o,c){var f=this&&this.__decorate||function(b,S,x,y){var E,R=arguments.length,N=R<3?S:y===null?y=Object.getOwnPropertyDescriptor(S,x):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,S,x,y);else for(var D=b.length-1;D>=0;D--)(E=b[D])&&(N=(R<3?E(N):R>3?E(S,x,N):E(S,x))||N);return R>3&&N&&Object.defineProperty(S,x,N),N},p=this&&this.__param||function(b,S){return function(x,y){S(x,y,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const d=c(8460),_=c(844),v=c(5295),w=c(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let C=o.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(b){super(),this.isUserScrolling=!1,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(b.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(b.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(b,this))}resize(b,S){this.cols=b,this.rows=S,this.buffers.resize(b,S),this._onResize.fire({cols:b,rows:S})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(b,S=!1){const x=this.buffer;let y;y=this._cachedBlankLine,y&&y.length===this.cols&&y.getFg(0)===b.fg&&y.getBg(0)===b.bg||(y=x.getBlankLine(b,S),this._cachedBlankLine=y),y.isWrapped=S;const E=x.ybase+x.scrollTop,R=x.ybase+x.scrollBottom;if(x.scrollTop===0){const N=x.lines.isFull;R===x.lines.length-1?N?x.lines.recycle().copyFrom(y):x.lines.push(y.clone()):x.lines.splice(R+1,0,y.clone()),N?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const N=R-E+1;x.lines.shiftElements(E+1,N-1,-1),x.lines.set(R,y.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(b,S,x){const y=this.buffer;if(b<0){if(y.ydisp===0)return;this.isUserScrolling=!0}else b+y.ydisp>=y.ybase&&(this.isUserScrolling=!1);const E=y.ydisp;y.ydisp=Math.max(Math.min(y.ydisp+b,y.ybase),0),E!==y.ydisp&&(S||this._onScroll.fire(y.ydisp))}};o.BufferService=C=f([p(0,w.IOptionsService)],C)},7994:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CharsetService=void 0,o.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(c){this.glevel=c,this.charset=this._charsets[c]}setgCharset(c,f){this._charsets[c]=f,this.glevel===c&&(this.charset=f)}}},1753:function(u,o,c){var f=this&&this.__decorate||function(y,E,R,N){var D,T=arguments.length,j=T<3?E:N===null?N=Object.getOwnPropertyDescriptor(E,R):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(y,E,R,N);else for(var B=y.length-1;B>=0;B--)(D=y[B])&&(j=(T<3?D(j):T>3?D(E,R,j):D(E,R))||j);return T>3&&j&&Object.defineProperty(E,R,j),j},p=this&&this.__param||function(y,E){return function(R,N){E(R,N,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const d=c(2585),_=c(8460),v=c(844),w={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:y=>y.button!==4&&y.action===1&&(y.ctrl=!1,y.alt=!1,y.shift=!1,!0)},VT200:{events:19,restrict:y=>y.action!==32},DRAG:{events:23,restrict:y=>y.action!==32||y.button!==3},ANY:{events:31,restrict:y=>!0}};function C(y,E){let R=(y.ctrl?16:0)|(y.shift?4:0)|(y.alt?8:0);return y.button===4?(R|=64,R|=y.action):(R|=3&y.button,4&y.button&&(R|=64),8&y.button&&(R|=128),y.action===32?R|=32:y.action!==0||E||(R|=3)),R}const b=String.fromCharCode,S={DEFAULT:y=>{const E=[C(y,!1)+32,y.col+32,y.row+32];return E[0]>255||E[1]>255||E[2]>255?"":`\x1B[M${b(E[0])}${b(E[1])}${b(E[2])}`},SGR:y=>{const E=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.col};${y.row}${E}`},SGR_PIXELS:y=>{const E=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.x};${y.y}${E}`}};let x=o.CoreMouseService=class extends v.Disposable{constructor(y,E){super(),this._bufferService=y,this._coreService=E,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const R of Object.keys(w))this.addProtocol(R,w[R]);for(const R of Object.keys(S))this.addEncoding(R,S[R]);this.reset()}addProtocol(y,E){this._protocols[y]=E}addEncoding(y,E){this._encodings[y]=E}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(y){if(!this._protocols[y])throw new Error(`unknown protocol "${y}"`);this._activeProtocol=y,this._onProtocolChange.fire(this._protocols[y].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(y){if(!this._encodings[y])throw new Error(`unknown encoding "${y}"`);this._activeEncoding=y}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(y){if(y.col<0||y.col>=this._bufferService.cols||y.row<0||y.row>=this._bufferService.rows||y.button===4&&y.action===32||y.button===3&&y.action!==32||y.button!==4&&(y.action===2||y.action===3)||(y.col++,y.row++,y.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,y,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(y))return!1;const E=this._encodings[this._activeEncoding](y);return E&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(E):this._coreService.triggerDataEvent(E,!0)),this._lastEvent=y,!0}explainEvents(y){return{down:!!(1&y),up:!!(2&y),drag:!!(4&y),move:!!(8&y),wheel:!!(16&y)}}_equalEvents(y,E,R){if(R){if(y.x!==E.x||y.y!==E.y)return!1}else if(y.col!==E.col||y.row!==E.row)return!1;return y.button===E.button&&y.action===E.action&&y.ctrl===E.ctrl&&y.alt===E.alt&&y.shift===E.shift}};o.CoreMouseService=x=f([p(0,d.IBufferService),p(1,d.ICoreService)],x)},6975:function(u,o,c){var f=this&&this.__decorate||function(x,y,E,R){var N,D=arguments.length,T=D<3?y:R===null?R=Object.getOwnPropertyDescriptor(y,E):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,y,E,R);else for(var j=x.length-1;j>=0;j--)(N=x[j])&&(T=(D<3?N(T):D>3?N(y,E,T):N(y,E))||T);return D>3&&T&&Object.defineProperty(y,E,T),T},p=this&&this.__param||function(x,y){return function(E,R){y(E,R,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const d=c(1439),_=c(8460),v=c(844),w=c(2585),C=Object.freeze({insertMode:!1}),b=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let S=o.CoreService=class extends v.Disposable{constructor(x,y,E){super(),this._bufferService=x,this._logService=y,this._optionsService=E,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(C),this.decPrivateModes=(0,d.clone)(b)}reset(){this.modes=(0,d.clone)(C),this.decPrivateModes=(0,d.clone)(b)}triggerDataEvent(x,y=!1){if(this._optionsService.rawOptions.disableStdin)return;const E=this._bufferService.buffer;y&&this._optionsService.rawOptions.scrollOnUserInput&&E.ybase!==E.ydisp&&this._onRequestScrollToBottom.fire(),y&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((R=>R.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((y=>y.charCodeAt(0))))),this._onBinary.fire(x))}};o.CoreService=S=f([p(0,w.IBufferService),p(1,w.ILogService),p(2,w.IOptionsService)],S)},9074:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const f=c(8055),p=c(8460),d=c(844),_=c(6106);let v=0,w=0;class C extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((x=>x==null?void 0:x.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const y=new b(x);if(y){const E=y.marker.onDispose((()=>y.dispose()));y.onDispose((()=>{y&&(this._decorations.delete(y)&&this._onDecorationRemoved.fire(y),E.dispose())})),this._decorations.insert(y),this._onDecorationRegistered.fire(y)}return y}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,y,E){let R=0,N=0;for(const D of this._decorations.getKeyIterator(y))R=D.options.x??0,N=R+(D.options.width??1),x>=R&&x{v=N.options.x??0,w=v+(N.options.width??1),x>=v&&x{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const f=c(2585),p=c(8343);class d{constructor(...v){this._entries=new Map;for(const[w,C]of v)this.set(w,C)}set(v,w){const C=this._entries.get(v);return this._entries.set(v,w),C}forEach(v){for(const[w,C]of this._entries.entries())v(w,C)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}o.ServiceCollection=d,o.InstantiationService=class{constructor(){this._services=new d,this._services.set(f.IInstantiationService,this)}setService(_,v){this._services.set(_,v)}getService(_){return this._services.get(_)}createInstance(_,...v){const w=(0,p.getServiceDependencies)(_).sort(((S,x)=>S.index-x.index)),C=[];for(const S of w){const x=this._services.get(S.id);if(!x)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${S.id}.`);C.push(x)}const b=w.length>0?w[0].index:v.length;if(v.length!==b)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${b+1} conflicts with ${v.length} static arguments`);return new _(...v,...C)}}},7866:function(u,o,c){var f=this&&this.__decorate||function(b,S,x,y){var E,R=arguments.length,N=R<3?S:y===null?y=Object.getOwnPropertyDescriptor(S,x):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,S,x,y);else for(var D=b.length-1;D>=0;D--)(E=b[D])&&(N=(R<3?E(N):R>3?E(S,x,N):E(S,x))||N);return R>3&&N&&Object.defineProperty(S,x,N),N},p=this&&this.__param||function(b,S){return function(x,y){S(x,y,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const d=c(844),_=c(2585),v={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF};let w,C=o.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(b){super(),this._optionsService=b,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),w=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(b){for(let S=0;SJSON.stringify(N))).join(", ")})`);const R=y.apply(this,E);return w.trace(`GlyphRenderer#${y.name} return`,R),R}}},7302:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const f=c(8460),p=c(844),d=c(6114);o.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:d.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const _=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends p.Disposable{constructor(C){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const b={...o.DEFAULT_OPTIONS};for(const S in C)if(S in b)try{const x=C[S];b[S]=this._sanitizeAndValidateOption(S,x)}catch(x){console.error(x)}this.rawOptions=b,this.options={...b},this._setupOptions(),this.register((0,p.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,b){return this.onOptionChange((S=>{S===C&&b(this.rawOptions[C])}))}onMultipleOptionChange(C,b){return this.onOptionChange((S=>{C.indexOf(S)!==-1&&b()}))}_setupOptions(){const C=S=>{if(!(S in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${S}"`);return this.rawOptions[S]},b=(S,x)=>{if(!(S in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${S}"`);x=this._sanitizeAndValidateOption(S,x),this.rawOptions[S]!==x&&(this.rawOptions[S]=x,this._onOptionChange.fire(S))};for(const S in this.rawOptions){const x={get:C.bind(this,S),set:b.bind(this,S)};Object.defineProperty(this.options,S,x)}}_sanitizeAndValidateOption(C,b){switch(C){case"cursorStyle":if(b||(b=o.DEFAULT_OPTIONS[C]),!(function(S){return S==="block"||S==="underline"||S==="bar"})(b))throw new Error(`"${b}" is not a valid value for ${C}`);break;case"wordSeparator":b||(b=o.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof b=="number"&&1<=b&&b<=1e3)break;b=_.includes(b)?b:o.DEFAULT_OPTIONS[C];break;case"cursorWidth":b=Math.floor(b);case"lineHeight":case"tabStopWidth":if(b<1)throw new Error(`${C} cannot be less than 1, value: ${b}`);break;case"minimumContrastRatio":b=Math.max(1,Math.min(21,Math.round(10*b)/10));break;case"scrollback":if((b=Math.min(b,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${b}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(b<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${b}`);break;case"rows":case"cols":if(!b&&b!==0)throw new Error(`${C} must be numeric, value: ${b}`);break;case"windowsPty":b=b??{}}return b}}o.OptionsService=v},2660:function(u,o,c){var f=this&&this.__decorate||function(v,w,C,b){var S,x=arguments.length,y=x<3?w:b===null?b=Object.getOwnPropertyDescriptor(w,C):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(v,w,C,b);else for(var E=v.length-1;E>=0;E--)(S=v[E])&&(y=(x<3?S(y):x>3?S(w,C,y):S(w,C))||y);return x>3&&y&&Object.defineProperty(w,C,y),y},p=this&&this.__param||function(v,w){return function(C,b){w(C,b,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const d=c(2585);let _=o.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const w=this._bufferService.buffer;if(v.id===void 0){const E=w.addMarker(w.ybase+w.y),R={data:v,id:this._nextId++,lines:[E]};return E.onDispose((()=>this._removeMarkerFromLink(R,E))),this._dataByLinkId.set(R.id,R),R.id}const C=v,b=this._getEntryIdKey(C),S=this._entriesWithId.get(b);if(S)return this.addLineToLink(S.id,w.ybase+w.y),S.id;const x=w.addMarker(w.ybase+w.y),y={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(y,x))),this._entriesWithId.set(y.key,y),this._dataByLinkId.set(y.id,y),y.id}addLineToLink(v,w){const C=this._dataByLinkId.get(v);if(C&&C.lines.every((b=>b.line!==w))){const b=this._bufferService.buffer.addMarker(w);C.lines.push(b),b.onDispose((()=>this._removeMarkerFromLink(C,b)))}}getLinkData(v){var w;return(w=this._dataByLinkId.get(v))==null?void 0:w.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,w){const C=v.lines.indexOf(w);C!==-1&&(v.lines.splice(C,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};o.OscLinkService=_=f([p(0,d.IBufferService)],_)},8343:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const c="di$target",f="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(p){return p[f]||[]},o.createDecorator=function(p){if(o.serviceRegistry.has(p))return o.serviceRegistry.get(p);const d=function(_,v,w){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,b,S){b[c]===b?b[f].push({id:C,index:S}):(b[f]=[{id:C,index:S}],b[c]=b)})(d,_,w)};return d.toString=()=>p,o.serviceRegistry.set(p,d),d}},2585:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const f=c(8343);var p;o.IBufferService=(0,f.createDecorator)("BufferService"),o.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),o.ICoreService=(0,f.createDecorator)("CoreService"),o.ICharsetService=(0,f.createDecorator)("CharsetService"),o.IInstantiationService=(0,f.createDecorator)("InstantiationService"),(function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"})(p||(o.LogLevelEnum=p={})),o.ILogService=(0,f.createDecorator)("LogService"),o.IOptionsService=(0,f.createDecorator)("OptionsService"),o.IOscLinkService=(0,f.createDecorator)("OscLinkService"),o.IUnicodeService=(0,f.createDecorator)("UnicodeService"),o.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const f=c(8460),p=c(225);class d{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,w,C=!1){return(16777215&v)<<3|(3&w)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const v=new p.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let w=0,C=0;const b=v.length;for(let S=0;S=b)return w+this.wcwidth(x);const R=v.charCodeAt(S);56320<=R&&R<=57343?x=1024*(x-55296)+R-56320+65536:w+=this.wcwidth(R)}const y=this.charProperties(x,C);let E=d.extractWidth(y);d.extractShouldJoin(y)&&(E-=d.extractWidth(C)),w+=E,C=y}return w}charProperties(v,w){return this._activeProvider.charProperties(v,w)}}o.UnicodeService=d}},r={};function a(u){var o=r[u];if(o!==void 0)return o.exports;var c=r[u]={exports:{}};return n[u].call(c.exports,c,c.exports,a),c.exports}var l={};return(()=>{var u=l;Object.defineProperty(u,"__esModule",{value:!0}),u.Terminal=void 0;const o=a(9042),c=a(3236),f=a(844),p=a(5741),d=a(8285),_=a(7975),v=a(7090),w=["cols","rows"];class C extends f.Disposable{constructor(S){super(),this._core=this.register(new c.Terminal(S)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const x=E=>this._core.options[E],y=(E,R)=>{this._checkReadonlyOptions(E),this._core.options[E]=R};for(const E in this._core.options){const R={get:x.bind(this,E),set:y.bind(this,E)};Object.defineProperty(this._publicOptions,E,R)}}_checkReadonlyOptions(S){if(w.includes(S))throw new Error(`Option "${S}" 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 _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.UnicodeApi(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 d.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const S=this._core.coreService.decPrivateModes;let x="none";switch(this._core.coreMouseService.activeProtocol){case"X10":x="x10";break;case"VT200":x="vt200";break;case"DRAG":x="drag";break;case"ANY":x="any"}return{applicationCursorKeysMode:S.applicationCursorKeys,applicationKeypadMode:S.applicationKeypad,bracketedPasteMode:S.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:S.origin,reverseWraparoundMode:S.reverseWraparound,sendFocusMode:S.sendFocus,wraparoundMode:S.wraparound}}get options(){return this._publicOptions}set options(S){for(const x in S)this._publicOptions[x]=S[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(S,x=!0){this._core.input(S,x)}resize(S,x){this._verifyIntegers(S,x),this._core.resize(S,x)}open(S){this._core.open(S)}attachCustomKeyEventHandler(S){this._core.attachCustomKeyEventHandler(S)}attachCustomWheelEventHandler(S){this._core.attachCustomWheelEventHandler(S)}registerLinkProvider(S){return this._core.registerLinkProvider(S)}registerCharacterJoiner(S){return this._checkProposedApi(),this._core.registerCharacterJoiner(S)}deregisterCharacterJoiner(S){this._checkProposedApi(),this._core.deregisterCharacterJoiner(S)}registerMarker(S=0){return this._verifyIntegers(S),this._core.registerMarker(S)}registerDecoration(S){return this._checkProposedApi(),this._verifyPositiveIntegers(S.x??0,S.width??0,S.height??0),this._core.registerDecoration(S)}hasSelection(){return this._core.hasSelection()}select(S,x,y){this._verifyIntegers(S,x,y),this._core.select(S,x,y)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(S,x){this._verifyIntegers(S,x),this._core.selectLines(S,x)}dispose(){super.dispose()}scrollLines(S){this._verifyIntegers(S),this._core.scrollLines(S)}scrollPages(S){this._verifyIntegers(S),this._core.scrollPages(S)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(S){this._verifyIntegers(S),this._core.scrollToLine(S)}clear(){this._core.clear()}write(S,x){this._core.write(S,x)}writeln(S,x){this._core.write(S),this._core.write(`\r +`,x)}paste(S){this._core.paste(S)}refresh(S,x){this._verifyIntegers(S,x),this._core.refresh(S,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(S){this._addonManager.loadAddon(this,S)}static get strings(){return o}_verifyIntegers(...S){for(const x of S)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...S){for(const x of S)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}u.Terminal=C})(),l})()))})(dp)),dp.exports}var cB=lB();function kb(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r{const n=t.current;if(!n)return;const r=new cB.Terminal({convertEol:!0,disableStdin:!0,fontSize:12,fontFamily:'ui-monospace, "SF Mono", Menlo, Consolas, monospace',scrollback:2e4,theme:{background:"#1a1a1a",foreground:"#e6e1e0",cursor:"#1a1a1a",selectionBackground:"#2c3441"}}),a=new oB.FitAddon;r.loadAddon(a),r.open(n);try{a.fit()}catch{}const l=new ResizeObserver(()=>{try{a.fit()}catch{}});l.observe(n);let u=!1,o=0,c=!1,f=!1;async function p(){if(c){f=!0;return}c=!0;try{for(;;){const _=await BN(e,o);if(u)return;if(_.dataBase64&&r.write(kb(_.dataBase64)),o=_.nextOffset,_.eof)break}}catch{}finally{c=!1,f&&!u&&(f=!1,p())}}const d=wT(e,_=>{if(u)return;const v=kb(_.dataBase64);!c&&_.offset===o?(r.write(v),o+=v.length):_.offset+v.length>o&&p()});return p(),()=>{u=!0,d(),l.disconnect(),r.dispose()}},[e]),m.jsx("div",{ref:t,style:{width:"100%",height:"100%"}})}const ea="__uncommitted__";function hB({state:e}){return!e||e.loading?m.jsx("div",{className:"changes-note",children:"Loading diff…"}):e.error?m.jsx("div",{className:"error",children:e.error}):e.payload?e.payload.truncated?m.jsx(rB,{bytesRead:e.payload.bytesRead,byteLimit:e.payload.byteLimit}):m.jsx(fC,{diff:e.payload.diff}):m.jsx("div",{className:"diff-empty",children:"No changes."})}function fB({experiment:e,project:t,view:n,runs:r,selectedRunId:a,onSelectRun:l}){const u=r.filter(o=>o.experimentId===e.id).sort((o,c)=>c.createdAt-o.createdAt);return n==="terminal"?m.jsx(dB,{experiment:e,expRuns:u,selectedRunId:a,onSelectRun:l}):m.jsx(pB,{experiment:e,project:t})}function dB({experiment:e,expRuns:t,selectedRunId:n,onSelectRun:r}){const[a,l]=V.useState(null),[u,o]=V.useState(!1),c=V.useRef(null),f=n&&t.find(w=>w.id===n)||t[0]||null,p=(f==null?void 0:f.status)==="running"||(f==null?void 0:f.status)==="starting",d=w=>{const C=t.findIndex(b=>b.id===w);return C===-1?t.length:t.length-C},_=V.useRef(null);V.useEffect(()=>{if(_.current===null){_.current=new Set(t.map(C=>C.id));return}const w=t.find(C=>!_.current.has(C.id));for(const C of t)_.current.add(C.id);w&&r(w.id)},[t,r]),V.useEffect(()=>{if(!u)return;const w=C=>{var b;(b=c.current)!=null&&b.contains(C.target)||o(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[u]);async function v(){if(f){l(null);try{await XS(f.id)}catch(w){l(w instanceof Error?w.message:String(w))}}}return m.jsxs("div",{className:"term-view",children:[m.jsxs("div",{className:"term-bar",children:[m.jsx("div",{className:"term-title",title:e.title||e.slug,children:e.title||e.slug}),m.jsx("span",{style:{flex:1}}),a&&m.jsx("span",{className:"error",children:a}),p&&m.jsxs("button",{className:"btn sm ghost",onClick:()=>void v(),children:[m.jsx(MA,{size:13}),"Stop"]}),t.length>0&&f&&m.jsxs("div",{className:"run-history",ref:c,children:[m.jsxs("button",{className:"run-picker",title:"Switch run",onClick:()=>o(w=>!w),children:[m.jsxs("span",{className:"run-label",children:["Run ",d(f.id)]}),m.jsx(Vo,{status:f.status}),m.jsx(cs,{size:14,className:"run-picker-chev"})]}),u&&m.jsx("div",{className:"history-menu",children:t.map(w=>m.jsxs("button",{className:`history-item ${w.id===(f==null?void 0:f.id)?"active":""}`,onClick:()=>{r(w.id),o(!1)},children:[m.jsxs("span",{className:"run-label",children:["Run ",d(w.id)]}),m.jsx(Vo,{status:w.status}),m.jsx("span",{className:"when",children:Sa(w.createdAt)})]},w.id))})]})]}),m.jsx("div",{className:"term-fill",children:f?m.jsx(uB,{runId:f.id},f.id):m.jsx("div",{className:"term-empty",children:"No runs yet — ask the agent to launch one."})})]})}function pB({experiment:e,project:t}){const[n,r]=V.useState(null),[a,l]=V.useState(null),[u,o]=V.useState(null),[c,f]=V.useState(null),[p,d]=V.useState({}),_=!!(u&&u.diff.trim()!==""&&u.experimentId===e.id);async function v(){l(null);try{const[C,b]=await Promise.all([IN(e.id),By(e.projectId)]);r(C),o(b),f(S=>{var y;return S!==null?S:b.diff.trim()!==""&&b.experimentId===e.id?ea:((y=C[0])==null?void 0:y.sha)??null})}catch(C){l(C instanceof Error?C.message:String(C))}}V.useEffect(()=>{n===null&&!a&&v()},[n,a,e.id]),V.useEffect(()=>{const C=setInterval(()=>{By(e.projectId).then(o).catch(()=>{})},5e3);return()=>clearInterval(C)},[e.projectId]),V.useEffect(()=>{var C;c===ea&&u&&!_&&f(((C=n==null?void 0:n[0])==null?void 0:C.sha)??null)},[c,u,_,n]),V.useEffect(()=>{if(!c||c===ea||p[c])return;const C=c;d(b=>({...b,[C]:{loading:!0}})),zN(e.id,C).then(b=>d(S=>({...S,[C]:{loading:!1,payload:b}}))).catch(b=>d(S=>({...S,[C]:{loading:!1,error:b instanceof Error?b.message:String(b)}})))},[c,p,e.id]);const w=!_&&((n==null?void 0:n.length)??0)===0;return m.jsx("div",{className:"drawer",children:m.jsx("div",{className:"drawer-body",children:m.jsxs("div",{className:"drawer-section",children:[m.jsxs("div",{className:"changes-branch",children:[m.jsx("span",{className:"ctl-label",children:"Branch"}),m.jsx(UL,{owner:t.githubOwner,repo:t.githubRepo,branch:e.branchName})]}),a?m.jsx("div",{className:"error",children:a}):n===null?m.jsx("div",{className:"changes-note",children:"Loading changes…"}):w?m.jsx("div",{className:"changes-note",children:"No changes yet — the agent hasn't committed on this branch."}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"commit-picker",children:[m.jsx("span",{className:"ctl-label",children:"Commit"}),c===ea&&m.jsx("span",{className:"uncommitted-dot"}),m.jsxs("select",{className:"input sm",value:c??"",onChange:C=>f(C.target.value),children:[_&&m.jsx("option",{value:ea,children:"● Uncommitted changes"}),n.map(C=>m.jsxs("option",{value:C.sha,children:[C.sha.slice(0,7)," — ",C.subject]},C.sha))]}),m.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:()=>void v(),children:m.jsx(Sg,{size:14})})]}),m.jsx("div",{style:{marginTop:10},children:c===ea&&u?u.truncated?m.jsxs("div",{className:"truncated-notice",children:[m.jsx("h4",{children:"Diff too large to display"}),m.jsx("p",{children:"The uncommitted diff is too large to display. View it locally with git."})]}):m.jsx(fC,{diff:u.diff}):c?m.jsx(hB,{state:p[c]}):m.jsx("div",{className:"changes-note",children:"Select a commit to view its diff."})})]})]})})})}function gB(e,t){return vw(e,hw(t))}function mB({projectId:e,path:t,sessionId:n,gitRef:r,onOpenFile:a}){const[l,u]=V.useState(null),[o,c]=V.useState(null),[f,p]=V.useState(!0),[d,_]=V.useState(0),v=/\.(md|mdx|markdown)$/i.test(t),[w,C]=V.useState(!1);V.useEffect(()=>{let y=!1;return p(!0),HN(e,t,{sessionId:n,ref:r}).then(E=>{y||(u(E),c(null))}).catch(E=>{y||c(E.message)}).finally(()=>{y||p(!1)}),()=>{y=!0}},[e,t,n,r,d]);const b=V.useMemo(()=>l&&!l.notFound?gB(l.content,t):null,[l,t]),S=l&&!l.notFound&&l.content?l.content.split(` `).length-(l.content.endsWith(` -`)?1:0):0,x=y=>r?`File not found on branch ${r}.`:n&&y.root==="clone"?"This session's worktree isn't available, and the file isn't in the project clone.":`File not found in the ${y.root==="worktree"?"session's worktree":"project clone"}.`;return m.jsxs("div",{className:"file-view",children:[m.jsxs("div",{className:"file-view-header",children:[m.jsx(KA,{size:13,style:{flexShrink:0}}),m.jsx("code",{className:"file-view-path",title:t,children:t}),r&&m.jsx("code",{className:"file-view-ref",title:`Committed state of ${r}`,children:r}),v&&m.jsx("button",{className:`icon-btn ${w?"active":""}`,title:w?"Rendered view":"Source view","aria-label":w?"Rendered view":"Source view",onClick:()=>C(y=>!y),children:m.jsx(FA,{size:13})}),m.jsx("button",{className:"icon-btn",title:"Reload file","aria-label":"Reload file",onClick:()=>_(y=>y+1),children:f?m.jsx("span",{className:"spinner"}):m.jsx(Sg,{size:13})})]}),m.jsx("div",{className:"file-view-body",children:o?m.jsxs("div",{className:"file-view-note",children:["Failed to load file: ",o]}):l===null?m.jsx("div",{className:"file-view-note",children:"Loading…"}):l.notFound?m.jsx("div",{className:"file-view-note",children:x(l)}):m.jsxs(m.Fragment,{children:[!r&&n&&l.root==="clone"&&m.jsx("div",{className:"file-view-note",children:"This session's worktree isn't available — showing the project clone's copy."}),v&&!w?m.jsx("div",{className:"file-view-md",children:m.jsx(qo,{text:l.content,onOpenFile:a&&(y=>a(y,n,r))})}):m.jsxs("div",{className:"file-view-codewrap",children:[S>0&&m.jsx("pre",{className:"file-view-gutter","aria-hidden":"true",children:Array.from({length:S},(y,E)=>E+1).join(` -`)}),m.jsx("pre",{className:"file-view-code",children:m.jsx("code",{children:b})})]}),l.truncated&&m.jsx("div",{className:"file-view-note",children:"File truncated — showing the first 512 KB."})]})})]})}function bB({projectName:e,onHome:t,onCollapse:n}){return m.jsxs("div",{className:"rail-brand",children:[m.jsxs("button",{className:"brand",onClick:t,title:"All projects",children:[m.jsx(jo,{size:15}),m.jsx("span",{className:"brand-project",children:e})]}),n&&m.jsx("button",{className:"icon-btn",title:"Hide sidebar","aria-label":"Hide sidebar",onClick:n,children:m.jsx(YS,{size:15})})]})}function SB({onDone:e}){const[t,n]=q.useState(0),[r,a]=q.useState(null),[l,u]=q.useState(null),[o,c]=q.useState(null),[f,p]=q.useState(null),[d,_]=q.useState(!1),v=C=>{_(!0),Promise.allSettled([wg(C).then(a),nx().then(u),ex().then(c),gT().then(p)]).finally(()=>_(!1))};q.useEffect(()=>v(!1),[]);const w=()=>{_T((f==null?void 0:f.enabled)??!0).catch(()=>{}),e()};return m.jsx("div",{className:"home onboarding",children:m.jsx("div",{className:"home-inner",children:t===0?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 1 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Your coding agents"}),m.jsx("p",{className:"onb-sub",children:"orx found the agent CLIs on this machine and drives them directly — chat and autoresearch run on your own logins, no extra API keys."}),m.jsx("div",{className:"onb-cards",children:r===null?m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Detecting Claude Code, Codex, OpenCode…"]}):r.map(C=>m.jsx(wB,{h:C},C.id))}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>v(!0),disabled:d,children:[m.jsx(Su,{size:12,className:d?"spin":""})," Re-check"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(1),children:["Continue ",m.jsx(Ic,{size:13})]})]})]}):t===1?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 2 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Git & GitHub"}),m.jsx("p",{className:"onb-sub",children:"A project is a clone of one of your GitHub repos, made with your own git credentials. Every experiment becomes a branch pushed to that repo — compute jobs clone it from there."}),m.jsx("div",{className:"onb-cards",children:m.jsx(CB,{git:l,onUpdate:u})}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(0),children:[m.jsx(jo,{size:12})," Back"]}),m.jsxs("button",{className:"btn ghost",onClick:()=>v(!1),disabled:d,children:[m.jsx(Su,{size:12,className:d?"spin":""})," Re-check"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(2),children:["Continue ",m.jsx(Ic,{size:13})]})]})]}):t===2?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 3 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Where orx keeps your data"}),m.jsx("p",{className:"onb-sub",children:"Your local database, run logs, artifacts, and chat attachments live in one folder on this machine. The default works for most people — change it if you'd rather keep it on another disk."}),m.jsx("div",{className:"onb-cards",children:m.jsx(EB,{dataDir:o,onUpdate:c})}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(1),children:[m.jsx(jo,{size:12})," Back"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(3),children:["Continue ",m.jsx(Ic,{size:13})]})]})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 4 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Usage analytics"}),m.jsx("p",{className:"onb-sub",children:"orx can send anonymous usage analytics to help improve the tool. No code, prompts, file contents, or identifiers are ever sent — just a random per-install id, the command run, and your OS."}),m.jsx("div",{className:"onb-cards",children:m.jsx(kB,{telemetry:f,onUpdate:p})}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(2),children:[m.jsx(jo,{size:12})," Back"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:w,children:["Create your first project ",m.jsx(Ic,{size:13})]})]})]})})})}function xB(e){return e.agentReady?{cls:"st-done",label:"connected"}:e.installed?{cls:"st-starting",label:"not signed in"}:{cls:"st-idle",label:"not detected"}}function wB({h:e}){var r,a;const t=xB(e),n=(r=e.version)==null?void 0:r.replace(/\s*\(.*\)$/,"");return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsx("span",{className:"onb-card-name",children:e.name}),m.jsxs("span",{className:`status-badge ${t.cls}`,children:[e.agentReady?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),t.label]})]}),e.agentReady?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-card-detail mono",children:[e.account??"API key",e.plan?` · ${e.plan}`:""]}),m.jsx("div",{className:"onb-card-meta",children:[n,e.models.length>0&&`${e.models.length} model${e.models.length===1?"":"s"} — ${e.models.slice(0,3).map(l=>xu(l.id)).join(", ")}${e.models.length>3?", …":""}`].filter(Boolean).join(" · ")})]}):m.jsx("div",{className:"onb-card-meta",children:(a=e.agentNote)==null?void 0:a.replace(/`/g,"")})]})}function CB({git:e,onUpdate:t}){const[n,r]=q.useState(!1),a=()=>{navigator.clipboard.writeText("gh auth login").then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};if(e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking git…"]});if(!e.gitVersion)return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsx("span",{className:"onb-card-name",children:"git"}),m.jsxs("span",{className:"status-badge st-failed",children:[m.jsx("span",{className:"dot"})," not found"]})]}),m.jsx("div",{className:"onb-card-meta",children:"Install git to clone projects, then re-open orx."})]});const l=[e.userName,e.userEmail&&`<${e.userEmail}>`].filter(Boolean).join(" ");return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"git"}),m.jsxs("span",{className:"onb-card-detail mono",children:[e.gitVersion.replace(/^git version /,""),l?` · ${l}`:""]}),m.jsxs("span",{className:`status-badge ${l?"st-done":"st-starting"}`,children:[l?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),l?"ready":"no identity"]})]}),m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"GitHub"}),m.jsx("span",{className:"onb-card-detail mono",children:e.githubTokenSource==="env"?"token from GITHUB_TOKEN":e.githubTokenSource==="stored"?"token saved in orx":e.githubTokenSource==="gh"?"signed in via gh CLI":"not connected"}),m.jsxs("span",{className:`status-badge ${e.githubTokenSource?"st-done":"st-starting"}`,children:[e.githubTokenSource?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),e.githubTokenSource?"ready":"check"]})]}),!l&&m.jsxs("div",{className:"onb-card-meta",children:["Set ",m.jsx("code",{children:"git config --global user.name / user.email"})," so the agent can commit."]}),!e.githubTokenSource&&m.jsxs("div",{className:"onb-gh-options",children:[m.jsx("div",{className:"onb-card-meta",children:"GitHub access is used to clone your repos and push experiment branches. Connect either way:"}),m.jsxs("div",{className:"onb-gh-option",children:[m.jsx("span",{className:"onb-gh-option-label",children:"GitHub CLI"}),m.jsx("div",{className:"onb-gh-option-body",children:e.ghInstalled?m.jsxs(m.Fragment,{children:[m.jsx("code",{className:"onb-gh-cmd",children:"gh auth login"}),m.jsxs("button",{className:"btn ghost",onClick:a,children:[n?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx(yg,{size:12}),n?"Copied":"Copy"]}),m.jsx("span",{className:"onb-gh-hint",children:"run in a terminal, then Re-check"})]}):m.jsxs("span",{className:"onb-gh-hint",children:["install the GitHub CLI, run ",m.jsx("code",{children:"gh auth login"}),", then Re-check"]})})]}),m.jsx("div",{className:"onb-gh-or",children:"or"}),m.jsxs("div",{className:"onb-gh-option",children:[m.jsx("span",{className:"onb-gh-option-label",children:"Paste a token"}),m.jsx(Cw,{onSaved:t})]})]})]})}function EB({dataDir:e,onUpdate:t}){const[n,r]=q.useState(""),[a,l]=q.useState(!1),[u,o]=q.useState(!1),[c,f]=q.useState(null);if(q.useEffect(()=>{e&&!n&&r(e.current)},[e,n]),e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking storage…"]});if(e.source==="env")return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"Data folder"}),m.jsx("span",{className:"onb-card-detail mono",children:e.current}),m.jsxs("span",{className:"status-badge st-done",children:[m.jsx(_n,{size:12,strokeWidth:3})," pinned"]})]}),m.jsxs("div",{className:"onb-card-meta",children:["Set by the ",m.jsx("code",{children:"ORX_DATA_DIR"})," environment variable."]})]});const p=n.trim(),d=p!==""&&p!==e.current;async function _(){if(!(u||!d)){o(!0),f(null);try{t(await eT(p)),l(!1)}catch(v){f(v instanceof Error?v.message:String(v))}finally{o(!1)}}}return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"Data folder"}),m.jsx("span",{className:"onb-card-detail mono",children:e.current}),m.jsxs("span",{className:`status-badge ${e.isDefault?"st-idle":"st-done"}`,children:[e.isDefault?m.jsx("span",{className:"dot"}):m.jsx(_n,{size:12,strokeWidth:3}),e.isDefault?"default":"custom"]})]}),a?m.jsxs(m.Fragment,{children:[m.jsx("input",{className:"mono",type:"text",value:n,onChange:v=>r(v.target.value),placeholder:"/absolute/path/to/openresearch",autoComplete:"off",spellCheck:!1,style:{width:"100%",marginTop:10}}),c&&m.jsx("div",{className:"error",style:{marginTop:8},children:c}),m.jsxs("div",{style:{display:"flex",gap:6,marginTop:10},children:[m.jsx("button",{className:"btn primary",onClick:_,disabled:u||!d,children:u?"Saving…":"Use this folder"}),m.jsx("button",{className:"btn ghost",onClick:()=>{l(!1),r(e.current),f(null)},disabled:u,children:"Cancel"})]})]}):m.jsxs("div",{className:"onb-card-meta",style:{display:"flex",gap:10,alignItems:"center"},children:["The default is fine for most setups.",m.jsx("button",{className:"btn ghost",onClick:()=>l(!0),children:"Change…"})]})]})}function kB({telemetry:e,onUpdate:t}){const[n,r]=q.useState(!1);if(e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking analytics…"]});const a=e.enabled,l=!a&&e.reason!==null&&e.reason!=="disabled via `orx telemetry off`",u=o=>{n||o===a||(r(!0),mT(o).then(t).finally(()=>r(!1)))};return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsxs("div",{children:[m.jsx("div",{className:"onb-card-name",children:"Share anonymous usage analytics"}),m.jsx("div",{className:"onb-card-meta",style:{marginTop:2},children:a?"On — helps prioritize what to build next.":l?`Off — ${e.reason}.`:"Off — you can turn it back on anytime."})]}),m.jsxs("div",{style:{display:"flex",gap:6,flex:"none"},children:[m.jsxs("button",{className:`btn ${a?"primary":"ghost"}`,onClick:()=>u(!0),disabled:n,"aria-pressed":a,children:[a?m.jsx(_n,{size:12,strokeWidth:3}):null," On"]}),m.jsxs("button",{className:`btn ${a?"ghost":"primary"}`,onClick:()=>u(!1),disabled:n,"aria-pressed":!a,children:[a?null:m.jsx(_n,{size:12,strokeWidth:3})," Off"]})]})]}),m.jsxs("div",{className:"onb-card-meta",style:{marginTop:12},children:["Sent: a random per-install id, the command run, CLI version, and OS. Never sent: code, prompts, file contents, paths, or repo names. Change anytime in Settings or with"," ",m.jsx("code",{children:"orx telemetry off"}),"."]}),l&&m.jsxs("div",{className:"onb-card-meta",style:{marginTop:8},children:["Note: this run is off because of ",e.reason,", which overrides the saved choice."]})]})}function Kc(e){const t=e.trim().replace(/^git@github\.com:/i,"").replace(/^https?:\/\/(www\.)?github\.com\//i,"").replace(/\.git$/i,"").replace(/^\/+|\/+$/g,""),[n,r]=t.split("/");return!n||!r||/[\s:@]/.test(n)||/[\s:@]/.test(r)?null:{owner:n,repo:r}}function Ab(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48).replace(/-+$/,"")||"experiment"}function AB(e){const r=(e.trim().split(/[?#]/)[0].split("/").filter(Boolean).pop()??"").replace(/\.(pdf|md)$/i,"");return/^\d{4}\.\d{4,5}(v\d+)?$/.test(r)?r:null}function NB(e){return e.replace(/^\[[^\]]*\]\s*/,"").replace(/\s*[-–|]\s*arXiv\s*$/i,"")}function TB({onCreated:e,onCancel:t}){var U;const[n,r]=q.useState("paper"),[a,l]=q.useState("use"),[u,o]=q.useState(""),[c,f]=q.useState(""),[p,d]=q.useState(!1),[_,v]=q.useState("main"),[w,C]=q.useState(!1),[b,S]=q.useState(null),[x,y]=q.useState(""),[E,R]=q.useState([]),[N,D]=q.useState(!1),[T,j]=q.useState(null),[B,F]=q.useState(!1),[Y,H]=q.useState(null),z=q.useRef(0),V=Kc(u),G=!!(c.trim()&&(n==="new"||n==="existing"&&V!==null||n==="paper"&&T!==null&&(u.trim()===""||V!==null))),X=Q=>{var re;o(Q),p||f(((re=Kc(Q))==null?void 0:re.repo)??"")};async function K(Q){const re=++z.current;R([]),D(!1),F(!0),H(null);try{const ae=await LN(Q);if(re!==z.current)return;j(ae);const Z=ae.repoUrl?Kc(ae.repoUrl):null;o(Z?`${Z.owner}/${Z.repo}`:""),l("fork"),p||f((Z==null?void 0:Z.repo)??(ae.title??"").trim().slice(0,60))}catch(ae){if(re!==z.current)return;H(ae instanceof Error?ae.message:String(ae))}finally{re===z.current&&F(!1)}}function L(){z.current++,j(null),y(""),R([]),H(null),o(""),p||f("")}q.useEffect(()=>{if(n!=="paper"||T)return;const Q=x.trim(),re=AB(Q);if(!re&&Q.length<3){R([]),D(!1);return}const ae=++z.current;re||D(!0);const Z=setTimeout(()=>{if(re){K(re);return}jN(Q).then(P=>{ae===z.current&&R(P)}).catch(P=>{ae===z.current&&(R([]),H(P instanceof Error?P.message:String(P)))}).finally(()=>{ae===z.current&&D(!1)})},350);return()=>clearTimeout(Z)},[n,T,x]);async function M(Q){if(Q.preventDefault(),!(!G||w)){C(!0),S(null);try{const re=await MN(n==="new"?{name:c.trim(),createRepo:!0}:n==="paper"&&!V?{name:c.trim(),createRepo:!0,paperId:T.paperId}:{name:c.trim(),githubOwner:V.owner,githubRepo:V.repo,baselineBranch:_.trim()||"main",forkRepo:a==="fork",...n==="paper"?{paperId:T.paperId}:{}});e(re)}catch(re){S(re instanceof Error?re.message:String(re))}finally{C(!1)}}}const O=n==="new"||n==="paper"&&!V,$=m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"seg form-seg",children:[m.jsx("button",{type:"button",className:a==="use"?"active":"",onClick:()=>l("use"),children:"Use this repo"}),m.jsx("button",{type:"button",className:a==="fork"?"active":"",onClick:()=>l("fork"),children:"Fork a copy"})]}),m.jsx("span",{className:"repo-hint",children:a==="fork"?`snapshots ${V?`${V.owner}/${V.repo}`:"the repo"} into a private repo on your account`:"experiments push branches here — if you can't push to it, a fork is made automatically"}),m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Project name",m.jsx("input",{value:c,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research"})]}),m.jsxs("label",{children:["Branch",m.jsx("input",{value:_,onChange:Q=>v(Q.target.value),placeholder:"main"})]})]})]});return m.jsxs("form",{className:"form",onSubmit:M,children:[m.jsxs("div",{className:"seg form-seg",children:[m.jsx("button",{type:"button",className:n==="paper"?"active":"",onClick:()=>r("paper"),children:"From a paper"}),m.jsx("button",{type:"button",className:n==="existing"?"active":"",onClick:()=>r("existing"),children:"Existing repo"}),m.jsx("button",{type:"button",className:n==="new"?"active":"",onClick:()=>r("new"),children:"New blank repo"})]}),n==="existing"&&m.jsxs(m.Fragment,{children:[m.jsxs("label",{children:["GitHub repository",m.jsx("input",{value:u,onChange:Q=>X(Q.target.value),placeholder:"https://github.com/karpathy/nanoGPT",autoFocus:!0,spellCheck:!1}),m.jsx("span",{className:`repo-hint mono ${V?"ok":""}`,children:V?`${V.owner} / ${V.repo}`:u.trim()?"paste a GitHub URL or owner/repo":"URL or owner/repo — cloned with your git credentials"})]}),$]}),n==="paper"&&(T===null?m.jsxs(m.Fragment,{children:[m.jsxs("label",{children:["Paper",m.jsx("input",{value:x,onChange:Q=>y(Q.target.value),placeholder:"arXiv id, URL, or title — e.g. 1706.03762",autoFocus:!0,spellCheck:!1}),m.jsx("span",{className:`repo-hint ${Y?"":"mono"}`,children:B?"looking up paper…":N?"searching alphaXiv…":Y??"searches alphaXiv by title — or paste an arXiv id / URL"})]}),E.length>0&&m.jsx("div",{className:"paper-results",children:E.map(Q=>m.jsxs("button",{type:"button",onClick:()=>void K(Q.paperId),children:[m.jsx("span",{className:"title",children:NB(Q.title)}),m.jsx("span",{className:"id",children:Q.paperId})]},Q.paperId))})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"paper-pick",children:[m.jsxs("div",{className:"meta",children:[m.jsx("div",{className:"title",children:T.title||T.paperId}),m.jsxs("div",{className:"id",children:["arXiv ",T.paperId]})]}),m.jsx("button",{type:"button",className:"btn ghost",onClick:L,children:"Change"})]}),m.jsxs("label",{children:["GitHub repository",T.repoUrl?"":" (optional)",m.jsx("input",{value:u,onChange:Q=>X(Q.target.value),placeholder:"owner/repo — leave blank for a new private repo",spellCheck:!1}),m.jsx("span",{className:`repo-hint mono ${V?"ok":""}`,children:V?`${V.owner} / ${V.repo}`+(T.repoUrl&&((U=Kc(T.repoUrl))==null?void 0:U.repo)===V.repo?` · linked on alphaXiv${T.repoStars!=null?` · ★ ${T.repoStars}`:""}`:""):u.trim()?"paste a GitHub URL or owner/repo":"no code linked to this paper — a blank private repo will be created"})]}),V?$:m.jsxs("label",{children:["Project name",m.jsx("input",{value:c,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research"}),m.jsx("span",{className:`repo-hint mono ${c.trim()?"ok":""}`,children:c.trim()?`creates github.com/you/${Ab(c)} · private`:"a blank private repo is created on your GitHub account"})]})]})),n==="new"&&m.jsxs("label",{children:["Project name",m.jsx("input",{value:c,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research",autoFocus:!0}),m.jsx("span",{className:`repo-hint mono ${c.trim()?"ok":""}`,children:c.trim()?`creates github.com/you/${Ab(c)} · private`:"a blank private repo is created on your GitHub account"})]}),b&&m.jsx("div",{className:"error",children:b}),m.jsxs("div",{className:"actions",children:[t&&m.jsx("button",{type:"button",className:"btn ghost",onClick:t,children:"Cancel"}),m.jsx("button",{type:"submit",className:"btn primary",disabled:!G||w,children:w?O?"Creating repo…":a==="fork"?"Forking repo…":"Cloning repo…":"Create project"})]})]})}function Nb({projects:e,onOpen:t,onCreated:n,onDeleted:r}){const[a,l]=q.useState(!1),[u,o]=q.useState(null);async function c(f){if(window.confirm(`Delete project "${f.name}"? +`)?1:0):0,x=y=>r?`File not found on branch ${r}.`:n&&y.root==="clone"?"This session's worktree isn't available, and the file isn't in the project clone.":`File not found in the ${y.root==="worktree"?"session's worktree":"project clone"}.`;return m.jsxs("div",{className:"file-view",children:[m.jsxs("div",{className:"file-view-header",children:[m.jsx(VA,{size:13,style:{flexShrink:0}}),m.jsx("code",{className:"file-view-path",title:t,children:t}),r&&m.jsx("code",{className:"file-view-ref",title:`Committed state of ${r}`,children:r}),v&&m.jsx("button",{className:`icon-btn ${w?"active":""}`,title:w?"Rendered view":"Source view","aria-label":w?"Rendered view":"Source view",onClick:()=>C(y=>!y),children:m.jsx(BA,{size:13})}),m.jsx("button",{className:"icon-btn",title:"Reload file","aria-label":"Reload file",onClick:()=>_(y=>y+1),children:f?m.jsx("span",{className:"spinner"}):m.jsx(Sg,{size:13})})]}),m.jsx("div",{className:"file-view-body",children:o?m.jsxs("div",{className:"file-view-note",children:["Failed to load file: ",o]}):l===null?m.jsx("div",{className:"file-view-note",children:"Loading…"}):l.notFound?m.jsx("div",{className:"file-view-note",children:x(l)}):m.jsxs(m.Fragment,{children:[!r&&n&&l.root==="clone"&&m.jsx("div",{className:"file-view-note",children:"This session's worktree isn't available — showing the project clone's copy."}),v&&!w?m.jsx("div",{className:"file-view-md",children:m.jsx(qo,{text:l.content,onOpenFile:a&&(y=>a(y,n,r))})}):m.jsxs("div",{className:"file-view-codewrap",children:[S>0&&m.jsx("pre",{className:"file-view-gutter","aria-hidden":"true",children:Array.from({length:S},(y,E)=>E+1).join(` +`)}),m.jsx("pre",{className:"file-view-code",children:m.jsx("code",{children:b})})]}),l.truncated&&m.jsx("div",{className:"file-view-note",children:"File truncated — showing the first 512 KB."})]})})]})}function _B({projectName:e,onHome:t,onCollapse:n}){return m.jsxs("div",{className:"rail-brand",children:[m.jsxs("button",{className:"brand",onClick:t,title:"All projects",children:[m.jsx(jo,{size:15}),m.jsx("span",{className:"brand-project",children:e})]}),n&&m.jsx("button",{className:"icon-btn",title:"Hide sidebar","aria-label":"Hide sidebar",onClick:n,children:m.jsx(qS,{size:15})})]})}function vB({onDone:e}){const[t,n]=V.useState(0),[r,a]=V.useState(null),[l,u]=V.useState(null),[o,c]=V.useState(null),[f,p]=V.useState(null),[d,_]=V.useState(!1),v=C=>{_(!0),Promise.allSettled([wg(C).then(a),ex().then(u),QS().then(c),hT().then(p)]).finally(()=>_(!1))};V.useEffect(()=>v(!1),[]);const w=()=>{dT((f==null?void 0:f.enabled)??!0).catch(()=>{}),e()};return m.jsx("div",{className:"home onboarding",children:m.jsx("div",{className:"home-inner",children:t===0?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 1 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Your coding agents"}),m.jsx("p",{className:"onb-sub",children:"orx found the agent CLIs on this machine and drives them directly — chat and autoresearch run on your own logins, no extra API keys."}),m.jsx("div",{className:"onb-cards",children:r===null?m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Detecting Claude Code, Codex, OpenCode…"]}):r.map(C=>m.jsx(bB,{h:C},C.id))}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>v(!0),disabled:d,children:[m.jsx(Su,{size:12,className:d?"spin":""})," Re-check"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(1),children:["Continue ",m.jsx(Ic,{size:13})]})]})]}):t===1?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 2 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Git & GitHub"}),m.jsx("p",{className:"onb-sub",children:"A project is a clone of one of your GitHub repos, made with your own git credentials. Every experiment becomes a branch pushed to that repo — compute jobs clone it from there."}),m.jsx("div",{className:"onb-cards",children:m.jsx(SB,{git:l,onUpdate:u})}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(0),children:[m.jsx(jo,{size:12})," Back"]}),m.jsxs("button",{className:"btn ghost",onClick:()=>v(!1),disabled:d,children:[m.jsx(Su,{size:12,className:d?"spin":""})," Re-check"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(2),children:["Continue ",m.jsx(Ic,{size:13})]})]})]}):t===2?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 3 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Where orx keeps your data"}),m.jsx("p",{className:"onb-sub",children:"Your local database, run logs, artifacts, and chat attachments live in one folder on this machine. The default works for most people — change it if you'd rather keep it on another disk."}),m.jsx("div",{className:"onb-cards",children:m.jsx(xB,{dataDir:o,onUpdate:c})}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(1),children:[m.jsx(jo,{size:12})," Back"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(3),children:["Continue ",m.jsx(Ic,{size:13})]})]})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 4 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Usage analytics"}),m.jsx("p",{className:"onb-sub",children:"orx can send anonymous usage analytics to help improve the tool. No code, prompts, file contents, or identifiers are ever sent — just a random per-install id, the command run, and your OS."}),m.jsx("div",{className:"onb-cards",children:m.jsx(wB,{telemetry:f,onUpdate:p})}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(2),children:[m.jsx(jo,{size:12})," Back"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:w,children:["Create your first project ",m.jsx(Ic,{size:13})]})]})]})})})}function yB(e){return e.agentReady?{cls:"st-done",label:"connected"}:e.installed?{cls:"st-starting",label:"not signed in"}:{cls:"st-idle",label:"not detected"}}function bB({h:e}){var r,a;const t=yB(e),n=(r=e.version)==null?void 0:r.replace(/\s*\(.*\)$/,"");return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsx("span",{className:"onb-card-name",children:e.name}),m.jsxs("span",{className:`status-badge ${t.cls}`,children:[e.agentReady?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),t.label]})]}),e.agentReady?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-card-detail mono",children:[e.account??"API key",e.plan?` · ${e.plan}`:""]}),m.jsx("div",{className:"onb-card-meta",children:[n,e.models.length>0&&`${e.models.length} model${e.models.length===1?"":"s"} — ${e.models.slice(0,3).map(l=>xu(l.id)).join(", ")}${e.models.length>3?", …":""}`].filter(Boolean).join(" · ")})]}):m.jsx("div",{className:"onb-card-meta",children:(a=e.agentNote)==null?void 0:a.replace(/`/g,"")})]})}function SB({git:e,onUpdate:t}){const[n,r]=V.useState(!1),a=()=>{navigator.clipboard.writeText("gh auth login").then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};if(e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking git…"]});if(!e.gitVersion)return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsx("span",{className:"onb-card-name",children:"git"}),m.jsxs("span",{className:"status-badge st-failed",children:[m.jsx("span",{className:"dot"})," not found"]})]}),m.jsx("div",{className:"onb-card-meta",children:"Install git to clone projects, then re-open orx."})]});const l=[e.userName,e.userEmail&&`<${e.userEmail}>`].filter(Boolean).join(" ");return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"git"}),m.jsxs("span",{className:"onb-card-detail mono",children:[e.gitVersion.replace(/^git version /,""),l?` · ${l}`:""]}),m.jsxs("span",{className:`status-badge ${l?"st-done":"st-starting"}`,children:[l?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),l?"ready":"no identity"]})]}),m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"GitHub"}),m.jsx("span",{className:"onb-card-detail mono",children:e.githubTokenSource==="env"?"token from GITHUB_TOKEN":e.githubTokenSource==="stored"?"token saved in orx":e.githubTokenSource==="gh"?"signed in via gh CLI":"not connected"}),m.jsxs("span",{className:`status-badge ${e.githubTokenSource?"st-done":"st-starting"}`,children:[e.githubTokenSource?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),e.githubTokenSource?"ready":"check"]})]}),!l&&m.jsxs("div",{className:"onb-card-meta",children:["Set ",m.jsx("code",{children:"git config --global user.name / user.email"})," so the agent can commit."]}),!e.githubTokenSource&&m.jsxs("div",{className:"onb-gh-options",children:[m.jsx("div",{className:"onb-card-meta",children:"GitHub access is used to clone your repos and push experiment branches. Connect either way:"}),m.jsxs("div",{className:"onb-gh-option",children:[m.jsx("span",{className:"onb-gh-option-label",children:"GitHub CLI"}),m.jsx("div",{className:"onb-gh-option-body",children:e.ghInstalled?m.jsxs(m.Fragment,{children:[m.jsx("code",{className:"onb-gh-cmd",children:"gh auth login"}),m.jsxs("button",{className:"btn ghost",onClick:a,children:[n?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx(yg,{size:12}),n?"Copied":"Copy"]}),m.jsx("span",{className:"onb-gh-hint",children:"run in a terminal, then Re-check"})]}):m.jsxs("span",{className:"onb-gh-hint",children:["install the GitHub CLI, run ",m.jsx("code",{children:"gh auth login"}),", then Re-check"]})})]}),m.jsx("div",{className:"onb-gh-or",children:"or"}),m.jsxs("div",{className:"onb-gh-option",children:[m.jsx("span",{className:"onb-gh-option-label",children:"Paste a token"}),m.jsx(Sw,{onSaved:t})]})]})]})}function xB({dataDir:e,onUpdate:t}){const[n,r]=V.useState(""),[a,l]=V.useState(!1),[u,o]=V.useState(!1),[c,f]=V.useState(null);if(V.useEffect(()=>{e&&!n&&r(e.current)},[e,n]),e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking storage…"]});if(e.source==="env")return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"Data folder"}),m.jsx("span",{className:"onb-card-detail mono",children:e.current}),m.jsxs("span",{className:"status-badge st-done",children:[m.jsx(_n,{size:12,strokeWidth:3})," pinned"]})]}),m.jsxs("div",{className:"onb-card-meta",children:["Set by the ",m.jsx("code",{children:"ORX_DATA_DIR"})," environment variable."]})]});const p=n.trim(),d=p!==""&&p!==e.current;async function _(){if(!(u||!d)){o(!0),f(null);try{t(await KN(p)),l(!1)}catch(v){f(v instanceof Error?v.message:String(v))}finally{o(!1)}}}return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"Data folder"}),m.jsx("span",{className:"onb-card-detail mono",children:e.current}),m.jsxs("span",{className:`status-badge ${e.isDefault?"st-idle":"st-done"}`,children:[e.isDefault?m.jsx("span",{className:"dot"}):m.jsx(_n,{size:12,strokeWidth:3}),e.isDefault?"default":"custom"]})]}),a?m.jsxs(m.Fragment,{children:[m.jsx("input",{className:"mono",type:"text",value:n,onChange:v=>r(v.target.value),placeholder:"/absolute/path/to/openresearch",autoComplete:"off",spellCheck:!1,style:{width:"100%",marginTop:10}}),c&&m.jsx("div",{className:"error",style:{marginTop:8},children:c}),m.jsxs("div",{style:{display:"flex",gap:6,marginTop:10},children:[m.jsx("button",{className:"btn primary",onClick:_,disabled:u||!d,children:u?"Saving…":"Use this folder"}),m.jsx("button",{className:"btn ghost",onClick:()=>{l(!1),r(e.current),f(null)},disabled:u,children:"Cancel"})]})]}):m.jsxs("div",{className:"onb-card-meta",style:{display:"flex",gap:10,alignItems:"center"},children:["The default is fine for most setups.",m.jsx("button",{className:"btn ghost",onClick:()=>l(!0),children:"Change…"})]})]})}function wB({telemetry:e,onUpdate:t}){const[n,r]=V.useState(!1);if(e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking analytics…"]});const a=e.enabled,l=!a&&e.reason!==null&&e.reason!=="disabled via `orx telemetry off`",u=o=>{n||o===a||(r(!0),fT(o).then(t).finally(()=>r(!1)))};return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsxs("div",{children:[m.jsx("div",{className:"onb-card-name",children:"Share anonymous usage analytics"}),m.jsx("div",{className:"onb-card-meta",style:{marginTop:2},children:a?"On — helps prioritize what to build next.":l?`Off — ${e.reason}.`:"Off — you can turn it back on anytime."})]}),m.jsxs("div",{style:{display:"flex",gap:6,flex:"none"},children:[m.jsxs("button",{className:`btn ${a?"primary":"ghost"}`,onClick:()=>u(!0),disabled:n,"aria-pressed":a,children:[a?m.jsx(_n,{size:12,strokeWidth:3}):null," On"]}),m.jsxs("button",{className:`btn ${a?"ghost":"primary"}`,onClick:()=>u(!1),disabled:n,"aria-pressed":!a,children:[a?null:m.jsx(_n,{size:12,strokeWidth:3})," Off"]})]})]}),m.jsxs("div",{className:"onb-card-meta",style:{marginTop:12},children:["Sent: a random per-install id, the command run, CLI version, and OS. Never sent: code, prompts, file contents, paths, or repo names. Change anytime in Settings or with"," ",m.jsx("code",{children:"orx telemetry off"}),"."]}),l&&m.jsxs("div",{className:"onb-card-meta",style:{marginTop:8},children:["Note: this run is off because of ",e.reason,", which overrides the saved choice."]})]})}function Kc(e){const t=e.trim().replace(/^git@github\.com:/i,"").replace(/^https?:\/\/(www\.)?github\.com\//i,"").replace(/\.git$/i,"").replace(/^\/+|\/+$/g,""),[n,r]=t.split("/");return!n||!r||/[\s:@]/.test(n)||/[\s:@]/.test(r)?null:{owner:n,repo:r}}function Ab(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48).replace(/-+$/,"")||"experiment"}function CB(e){const r=(e.trim().split(/[?#]/)[0].split("/").filter(Boolean).pop()??"").replace(/\.(pdf|md)$/i,"");return/^\d{4}\.\d{4,5}(v\d+)?$/.test(r)?r:null}function EB(e){return e.replace(/^\[[^\]]*\]\s*/,"").replace(/\s*[-–|]\s*arXiv\s*$/i,"")}function kB({onCreated:e,onCancel:t}){var F;const[n,r]=V.useState("paper"),[a,l]=V.useState("use"),[u,o]=V.useState(""),[c,f]=V.useState(""),[p,d]=V.useState(!1),[_,v]=V.useState("main"),[w,C]=V.useState(!1),[b,S]=V.useState(null),[x,y]=V.useState(""),[E,R]=V.useState([]),[N,D]=V.useState(!1),[T,j]=V.useState(null),[B,z]=V.useState(!1),[G,U]=V.useState(null),H=V.useRef(0),Y=Kc(u),q=!!(c.trim()&&(n==="new"||n==="existing"&&Y!==null||n==="paper"&&T!==null&&(u.trim()===""||Y!==null))),X=Q=>{var re;o(Q),p||f(((re=Kc(Q))==null?void 0:re.repo)??"")};async function K(Q){const re=++H.current;R([]),D(!1),z(!0),U(null);try{const ae=await RN(Q);if(re!==H.current)return;j(ae);const Z=ae.repoUrl?Kc(ae.repoUrl):null;o(Z?`${Z.owner}/${Z.repo}`:""),l("fork"),p||f((Z==null?void 0:Z.repo)??(ae.title??"").trim().slice(0,60))}catch(ae){if(re!==H.current)return;U(ae instanceof Error?ae.message:String(ae))}finally{re===H.current&&z(!1)}}function L(){H.current++,j(null),y(""),R([]),U(null),o(""),p||f("")}V.useEffect(()=>{if(n!=="paper"||T)return;const Q=x.trim(),re=CB(Q);if(!re&&Q.length<3){R([]),D(!1);return}const ae=++H.current;re||D(!0);const Z=setTimeout(()=>{if(re){K(re);return}TN(Q).then(P=>{ae===H.current&&R(P)}).catch(P=>{ae===H.current&&(R([]),U(P instanceof Error?P.message:String(P)))}).finally(()=>{ae===H.current&&D(!1)})},350);return()=>clearTimeout(Z)},[n,T,x]);async function M(Q){if(Q.preventDefault(),!(!q||w)){C(!0),S(null);try{const re=await NN(n==="new"?{name:c.trim(),createRepo:!0}:n==="paper"&&!Y?{name:c.trim(),createRepo:!0,paperId:T.paperId}:{name:c.trim(),githubOwner:Y.owner,githubRepo:Y.repo,baselineBranch:_.trim()||"main",forkRepo:a==="fork",...n==="paper"?{paperId:T.paperId}:{}});e(re)}catch(re){S(re instanceof Error?re.message:String(re))}finally{C(!1)}}}const O=n==="new"||n==="paper"&&!Y,$=m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"seg form-seg",children:[m.jsx("button",{type:"button",className:a==="use"?"active":"",onClick:()=>l("use"),children:"Use this repo"}),m.jsx("button",{type:"button",className:a==="fork"?"active":"",onClick:()=>l("fork"),children:"Fork a copy"})]}),m.jsx("span",{className:"repo-hint",children:a==="fork"?`snapshots ${Y?`${Y.owner}/${Y.repo}`:"the repo"} into a private repo on your account`:"experiments push branches here — if you can't push to it, a fork is made automatically"}),m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Project name",m.jsx("input",{value:c,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research"})]}),m.jsxs("label",{children:["Branch",m.jsx("input",{value:_,onChange:Q=>v(Q.target.value),placeholder:"main"})]})]})]});return m.jsxs("form",{className:"form",onSubmit:M,children:[m.jsxs("div",{className:"seg form-seg",children:[m.jsx("button",{type:"button",className:n==="paper"?"active":"",onClick:()=>r("paper"),children:"From a paper"}),m.jsx("button",{type:"button",className:n==="existing"?"active":"",onClick:()=>r("existing"),children:"Existing repo"}),m.jsx("button",{type:"button",className:n==="new"?"active":"",onClick:()=>r("new"),children:"New blank repo"})]}),n==="existing"&&m.jsxs(m.Fragment,{children:[m.jsxs("label",{children:["GitHub repository",m.jsx("input",{value:u,onChange:Q=>X(Q.target.value),placeholder:"https://github.com/karpathy/nanoGPT",autoFocus:!0,spellCheck:!1}),m.jsx("span",{className:`repo-hint mono ${Y?"ok":""}`,children:Y?`${Y.owner} / ${Y.repo}`:u.trim()?"paste a GitHub URL or owner/repo":"URL or owner/repo — cloned with your git credentials"})]}),$]}),n==="paper"&&(T===null?m.jsxs(m.Fragment,{children:[m.jsxs("label",{children:["Paper",m.jsx("input",{value:x,onChange:Q=>y(Q.target.value),placeholder:"arXiv id, URL, or title — e.g. 1706.03762",autoFocus:!0,spellCheck:!1}),m.jsx("span",{className:`repo-hint ${G?"":"mono"}`,children:B?"looking up paper…":N?"searching alphaXiv…":G??"searches alphaXiv by title — or paste an arXiv id / URL"})]}),E.length>0&&m.jsx("div",{className:"paper-results",children:E.map(Q=>m.jsxs("button",{type:"button",onClick:()=>void K(Q.paperId),children:[m.jsx("span",{className:"title",children:EB(Q.title)}),m.jsx("span",{className:"id",children:Q.paperId})]},Q.paperId))})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"paper-pick",children:[m.jsxs("div",{className:"meta",children:[m.jsx("div",{className:"title",children:T.title||T.paperId}),m.jsxs("div",{className:"id",children:["arXiv ",T.paperId]})]}),m.jsx("button",{type:"button",className:"btn ghost",onClick:L,children:"Change"})]}),m.jsxs("label",{children:["GitHub repository",T.repoUrl?"":" (optional)",m.jsx("input",{value:u,onChange:Q=>X(Q.target.value),placeholder:"owner/repo — leave blank for a new private repo",spellCheck:!1}),m.jsx("span",{className:`repo-hint mono ${Y?"ok":""}`,children:Y?`${Y.owner} / ${Y.repo}`+(T.repoUrl&&((F=Kc(T.repoUrl))==null?void 0:F.repo)===Y.repo?` · linked on alphaXiv${T.repoStars!=null?` · ★ ${T.repoStars}`:""}`:""):u.trim()?"paste a GitHub URL or owner/repo":"no code linked to this paper — a blank private repo will be created"})]}),Y?$:m.jsxs("label",{children:["Project name",m.jsx("input",{value:c,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research"}),m.jsx("span",{className:`repo-hint mono ${c.trim()?"ok":""}`,children:c.trim()?`creates github.com/you/${Ab(c)} · private`:"a blank private repo is created on your GitHub account"})]})]})),n==="new"&&m.jsxs("label",{children:["Project name",m.jsx("input",{value:c,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research",autoFocus:!0}),m.jsx("span",{className:`repo-hint mono ${c.trim()?"ok":""}`,children:c.trim()?`creates github.com/you/${Ab(c)} · private`:"a blank private repo is created on your GitHub account"})]}),b&&m.jsx("div",{className:"error",children:b}),m.jsxs("div",{className:"actions",children:[t&&m.jsx("button",{type:"button",className:"btn ghost",onClick:t,children:"Cancel"}),m.jsx("button",{type:"submit",className:"btn primary",disabled:!q||w,children:w?O?"Creating repo…":a==="fork"?"Forking repo…":"Cloning repo…":"Create project"})]})]})}function Nb({projects:e,onOpen:t,onCreated:n,onDeleted:r}){const[a,l]=V.useState(!1),[u,o]=V.useState(null);async function c(f){if(window.confirm(`Delete project "${f.name}"? -Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githubOwner}/${f.githubRepo}) is kept.`)){o(f.id);try{await BN(f.id),r(f.id)}catch(d){window.alert(d instanceof Error?d.message:String(d))}finally{o(null)}}}return m.jsxs("div",{className:"home",children:[m.jsxs("div",{className:"home-inner",children:[m.jsxs("div",{className:"home-brand",children:["Open",m.jsx("span",{children:"Research"})]}),m.jsxs("div",{className:"home-head",children:[m.jsx("h2",{children:"Projects"}),m.jsxs("button",{className:"btn sm",onClick:()=>l(!0),children:[m.jsx(bg,{size:13})," New project"]})]}),m.jsx("div",{className:"home-list",children:e.length===0?m.jsx("div",{className:"changes-note",children:"No projects yet — create one to get started."}):[...e].sort((f,p)=>p.updatedAt-f.updatedAt).map(f=>m.jsxs("div",{className:"project-card",role:"button",tabIndex:0,onClick:()=>t(f.id),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&t(f.id)},children:[m.jsx("span",{className:"name",children:f.name}),m.jsxs("span",{className:"repo mono",children:[f.githubOwner,"/",f.githubRepo," · ",f.baselineBranch]}),f.paperId&&m.jsxs("span",{className:"paper mono",children:["arXiv ",f.paperId]}),m.jsxs("span",{className:"time",children:["created ",Sa(f.createdAt)]}),m.jsx("button",{className:"project-delete",title:`Delete ${f.name}`,disabled:u===f.id,onClick:p=>{p.stopPropagation(),c(f)},children:m.jsx(Gu,{size:14})})]},f.id))})]}),a&&m.jsx("div",{className:"modal-backdrop",onClick:()=>l(!1),children:m.jsxs("div",{className:"modal",onClick:f=>f.stopPropagation(),children:[m.jsx("h2",{children:"New project"}),m.jsx(TB,{onCancel:()=>l(!1),onCreated:f=>{l(!1),n(f)}})]})})]})}function RB(e){const t=ix(e.backend);return t?[t,rx(e.backend)].filter(Boolean).join(" · "):"—"}function DB({runs:e,experiments:t,onOpen:n,onOpenChanges:r,onCancel:a}){const l=new Map(t.map(o=>[o.id,o.slug])),u=[...e].sort((o,c)=>c.createdAt-o.createdAt);return u.length===0?m.jsx("div",{className:"empty-state",children:m.jsx("p",{children:"No runs yet."})}):m.jsx("div",{className:"runs-table-wrap",children:m.jsxs("table",{className:"runs-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Run"}),m.jsx("th",{children:"Experiment"}),m.jsx("th",{children:"Status"}),m.jsx("th",{children:"Backend"}),m.jsx("th",{children:"Commit"}),m.jsx("th",{children:"Started"}),m.jsx("th",{children:"Exit"}),m.jsx("th",{})]})}),m.jsx("tbody",{children:u.map(o=>{const c=o.status==="running"||o.status==="starting";return m.jsxs("tr",{className:"clickable",onClick:()=>n(o),children:[m.jsx("td",{className:"mono",children:Tp(o.id)}),m.jsx("td",{className:"mono",children:l.get(o.experimentId)??Tp(o.experimentId)}),m.jsx("td",{children:m.jsx(Vo,{status:o.status})}),m.jsx("td",{className:"mono",children:RB(o)}),m.jsx("td",{className:"mono",children:o.commitSha?o.commitSha.slice(0,7):"—"}),m.jsx("td",{children:Sa(o.createdAt)}),m.jsx("td",{className:"mono",children:o.exitCode??"—"}),m.jsx("td",{children:m.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[m.jsx("button",{className:"icon-btn",title:"Open changes",onClick:f=>{f.stopPropagation(),r(o.experimentId)},children:m.jsx($u,{size:14})}),c&&m.jsx("button",{className:"btn sm danger",onClick:f=>{f.stopPropagation(),a(o.id)},children:"Cancel"})]})})]},o.id)})})]})})}function Ft(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function mh(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}pu.prototype=mh.prototype={constructor:pu,on:function(e,t){var n=this._,r=jB(e+"",n),a,l=-1,u=r.length;if(arguments.length<2){for(;++l0)for(var n=new Array(a),r=0,a,l;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rb.hasOwnProperty(t)?{space:Rb[t],local:e}:e}function OB(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ig&&t.documentElement.namespaceURI===ig?t.createElement(e):t.createElementNS(n,e)}}function BB(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _C(e){var t=_h(e);return(t.local?BB:OB)(t)}function IB(){}function Em(e){return e==null?IB:function(){return this.querySelector(e)}}function zB(e){typeof e!="function"&&(e=Em(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a=y&&(y=x+1);!(R=b[y])&&++y=0;)(u=r[a])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function cI(e){e||(e=uI);function t(d,_){return d&&_?e(d.__data__,_.__data__):!d-!_}for(var n=this._groups,r=n.length,a=new Array(r),l=0;lt?1:e>=t?0:NaN}function hI(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function fI(){return Array.from(this)}function dI(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?CI:typeof t=="function"?kI:EI)(e,t,n??"")):pa(this.node(),e)}function pa(e,t){return e.style.getPropertyValue(t)||xC(e).getComputedStyle(e,null).getPropertyValue(t)}function NI(e){return function(){delete this[e]}}function TI(e,t){return function(){this[e]=t}}function RI(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function DI(e,t){return arguments.length>1?this.each((t==null?NI:typeof t=="function"?RI:TI)(e,t)):this.node()[e]}function wC(e){return e.trim().split(/^|\s+/)}function km(e){return e.classList||new CC(e)}function CC(e){this._node=e,this._names=wC(e.getAttribute("class")||"")}CC.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function EC(e,t){for(var n=km(e),r=-1,a=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function s7(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,l;n()=>e;function rg(e,{sourceEvent:t,subject:n,target:r,identifier:a,active:l,x:u,y:o,dx:c,dy:f,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:p}})}rg.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function g7(e){return!e.ctrlKey&&!e.button}function m7(){return this.parentNode}function _7(e,t){return t??{x:e.x,y:e.y}}function v7(){return navigator.maxTouchPoints||"ontouchstart"in this}function DC(){var e=g7,t=m7,n=_7,r=v7,a={},l=mh("start","drag","end"),u=0,o,c,f,p,d=0;function _(E){E.on("mousedown.drag",v).filter(r).on("touchstart.drag",b).on("touchmove.drag",S,p7).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(E,R){if(!(p||!e.call(this,E,R))){var N=y(this,t.call(this,E,R),E,R,"mouse");N&&(An(E.view).on("mousemove.drag",w,Zo).on("mouseup.drag",C,Zo),TC(E.view),pp(E),f=!1,o=E.clientX,c=E.clientY,N("start",E))}}function w(E){if(ua(E),!f){var R=E.clientX-o,N=E.clientY-c;f=R*R+N*N>d}a.mouse("drag",E)}function C(E){An(E.view).on("mousemove.drag mouseup.drag",null),RC(E.view,f),ua(E),a.mouse("end",E)}function b(E,R){if(e.call(this,E,R)){var N=E.changedTouches,D=t.call(this,E,R),T=N.length,j,B;for(j=0;j>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Qc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Qc(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=b7.exec(e))?new mn(t[1],t[2],t[3],1):(t=S7.exec(e))?new mn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=x7.exec(e))?Qc(t[1],t[2],t[3],t[4]):(t=w7.exec(e))?Qc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=C7.exec(e))?Ib(t[1],t[2]/100,t[3]/100,1):(t=E7.exec(e))?Ib(t[1],t[2]/100,t[3]/100,t[4]):Db.hasOwnProperty(e)?Lb(Db[e]):e==="transparent"?new mn(NaN,NaN,NaN,0):null}function Lb(e){return new mn(e>>16&255,e>>8&255,e&255,1)}function Qc(e,t,n,r){return r<=0&&(e=t=n=NaN),new mn(e,t,n,r)}function N7(e){return e instanceof pl||(e=rs(e)),e?(e=e.rgb(),new mn(e.r,e.g,e.b,e.opacity)):new mn}function sg(e,t,n,r){return arguments.length===1?N7(e):new mn(e,t,n,r??1)}function mn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Am(mn,sg,MC(pl,{brighter(e){return e=e==null?Ru:Math.pow(Ru,e),new mn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Qo:Math.pow(Qo,e),new mn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new mn(es(this.r),es(this.g),es(this.b),Du(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ob,formatHex:Ob,formatHex8:T7,formatRgb:Bb,toString:Bb}));function Ob(){return`#${Qr(this.r)}${Qr(this.g)}${Qr(this.b)}`}function T7(){return`#${Qr(this.r)}${Qr(this.g)}${Qr(this.b)}${Qr((isNaN(this.opacity)?1:this.opacity)*255)}`}function Bb(){const e=Du(this.opacity);return`${e===1?"rgb(":"rgba("}${es(this.r)}, ${es(this.g)}, ${es(this.b)}${e===1?")":`, ${e})`}`}function Du(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function es(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Qr(e){return e=es(e),(e<16?"0":"")+e.toString(16)}function Ib(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Kn(e,t,n,r)}function jC(e){if(e instanceof Kn)return new Kn(e.h,e.s,e.l,e.opacity);if(e instanceof pl||(e=rs(e)),!e)return new Kn;if(e instanceof Kn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),l=Math.max(t,n,r),u=NaN,o=l-a,c=(l+a)/2;return o?(t===l?u=(n-r)/o+(n0&&c<1?0:u,new Kn(u,o,c,e.opacity)}function R7(e,t,n,r){return arguments.length===1?jC(e):new Kn(e,t,n,r??1)}function Kn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Am(Kn,R7,MC(pl,{brighter(e){return e=e==null?Ru:Math.pow(Ru,e),new Kn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Qo:Math.pow(Qo,e),new Kn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new mn(gp(e>=240?e-240:e+120,a,r),gp(e,a,r),gp(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new Kn(zb(this.h),Jc(this.s),Jc(this.l),Du(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Du(this.opacity);return`${e===1?"hsl(":"hsla("}${zb(this.h)}, ${Jc(this.s)*100}%, ${Jc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function zb(e){return e=(e||0)%360,e<0?e+360:e}function Jc(e){return Math.max(0,Math.min(1,e||0))}function gp(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Nm=e=>()=>e;function D7(e,t){return function(n){return e+n*t}}function M7(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function j7(e){return(e=+e)==1?LC:function(t,n){return n-t?M7(t,n,e):Nm(isNaN(t)?n:t)}}function LC(e,t){var n=t-e;return n?D7(e,n):Nm(isNaN(e)?t:e)}const Mu=(function e(t){var n=j7(t);function r(a,l){var u=n((a=sg(a)).r,(l=sg(l)).r),o=n(a.g,l.g),c=n(a.b,l.b),f=LC(a.opacity,l.opacity);return function(p){return a.r=u(p),a.g=o(p),a.b=c(p),a.opacity=f(p),a+""}}return r.gamma=e,r})(1);function L7(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(l){for(a=0;an&&(l=t.slice(n,l),o[u]?o[u]+=l:o[++u]=l),(r=r[0])===(a=a[0])?o[u]?o[u]+=a:o[++u]=a:(o[++u]=null,c.push({i:u,x:ci(r,a)})),n=mp.lastIndex;return n180?p+=360:p-f>180&&(f+=360),_.push({i:d.push(a(d)+"rotate(",null,r)-2,x:ci(f,p)})):p&&d.push(a(d)+"rotate("+p+r)}function o(f,p,d,_){f!==p?_.push({i:d.push(a(d)+"skewX(",null,r)-2,x:ci(f,p)}):p&&d.push(a(d)+"skewX("+p+r)}function c(f,p,d,_,v,w){if(f!==d||p!==_){var C=v.push(a(v)+"scale(",null,",",null,")");w.push({i:C-4,x:ci(f,d)},{i:C-2,x:ci(p,_)})}else(d!==1||_!==1)&&v.push(a(v)+"scale("+d+","+_+")")}return function(f,p){var d=[],_=[];return f=e(f),p=e(p),l(f.translateX,f.translateY,p.translateX,p.translateY,d,_),u(f.rotate,p.rotate,d,_),o(f.skewX,p.skewX,d,_),c(f.scaleX,f.scaleY,p.scaleX,p.scaleY,d,_),f=p=null,function(v){for(var w=-1,C=_.length,b;++w=0&&e._call.call(void 0,t),e=e._next;--ga}function Pb(){ss=(Lu=el.now())+vh,ga=Do=0;try{X7()}finally{ga=0,Z7(),ss=0}}function K7(){var e=el.now(),t=e-Lu;t>zC&&(vh-=t,Lu=e)}function Z7(){for(var e,t=ju,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ju=n);Mo=e,lg(r)}function lg(e){if(!ga){Do&&(Do=clearTimeout(Do));var t=e-ss;t>24?(e<1/0&&(Do=setTimeout(Pb,e-el.now()-vh)),To&&(To=clearInterval(To))):(To||(Lu=el.now(),To=setInterval(K7,zC)),ga=1,HC(Pb))}}function Ub(e,t,n){var r=new Ou;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var Q7=mh("start","end","cancel","interrupt"),J7=[],PC=0,$b=1,cg=2,mu=3,Gb=4,ug=5,_u=6;function yh(e,t,n,r,a,l){var u=e.__transition;if(!u)e.__transition={};else if(n in u)return;e9(e,n,{name:t,index:r,group:a,on:Q7,tween:J7,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:PC})}function Rm(e,t){var n=ti(e,t);if(n.state>PC)throw new Error("too late; already scheduled");return n}function pi(e,t){var n=ti(e,t);if(n.state>mu)throw new Error("too late; already running");return n}function ti(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function e9(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=FC(l,0,n.time);function l(f){n.state=$b,n.timer.restart(u,n.delay,n.time),n.delay<=f&&u(f-n.delay)}function u(f){var p,d,_,v;if(n.state!==$b)return c();for(p in r)if(v=r[p],v.name===n.name){if(v.state===mu)return Ub(u);v.state===Gb?(v.state=_u,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete r[p]):+pcg&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function R9(e,t,n){var r,a,l=T9(t)?Rm:pi;return function(){var u=l(this,e),o=u.on;o!==r&&(a=(r=o).copy()).on(t,n),u.on=a}}function D9(e,t){var n=this._id;return arguments.length<2?ti(this.node(),n).on.on(e):this.each(R9(n,e,t))}function M9(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function j9(){return this.on("end.remove",M9(this._id))}function L9(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Em(e));for(var r=this._groups,a=r.length,l=new Array(a),u=0;u()=>e;function sz(e,{sourceEvent:t,target:n,transform:r,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:a}})}function Pi(e,t,n){this.k=e,this.x=t,this.y=n}Pi.prototype={constructor:Pi,scale:function(e){return e===1?this:new Pi(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Pi(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var bh=new Pi(1,0,0);qC.prototype=Pi.prototype;function qC(e){for(;!e.__zoom;)if(!(e=e.parentNode))return bh;return e.__zoom}function _p(e){e.stopImmediatePropagation()}function Ro(e){e.preventDefault(),e.stopImmediatePropagation()}function az(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function oz(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function qb(){return this.__zoom||bh}function lz(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function cz(){return navigator.maxTouchPoints||"ontouchstart"in this}function uz(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],u=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function VC(){var e=az,t=oz,n=uz,r=lz,a=cz,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],o=250,c=gu,f=mh("start","zoom","end"),p,d,_,v=500,w=150,C=0,b=10;function S(z){z.property("__zoom",qb).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",j).on("dblclick.zoom",B).filter(a).on("touchstart.zoom",F).on("touchmove.zoom",Y).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(z,V,G,X){var K=z.selection?z.selection():z;K.property("__zoom",qb),z!==K?R(z,V,G,X):K.interrupt().each(function(){N(this,arguments).event(X).start().zoom(null,typeof V=="function"?V.apply(this,arguments):V).end()})},S.scaleBy=function(z,V,G,X){S.scaleTo(z,function(){var K=this.__zoom.k,L=typeof V=="function"?V.apply(this,arguments):V;return K*L},G,X)},S.scaleTo=function(z,V,G,X){S.transform(z,function(){var K=t.apply(this,arguments),L=this.__zoom,M=G==null?E(K):typeof G=="function"?G.apply(this,arguments):G,O=L.invert(M),$=typeof V=="function"?V.apply(this,arguments):V;return n(y(x(L,$),M,O),K,u)},G,X)},S.translateBy=function(z,V,G,X){S.transform(z,function(){return n(this.__zoom.translate(typeof V=="function"?V.apply(this,arguments):V,typeof G=="function"?G.apply(this,arguments):G),t.apply(this,arguments),u)},null,X)},S.translateTo=function(z,V,G,X,K){S.transform(z,function(){var L=t.apply(this,arguments),M=this.__zoom,O=X==null?E(L):typeof X=="function"?X.apply(this,arguments):X;return n(bh.translate(O[0],O[1]).scale(M.k).translate(typeof V=="function"?-V.apply(this,arguments):-V,typeof G=="function"?-G.apply(this,arguments):-G),L,u)},X,K)};function x(z,V){return V=Math.max(l[0],Math.min(l[1],V)),V===z.k?z:new Pi(V,z.x,z.y)}function y(z,V,G){var X=V[0]-G[0]*z.k,K=V[1]-G[1]*z.k;return X===z.x&&K===z.y?z:new Pi(z.k,X,K)}function E(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function R(z,V,G,X){z.on("start.zoom",function(){N(this,arguments).event(X).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(X).end()}).tween("zoom",function(){var K=this,L=arguments,M=N(K,L).event(X),O=t.apply(K,L),$=G==null?E(O):typeof G=="function"?G.apply(K,L):G,U=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),Q=K.__zoom,re=typeof V=="function"?V.apply(K,L):V,ae=c(Q.invert($).concat(U/Q.k),re.invert($).concat(U/re.k));return function(Z){if(Z===1)Z=re;else{var P=ae(Z),ee=U/P[2];Z=new Pi(ee,$[0]-P[0]*ee,$[1]-P[1]*ee)}M.zoom(null,Z)}})}function N(z,V,G){return!G&&z.__zooming||new D(z,V)}function D(z,V){this.that=z,this.args=V,this.active=0,this.sourceEvent=null,this.extent=t.apply(z,V),this.taps=0}D.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,V){return this.mouse&&z!=="mouse"&&(this.mouse[1]=V.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=V.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=V.invert(this.touch1[0])),this.that.__zoom=V,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var V=An(this.that).datum();f.call(z,this.that,new sz(z,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:f}),V)}};function T(z,...V){if(!e.apply(this,arguments))return;var G=N(this,V).event(z),X=this.__zoom,K=Math.max(l[0],Math.min(l[1],X.k*Math.pow(2,r.apply(this,arguments)))),L=Xn(z);if(G.wheel)(G.mouse[0][0]!==L[0]||G.mouse[0][1]!==L[1])&&(G.mouse[1]=X.invert(G.mouse[0]=L)),clearTimeout(G.wheel);else{if(X.k===K)return;G.mouse=[L,X.invert(L)],vu(this),G.start()}Ro(z),G.wheel=setTimeout(M,w),G.zoom("mouse",n(y(x(X,K),G.mouse[0],G.mouse[1]),G.extent,u));function M(){G.wheel=null,G.end()}}function j(z,...V){if(_||!e.apply(this,arguments))return;var G=z.currentTarget,X=N(this,V,!0).event(z),K=An(z.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",U,!0),L=Xn(z,G),M=z.clientX,O=z.clientY;TC(z.view),_p(z),X.mouse=[L,this.__zoom.invert(L)],vu(this),X.start();function $(Q){if(Ro(Q),!X.moved){var re=Q.clientX-M,ae=Q.clientY-O;X.moved=re*re+ae*ae>C}X.event(Q).zoom("mouse",n(y(X.that.__zoom,X.mouse[0]=Xn(Q,G),X.mouse[1]),X.extent,u))}function U(Q){K.on("mousemove.zoom mouseup.zoom",null),RC(Q.view,X.moved),Ro(Q),X.event(Q).end()}}function B(z,...V){if(e.apply(this,arguments)){var G=this.__zoom,X=Xn(z.changedTouches?z.changedTouches[0]:z,this),K=G.invert(X),L=G.k*(z.shiftKey?.5:2),M=n(y(x(G,L),X,K),t.apply(this,V),u);Ro(z),o>0?An(this).transition().duration(o).call(R,M,X,z):An(this).call(S.transform,M,X,z)}}function F(z,...V){if(e.apply(this,arguments)){var G=z.touches,X=G.length,K=N(this,V,z.changedTouches.length===X).event(z),L,M,O,$;for(_p(z),M=0;M`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},tl=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],YC=["Enter"," ","Escape"],WC={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var ma;(function(e){e.Strict="strict",e.Loose="loose"})(ma||(ma={}));var ts;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ts||(ts={}));var nl;(function(e){e.Partial="partial",e.Full="full"})(nl||(nl={}));const XC={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Er;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Er||(Er={}));var Bu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Bu||(Bu={}));var Me;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Me||(Me={}));const Vb={[Me.Left]:Me.Right,[Me.Right]:Me.Left,[Me.Top]:Me.Bottom,[Me.Bottom]:Me.Top};function KC(e){return e===null?null:e?"valid":"invalid"}const ZC=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,hz=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Mm=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),gl=(e,t=[0,0])=>{const{width:n,height:r}=gi(e),a=e.origin??t,l=n*a[0],u=r*a[1];return{x:e.position.x-l,y:e.position.y-u}},fz=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,a)=>{const l=typeof a=="string";let u=!t.nodeLookup&&!l?a:void 0;t.nodeLookup&&(u=l?t.nodeLookup.get(a):Mm(a)?a:t.nodeLookup.get(a.id));const o=u?Iu(u,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Sh(r,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return xh(n)},ml=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(a=>{(t.filter===void 0||t.filter(a))&&(n=Sh(n,Iu(a)),r=!0)}),r?xh(n):{x:0,y:0,width:0,height:0}},jm=(e,t,[n,r,a]=[0,0,1],l=!1,u=!1)=>{const o=(t.x-n)/a,c=(t.y-r)/a,f=t.width/a,p=t.height/a,d=[];for(const _ of e.values()){const{measured:v,selectable:w=!0,hidden:C=!1}=_;if(u&&!w||C)continue;const b=v.width??_.width??_.initialWidth??0,S=v.height??_.height??_.initialHeight??0,{x,y}=_.internals.positionAbsolute,E=t2(o,c,f,p,x,y,b,S),R=b*S,N=l&&E>0;(!_.internals.handleBounds||N||E>=R||_.dragging)&&d.push(_)}return d},dz=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function pz(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(a=>a.id)):null;return e.forEach(a=>{let l;if(t!=null&&t.includeHiddenNodes){const{width:u,height:o}=gi(a);l=u>0&&o>0}else l=!!(a.measured.width&&a.measured.height&&!a.hidden);l&&(!r||r.has(a.id))&&n.set(a.id,a)}),n}async function gz({nodes:e,width:t,height:n,panZoom:r,minZoom:a,maxZoom:l},u){if(e.size===0)return!0;const o=pz(e,u),c=ml(o),f=Om(c,t,n,(u==null?void 0:u.minZoom)??a,(u==null?void 0:u.maxZoom)??l,(u==null?void 0:u.padding)??.1);return await r.setViewport(f,{duration:u==null?void 0:u.duration,ease:u==null?void 0:u.ease,interpolate:u==null?void 0:u.interpolate}),!0}function QC({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:a,onError:l}){const u=n.get(e),o=u.parentId?n.get(u.parentId):void 0,{x:c,y:f}=o?o.internals.positionAbsolute:{x:0,y:0},p=u.origin??r;let d=u.extent||a;if(u.extent==="parent"&&!u.expandParent)if(!o)l==null||l("005",ei.error005());else{const v=o.measured.width,w=o.measured.height;v&&w&&(d=[[c,f],[c+v,f+w]])}else o&&os(u.extent)&&(d=[[u.extent[0][0]+c,u.extent[0][1]+f],[u.extent[1][0]+c,u.extent[1][1]+f]]);const _=os(d)?as(t,d,u.measured):t;return(u.measured.width===void 0||u.measured.height===void 0)&&(l==null||l("015",ei.error015())),{position:{x:_.x-c+(u.measured.width??0)*p[0],y:_.y-f+(u.measured.height??0)*p[1]},positionAbsolute:_}}async function mz({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:a}){const l=new Set(e.map(_=>_.id)),u=[];for(const _ of n){if(_.deletable===!1)continue;const v=l.has(_.id),w=!v&&_.parentId&&u.find(C=>C.id===_.parentId);(v||w)&&u.push(_)}const o=new Set(t.map(_=>_.id)),c=r.filter(_=>_.deletable!==!1),p=dz(u,c);for(const _ of c)o.has(_.id)&&!p.find(w=>w.id===_.id)&&p.push(_);if(!a)return{edges:p,nodes:u};const d=await a({nodes:u,edges:p});return typeof d=="boolean"?d?{edges:p,nodes:u}:{edges:[],nodes:[]}:d}const _a=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),as=(e={x:0,y:0},t,n)=>({x:_a(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:_a(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function JC(e,t,n){const{width:r,height:a}=gi(n),{x:l,y:u}=n.internals.positionAbsolute;return as(e,[[l,u],[l+r,u+a]],t)}const Yb=(e,t,n)=>en?-_a(Math.abs(e-n),1,t)/t:0,Lm=(e,t,n=15,r=40)=>{const a=Yb(e.x,r,t.width-r)*n,l=Yb(e.y,r,t.height-r)*n;return[a,l]},Sh=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),hg=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),xh=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),il=(e,t=[0,0])=>{var a,l;const{x:n,y:r}=Mm(e)?e.internals.positionAbsolute:gl(e,t);return{x:n,y:r,width:((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0,height:((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0}},Iu=(e,t=[0,0])=>{var a,l;const{x:n,y:r}=Mm(e)?e.internals.positionAbsolute:gl(e,t);return{x:n,y:r,x2:n+(((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0),y2:r+(((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0)}},e2=(e,t)=>xh(Sh(hg(e),hg(t))),t2=(e,t,n,r,a,l,u,o)=>{const c=Math.max(0,Math.min(e+n,a+u)-Math.max(e,a)),f=Math.max(0,Math.min(t+r,l+o)-Math.max(t,l));return Math.ceil(c*f)},zu=(e,t)=>t2(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Wb=e=>Zn(e.width)&&Zn(e.height)&&Zn(e.x)&&Zn(e.y),Zn=e=>!isNaN(e)&&isFinite(e),n2=(e,t)=>(n,r)=>{},_l=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),vl=({x:e,y:t},[n,r,a],l=!1,u=[1,1])=>{const o={x:(e-n)/a,y:(t-r)/a};return l?_l(o,u):o},va=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r});function ta(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function _z(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=ta(e,n),a=ta(e,t);return{top:r,right:a,bottom:r,left:a,x:a*2,y:r*2}}if(typeof e=="object"){const r=ta(e.top??e.y??0,n),a=ta(e.bottom??e.y??0,n),l=ta(e.left??e.x??0,t),u=ta(e.right??e.x??0,t);return{top:r,right:u,bottom:a,left:l,x:l+u,y:r+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vz(e,t,n,r,a,l){const{x:u,y:o}=va(e,[t,n,r]),{x:c,y:f}=va({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=a-c,d=l-f;return{left:Math.floor(u),top:Math.floor(o),right:Math.floor(p),bottom:Math.floor(d)}}const Om=(e,t,n,r,a,l)=>{const u=_z(l,t,n),o=(t-u.x)/e.width,c=(n-u.y)/e.height,f=Math.min(o,c),p=_a(f,r,a),d=e.x+e.width/2,_=e.y+e.height/2,v=t/2-d*p,w=n/2-_*p,C=vz(e,v,w,p,t,n),b={left:Math.min(C.left-u.left,0),top:Math.min(C.top-u.top,0),right:Math.min(C.right-u.right,0),bottom:Math.min(C.bottom-u.bottom,0)};return{x:v-b.left+b.right,y:w-b.top+b.bottom,zoom:p}},rl=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function os(e){return e!=null&&e!=="parent"}function gi(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function i2(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function r2(e,t={width:0,height:0},n,r,a){const l={...e},u=r.get(n);if(u){const o=u.origin||a;l.x+=u.internals.positionAbsolute.x-(t.width??0)*o[0],l.y+=u.internals.positionAbsolute.y-(t.height??0)*o[1]}return l}function Xb(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function yz(){let e,t;return{promise:new Promise((r,a)=>{e=r,t=a}),resolve:e,reject:t}}function bz(e){return{...WC,...e||{}}}function Ho(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:a}){const{x:l,y:u}=Qn(e),o=vl({x:l-((a==null?void 0:a.left)??0),y:u-((a==null?void 0:a.top)??0)},r),{x:c,y:f}=n?_l(o,t):o;return{xSnapped:c,ySnapped:f,...o}}const Bm=e=>({width:e.offsetWidth,height:e.offsetHeight}),s2=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Sz=["INPUT","SELECT","TEXTAREA"];function a2(e){var r,a;const t=((a=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:a[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Sz.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const o2=e=>"clientX"in e,Qn=(e,t)=>{var l,u;const n=o2(e),r=n?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,a=n?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},Kb=(e,t,n,r,a)=>{const l=t.querySelectorAll(`.${e}`);return!l||!l.length?null:Array.from(l).map(u=>{const o=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:a,position:u.getAttribute("data-handlepos"),x:(o.left-n.left)/r,y:(o.top-n.top)/r,...Bm(u)}})};function l2({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:o}){const c=e*.125+a*.375+u*.375+n*.125,f=t*.125+l*.375+o*.375+r*.125,p=Math.abs(c-e),d=Math.abs(f-t);return[c,f,p,d]}function nu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Zb({pos:e,x1:t,y1:n,x2:r,y2:a,c:l}){switch(e){case Me.Left:return[t-nu(t-r,l),n];case Me.Right:return[t+nu(r-t,l),n];case Me.Top:return[t,n-nu(n-a,l)];case Me.Bottom:return[t,n+nu(a-n,l)]}}function c2({sourceX:e,sourceY:t,sourcePosition:n=Me.Bottom,targetX:r,targetY:a,targetPosition:l=Me.Top,curvature:u=.25}){const[o,c]=Zb({pos:n,x1:e,y1:t,x2:r,y2:a,c:u}),[f,p]=Zb({pos:l,x1:r,y1:a,x2:e,y2:t,c:u}),[d,_,v,w]=l2({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:o,sourceControlY:c,targetControlX:f,targetControlY:p});return[`M${e},${t} C${o},${c} ${f},${p} ${r},${a}`,d,_,v,w]}function u2({sourceX:e,sourceY:t,targetX:n,targetY:r}){const a=Math.abs(n-e)/2,l=n0}const Cz=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Ez=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),kz=(e,t,n={})=>{var l;if(!e.source||!e.target)return(l=n.onError)==null||l.call(n,"006",ei.error006()),t;const r=n.getEdgeId||Cz;let a;return ZC(e)?a={...e}:a={...e,id:r(e)},Ez(a,t)?t:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,t.concat(a))};function h2({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[a,l,u,o]=u2({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,l,u,o]}const Qb={[Me.Left]:{x:-1,y:0},[Me.Right]:{x:1,y:0},[Me.Top]:{x:0,y:-1},[Me.Bottom]:{x:0,y:1}},Az=({source:e,sourcePosition:t=Me.Bottom,target:n})=>t===Me.Left||t===Me.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Nz({source:e,sourcePosition:t=Me.Bottom,target:n,targetPosition:r=Me.Top,center:a,offset:l,stepPosition:u}){const o=Qb[t],c=Qb[r],f={x:e.x+o.x*l,y:e.y+o.y*l},p={x:n.x+c.x*l,y:n.y+c.y*l},d=Az({source:f,sourcePosition:t,target:p}),_=d.x!==0?"x":"y",v=d[_];let w=[],C,b;const S={x:0,y:0},x={x:0,y:0},[,,y,E]=u2({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[_]*c[_]===-1){_==="x"?(C=a.x??f.x+(p.x-f.x)*u,b=a.y??(f.y+p.y)/2):(C=a.x??(f.x+p.x)/2,b=a.y??f.y+(p.y-f.y)*u);const T=[{x:C,y:f.y},{x:C,y:p.y}],j=[{x:f.x,y:b},{x:p.x,y:b}];o[_]===v?w=_==="x"?T:j:w=_==="x"?j:T}else{const T=[{x:f.x,y:p.y}],j=[{x:p.x,y:f.y}];if(_==="x"?w=o.x===v?j:T:w=o.y===v?T:j,t===r){const z=Math.abs(e[_]-n[_]);if(z<=l){const V=Math.min(l-1,l-z);o[_]===v?S[_]=(f[_]>e[_]?-1:1)*V:x[_]=(p[_]>n[_]?-1:1)*V}}if(t!==r){const z=_==="x"?"y":"x",V=o[_]===c[z],G=f[z]>p[z],X=f[z]=H?(C=(B.x+F.x)/2,b=w[0].y):(C=w[0].x,b=(B.y+F.y)/2)}const R={x:f.x+S.x,y:f.y+S.y},N={x:p.x+x.x,y:p.y+x.y};return[[e,...R.x!==w[0].x||R.y!==w[0].y?[R]:[],...w,...N.x!==w[w.length-1].x||N.y!==w[w.length-1].y?[N]:[],n],C,b,y,E]}function Tz(e,t,n,r){const a=Math.min(Jb(e,t)/2,Jb(t,n)/2,r),{x:l,y:u}=t;if(e.x===l&&l===n.x||e.y===u&&u===n.y)return`L${l} ${u}`;if(e.y===u){const f=e.xn.id===t):e[0])||null}function dg(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Dz(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:a}){const l=new Set;return e.reduce((u,o)=>([o.markerStart||r,o.markerEnd||a].forEach(c=>{if(c&&typeof c=="object"){const f=dg(c,t);l.has(f)||(u.push({id:f,color:c.color||n,...c}),l.add(f))}}),u),[]).sort((u,o)=>u.id.localeCompare(o.id))}const f2=1e3,Mz=10,Im={nodeOrigin:[0,0],nodeExtent:tl,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},jz={...Im,checkEquality:!0};function zm(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Lz(e,t,n){const r=zm(Im,n);for(const a of e.values())if(a.parentId)Fm(a,e,t,r);else{const l=gl(a,r.nodeOrigin),u=os(a.extent)?a.extent:r.nodeExtent,o=as(l,u,gi(a));a.internals.positionAbsolute=o}}function Oz(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const a of e.handles){const l={id:a.id,width:a.width??1,height:a.height??1,nodeId:e.id,x:a.x,y:a.y,position:a.position,type:a.type};a.type==="source"?n.push(l):a.type==="target"&&r.push(l)}return{source:n,target:r}}function Hm(e){return e==="manual"}function pg(e,t,n,r={}){var p,d;const a=zm(jz,r),l={i:0},u=new Map(t),o=a!=null&&a.elevateNodesOnSelect&&!Hm(a.zIndexMode)?f2:0;let c=e.length>0,f=!1;t.clear(),n.clear();for(const _ of e){let v=u.get(_.id);if(a.checkEquality&&_===(v==null?void 0:v.internals.userNode))t.set(_.id,v);else{const w=gl(_,a.nodeOrigin),C=os(_.extent)?_.extent:a.nodeExtent,b=as(w,C,gi(_));v={...a.defaults,..._,measured:{width:(p=_.measured)==null?void 0:p.width,height:(d=_.measured)==null?void 0:d.height},internals:{positionAbsolute:b,handleBounds:Oz(_,v),z:d2(_,o,a.zIndexMode),userNode:_}},t.set(_.id,v)}(v.measured===void 0||v.measured.width===void 0||v.measured.height===void 0)&&!v.hidden&&(c=!1),_.parentId&&Fm(v,t,n,r,l),f||(f=_.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:f}}function Bz(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Fm(e,t,n,r,a){const{elevateNodesOnSelect:l,nodeOrigin:u,nodeExtent:o,zIndexMode:c}=zm(Im,r),f=e.parentId,p=t.get(f);if(!p){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Bz(e,n),a&&!p.parentId&&p.internals.rootParentIndex===void 0&&c==="auto"&&(p.internals.rootParentIndex=++a.i,p.internals.z=p.internals.z+a.i*Mz),a&&p.internals.rootParentIndex!==void 0&&(a.i=p.internals.rootParentIndex);const d=l&&!Hm(c)?f2:0,{x:_,y:v,z:w}=Iz(e,p,u,o,d,c),{positionAbsolute:C}=e.internals,b=_!==C.x||v!==C.y;(b||w!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:_,y:v}:C,z:w}})}function d2(e,t,n){const r=Zn(e.zIndex)?e.zIndex:0;return Hm(n)?r:r+(e.selected?t:0)}function Iz(e,t,n,r,a,l){const{x:u,y:o}=t.internals.positionAbsolute,c=gi(e),f=gl(e,n),p=os(e.extent)?as(f,e.extent,c):f;let d=as({x:u+p.x,y:o+p.y},r,c);e.extent==="parent"&&(d=JC(d,c,t));const _=d2(e,a,l),v=t.internals.z??0;return{x:d.x,y:d.y,z:v>=_?v+1:_}}function Pm(e,t,n,r=[0,0]){var u;const a=[],l=new Map;for(const o of e){const c=t.get(o.parentId);if(!c)continue;const f=((u=l.get(o.parentId))==null?void 0:u.expandedRect)??il(c),p=e2(f,o.rect);l.set(o.parentId,{expandedRect:p,parent:c})}return l.size>0&&l.forEach(({expandedRect:o,parent:c},f)=>{var y;const p=c.internals.positionAbsolute,d=gi(c),_=c.origin??r,v=o.x0||w>0||S||x)&&(a.push({id:f,type:"position",position:{x:c.position.x-v+S,y:c.position.y-w+x}}),(y=n.get(f))==null||y.forEach(E=>{e.some(R=>R.id===E.id)||a.push({id:E.id,type:"position",position:{x:E.position.x+v,y:E.position.y+w}})})),(d.width0){const v=Pm(_,t,n,a);f.push(...v)}return{changes:f,updatedInternals:c}}async function Hz({delta:e,panZoom:t,transform:n,translateExtent:r,width:a,height:l}){if(!t||!e.x&&!e.y)return!1;const u=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[a,l]],r);return!!u&&(u.x!==n[0]||u.y!==n[1]||u.k!==n[2])}function iS(e,t,n,r,a,l){let u=a;const o=r.get(u)||new Map;r.set(u,o.set(n,t)),u=`${a}-${e}`;const c=r.get(u)||new Map;if(r.set(u,c.set(n,t)),l){u=`${a}-${e}-${l}`;const f=r.get(u)||new Map;r.set(u,f.set(n,t))}}function p2(e,t,n){e.clear(),t.clear();for(const r of n){const{source:a,target:l,sourceHandle:u=null,targetHandle:o=null}=r,c={edgeId:r.id,source:a,target:l,sourceHandle:u,targetHandle:o},f=`${a}-${u}--${l}-${o}`,p=`${l}-${o}--${a}-${u}`;iS("source",c,p,e,a,u),iS("target",c,f,e,l,o),t.set(r.id,r)}}function g2(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:g2(n,t):!1}function rS(e,t,n){var a;let r=e;do{if((a=r==null?void 0:r.matches)!=null&&a.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Fz(e,t,n,r){const a=new Map;for(const[l,u]of e)if((u.selected||u.id===r)&&(!u.parentId||!g2(u,e))&&(u.draggable||t&&typeof u.draggable>"u")){const o=e.get(l);o&&a.set(l,{id:l,position:o.position||{x:0,y:0},distance:{x:n.x-o.internals.positionAbsolute.x,y:n.y-o.internals.positionAbsolute.y},extent:o.extent,parentId:o.parentId,origin:o.origin,expandParent:o.expandParent,internals:{positionAbsolute:o.internals.positionAbsolute||{x:0,y:0}},measured:{width:o.measured.width??0,height:o.measured.height??0}})}return a}function vp({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var u,o,c;const a=[];for(const[f,p]of t){const d=(u=n.get(f))==null?void 0:u.internals.userNode;d&&a.push({...d,position:p.position,dragging:r})}if(!e)return[a[0],a];const l=(o=n.get(e))==null?void 0:o.internals.userNode;return[l?{...l,position:((c=t.get(e))==null?void 0:c.position)||l.position,dragging:r}:a[0],a]}function Pz({dragItems:e,snapGrid:t,x:n,y:r}){const a=e.values().next().value;if(!a)return null;const l={x:n-a.distance.x,y:r-a.distance.y},u=_l(l,t);return{x:u.x-l.x,y:u.y-l.y}}function Uz({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:a}){let l={x:null,y:null},u=0,o=new Map,c=!1,f={x:0,y:0},p=null,d=!1,_=null,v=!1,w=!1,C=null;function b({noDragClassName:x,handleSelector:y,domNode:E,isSelectable:R,nodeId:N,nodeClickDistance:D=0}){_=An(E);function T({x:Y,y:H}){const{nodeLookup:z,nodeExtent:V,snapGrid:G,snapToGrid:X,nodeOrigin:K,onNodeDrag:L,onSelectionDrag:M,onError:O,updateNodePositions:$}=t();l={x:Y,y:H};let U=!1;const Q=o.size>1,re=Q&&V?hg(ml(o)):null,ae=Q&&X?Pz({dragItems:o,snapGrid:G,x:Y,y:H}):null;for(const[Z,P]of o){if(!z.has(Z))continue;let ee={x:Y-P.distance.x,y:H-P.distance.y};X&&(ee=ae?{x:Math.round(ee.x+ae.x),y:Math.round(ee.y+ae.y)}:_l(ee,G));let ne=null;if(Q&&V&&!P.extent&&re){const{positionAbsolute:ye}=P.internals,be=ye.x-re.x+V[0][0],ke=ye.x+P.measured.width-re.x2+V[1][0],Ee=ye.y-re.y+V[0][1],Ce=ye.y+P.measured.height-re.y2+V[1][1];ne=[[be,Ee],[ke,Ce]]}const{position:ge,positionAbsolute:he}=QC({nodeId:Z,nextPosition:ee,nodeLookup:z,nodeExtent:ne||V,nodeOrigin:K,onError:O});U=U||P.position.x!==ge.x||P.position.y!==ge.y,P.position=ge,P.internals.positionAbsolute=he}if(w=w||U,!!U&&($(o,!0),C&&(r||L||!N&&M))){const[Z,P]=vp({nodeId:N,dragItems:o,nodeLookup:z});r==null||r(C,o,Z,P),L==null||L(C,Z,P),N||M==null||M(C,P)}}async function j(){if(!p)return;const{transform:Y,panBy:H,autoPanSpeed:z,autoPanOnNodeDrag:V}=t();if(!V){c=!1,cancelAnimationFrame(u);return}const[G,X]=Lm(f,p,z);(G!==0||X!==0)&&(l.x=(l.x??0)-G/Y[2],l.y=(l.y??0)-X/Y[2],await H({x:G,y:X})&&T(l)),u=requestAnimationFrame(j)}function B(Y){var Q;const{nodeLookup:H,multiSelectionActive:z,nodesDraggable:V,transform:G,snapGrid:X,snapToGrid:K,selectNodesOnDrag:L,onNodeDragStart:M,onSelectionDragStart:O,unselectNodesAndEdges:$}=t();d=!0,(!L||!R)&&!z&&N&&((Q=H.get(N))!=null&&Q.selected||$()),R&&L&&N&&(e==null||e(N));const U=Ho(Y.sourceEvent,{transform:G,snapGrid:X,snapToGrid:K,containerBounds:p});if(l=U,o=Fz(H,V,U,N),o.size>0&&(n||M||!N&&O)){const[re,ae]=vp({nodeId:N,dragItems:o,nodeLookup:H});n==null||n(Y.sourceEvent,o,re,ae),M==null||M(Y.sourceEvent,re,ae),N||O==null||O(Y.sourceEvent,ae)}}const F=DC().clickDistance(D).on("start",Y=>{const{domNode:H,nodeDragThreshold:z,transform:V,snapGrid:G,snapToGrid:X}=t();p=(H==null?void 0:H.getBoundingClientRect())||null,v=!1,w=!1,C=Y.sourceEvent,z===0&&B(Y),l=Ho(Y.sourceEvent,{transform:V,snapGrid:G,snapToGrid:X,containerBounds:p}),f=Qn(Y.sourceEvent,p)}).on("drag",Y=>{const{autoPanOnNodeDrag:H,transform:z,snapGrid:V,snapToGrid:G,nodeDragThreshold:X,nodeLookup:K}=t(),L=Ho(Y.sourceEvent,{transform:z,snapGrid:V,snapToGrid:G,containerBounds:p});if(C=Y.sourceEvent,(Y.sourceEvent.type==="touchmove"&&Y.sourceEvent.touches.length>1||N&&!K.has(N))&&(v=!0),!v){if(!c&&H&&d&&(c=!0,j()),!d){const M=Qn(Y.sourceEvent,p),O=M.x-f.x,$=M.y-f.y;Math.sqrt(O*O+$*$)>X&&B(Y)}(l.x!==L.xSnapped||l.y!==L.ySnapped)&&o&&d&&(f=Qn(Y.sourceEvent,p),T(L))}}).on("end",Y=>{if(!d||v){v&&o.size>0&&t().updateNodePositions(o,!1);return}if(c=!1,d=!1,cancelAnimationFrame(u),o.size>0){const{nodeLookup:H,updateNodePositions:z,onNodeDragStop:V,onSelectionDragStop:G}=t();if(w&&(z(o,!1),w=!1),a||V||!N&&G){const[X,K]=vp({nodeId:N,dragItems:o,nodeLookup:H,dragging:!1});a==null||a(Y.sourceEvent,o,X,K),V==null||V(Y.sourceEvent,X,K),N||G==null||G(Y.sourceEvent,K)}}}).filter(Y=>{const H=Y.target;return!Y.button&&(!x||!rS(H,`.${x}`,E))&&(!y||rS(H,y,E))});_.call(F)}function S(){_==null||_.on(".drag",null)}return{update:b,destroy:S}}function $z(e,t,n){const r=[],a={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const l of t.values())zu(a,il(l))>0&&r.push(l);return r}const Gz=250;function qz(e,t,n,r){var o,c;let a=[],l=1/0;const u=$z(e,n,t+Gz);for(const f of u){const p=[...((o=f.internals.handleBounds)==null?void 0:o.source)??[],...((c=f.internals.handleBounds)==null?void 0:c.target)??[]];for(const d of p){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:_,y:v}=ls(f,d,d.position,!0),w=Math.sqrt(Math.pow(_-e.x,2)+Math.pow(v-e.y,2));w>t||(w1){const f=r.type==="source"?"target":"source";return a.find(p=>p.type===f)??a[0]}return a[0]}function m2(e,t,n,r,a,l=!1){var f,p,d;const u=r.get(e);if(!u)return null;const o=a==="strict"?(f=u.internals.handleBounds)==null?void 0:f[t]:[...((p=u.internals.handleBounds)==null?void 0:p.source)??[],...((d=u.internals.handleBounds)==null?void 0:d.target)??[]],c=(n?o==null?void 0:o.find(_=>_.id===n):o==null?void 0:o[0])??null;return c&&l?{...c,...ls(u,c,c.position,!0)}:c}function _2(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Vz(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const v2=()=>!0;function Yz(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:a,edgeUpdaterType:l,isTarget:u,domNode:o,nodeLookup:c,lib:f,autoPanOnConnect:p,flowId:d,panBy:_,cancelConnection:v,onConnectStart:w,onConnect:C,onConnectEnd:b,isValidConnection:S=v2,onReconnectEnd:x,updateConnection:y,getTransform:E,getFromHandle:R,autoPanSpeed:N,dragThreshold:D=1,handleDomNode:T}){const j=s2(e.target);let B=0,F;const{x:Y,y:H}=Qn(e),z=_2(l,T),V=o==null?void 0:o.getBoundingClientRect();let G=!1;if(!V||!z)return;const X=m2(a,z,r,c,t);if(!X)return;let K=Qn(e,V),L=!1,M=null,O=!1,$=null;function U(){if(!p||!V)return;const[ge,he]=Lm(K,V,N);_({x:ge,y:he}),B=requestAnimationFrame(U)}const Q={...X,nodeId:a,type:z,position:X.position},re=c.get(a);let Z={inProgress:!0,isValid:null,from:ls(re,Q,Me.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:re,to:K,toHandle:null,toPosition:Vb[Q.position],toNode:null,pointer:K};function P(){G=!0,y(Z),w==null||w(e,{nodeId:a,handleId:r,handleType:z})}D===0&&P();function ee(ge){if(!G){const{x:Ce,y:rt}=Qn(ge),bt=Ce-Y,Ge=rt-H;if(!(bt*bt+Ge*Ge>D*D))return;P()}if(!R()||!Q){ne(ge);return}const he=E();K=Qn(ge,V),F=qz(vl(K,he,!1,[1,1]),n,c,Q),L||(U(),L=!0);const ye=y2(ge,{handle:F,connectionMode:t,fromNodeId:a,fromHandleId:r,fromType:u?"target":"source",isValidConnection:S,doc:j,lib:f,flowId:d,nodeLookup:c});$=ye.handleDomNode,M=ye.connection,O=Vz(!!F,ye.isValid);const be=c.get(a),ke=be?ls(be,Q,Me.Left,!0):Z.from,Ee={...Z,from:ke,isValid:O,to:ye.toHandle&&O?va({x:ye.toHandle.x,y:ye.toHandle.y},he):K,toHandle:ye.toHandle,toPosition:O&&ye.toHandle?ye.toHandle.position:Vb[Q.position],toNode:ye.toHandle?c.get(ye.toHandle.nodeId):null,pointer:K};y(Ee),Z=Ee}function ne(ge){if(!("touches"in ge&&ge.touches.length>0)){if(G){(F||$)&&M&&O&&(C==null||C(M));const{inProgress:he,...ye}=Z,be={...ye,toPosition:Z.toHandle?Z.toPosition:null};b==null||b(ge,be),l&&(x==null||x(ge,be))}v(),cancelAnimationFrame(B),L=!1,O=!1,M=null,$=null,j.removeEventListener("mousemove",ee),j.removeEventListener("mouseup",ne),j.removeEventListener("touchmove",ee),j.removeEventListener("touchend",ne)}}j.addEventListener("mousemove",ee),j.addEventListener("mouseup",ne),j.addEventListener("touchmove",ee),j.addEventListener("touchend",ne)}function y2(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:a,fromType:l,doc:u,lib:o,flowId:c,isValidConnection:f=v2,nodeLookup:p}){const d=l==="target",_=t?u.querySelector(`.${o}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:v,y:w}=Qn(e),C=u.elementFromPoint(v,w),b=C!=null&&C.classList.contains(`${o}-flow__handle`)?C:_,S={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const x=_2(void 0,b),y=b.getAttribute("data-nodeid"),E=b.getAttribute("data-handleid"),R=b.classList.contains("connectable"),N=b.classList.contains("connectableend");if(!y||!x)return S;const D={source:d?y:r,sourceHandle:d?E:a,target:d?r:y,targetHandle:d?a:E};S.connection=D;const j=R&&N&&(n===ma.Strict?d&&x==="source"||!d&&x==="target":y!==r||E!==a);S.isValid=j&&f(D),S.toHandle=m2(y,x,E,p,n,!0)}return S}const gg={onPointerDown:Yz,isValid:y2};function Wz({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const a=An(e);function l({translateExtent:o,width:c,height:f,zoomStep:p=1,pannable:d=!0,zoomable:_=!0,inversePan:v=!1}){const w=y=>{if(y.sourceEvent.type!=="wheel"||!t)return;const E=n(),R=y.sourceEvent.ctrlKey&&rl()?10:1,N=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*p,D=E[2]*Math.pow(2,N*R);t.scaleTo(D)};let C=[0,0];const b=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(C=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},S=y=>{const E=n();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!t)return;const R=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],N=[R[0]-C[0],R[1]-C[1]];C=R;const D=r()*Math.max(E[2],Math.log(E[2]))*(v?-1:1),T={x:E[0]-N[0]*D,y:E[1]-N[1]*D},j=[[0,0],[c,f]];t.setViewportConstrained({x:T.x,y:T.y,zoom:E[2]},j,o)},x=VC().on("start",b).on("zoom",d?S:null).on("zoom.wheel",_?w:null);a.call(x,{})}function u(){a.on("zoom",null)}return{update:l,destroy:u,pointer:Xn}}const wh=e=>({x:e.x,y:e.y,zoom:e.k}),yp=({x:e,y:t,zoom:n})=>bh.translate(e,t).scale(n),la=(e,t)=>e.target.closest(`.${t}`),b2=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Xz=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,bp=(e,t=0,n=Xz,r=()=>{})=>{const a=typeof t=="number"&&t>0;return a||r(),a?e.transition().duration(t).ease(n).on("end",r):e},S2=e=>{const t=e.ctrlKey&&rl()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Kz({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:a,panOnScrollSpeed:l,zoomOnPinch:u,onPanZoomStart:o,onPanZoom:c,onPanZoomEnd:f}){return p=>{if(la(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(p.ctrlKey&&u){const b=Xn(p),S=S2(p),x=d*Math.pow(2,S);r.scaleTo(n,x,b,p);return}const _=p.deltaMode===1?20:1;let v=a===ts.Vertical?0:p.deltaX*_,w=a===ts.Horizontal?0:p.deltaY*_;!rl()&&p.shiftKey&&a!==ts.Vertical&&(v=p.deltaY*_,w=0),r.translateBy(n,-(v/d)*l,-(w/d)*l,{internal:!0});const C=wh(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c==null||c(p,C):(e.isPanScrolling=!0,o==null||o(p,C)),e.panScrollTimeout=setTimeout(()=>{f==null||f(p,C),e.isPanScrolling=!1},150)}}function Zz({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,a){const l=r.type==="wheel",u=!t&&l&&!r.ctrlKey,o=la(r,e);if(r.ctrlKey&&l&&o&&r.preventDefault(),u||o)return null;r.preventDefault(),n.call(this,r,a)}}function Qz({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var l,u,o;if((l=r.sourceEvent)!=null&&l.internal)return;const a=wh(r.transform);e.mouseButton=((u=r.sourceEvent)==null?void 0:u.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=a,((o=r.sourceEvent)==null?void 0:o.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,a))}}function Jz({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:a}){return l=>{var u,o;e.usedRightMouseButton=!!(n&&b2(t,e.mouseButton??0)),(u=l.sourceEvent)!=null&&u.sync||r([l.transform.x,l.transform.y,l.transform.k]),a&&!((o=l.sourceEvent)!=null&&o.internal)&&(a==null||a(l.sourceEvent,wh(l.transform)))}}function eH({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:a,onPaneContextMenu:l}){return u=>{var o;if(!((o=u.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,l&&b2(t,e.mouseButton??0)&&!e.usedRightMouseButton&&u.sourceEvent&&l(u.sourceEvent),e.usedRightMouseButton=!1,r(!1),a)){const c=wh(u.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a==null||a(u.sourceEvent,c)},n?150:0)}}}function tH({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:a,zoomOnDoubleClick:l,userSelectionActive:u,noWheelClassName:o,noPanClassName:c,lib:f,connectionInProgress:p}){return d=>{var b;const _=e||t,v=n&&d.ctrlKey,w=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(la(d,`${f}-flow__node`)||la(d,`${f}-flow__edge`)))return!0;if(!r&&!_&&!a&&!l&&!n||u||p&&!w||la(d,o)&&w||la(d,c)&&(!w||a&&w&&!e)||!n&&d.ctrlKey&&w)return!1;if(!n&&d.type==="touchstart"&&((b=d.touches)==null?void 0:b.length)>1)return d.preventDefault(),!1;if(!_&&!a&&!v&&w||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const C=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||w)&&C}}function nH({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:a,onPanZoom:l,onPanZoomStart:u,onPanZoomEnd:o,onDraggingChange:c}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect();let d=[[0,0],[p.width,p.height]];const _=typeof ResizeObserver<"u"?new ResizeObserver(H=>{const z=H[0];z&&(d=[[0,0],[z.contentRect.width,z.contentRect.height]])}):null;_==null||_.observe(e);const v=VC().extent(()=>d).scaleExtent([t,n]).translateExtent(r),w=An(e).call(v);E({x:a.x,y:a.y,zoom:_a(a.zoom,t,n)},[[0,0],[p.width,p.height]],r);const C=w.on("wheel.zoom"),b=w.on("dblclick.zoom");v.wheelDelta(S2);async function S(H,z){return w?new Promise(V=>{v==null||v.interpolate((z==null?void 0:z.interpolate)==="linear"?zo:gu).transform(bp(w,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>V(!0)),H)}):!1}function x({noWheelClassName:H,noPanClassName:z,onPaneContextMenu:V,userSelectionActive:G,panOnScroll:X,panOnDrag:K,panOnScrollMode:L,panOnScrollSpeed:M,preventScrolling:O,zoomOnPinch:$,zoomOnScroll:U,zoomOnDoubleClick:Q,zoomActivationKeyPressed:re,lib:ae,onTransformChange:Z,connectionInProgress:P,paneClickDistance:ee,selectionOnDrag:ne}){G&&!f.isZoomingOrPanning&&y();const ge=X&&!re&&!G;v.clickDistance(ne?1/0:!Zn(ee)||ee<0?0:ee);const he=ge?Kz({zoomPanValues:f,noWheelClassName:H,d3Selection:w,d3Zoom:v,panOnScrollMode:L,panOnScrollSpeed:M,zoomOnPinch:$,onPanZoomStart:u,onPanZoom:l,onPanZoomEnd:o}):Zz({noWheelClassName:H,preventScrolling:O,d3ZoomHandler:C});w.on("wheel.zoom",he,{passive:!1});const ye=Qz({zoomPanValues:f,onDraggingChange:c,onPanZoomStart:u});v.on("start",ye);const be=Jz({zoomPanValues:f,panOnDrag:K,onPaneContextMenu:!!V,onPanZoom:l,onTransformChange:Z});v.on("zoom",be);const ke=eH({zoomPanValues:f,panOnDrag:K,panOnScroll:X,onPaneContextMenu:V,onPanZoomEnd:o,onDraggingChange:c});v.on("end",ke);const Ee=tH({zoomActivationKeyPressed:re,panOnDrag:K,zoomOnScroll:U,panOnScroll:X,zoomOnDoubleClick:Q,zoomOnPinch:$,userSelectionActive:G,noPanClassName:z,noWheelClassName:H,lib:ae,connectionInProgress:P});v.filter(Ee),Q?w.on("dblclick.zoom",b):w.on("dblclick.zoom",null)}function y(){v.on("zoom",null)}async function E(H,z,V){const G=yp(H),X=v==null?void 0:v.constrain()(G,z,V);return X&&await S(X),X}async function R(H,z){const V=yp(H);return await S(V,z),V}function N(H){if(w){const z=yp(H),V=w.property("__zoom");(V.k!==H.zoom||V.x!==H.x||V.y!==H.y)&&(v==null||v.transform(w,z,null,{sync:!0}))}}function D(){const H=w?qC(w.node()):{x:0,y:0,k:1};return{x:H.x,y:H.y,zoom:H.k}}async function T(H,z){return w?new Promise(V=>{v==null||v.interpolate((z==null?void 0:z.interpolate)==="linear"?zo:gu).scaleTo(bp(w,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>V(!0)),H)}):!1}async function j(H,z){return w?new Promise(V=>{v==null||v.interpolate((z==null?void 0:z.interpolate)==="linear"?zo:gu).scaleBy(bp(w,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>V(!0)),H)}):!1}function B(H){v==null||v.scaleExtent(H)}function F(H){v==null||v.translateExtent(H)}function Y(H){const z=!Zn(H)||H<0?0:H;v==null||v.clickDistance(z)}return{update:x,destroy:y,setViewport:R,setViewportConstrained:E,getViewport:D,scaleTo:T,scaleBy:j,setScaleExtent:B,setTranslateExtent:F,syncViewport:N,setClickDistance:Y}}var ya;(function(e){e.Line="line",e.Handle="handle"})(ya||(ya={}));function iH({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:a,affectsY:l}){const u=e-t,o=n-r,c=[u>0?1:u<0?-1:0,o>0?1:o<0?-1:0];return u&&a&&(c[0]=c[0]*-1),o&&l&&(c[1]=c[1]*-1),c}function sS(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),a=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:a}}function wr(e,t){return Math.max(0,t-e)}function Cr(e,t){return Math.max(0,e-t)}function iu(e,t,n){return Math.max(0,t-e,e-n)}function aS(e,t){return e?!t:t}function rH(e,t,n,r,a,l,u,o){let{affectsX:c,affectsY:f}=t;const{isHorizontal:p,isVertical:d}=t,_=p&&d,{xSnapped:v,ySnapped:w}=n,{minWidth:C,maxWidth:b,minHeight:S,maxHeight:x}=r,{x:y,y:E,width:R,height:N,aspectRatio:D}=e;let T=Math.floor(p?v-e.pointerX:0),j=Math.floor(d?w-e.pointerY:0);const B=R+(c?-T:T),F=N+(f?-j:j),Y=-l[0]*R,H=-l[1]*N;let z=iu(B,C,b),V=iu(F,S,x);if(u){let K=0,L=0;c&&T<0?K=wr(y+T+Y,u[0][0]):!c&&T>0&&(K=Cr(y+B+Y,u[1][0])),f&&j<0?L=wr(E+j+H,u[0][1]):!f&&j>0&&(L=Cr(E+F+H,u[1][1])),z=Math.max(z,K),V=Math.max(V,L)}if(o){let K=0,L=0;c&&T>0?K=Cr(y+T,o[0][0]):!c&&T<0&&(K=wr(y+B,o[1][0])),f&&j>0?L=Cr(E+j,o[0][1]):!f&&j<0&&(L=wr(E+F,o[1][1])),z=Math.max(z,K),V=Math.max(V,L)}if(a){if(p){const K=iu(B/D,S,x)*D;if(z=Math.max(z,K),u){let L=0;!c&&!f||c&&!f&&_?L=Cr(E+H+B/D,u[1][1])*D:L=wr(E+H+(c?T:-T)/D,u[0][1])*D,z=Math.max(z,L)}if(o){let L=0;!c&&!f||c&&!f&&_?L=wr(E+B/D,o[1][1])*D:L=Cr(E+(c?T:-T)/D,o[0][1])*D,z=Math.max(z,L)}}if(d){const K=iu(F*D,C,b)/D;if(V=Math.max(V,K),u){let L=0;!c&&!f||f&&!c&&_?L=Cr(y+F*D+Y,u[1][0])/D:L=wr(y+(f?j:-j)*D+Y,u[0][0])/D,V=Math.max(V,L)}if(o){let L=0;!c&&!f||f&&!c&&_?L=wr(y+F*D,o[1][0])/D:L=Cr(y+(f?j:-j)*D,o[0][0])/D,V=Math.max(V,L)}}}j=j+(j<0?V:-V),T=T+(T<0?z:-z),a&&(_?B>F*D?j=(aS(c,f)?-T:T)/D:T=(aS(c,f)?-j:j)*D:p?(j=T/D,f=c):(T=j*D,c=f));const G=c?y+T:y,X=f?E+j:E;return{width:R+(c?-T:T),height:N+(f?-j:j),x:l[0]*T*(c?-1:1)+G,y:l[1]*j*(f?-1:1)+X}}const x2={width:0,height:0,x:0,y:0},sH={...x2,pointerX:0,pointerY:0,aspectRatio:1};function aH(e,t,n){const r=t.position.x+e.position.x,a=t.position.y+e.position.y,l=e.measured.width??0,u=e.measured.height??0,o=n[0]*l,c=n[1]*u;return[[r-o,a-c],[r+l-o,a+u-c]]}function oH({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:a}){const l=An(e);let u={controlDirection:sS("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:f,boundaries:p,keepAspectRatio:d,resizeDirection:_,onResizeStart:v,onResize:w,onResizeEnd:C,shouldResize:b}){let S={...x2},x={...sH};u={boundaries:p,resizeDirection:_,keepAspectRatio:d,controlDirection:sS(f)};let y,E=null,R=[],N,D,T,j=!1;const B=DC().on("start",F=>{const{nodeLookup:Y,transform:H,snapGrid:z,snapToGrid:V,nodeOrigin:G,paneDomNode:X}=n();if(y=Y.get(t),!y)return;E=(X==null?void 0:X.getBoundingClientRect())??null;const{xSnapped:K,ySnapped:L}=Ho(F.sourceEvent,{transform:H,snapGrid:z,snapToGrid:V,containerBounds:E});S={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},x={...S,pointerX:K,pointerY:L,aspectRatio:S.width/S.height},N=void 0,D=os(y.extent)?y.extent:void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(N=Y.get(y.parentId)),N&&y.extent==="parent"&&(D=[[0,0],[N.measured.width,N.measured.height]]),R=[],T=void 0;for(const[M,O]of Y)if(O.parentId===t&&(R.push({id:M,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const $=aH(O,y,O.origin??G);T?T=[[Math.min($[0][0],T[0][0]),Math.min($[0][1],T[0][1])],[Math.max($[1][0],T[1][0]),Math.max($[1][1],T[1][1])]]:T=$}v==null||v(F,{...S})}).on("drag",F=>{const{transform:Y,snapGrid:H,snapToGrid:z,nodeOrigin:V}=n(),G=Ho(F.sourceEvent,{transform:Y,snapGrid:H,snapToGrid:z,containerBounds:E}),X=[];if(!y)return;const{x:K,y:L,width:M,height:O}=S,$={},U=y.origin??V,{width:Q,height:re,x:ae,y:Z}=rH(x,u.controlDirection,G,u.boundaries,u.keepAspectRatio,U,D,T),P=Q!==M,ee=re!==O,ne=ae!==K&&P,ge=Z!==L&ⅇif(!ne&&!ge&&!P&&!ee)return;if((ne||ge||U[0]===1||U[1]===1)&&($.x=ne?ae:S.x,$.y=ge?Z:S.y,S.x=$.x,S.y=$.y,R.length>0)){const ke=ae-K,Ee=Z-L;for(const Ce of R)Ce.position={x:Ce.position.x-ke+U[0]*(Q-M),y:Ce.position.y-Ee+U[1]*(re-O)},X.push(Ce)}if((P||ee)&&($.width=P&&(!u.resizeDirection||u.resizeDirection==="horizontal")?Q:S.width,$.height=ee&&(!u.resizeDirection||u.resizeDirection==="vertical")?re:S.height,S.width=$.width,S.height=$.height),N&&y.expandParent){const ke=U[0]*($.width??0);$.x&&$.x{j&&(C==null||C(F,{...S}),a==null||a({...S}),j=!1)});l.call(B)}function c(){l.on(".drag",null)}return{update:o,destroy:c}}var Sp={exports:{}},xp={},wp={exports:{}},Cp={};/** +Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githubOwner}/${f.githubRepo}) is kept.`)){o(f.id);try{await MN(f.id),r(f.id)}catch(d){window.alert(d instanceof Error?d.message:String(d))}finally{o(null)}}}return m.jsxs("div",{className:"home",children:[m.jsxs("div",{className:"home-inner",children:[m.jsxs("div",{className:"home-brand",children:["Open",m.jsx("span",{children:"Research"})]}),m.jsxs("div",{className:"home-head",children:[m.jsx("h2",{children:"Projects"}),m.jsxs("button",{className:"btn sm",onClick:()=>l(!0),children:[m.jsx(bg,{size:13})," New project"]})]}),m.jsx("div",{className:"home-list",children:e.length===0?m.jsx("div",{className:"changes-note",children:"No projects yet — create one to get started."}):[...e].sort((f,p)=>p.updatedAt-f.updatedAt).map(f=>m.jsxs("div",{className:"project-card",role:"button",tabIndex:0,onClick:()=>t(f.id),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&t(f.id)},children:[m.jsx("span",{className:"name",children:f.name}),m.jsxs("span",{className:"repo mono",children:[f.githubOwner,"/",f.githubRepo," · ",f.baselineBranch]}),f.paperId&&m.jsxs("span",{className:"paper mono",children:["arXiv ",f.paperId]}),m.jsxs("span",{className:"time",children:["created ",Sa(f.createdAt)]}),m.jsx("button",{className:"project-delete",title:`Delete ${f.name}`,disabled:u===f.id,onClick:p=>{p.stopPropagation(),c(f)},children:m.jsx(Gu,{size:14})})]},f.id))})]}),a&&m.jsx("div",{className:"modal-backdrop",onClick:()=>l(!1),children:m.jsxs("div",{className:"modal",onClick:f=>f.stopPropagation(),children:[m.jsx("h2",{children:"New project"}),m.jsx(kB,{onCancel:()=>l(!1),onCreated:f=>{l(!1),n(f)}})]})})]})}function AB(e){const t=tx(e.backend);return t?[t,nx(e.backend)].filter(Boolean).join(" · "):"—"}function NB({runs:e,experiments:t,onOpen:n,onOpenChanges:r,onCancel:a}){const l=new Map(t.map(o=>[o.id,o.slug])),u=[...e].sort((o,c)=>c.createdAt-o.createdAt);return u.length===0?m.jsx("div",{className:"empty-state",children:m.jsx("p",{children:"No runs yet."})}):m.jsx("div",{className:"runs-table-wrap",children:m.jsxs("table",{className:"runs-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Run"}),m.jsx("th",{children:"Experiment"}),m.jsx("th",{children:"Status"}),m.jsx("th",{children:"Backend"}),m.jsx("th",{children:"Commit"}),m.jsx("th",{children:"Started"}),m.jsx("th",{children:"Exit"}),m.jsx("th",{})]})}),m.jsx("tbody",{children:u.map(o=>{const c=o.status==="running"||o.status==="starting";return m.jsxs("tr",{className:"clickable",onClick:()=>n(o),children:[m.jsx("td",{className:"mono",children:Tp(o.id)}),m.jsx("td",{className:"mono",children:l.get(o.experimentId)??Tp(o.experimentId)}),m.jsx("td",{children:m.jsx(Vo,{status:o.status})}),m.jsx("td",{className:"mono",children:AB(o)}),m.jsx("td",{className:"mono",children:o.commitSha?o.commitSha.slice(0,7):"—"}),m.jsx("td",{children:Sa(o.createdAt)}),m.jsx("td",{className:"mono",children:o.exitCode??"—"}),m.jsx("td",{children:m.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[m.jsx("button",{className:"icon-btn",title:"Open changes",onClick:f=>{f.stopPropagation(),r(o.experimentId)},children:m.jsx($u,{size:14})}),c&&m.jsx("button",{className:"btn sm danger",onClick:f=>{f.stopPropagation(),a(o.id)},children:"Cancel"})]})})]},o.id)})})]})})}function Ft(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function mh(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}pu.prototype=mh.prototype={constructor:pu,on:function(e,t){var n=this._,r=RB(e+"",n),a,l=-1,u=r.length;if(arguments.length<2){for(;++l0)for(var n=new Array(a),r=0,a,l;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rb.hasOwnProperty(t)?{space:Rb[t],local:e}:e}function MB(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ig&&t.documentElement.namespaceURI===ig?t.createElement(e):t.createElementNS(n,e)}}function jB(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function pC(e){var t=_h(e);return(t.local?jB:MB)(t)}function LB(){}function Em(e){return e==null?LB:function(){return this.querySelector(e)}}function OB(e){typeof e!="function"&&(e=Em(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a=y&&(y=x+1);!(R=b[y])&&++y=0;)(u=r[a])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function aI(e){e||(e=oI);function t(d,_){return d&&_?e(d.__data__,_.__data__):!d-!_}for(var n=this._groups,r=n.length,a=new Array(r),l=0;lt?1:e>=t?0:NaN}function lI(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function cI(){return Array.from(this)}function uI(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?SI:typeof t=="function"?wI:xI)(e,t,n??"")):pa(this.node(),e)}function pa(e,t){return e.style.getPropertyValue(t)||yC(e).getComputedStyle(e,null).getPropertyValue(t)}function EI(e){return function(){delete this[e]}}function kI(e,t){return function(){this[e]=t}}function AI(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function NI(e,t){return arguments.length>1?this.each((t==null?EI:typeof t=="function"?AI:kI)(e,t)):this.node()[e]}function bC(e){return e.trim().split(/^|\s+/)}function km(e){return e.classList||new SC(e)}function SC(e){this._node=e,this._names=bC(e.getAttribute("class")||"")}SC.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function xC(e,t){for(var n=km(e),r=-1,a=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function n7(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,l;n()=>e;function rg(e,{sourceEvent:t,subject:n,target:r,identifier:a,active:l,x:u,y:o,dx:c,dy:f,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:p}})}rg.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function f7(e){return!e.ctrlKey&&!e.button}function d7(){return this.parentNode}function p7(e,t){return t??{x:e.x,y:e.y}}function g7(){return navigator.maxTouchPoints||"ontouchstart"in this}function NC(){var e=f7,t=d7,n=p7,r=g7,a={},l=mh("start","drag","end"),u=0,o,c,f,p,d=0;function _(E){E.on("mousedown.drag",v).filter(r).on("touchstart.drag",b).on("touchmove.drag",S,h7).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(E,R){if(!(p||!e.call(this,E,R))){var N=y(this,t.call(this,E,R),E,R,"mouse");N&&(An(E.view).on("mousemove.drag",w,Zo).on("mouseup.drag",C,Zo),kC(E.view),pp(E),f=!1,o=E.clientX,c=E.clientY,N("start",E))}}function w(E){if(ua(E),!f){var R=E.clientX-o,N=E.clientY-c;f=R*R+N*N>d}a.mouse("drag",E)}function C(E){An(E.view).on("mousemove.drag mouseup.drag",null),AC(E.view,f),ua(E),a.mouse("end",E)}function b(E,R){if(e.call(this,E,R)){var N=E.changedTouches,D=t.call(this,E,R),T=N.length,j,B;for(j=0;j>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Qc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Qc(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=_7.exec(e))?new mn(t[1],t[2],t[3],1):(t=v7.exec(e))?new mn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=y7.exec(e))?Qc(t[1],t[2],t[3],t[4]):(t=b7.exec(e))?Qc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=S7.exec(e))?Ib(t[1],t[2]/100,t[3]/100,1):(t=x7.exec(e))?Ib(t[1],t[2]/100,t[3]/100,t[4]):Db.hasOwnProperty(e)?Lb(Db[e]):e==="transparent"?new mn(NaN,NaN,NaN,0):null}function Lb(e){return new mn(e>>16&255,e>>8&255,e&255,1)}function Qc(e,t,n,r){return r<=0&&(e=t=n=NaN),new mn(e,t,n,r)}function E7(e){return e instanceof pl||(e=rs(e)),e?(e=e.rgb(),new mn(e.r,e.g,e.b,e.opacity)):new mn}function sg(e,t,n,r){return arguments.length===1?E7(e):new mn(e,t,n,r??1)}function mn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Am(mn,sg,TC(pl,{brighter(e){return e=e==null?Ru:Math.pow(Ru,e),new mn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Qo:Math.pow(Qo,e),new mn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new mn(es(this.r),es(this.g),es(this.b),Du(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ob,formatHex:Ob,formatHex8:k7,formatRgb:Bb,toString:Bb}));function Ob(){return`#${Qr(this.r)}${Qr(this.g)}${Qr(this.b)}`}function k7(){return`#${Qr(this.r)}${Qr(this.g)}${Qr(this.b)}${Qr((isNaN(this.opacity)?1:this.opacity)*255)}`}function Bb(){const e=Du(this.opacity);return`${e===1?"rgb(":"rgba("}${es(this.r)}, ${es(this.g)}, ${es(this.b)}${e===1?")":`, ${e})`}`}function Du(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function es(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Qr(e){return e=es(e),(e<16?"0":"")+e.toString(16)}function Ib(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Kn(e,t,n,r)}function RC(e){if(e instanceof Kn)return new Kn(e.h,e.s,e.l,e.opacity);if(e instanceof pl||(e=rs(e)),!e)return new Kn;if(e instanceof Kn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),l=Math.max(t,n,r),u=NaN,o=l-a,c=(l+a)/2;return o?(t===l?u=(n-r)/o+(n0&&c<1?0:u,new Kn(u,o,c,e.opacity)}function A7(e,t,n,r){return arguments.length===1?RC(e):new Kn(e,t,n,r??1)}function Kn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Am(Kn,A7,TC(pl,{brighter(e){return e=e==null?Ru:Math.pow(Ru,e),new Kn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Qo:Math.pow(Qo,e),new Kn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new mn(gp(e>=240?e-240:e+120,a,r),gp(e,a,r),gp(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new Kn(zb(this.h),Jc(this.s),Jc(this.l),Du(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Du(this.opacity);return`${e===1?"hsl(":"hsla("}${zb(this.h)}, ${Jc(this.s)*100}%, ${Jc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function zb(e){return e=(e||0)%360,e<0?e+360:e}function Jc(e){return Math.max(0,Math.min(1,e||0))}function gp(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Nm=e=>()=>e;function N7(e,t){return function(n){return e+n*t}}function T7(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function R7(e){return(e=+e)==1?DC:function(t,n){return n-t?T7(t,n,e):Nm(isNaN(t)?n:t)}}function DC(e,t){var n=t-e;return n?N7(e,n):Nm(isNaN(e)?t:e)}const Mu=(function e(t){var n=R7(t);function r(a,l){var u=n((a=sg(a)).r,(l=sg(l)).r),o=n(a.g,l.g),c=n(a.b,l.b),f=DC(a.opacity,l.opacity);return function(p){return a.r=u(p),a.g=o(p),a.b=c(p),a.opacity=f(p),a+""}}return r.gamma=e,r})(1);function D7(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(l){for(a=0;an&&(l=t.slice(n,l),o[u]?o[u]+=l:o[++u]=l),(r=r[0])===(a=a[0])?o[u]?o[u]+=a:o[++u]=a:(o[++u]=null,c.push({i:u,x:ci(r,a)})),n=mp.lastIndex;return n180?p+=360:p-f>180&&(f+=360),_.push({i:d.push(a(d)+"rotate(",null,r)-2,x:ci(f,p)})):p&&d.push(a(d)+"rotate("+p+r)}function o(f,p,d,_){f!==p?_.push({i:d.push(a(d)+"skewX(",null,r)-2,x:ci(f,p)}):p&&d.push(a(d)+"skewX("+p+r)}function c(f,p,d,_,v,w){if(f!==d||p!==_){var C=v.push(a(v)+"scale(",null,",",null,")");w.push({i:C-4,x:ci(f,d)},{i:C-2,x:ci(p,_)})}else(d!==1||_!==1)&&v.push(a(v)+"scale("+d+","+_+")")}return function(f,p){var d=[],_=[];return f=e(f),p=e(p),l(f.translateX,f.translateY,p.translateX,p.translateY,d,_),u(f.rotate,p.rotate,d,_),o(f.skewX,p.skewX,d,_),c(f.scaleX,f.scaleY,p.scaleX,p.scaleY,d,_),f=p=null,function(v){for(var w=-1,C=_.length,b;++w=0&&e._call.call(void 0,t),e=e._next;--ga}function Pb(){ss=(Lu=el.now())+vh,ga=Do=0;try{V7()}finally{ga=0,W7(),ss=0}}function Y7(){var e=el.now(),t=e-Lu;t>OC&&(vh-=t,Lu=e)}function W7(){for(var e,t=ju,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ju=n);Mo=e,lg(r)}function lg(e){if(!ga){Do&&(Do=clearTimeout(Do));var t=e-ss;t>24?(e<1/0&&(Do=setTimeout(Pb,e-el.now()-vh)),To&&(To=clearInterval(To))):(To||(Lu=el.now(),To=setInterval(Y7,OC)),ga=1,BC(Pb))}}function Ub(e,t,n){var r=new Ou;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var X7=mh("start","end","cancel","interrupt"),K7=[],zC=0,$b=1,cg=2,mu=3,Gb=4,ug=5,_u=6;function yh(e,t,n,r,a,l){var u=e.__transition;if(!u)e.__transition={};else if(n in u)return;Z7(e,n,{name:t,index:r,group:a,on:X7,tween:K7,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:zC})}function Rm(e,t){var n=ti(e,t);if(n.state>zC)throw new Error("too late; already scheduled");return n}function pi(e,t){var n=ti(e,t);if(n.state>mu)throw new Error("too late; already running");return n}function ti(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Z7(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=IC(l,0,n.time);function l(f){n.state=$b,n.timer.restart(u,n.delay,n.time),n.delay<=f&&u(f-n.delay)}function u(f){var p,d,_,v;if(n.state!==$b)return c();for(p in r)if(v=r[p],v.name===n.name){if(v.state===mu)return Ub(u);v.state===Gb?(v.state=_u,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete r[p]):+pcg&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function A9(e,t,n){var r,a,l=k9(t)?Rm:pi;return function(){var u=l(this,e),o=u.on;o!==r&&(a=(r=o).copy()).on(t,n),u.on=a}}function N9(e,t){var n=this._id;return arguments.length<2?ti(this.node(),n).on.on(e):this.each(A9(n,e,t))}function T9(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function R9(){return this.on("end.remove",T9(this._id))}function D9(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Em(e));for(var r=this._groups,a=r.length,l=new Array(a),u=0;u()=>e;function nz(e,{sourceEvent:t,target:n,transform:r,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:a}})}function Fi(e,t,n){this.k=e,this.x=t,this.y=n}Fi.prototype={constructor:Fi,scale:function(e){return e===1?this:new Fi(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Fi(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var bh=new Fi(1,0,0);UC.prototype=Fi.prototype;function UC(e){for(;!e.__zoom;)if(!(e=e.parentNode))return bh;return e.__zoom}function _p(e){e.stopImmediatePropagation()}function Ro(e){e.preventDefault(),e.stopImmediatePropagation()}function iz(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function rz(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function qb(){return this.__zoom||bh}function sz(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function az(){return navigator.maxTouchPoints||"ontouchstart"in this}function oz(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],u=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function $C(){var e=iz,t=rz,n=oz,r=sz,a=az,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],o=250,c=gu,f=mh("start","zoom","end"),p,d,_,v=500,w=150,C=0,b=10;function S(H){H.property("__zoom",qb).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",j).on("dblclick.zoom",B).filter(a).on("touchstart.zoom",z).on("touchmove.zoom",G).on("touchend.zoom touchcancel.zoom",U).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(H,Y,q,X){var K=H.selection?H.selection():H;K.property("__zoom",qb),H!==K?R(H,Y,q,X):K.interrupt().each(function(){N(this,arguments).event(X).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},S.scaleBy=function(H,Y,q,X){S.scaleTo(H,function(){var K=this.__zoom.k,L=typeof Y=="function"?Y.apply(this,arguments):Y;return K*L},q,X)},S.scaleTo=function(H,Y,q,X){S.transform(H,function(){var K=t.apply(this,arguments),L=this.__zoom,M=q==null?E(K):typeof q=="function"?q.apply(this,arguments):q,O=L.invert(M),$=typeof Y=="function"?Y.apply(this,arguments):Y;return n(y(x(L,$),M,O),K,u)},q,X)},S.translateBy=function(H,Y,q,X){S.transform(H,function(){return n(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof q=="function"?q.apply(this,arguments):q),t.apply(this,arguments),u)},null,X)},S.translateTo=function(H,Y,q,X,K){S.transform(H,function(){var L=t.apply(this,arguments),M=this.__zoom,O=X==null?E(L):typeof X=="function"?X.apply(this,arguments):X;return n(bh.translate(O[0],O[1]).scale(M.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof q=="function"?-q.apply(this,arguments):-q),L,u)},X,K)};function x(H,Y){return Y=Math.max(l[0],Math.min(l[1],Y)),Y===H.k?H:new Fi(Y,H.x,H.y)}function y(H,Y,q){var X=Y[0]-q[0]*H.k,K=Y[1]-q[1]*H.k;return X===H.x&&K===H.y?H:new Fi(H.k,X,K)}function E(H){return[(+H[0][0]+ +H[1][0])/2,(+H[0][1]+ +H[1][1])/2]}function R(H,Y,q,X){H.on("start.zoom",function(){N(this,arguments).event(X).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(X).end()}).tween("zoom",function(){var K=this,L=arguments,M=N(K,L).event(X),O=t.apply(K,L),$=q==null?E(O):typeof q=="function"?q.apply(K,L):q,F=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),Q=K.__zoom,re=typeof Y=="function"?Y.apply(K,L):Y,ae=c(Q.invert($).concat(F/Q.k),re.invert($).concat(F/re.k));return function(Z){if(Z===1)Z=re;else{var P=ae(Z),ee=F/P[2];Z=new Fi(ee,$[0]-P[0]*ee,$[1]-P[1]*ee)}M.zoom(null,Z)}})}function N(H,Y,q){return!q&&H.__zooming||new D(H,Y)}function D(H,Y){this.that=H,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(H,Y),this.taps=0}D.prototype={event:function(H){return H&&(this.sourceEvent=H),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(H,Y){return this.mouse&&H!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&H!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&H!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(H){var Y=An(this.that).datum();f.call(H,this.that,new nz(H,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:f}),Y)}};function T(H,...Y){if(!e.apply(this,arguments))return;var q=N(this,Y).event(H),X=this.__zoom,K=Math.max(l[0],Math.min(l[1],X.k*Math.pow(2,r.apply(this,arguments)))),L=Xn(H);if(q.wheel)(q.mouse[0][0]!==L[0]||q.mouse[0][1]!==L[1])&&(q.mouse[1]=X.invert(q.mouse[0]=L)),clearTimeout(q.wheel);else{if(X.k===K)return;q.mouse=[L,X.invert(L)],vu(this),q.start()}Ro(H),q.wheel=setTimeout(M,w),q.zoom("mouse",n(y(x(X,K),q.mouse[0],q.mouse[1]),q.extent,u));function M(){q.wheel=null,q.end()}}function j(H,...Y){if(_||!e.apply(this,arguments))return;var q=H.currentTarget,X=N(this,Y,!0).event(H),K=An(H.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",F,!0),L=Xn(H,q),M=H.clientX,O=H.clientY;kC(H.view),_p(H),X.mouse=[L,this.__zoom.invert(L)],vu(this),X.start();function $(Q){if(Ro(Q),!X.moved){var re=Q.clientX-M,ae=Q.clientY-O;X.moved=re*re+ae*ae>C}X.event(Q).zoom("mouse",n(y(X.that.__zoom,X.mouse[0]=Xn(Q,q),X.mouse[1]),X.extent,u))}function F(Q){K.on("mousemove.zoom mouseup.zoom",null),AC(Q.view,X.moved),Ro(Q),X.event(Q).end()}}function B(H,...Y){if(e.apply(this,arguments)){var q=this.__zoom,X=Xn(H.changedTouches?H.changedTouches[0]:H,this),K=q.invert(X),L=q.k*(H.shiftKey?.5:2),M=n(y(x(q,L),X,K),t.apply(this,Y),u);Ro(H),o>0?An(this).transition().duration(o).call(R,M,X,H):An(this).call(S.transform,M,X,H)}}function z(H,...Y){if(e.apply(this,arguments)){var q=H.touches,X=q.length,K=N(this,Y,H.changedTouches.length===X).event(H),L,M,O,$;for(_p(H),M=0;M`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},tl=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],GC=["Enter"," ","Escape"],qC={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var ma;(function(e){e.Strict="strict",e.Loose="loose"})(ma||(ma={}));var ts;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ts||(ts={}));var nl;(function(e){e.Partial="partial",e.Full="full"})(nl||(nl={}));const VC={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Er;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Er||(Er={}));var Bu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Bu||(Bu={}));var Me;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Me||(Me={}));const Vb={[Me.Left]:Me.Right,[Me.Right]:Me.Left,[Me.Top]:Me.Bottom,[Me.Bottom]:Me.Top};function YC(e){return e===null?null:e?"valid":"invalid"}const WC=e=>"id"in e&&"source"in e&&"target"in e,lz=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Mm=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),gl=(e,t=[0,0])=>{const{width:n,height:r}=Vi(e),a=e.origin??t,l=n*a[0],u=r*a[1];return{x:e.position.x-l,y:e.position.y-u}},cz=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,a)=>{const l=typeof a=="string";let u=!t.nodeLookup&&!l?a:void 0;t.nodeLookup&&(u=l?t.nodeLookup.get(a):Mm(a)?a:t.nodeLookup.get(a.id));const o=u?Iu(u,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Sh(r,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return xh(n)},ml=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(a=>{(t.filter===void 0||t.filter(a))&&(n=Sh(n,Iu(a)),r=!0)}),r?xh(n):{x:0,y:0,width:0,height:0}},jm=(e,t,[n,r,a]=[0,0,1],l=!1,u=!1)=>{const o=(t.x-n)/a,c=(t.y-r)/a,f=t.width/a,p=t.height/a,d=[];for(const _ of e.values()){const{measured:v,selectable:w=!0,hidden:C=!1}=_;if(u&&!w||C)continue;const b=v.width??_.width??_.initialWidth??0,S=v.height??_.height??_.initialHeight??0,{x,y}=_.internals.positionAbsolute,E=QC(o,c,f,p,x,y,b,S),R=b*S,N=l&&E>0;(!_.internals.handleBounds||N||E>=R||_.dragging)&&d.push(_)}return d},uz=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function hz(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(a=>a.id)):null;return e.forEach(a=>{a.measured.width&&a.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!a.hidden)&&(!r||r.has(a.id))&&n.set(a.id,a)}),n}async function fz({nodes:e,width:t,height:n,panZoom:r,minZoom:a,maxZoom:l},u){if(e.size===0)return!0;const o=hz(e,u),c=ml(o),f=Om(c,t,n,(u==null?void 0:u.minZoom)??a,(u==null?void 0:u.maxZoom)??l,(u==null?void 0:u.padding)??.1);return await r.setViewport(f,{duration:u==null?void 0:u.duration,ease:u==null?void 0:u.ease,interpolate:u==null?void 0:u.interpolate}),!0}function XC({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:a,onError:l}){const u=n.get(e),o=u.parentId?n.get(u.parentId):void 0,{x:c,y:f}=o?o.internals.positionAbsolute:{x:0,y:0},p=u.origin??r;let d=u.extent||a;if(u.extent==="parent"&&!u.expandParent)if(!o)l==null||l("005",ei.error005());else{const v=o.measured.width,w=o.measured.height;v&&w&&(d=[[c,f],[c+v,f+w]])}else o&&os(u.extent)&&(d=[[u.extent[0][0]+c,u.extent[0][1]+f],[u.extent[1][0]+c,u.extent[1][1]+f]]);const _=os(d)?as(t,d,u.measured):t;return(u.measured.width===void 0||u.measured.height===void 0)&&(l==null||l("015",ei.error015())),{position:{x:_.x-c+(u.measured.width??0)*p[0],y:_.y-f+(u.measured.height??0)*p[1]},positionAbsolute:_}}async function dz({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:a}){const l=new Set(e.map(_=>_.id)),u=[];for(const _ of n){if(_.deletable===!1)continue;const v=l.has(_.id),w=!v&&_.parentId&&u.find(C=>C.id===_.parentId);(v||w)&&u.push(_)}const o=new Set(t.map(_=>_.id)),c=r.filter(_=>_.deletable!==!1),p=uz(u,c);for(const _ of c)o.has(_.id)&&!p.find(w=>w.id===_.id)&&p.push(_);if(!a)return{edges:p,nodes:u};const d=await a({nodes:u,edges:p});return typeof d=="boolean"?d?{edges:p,nodes:u}:{edges:[],nodes:[]}:d}const _a=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),as=(e={x:0,y:0},t,n)=>({x:_a(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:_a(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function KC(e,t,n){const{width:r,height:a}=Vi(n),{x:l,y:u}=n.internals.positionAbsolute;return as(e,[[l,u],[l+r,u+a]],t)}const Yb=(e,t,n)=>en?-_a(Math.abs(e-n),1,t)/t:0,Lm=(e,t,n=15,r=40)=>{const a=Yb(e.x,r,t.width-r)*n,l=Yb(e.y,r,t.height-r)*n;return[a,l]},Sh=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),hg=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),xh=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),il=(e,t=[0,0])=>{var a,l;const{x:n,y:r}=Mm(e)?e.internals.positionAbsolute:gl(e,t);return{x:n,y:r,width:((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0,height:((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0}},Iu=(e,t=[0,0])=>{var a,l;const{x:n,y:r}=Mm(e)?e.internals.positionAbsolute:gl(e,t);return{x:n,y:r,x2:n+(((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0),y2:r+(((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0)}},ZC=(e,t)=>xh(Sh(hg(e),hg(t))),QC=(e,t,n,r,a,l,u,o)=>{const c=Math.max(0,Math.min(e+n,a+u)-Math.max(e,a)),f=Math.max(0,Math.min(t+r,l+o)-Math.max(t,l));return Math.ceil(c*f)},zu=(e,t)=>QC(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Wb=e=>Zn(e.width)&&Zn(e.height)&&Zn(e.x)&&Zn(e.y),Zn=e=>!isNaN(e)&&isFinite(e),JC=(e,t)=>(n,r)=>{},_l=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),vl=({x:e,y:t},[n,r,a],l=!1,u=[1,1])=>{const o={x:(e-n)/a,y:(t-r)/a};return l?_l(o,u):o},va=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r});function ta(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function pz(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=ta(e,n),a=ta(e,t);return{top:r,right:a,bottom:r,left:a,x:a*2,y:r*2}}if(typeof e=="object"){const r=ta(e.top??e.y??0,n),a=ta(e.bottom??e.y??0,n),l=ta(e.left??e.x??0,t),u=ta(e.right??e.x??0,t);return{top:r,right:u,bottom:a,left:l,x:l+u,y:r+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function gz(e,t,n,r,a,l){const{x:u,y:o}=va(e,[t,n,r]),{x:c,y:f}=va({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=a-c,d=l-f;return{left:Math.floor(u),top:Math.floor(o),right:Math.floor(p),bottom:Math.floor(d)}}const Om=(e,t,n,r,a,l)=>{const u=pz(l,t,n),o=(t-u.x)/e.width,c=(n-u.y)/e.height,f=Math.min(o,c),p=_a(f,r,a),d=e.x+e.width/2,_=e.y+e.height/2,v=t/2-d*p,w=n/2-_*p,C=gz(e,v,w,p,t,n),b={left:Math.min(C.left-u.left,0),top:Math.min(C.top-u.top,0),right:Math.min(C.right-u.right,0),bottom:Math.min(C.bottom-u.bottom,0)};return{x:v-b.left+b.right,y:w-b.top+b.bottom,zoom:p}},rl=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function os(e){return e!=null&&e!=="parent"}function Vi(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function e2(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function t2(e,t={width:0,height:0},n,r,a){const l={...e},u=r.get(n);if(u){const o=u.origin||a;l.x+=u.internals.positionAbsolute.x-(t.width??0)*o[0],l.y+=u.internals.positionAbsolute.y-(t.height??0)*o[1]}return l}function Xb(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function mz(){let e,t;return{promise:new Promise((r,a)=>{e=r,t=a}),resolve:e,reject:t}}function _z(e){return{...qC,...e||{}}}function Ho(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:a}){const{x:l,y:u}=Qn(e),o=vl({x:l-((a==null?void 0:a.left)??0),y:u-((a==null?void 0:a.top)??0)},r),{x:c,y:f}=n?_l(o,t):o;return{xSnapped:c,ySnapped:f,...o}}const Bm=e=>({width:e.offsetWidth,height:e.offsetHeight}),n2=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},vz=["INPUT","SELECT","TEXTAREA"];function i2(e){var r,a;const t=((a=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:a[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:vz.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const r2=e=>"clientX"in e,Qn=(e,t)=>{var l,u;const n=r2(e),r=n?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,a=n?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},Kb=(e,t,n,r,a)=>{const l=t.querySelectorAll(`.${e}`);return!l||!l.length?null:Array.from(l).map(u=>{const o=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:a,position:u.getAttribute("data-handlepos"),x:(o.left-n.left)/r,y:(o.top-n.top)/r,...Bm(u)}})};function s2({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:o}){const c=e*.125+a*.375+u*.375+n*.125,f=t*.125+l*.375+o*.375+r*.125,p=Math.abs(c-e),d=Math.abs(f-t);return[c,f,p,d]}function nu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Zb({pos:e,x1:t,y1:n,x2:r,y2:a,c:l}){switch(e){case Me.Left:return[t-nu(t-r,l),n];case Me.Right:return[t+nu(r-t,l),n];case Me.Top:return[t,n-nu(n-a,l)];case Me.Bottom:return[t,n+nu(a-n,l)]}}function a2({sourceX:e,sourceY:t,sourcePosition:n=Me.Bottom,targetX:r,targetY:a,targetPosition:l=Me.Top,curvature:u=.25}){const[o,c]=Zb({pos:n,x1:e,y1:t,x2:r,y2:a,c:u}),[f,p]=Zb({pos:l,x1:r,y1:a,x2:e,y2:t,c:u}),[d,_,v,w]=s2({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:o,sourceControlY:c,targetControlX:f,targetControlY:p});return[`M${e},${t} C${o},${c} ${f},${p} ${r},${a}`,d,_,v,w]}function o2({sourceX:e,sourceY:t,targetX:n,targetY:r}){const a=Math.abs(n-e)/2,l=n0}const Sz=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,xz=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),wz=(e,t,n={})=>{var l;if(!e.source||!e.target)return(l=n.onError)==null||l.call(n,"006",ei.error006()),t;const r=n.getEdgeId||Sz;let a;return WC(e)?a={...e}:a={...e,id:r(e)},xz(a,t)?t:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,t.concat(a))};function l2({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[a,l,u,o]=o2({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,l,u,o]}const Qb={[Me.Left]:{x:-1,y:0},[Me.Right]:{x:1,y:0},[Me.Top]:{x:0,y:-1},[Me.Bottom]:{x:0,y:1}},Cz=({source:e,sourcePosition:t=Me.Bottom,target:n})=>t===Me.Left||t===Me.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Ez({source:e,sourcePosition:t=Me.Bottom,target:n,targetPosition:r=Me.Top,center:a,offset:l,stepPosition:u}){const o=Qb[t],c=Qb[r],f={x:e.x+o.x*l,y:e.y+o.y*l},p={x:n.x+c.x*l,y:n.y+c.y*l},d=Cz({source:f,sourcePosition:t,target:p}),_=d.x!==0?"x":"y",v=d[_];let w=[],C,b;const S={x:0,y:0},x={x:0,y:0},[,,y,E]=o2({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[_]*c[_]===-1){_==="x"?(C=a.x??f.x+(p.x-f.x)*u,b=a.y??(f.y+p.y)/2):(C=a.x??(f.x+p.x)/2,b=a.y??f.y+(p.y-f.y)*u);const T=[{x:C,y:f.y},{x:C,y:p.y}],j=[{x:f.x,y:b},{x:p.x,y:b}];o[_]===v?w=_==="x"?T:j:w=_==="x"?j:T}else{const T=[{x:f.x,y:p.y}],j=[{x:p.x,y:f.y}];if(_==="x"?w=o.x===v?j:T:w=o.y===v?T:j,t===r){const H=Math.abs(e[_]-n[_]);if(H<=l){const Y=Math.min(l-1,l-H);o[_]===v?S[_]=(f[_]>e[_]?-1:1)*Y:x[_]=(p[_]>n[_]?-1:1)*Y}}if(t!==r){const H=_==="x"?"y":"x",Y=o[_]===c[H],q=f[H]>p[H],X=f[H]=U?(C=(B.x+z.x)/2,b=w[0].y):(C=w[0].x,b=(B.y+z.y)/2)}const R={x:f.x+S.x,y:f.y+S.y},N={x:p.x+x.x,y:p.y+x.y};return[[e,...R.x!==w[0].x||R.y!==w[0].y?[R]:[],...w,...N.x!==w[w.length-1].x||N.y!==w[w.length-1].y?[N]:[],n],C,b,y,E]}function kz(e,t,n,r){const a=Math.min(Jb(e,t)/2,Jb(t,n)/2,r),{x:l,y:u}=t;if(e.x===l&&l===n.x||e.y===u&&u===n.y)return`L${l} ${u}`;if(e.y===u){const f=e.xn.id===t):e[0])||null}function dg(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Nz(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:a}){const l=new Set;return e.reduce((u,o)=>([o.markerStart||r,o.markerEnd||a].forEach(c=>{if(c&&typeof c=="object"){const f=dg(c,t);l.has(f)||(u.push({id:f,color:c.color||n,...c}),l.add(f))}}),u),[]).sort((u,o)=>u.id.localeCompare(o.id))}const c2=1e3,Tz=10,Im={nodeOrigin:[0,0],nodeExtent:tl,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Rz={...Im,checkEquality:!0};function zm(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Dz(e,t,n){const r=zm(Im,n);for(const a of e.values())if(a.parentId)Fm(a,e,t,r);else{const l=gl(a,r.nodeOrigin),u=os(a.extent)?a.extent:r.nodeExtent,o=as(l,u,Vi(a));a.internals.positionAbsolute=o}}function Mz(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const a of e.handles){const l={id:a.id,width:a.width??1,height:a.height??1,nodeId:e.id,x:a.x,y:a.y,position:a.position,type:a.type};a.type==="source"?n.push(l):a.type==="target"&&r.push(l)}return{source:n,target:r}}function Hm(e){return e==="manual"}function pg(e,t,n,r={}){var p,d;const a=zm(Rz,r),l={i:0},u=new Map(t),o=a!=null&&a.elevateNodesOnSelect&&!Hm(a.zIndexMode)?c2:0;let c=e.length>0,f=!1;t.clear(),n.clear();for(const _ of e){let v=u.get(_.id);if(a.checkEquality&&_===(v==null?void 0:v.internals.userNode))t.set(_.id,v);else{const w=gl(_,a.nodeOrigin),C=os(_.extent)?_.extent:a.nodeExtent,b=as(w,C,Vi(_));v={...a.defaults,..._,measured:{width:(p=_.measured)==null?void 0:p.width,height:(d=_.measured)==null?void 0:d.height},internals:{positionAbsolute:b,handleBounds:Mz(_,v),z:u2(_,o,a.zIndexMode),userNode:_}},t.set(_.id,v)}(v.measured===void 0||v.measured.width===void 0||v.measured.height===void 0)&&!v.hidden&&(c=!1),_.parentId&&Fm(v,t,n,r,l),f||(f=_.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:f}}function jz(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Fm(e,t,n,r,a){const{elevateNodesOnSelect:l,nodeOrigin:u,nodeExtent:o,zIndexMode:c}=zm(Im,r),f=e.parentId,p=t.get(f);if(!p){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}jz(e,n),a&&!p.parentId&&p.internals.rootParentIndex===void 0&&c==="auto"&&(p.internals.rootParentIndex=++a.i,p.internals.z=p.internals.z+a.i*Tz),a&&p.internals.rootParentIndex!==void 0&&(a.i=p.internals.rootParentIndex);const d=l&&!Hm(c)?c2:0,{x:_,y:v,z:w}=Lz(e,p,u,o,d,c),{positionAbsolute:C}=e.internals,b=_!==C.x||v!==C.y;(b||w!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:_,y:v}:C,z:w}})}function u2(e,t,n){const r=Zn(e.zIndex)?e.zIndex:0;return Hm(n)?r:r+(e.selected?t:0)}function Lz(e,t,n,r,a,l){const{x:u,y:o}=t.internals.positionAbsolute,c=Vi(e),f=gl(e,n),p=os(e.extent)?as(f,e.extent,c):f;let d=as({x:u+p.x,y:o+p.y},r,c);e.extent==="parent"&&(d=KC(d,c,t));const _=u2(e,a,l),v=t.internals.z??0;return{x:d.x,y:d.y,z:v>=_?v+1:_}}function Pm(e,t,n,r=[0,0]){var u;const a=[],l=new Map;for(const o of e){const c=t.get(o.parentId);if(!c)continue;const f=((u=l.get(o.parentId))==null?void 0:u.expandedRect)??il(c),p=ZC(f,o.rect);l.set(o.parentId,{expandedRect:p,parent:c})}return l.size>0&&l.forEach(({expandedRect:o,parent:c},f)=>{var y;const p=c.internals.positionAbsolute,d=Vi(c),_=c.origin??r,v=o.x0||w>0||S||x)&&(a.push({id:f,type:"position",position:{x:c.position.x-v+S,y:c.position.y-w+x}}),(y=n.get(f))==null||y.forEach(E=>{e.some(R=>R.id===E.id)||a.push({id:E.id,type:"position",position:{x:E.position.x+v,y:E.position.y+w}})})),(d.width0){const v=Pm(_,t,n,a);f.push(...v)}return{changes:f,updatedInternals:c}}async function Bz({delta:e,panZoom:t,transform:n,translateExtent:r,width:a,height:l}){if(!t||!e.x&&!e.y)return!1;const u=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[a,l]],r);return!!u&&(u.x!==n[0]||u.y!==n[1]||u.k!==n[2])}function iS(e,t,n,r,a,l){let u=a;const o=r.get(u)||new Map;r.set(u,o.set(n,t)),u=`${a}-${e}`;const c=r.get(u)||new Map;if(r.set(u,c.set(n,t)),l){u=`${a}-${e}-${l}`;const f=r.get(u)||new Map;r.set(u,f.set(n,t))}}function h2(e,t,n){e.clear(),t.clear();for(const r of n){const{source:a,target:l,sourceHandle:u=null,targetHandle:o=null}=r,c={edgeId:r.id,source:a,target:l,sourceHandle:u,targetHandle:o},f=`${a}-${u}--${l}-${o}`,p=`${l}-${o}--${a}-${u}`;iS("source",c,p,e,a,u),iS("target",c,f,e,l,o),t.set(r.id,r)}}function f2(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:f2(n,t):!1}function rS(e,t,n){var a;let r=e;do{if((a=r==null?void 0:r.matches)!=null&&a.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Iz(e,t,n,r){const a=new Map;for(const[l,u]of e)if((u.selected||u.id===r)&&(!u.parentId||!f2(u,e))&&(u.draggable||t&&typeof u.draggable>"u")){const o=e.get(l);o&&a.set(l,{id:l,position:o.position||{x:0,y:0},distance:{x:n.x-o.internals.positionAbsolute.x,y:n.y-o.internals.positionAbsolute.y},extent:o.extent,parentId:o.parentId,origin:o.origin,expandParent:o.expandParent,internals:{positionAbsolute:o.internals.positionAbsolute||{x:0,y:0}},measured:{width:o.measured.width??0,height:o.measured.height??0}})}return a}function vp({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var u,o,c;const a=[];for(const[f,p]of t){const d=(u=n.get(f))==null?void 0:u.internals.userNode;d&&a.push({...d,position:p.position,dragging:r})}if(!e)return[a[0],a];const l=(o=n.get(e))==null?void 0:o.internals.userNode;return[l?{...l,position:((c=t.get(e))==null?void 0:c.position)||l.position,dragging:r}:a[0],a]}function zz({dragItems:e,snapGrid:t,x:n,y:r}){const a=e.values().next().value;if(!a)return null;const l={x:n-a.distance.x,y:r-a.distance.y},u=_l(l,t);return{x:u.x-l.x,y:u.y-l.y}}function Hz({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:a}){let l={x:null,y:null},u=0,o=new Map,c=!1,f={x:0,y:0},p=null,d=!1,_=null,v=!1,w=!1,C=null;function b({noDragClassName:x,handleSelector:y,domNode:E,isSelectable:R,nodeId:N,nodeClickDistance:D=0}){_=An(E);function T({x:G,y:U}){const{nodeLookup:H,nodeExtent:Y,snapGrid:q,snapToGrid:X,nodeOrigin:K,onNodeDrag:L,onSelectionDrag:M,onError:O,updateNodePositions:$}=t();l={x:G,y:U};let F=!1;const Q=o.size>1,re=Q&&Y?hg(ml(o)):null,ae=Q&&X?zz({dragItems:o,snapGrid:q,x:G,y:U}):null;for(const[Z,P]of o){if(!H.has(Z))continue;let ee={x:G-P.distance.x,y:U-P.distance.y};X&&(ee=ae?{x:Math.round(ee.x+ae.x),y:Math.round(ee.y+ae.y)}:_l(ee,q));let ne=null;if(Q&&Y&&!P.extent&&re){const{positionAbsolute:ye}=P.internals,be=ye.x-re.x+Y[0][0],ke=ye.x+P.measured.width-re.x2+Y[1][0],Ee=ye.y-re.y+Y[0][1],Ce=ye.y+P.measured.height-re.y2+Y[1][1];ne=[[be,Ee],[ke,Ce]]}const{position:ge,positionAbsolute:he}=XC({nodeId:Z,nextPosition:ee,nodeLookup:H,nodeExtent:ne||Y,nodeOrigin:K,onError:O});F=F||P.position.x!==ge.x||P.position.y!==ge.y,P.position=ge,P.internals.positionAbsolute=he}if(w=w||F,!!F&&($(o,!0),C&&(r||L||!N&&M))){const[Z,P]=vp({nodeId:N,dragItems:o,nodeLookup:H});r==null||r(C,o,Z,P),L==null||L(C,Z,P),N||M==null||M(C,P)}}async function j(){if(!p)return;const{transform:G,panBy:U,autoPanSpeed:H,autoPanOnNodeDrag:Y}=t();if(!Y){c=!1,cancelAnimationFrame(u);return}const[q,X]=Lm(f,p,H);(q!==0||X!==0)&&(l.x=(l.x??0)-q/G[2],l.y=(l.y??0)-X/G[2],await U({x:q,y:X})&&T(l)),u=requestAnimationFrame(j)}function B(G){var Q;const{nodeLookup:U,multiSelectionActive:H,nodesDraggable:Y,transform:q,snapGrid:X,snapToGrid:K,selectNodesOnDrag:L,onNodeDragStart:M,onSelectionDragStart:O,unselectNodesAndEdges:$}=t();d=!0,(!L||!R)&&!H&&N&&((Q=U.get(N))!=null&&Q.selected||$()),R&&L&&N&&(e==null||e(N));const F=Ho(G.sourceEvent,{transform:q,snapGrid:X,snapToGrid:K,containerBounds:p});if(l=F,o=Iz(U,Y,F,N),o.size>0&&(n||M||!N&&O)){const[re,ae]=vp({nodeId:N,dragItems:o,nodeLookup:U});n==null||n(G.sourceEvent,o,re,ae),M==null||M(G.sourceEvent,re,ae),N||O==null||O(G.sourceEvent,ae)}}const z=NC().clickDistance(D).on("start",G=>{const{domNode:U,nodeDragThreshold:H,transform:Y,snapGrid:q,snapToGrid:X}=t();p=(U==null?void 0:U.getBoundingClientRect())||null,v=!1,w=!1,C=G.sourceEvent,H===0&&B(G),l=Ho(G.sourceEvent,{transform:Y,snapGrid:q,snapToGrid:X,containerBounds:p}),f=Qn(G.sourceEvent,p)}).on("drag",G=>{const{autoPanOnNodeDrag:U,transform:H,snapGrid:Y,snapToGrid:q,nodeDragThreshold:X,nodeLookup:K}=t(),L=Ho(G.sourceEvent,{transform:H,snapGrid:Y,snapToGrid:q,containerBounds:p});if(C=G.sourceEvent,(G.sourceEvent.type==="touchmove"&&G.sourceEvent.touches.length>1||N&&!K.has(N))&&(v=!0),!v){if(!c&&U&&d&&(c=!0,j()),!d){const M=Qn(G.sourceEvent,p),O=M.x-f.x,$=M.y-f.y;Math.sqrt(O*O+$*$)>X&&B(G)}(l.x!==L.xSnapped||l.y!==L.ySnapped)&&o&&d&&(f=Qn(G.sourceEvent,p),T(L))}}).on("end",G=>{if(!d||v){v&&o.size>0&&t().updateNodePositions(o,!1);return}if(c=!1,d=!1,cancelAnimationFrame(u),o.size>0){const{nodeLookup:U,updateNodePositions:H,onNodeDragStop:Y,onSelectionDragStop:q}=t();if(w&&(H(o,!1),w=!1),a||Y||!N&&q){const[X,K]=vp({nodeId:N,dragItems:o,nodeLookup:U,dragging:!1});a==null||a(G.sourceEvent,o,X,K),Y==null||Y(G.sourceEvent,X,K),N||q==null||q(G.sourceEvent,K)}}}).filter(G=>{const U=G.target;return!G.button&&(!x||!rS(U,`.${x}`,E))&&(!y||rS(U,y,E))});_.call(z)}function S(){_==null||_.on(".drag",null)}return{update:b,destroy:S}}function Fz(e,t,n){const r=[],a={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const l of t.values())zu(a,il(l))>0&&r.push(l);return r}const Pz=250;function Uz(e,t,n,r){var o,c;let a=[],l=1/0;const u=Fz(e,n,t+Pz);for(const f of u){const p=[...((o=f.internals.handleBounds)==null?void 0:o.source)??[],...((c=f.internals.handleBounds)==null?void 0:c.target)??[]];for(const d of p){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:_,y:v}=ls(f,d,d.position,!0),w=Math.sqrt(Math.pow(_-e.x,2)+Math.pow(v-e.y,2));w>t||(w1){const f=r.type==="source"?"target":"source";return a.find(p=>p.type===f)??a[0]}return a[0]}function d2(e,t,n,r,a,l=!1){var f,p,d;const u=r.get(e);if(!u)return null;const o=a==="strict"?(f=u.internals.handleBounds)==null?void 0:f[t]:[...((p=u.internals.handleBounds)==null?void 0:p.source)??[],...((d=u.internals.handleBounds)==null?void 0:d.target)??[]],c=(n?o==null?void 0:o.find(_=>_.id===n):o==null?void 0:o[0])??null;return c&&l?{...c,...ls(u,c,c.position,!0)}:c}function p2(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function $z(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const g2=()=>!0;function Gz(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:a,edgeUpdaterType:l,isTarget:u,domNode:o,nodeLookup:c,lib:f,autoPanOnConnect:p,flowId:d,panBy:_,cancelConnection:v,onConnectStart:w,onConnect:C,onConnectEnd:b,isValidConnection:S=g2,onReconnectEnd:x,updateConnection:y,getTransform:E,getFromHandle:R,autoPanSpeed:N,dragThreshold:D=1,handleDomNode:T}){const j=n2(e.target);let B=0,z;const{x:G,y:U}=Qn(e),H=p2(l,T),Y=o==null?void 0:o.getBoundingClientRect();let q=!1;if(!Y||!H)return;const X=d2(a,H,r,c,t);if(!X)return;let K=Qn(e,Y),L=!1,M=null,O=!1,$=null;function F(){if(!p||!Y)return;const[ge,he]=Lm(K,Y,N);_({x:ge,y:he}),B=requestAnimationFrame(F)}const Q={...X,nodeId:a,type:H,position:X.position},re=c.get(a);let Z={inProgress:!0,isValid:null,from:ls(re,Q,Me.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:re,to:K,toHandle:null,toPosition:Vb[Q.position],toNode:null,pointer:K};function P(){q=!0,y(Z),w==null||w(e,{nodeId:a,handleId:r,handleType:H})}D===0&&P();function ee(ge){if(!q){const{x:Ce,y:rt}=Qn(ge),bt=Ce-G,Ge=rt-U;if(!(bt*bt+Ge*Ge>D*D))return;P()}if(!R()||!Q){ne(ge);return}const he=E();K=Qn(ge,Y),z=Uz(vl(K,he,!1,[1,1]),n,c,Q),L||(F(),L=!0);const ye=m2(ge,{handle:z,connectionMode:t,fromNodeId:a,fromHandleId:r,fromType:u?"target":"source",isValidConnection:S,doc:j,lib:f,flowId:d,nodeLookup:c});$=ye.handleDomNode,M=ye.connection,O=$z(!!z,ye.isValid);const be=c.get(a),ke=be?ls(be,Q,Me.Left,!0):Z.from,Ee={...Z,from:ke,isValid:O,to:ye.toHandle&&O?va({x:ye.toHandle.x,y:ye.toHandle.y},he):K,toHandle:ye.toHandle,toPosition:O&&ye.toHandle?ye.toHandle.position:Vb[Q.position],toNode:ye.toHandle?c.get(ye.toHandle.nodeId):null,pointer:K};y(Ee),Z=Ee}function ne(ge){if(!("touches"in ge&&ge.touches.length>0)){if(q){(z||$)&&M&&O&&(C==null||C(M));const{inProgress:he,...ye}=Z,be={...ye,toPosition:Z.toHandle?Z.toPosition:null};b==null||b(ge,be),l&&(x==null||x(ge,be))}v(),cancelAnimationFrame(B),L=!1,O=!1,M=null,$=null,j.removeEventListener("mousemove",ee),j.removeEventListener("mouseup",ne),j.removeEventListener("touchmove",ee),j.removeEventListener("touchend",ne)}}j.addEventListener("mousemove",ee),j.addEventListener("mouseup",ne),j.addEventListener("touchmove",ee),j.addEventListener("touchend",ne)}function m2(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:a,fromType:l,doc:u,lib:o,flowId:c,isValidConnection:f=g2,nodeLookup:p}){const d=l==="target",_=t?u.querySelector(`.${o}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:v,y:w}=Qn(e),C=u.elementFromPoint(v,w),b=C!=null&&C.classList.contains(`${o}-flow__handle`)?C:_,S={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const x=p2(void 0,b),y=b.getAttribute("data-nodeid"),E=b.getAttribute("data-handleid"),R=b.classList.contains("connectable"),N=b.classList.contains("connectableend");if(!y||!x)return S;const D={source:d?y:r,sourceHandle:d?E:a,target:d?r:y,targetHandle:d?a:E};S.connection=D;const j=R&&N&&(n===ma.Strict?d&&x==="source"||!d&&x==="target":y!==r||E!==a);S.isValid=j&&f(D),S.toHandle=d2(y,x,E,p,n,!0)}return S}const gg={onPointerDown:Gz,isValid:m2};function qz({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const a=An(e);function l({translateExtent:o,width:c,height:f,zoomStep:p=1,pannable:d=!0,zoomable:_=!0,inversePan:v=!1}){const w=y=>{if(y.sourceEvent.type!=="wheel"||!t)return;const E=n(),R=y.sourceEvent.ctrlKey&&rl()?10:1,N=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*p,D=E[2]*Math.pow(2,N*R);t.scaleTo(D)};let C=[0,0];const b=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(C=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},S=y=>{const E=n();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!t)return;const R=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],N=[R[0]-C[0],R[1]-C[1]];C=R;const D=r()*Math.max(E[2],Math.log(E[2]))*(v?-1:1),T={x:E[0]-N[0]*D,y:E[1]-N[1]*D},j=[[0,0],[c,f]];t.setViewportConstrained({x:T.x,y:T.y,zoom:E[2]},j,o)},x=$C().on("start",b).on("zoom",d?S:null).on("zoom.wheel",_?w:null);a.call(x,{})}function u(){a.on("zoom",null)}return{update:l,destroy:u,pointer:Xn}}const wh=e=>({x:e.x,y:e.y,zoom:e.k}),yp=({x:e,y:t,zoom:n})=>bh.translate(e,t).scale(n),la=(e,t)=>e.target.closest(`.${t}`),_2=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Vz=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,bp=(e,t=0,n=Vz,r=()=>{})=>{const a=typeof t=="number"&&t>0;return a||r(),a?e.transition().duration(t).ease(n).on("end",r):e},v2=e=>{const t=e.ctrlKey&&rl()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Yz({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:a,panOnScrollSpeed:l,zoomOnPinch:u,onPanZoomStart:o,onPanZoom:c,onPanZoomEnd:f}){return p=>{if(la(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(p.ctrlKey&&u){const b=Xn(p),S=v2(p),x=d*Math.pow(2,S);r.scaleTo(n,x,b,p);return}const _=p.deltaMode===1?20:1;let v=a===ts.Vertical?0:p.deltaX*_,w=a===ts.Horizontal?0:p.deltaY*_;!rl()&&p.shiftKey&&a!==ts.Vertical&&(v=p.deltaY*_,w=0),r.translateBy(n,-(v/d)*l,-(w/d)*l,{internal:!0});const C=wh(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(p,C),e.panScrollTimeout=setTimeout(()=>{f==null||f(p,C),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,o==null||o(p,C))}}function Wz({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,a){const l=r.type==="wheel",u=!t&&l&&!r.ctrlKey,o=la(r,e);if(r.ctrlKey&&l&&o&&r.preventDefault(),u||o)return null;r.preventDefault(),n.call(this,r,a)}}function Xz({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var l,u,o;if((l=r.sourceEvent)!=null&&l.internal)return;const a=wh(r.transform);e.mouseButton=((u=r.sourceEvent)==null?void 0:u.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=a,((o=r.sourceEvent)==null?void 0:o.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,a))}}function Kz({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:a}){return l=>{var u,o;e.usedRightMouseButton=!!(n&&_2(t,e.mouseButton??0)),(u=l.sourceEvent)!=null&&u.sync||r([l.transform.x,l.transform.y,l.transform.k]),a&&!((o=l.sourceEvent)!=null&&o.internal)&&(a==null||a(l.sourceEvent,wh(l.transform)))}}function Zz({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:a,onPaneContextMenu:l}){return u=>{var o;if(!((o=u.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,l&&_2(t,e.mouseButton??0)&&!e.usedRightMouseButton&&u.sourceEvent&&l(u.sourceEvent),e.usedRightMouseButton=!1,r(!1),a)){const c=wh(u.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a==null||a(u.sourceEvent,c)},n?150:0)}}}function Qz({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:a,zoomOnDoubleClick:l,userSelectionActive:u,noWheelClassName:o,noPanClassName:c,lib:f,connectionInProgress:p}){return d=>{var b;const _=e||t,v=n&&d.ctrlKey,w=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(la(d,`${f}-flow__node`)||la(d,`${f}-flow__edge`)))return!0;if(!r&&!_&&!a&&!l&&!n||u||p&&!w||la(d,o)&&w||la(d,c)&&(!w||a&&w&&!e)||!n&&d.ctrlKey&&w)return!1;if(!n&&d.type==="touchstart"&&((b=d.touches)==null?void 0:b.length)>1)return d.preventDefault(),!1;if(!_&&!a&&!v&&w||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const C=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||w)&&C}}function Jz({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:a,onPanZoom:l,onPanZoomStart:u,onPanZoomEnd:o,onDraggingChange:c}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),d=$C().scaleExtent([t,n]).translateExtent(r),_=An(e).call(d);x({x:a.x,y:a.y,zoom:_a(a.zoom,t,n)},[[0,0],[p.width,p.height]],r);const v=_.on("wheel.zoom"),w=_.on("dblclick.zoom");d.wheelDelta(v2);async function C(z,G){return _?new Promise(U=>{d==null||d.interpolate((G==null?void 0:G.interpolate)==="linear"?zo:gu).transform(bp(_,G==null?void 0:G.duration,G==null?void 0:G.ease,()=>U(!0)),z)}):!1}function b({noWheelClassName:z,noPanClassName:G,onPaneContextMenu:U,userSelectionActive:H,panOnScroll:Y,panOnDrag:q,panOnScrollMode:X,panOnScrollSpeed:K,preventScrolling:L,zoomOnPinch:M,zoomOnScroll:O,zoomOnDoubleClick:$,zoomActivationKeyPressed:F,lib:Q,onTransformChange:re,connectionInProgress:ae,paneClickDistance:Z,selectionOnDrag:P}){H&&!f.isZoomingOrPanning&&S();const ee=Y&&!F&&!H;d.clickDistance(P?1/0:!Zn(Z)||Z<0?0:Z);const ne=ee?Yz({zoomPanValues:f,noWheelClassName:z,d3Selection:_,d3Zoom:d,panOnScrollMode:X,panOnScrollSpeed:K,zoomOnPinch:M,onPanZoomStart:u,onPanZoom:l,onPanZoomEnd:o}):Wz({noWheelClassName:z,preventScrolling:L,d3ZoomHandler:v});_.on("wheel.zoom",ne,{passive:!1});const ge=Xz({zoomPanValues:f,onDraggingChange:c,onPanZoomStart:u});d.on("start",ge);const he=Kz({zoomPanValues:f,panOnDrag:q,onPaneContextMenu:!!U,onPanZoom:l,onTransformChange:re});d.on("zoom",he);const ye=Zz({zoomPanValues:f,panOnDrag:q,panOnScroll:Y,onPaneContextMenu:U,onPanZoomEnd:o,onDraggingChange:c});d.on("end",ye);const be=Qz({zoomActivationKeyPressed:F,panOnDrag:q,zoomOnScroll:O,panOnScroll:Y,zoomOnDoubleClick:$,zoomOnPinch:M,userSelectionActive:H,noPanClassName:G,noWheelClassName:z,lib:Q,connectionInProgress:ae});d.filter(be),$?_.on("dblclick.zoom",w):_.on("dblclick.zoom",null)}function S(){d.on("zoom",null)}async function x(z,G,U){const H=yp(z),Y=d==null?void 0:d.constrain()(H,G,U);return Y&&await C(Y),Y}async function y(z,G){const U=yp(z);return await C(U,G),U}function E(z){if(_){const G=yp(z),U=_.property("__zoom");(U.k!==z.zoom||U.x!==z.x||U.y!==z.y)&&(d==null||d.transform(_,G,null,{sync:!0}))}}function R(){const z=_?UC(_.node()):{x:0,y:0,k:1};return{x:z.x,y:z.y,zoom:z.k}}async function N(z,G){return _?new Promise(U=>{d==null||d.interpolate((G==null?void 0:G.interpolate)==="linear"?zo:gu).scaleTo(bp(_,G==null?void 0:G.duration,G==null?void 0:G.ease,()=>U(!0)),z)}):!1}async function D(z,G){return _?new Promise(U=>{d==null||d.interpolate((G==null?void 0:G.interpolate)==="linear"?zo:gu).scaleBy(bp(_,G==null?void 0:G.duration,G==null?void 0:G.ease,()=>U(!0)),z)}):!1}function T(z){d==null||d.scaleExtent(z)}function j(z){d==null||d.translateExtent(z)}function B(z){const G=!Zn(z)||z<0?0:z;d==null||d.clickDistance(G)}return{update:b,destroy:S,setViewport:y,setViewportConstrained:x,getViewport:R,scaleTo:N,scaleBy:D,setScaleExtent:T,setTranslateExtent:j,syncViewport:E,setClickDistance:B}}var ya;(function(e){e.Line="line",e.Handle="handle"})(ya||(ya={}));function eH({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:a,affectsY:l}){const u=e-t,o=n-r,c=[u>0?1:u<0?-1:0,o>0?1:o<0?-1:0];return u&&a&&(c[0]=c[0]*-1),o&&l&&(c[1]=c[1]*-1),c}function sS(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),a=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:a}}function wr(e,t){return Math.max(0,t-e)}function Cr(e,t){return Math.max(0,e-t)}function iu(e,t,n){return Math.max(0,t-e,e-n)}function aS(e,t){return e?!t:t}function tH(e,t,n,r,a,l,u,o){let{affectsX:c,affectsY:f}=t;const{isHorizontal:p,isVertical:d}=t,_=p&&d,{xSnapped:v,ySnapped:w}=n,{minWidth:C,maxWidth:b,minHeight:S,maxHeight:x}=r,{x:y,y:E,width:R,height:N,aspectRatio:D}=e;let T=Math.floor(p?v-e.pointerX:0),j=Math.floor(d?w-e.pointerY:0);const B=R+(c?-T:T),z=N+(f?-j:j),G=-l[0]*R,U=-l[1]*N;let H=iu(B,C,b),Y=iu(z,S,x);if(u){let K=0,L=0;c&&T<0?K=wr(y+T+G,u[0][0]):!c&&T>0&&(K=Cr(y+B+G,u[1][0])),f&&j<0?L=wr(E+j+U,u[0][1]):!f&&j>0&&(L=Cr(E+z+U,u[1][1])),H=Math.max(H,K),Y=Math.max(Y,L)}if(o){let K=0,L=0;c&&T>0?K=Cr(y+T,o[0][0]):!c&&T<0&&(K=wr(y+B,o[1][0])),f&&j>0?L=Cr(E+j,o[0][1]):!f&&j<0&&(L=wr(E+z,o[1][1])),H=Math.max(H,K),Y=Math.max(Y,L)}if(a){if(p){const K=iu(B/D,S,x)*D;if(H=Math.max(H,K),u){let L=0;!c&&!f||c&&!f&&_?L=Cr(E+U+B/D,u[1][1])*D:L=wr(E+U+(c?T:-T)/D,u[0][1])*D,H=Math.max(H,L)}if(o){let L=0;!c&&!f||c&&!f&&_?L=wr(E+B/D,o[1][1])*D:L=Cr(E+(c?T:-T)/D,o[0][1])*D,H=Math.max(H,L)}}if(d){const K=iu(z*D,C,b)/D;if(Y=Math.max(Y,K),u){let L=0;!c&&!f||f&&!c&&_?L=Cr(y+z*D+G,u[1][0])/D:L=wr(y+(f?j:-j)*D+G,u[0][0])/D,Y=Math.max(Y,L)}if(o){let L=0;!c&&!f||f&&!c&&_?L=wr(y+z*D,o[1][0])/D:L=Cr(y+(f?j:-j)*D,o[0][0])/D,Y=Math.max(Y,L)}}}j=j+(j<0?Y:-Y),T=T+(T<0?H:-H),a&&(_?B>z*D?j=(aS(c,f)?-T:T)/D:T=(aS(c,f)?-j:j)*D:p?(j=T/D,f=c):(T=j*D,c=f));const q=c?y+T:y,X=f?E+j:E;return{width:R+(c?-T:T),height:N+(f?-j:j),x:l[0]*T*(c?-1:1)+q,y:l[1]*j*(f?-1:1)+X}}const y2={width:0,height:0,x:0,y:0},nH={...y2,pointerX:0,pointerY:0,aspectRatio:1};function iH(e,t,n){const r=t.position.x+e.position.x,a=t.position.y+e.position.y,l=e.measured.width??0,u=e.measured.height??0,o=n[0]*l,c=n[1]*u;return[[r-o,a-c],[r+l-o,a+u-c]]}function rH({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:a}){const l=An(e);let u={controlDirection:sS("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:f,boundaries:p,keepAspectRatio:d,resizeDirection:_,onResizeStart:v,onResize:w,onResizeEnd:C,shouldResize:b}){let S={...y2},x={...nH};u={boundaries:p,resizeDirection:_,keepAspectRatio:d,controlDirection:sS(f)};let y,E=null,R=[],N,D,T,j=!1;const B=NC().on("start",z=>{const{nodeLookup:G,transform:U,snapGrid:H,snapToGrid:Y,nodeOrigin:q,paneDomNode:X}=n();if(y=G.get(t),!y)return;E=(X==null?void 0:X.getBoundingClientRect())??null;const{xSnapped:K,ySnapped:L}=Ho(z.sourceEvent,{transform:U,snapGrid:H,snapToGrid:Y,containerBounds:E});S={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},x={...S,pointerX:K,pointerY:L,aspectRatio:S.width/S.height},N=void 0,D=os(y.extent)?y.extent:void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(N=G.get(y.parentId)),N&&y.extent==="parent"&&(D=[[0,0],[N.measured.width,N.measured.height]]),R=[],T=void 0;for(const[M,O]of G)if(O.parentId===t&&(R.push({id:M,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const $=iH(O,y,O.origin??q);T?T=[[Math.min($[0][0],T[0][0]),Math.min($[0][1],T[0][1])],[Math.max($[1][0],T[1][0]),Math.max($[1][1],T[1][1])]]:T=$}v==null||v(z,{...S})}).on("drag",z=>{const{transform:G,snapGrid:U,snapToGrid:H,nodeOrigin:Y}=n(),q=Ho(z.sourceEvent,{transform:G,snapGrid:U,snapToGrid:H,containerBounds:E}),X=[];if(!y)return;const{x:K,y:L,width:M,height:O}=S,$={},F=y.origin??Y,{width:Q,height:re,x:ae,y:Z}=tH(x,u.controlDirection,q,u.boundaries,u.keepAspectRatio,F,D,T),P=Q!==M,ee=re!==O,ne=ae!==K&&P,ge=Z!==L&ⅇif(!ne&&!ge&&!P&&!ee)return;if((ne||ge||F[0]===1||F[1]===1)&&($.x=ne?ae:S.x,$.y=ge?Z:S.y,S.x=$.x,S.y=$.y,R.length>0)){const ke=ae-K,Ee=Z-L;for(const Ce of R)Ce.position={x:Ce.position.x-ke+F[0]*(Q-M),y:Ce.position.y-Ee+F[1]*(re-O)},X.push(Ce)}if((P||ee)&&($.width=P&&(!u.resizeDirection||u.resizeDirection==="horizontal")?Q:S.width,$.height=ee&&(!u.resizeDirection||u.resizeDirection==="vertical")?re:S.height,S.width=$.width,S.height=$.height),N&&y.expandParent){const ke=F[0]*($.width??0);$.x&&$.x{j&&(C==null||C(z,{...S}),a==null||a({...S}),j=!1)});l.call(B)}function c(){l.on(".drag",null)}return{update:o,destroy:c}}var Sp={exports:{}},xp={},wp={exports:{}},Cp={};/** * @license React * use-sync-external-store-shim.production.js * @@ -364,7 +364,7 @@ Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githu * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var oS;function lH(){if(oS)return Cp;oS=1;var e=al();function t(d,_){return d===_&&(d!==0||1/d===1/_)||d!==d&&_!==_}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function o(d,_){var v=_(),w=r({inst:{value:v,getSnapshot:_}}),C=w[0].inst,b=w[1];return l(function(){C.value=v,C.getSnapshot=_,c(C)&&b({inst:C})},[d,v,_]),a(function(){return c(C)&&b({inst:C}),d(function(){c(C)&&b({inst:C})})},[d]),u(v),v}function c(d){var _=d.getSnapshot;d=d.value;try{var v=_();return!n(d,v)}catch{return!0}}function f(d,_){return _()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:o;return Cp.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Cp}var lS;function cH(){return lS||(lS=1,wp.exports=lH()),wp.exports}/** + */var oS;function sH(){if(oS)return Cp;oS=1;var e=al();function t(d,_){return d===_&&(d!==0||1/d===1/_)||d!==d&&_!==_}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function o(d,_){var v=_(),w=r({inst:{value:v,getSnapshot:_}}),C=w[0].inst,b=w[1];return l(function(){C.value=v,C.getSnapshot=_,c(C)&&b({inst:C})},[d,v,_]),a(function(){return c(C)&&b({inst:C}),d(function(){c(C)&&b({inst:C})})},[d]),u(v),v}function c(d){var _=d.getSnapshot;d=d.value;try{var v=_();return!n(d,v)}catch{return!0}}function f(d,_){return _()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:o;return Cp.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Cp}var lS;function aH(){return lS||(lS=1,wp.exports=sH()),wp.exports}/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -372,10 +372,10 @@ Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githu * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var cS;function uH(){if(cS)return xp;cS=1;var e=al(),t=cH();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,l=e.useRef,u=e.useEffect,o=e.useMemo,c=e.useDebugValue;return xp.useSyncExternalStoreWithSelector=function(f,p,d,_,v){var w=l(null);if(w.current===null){var C={hasValue:!1,value:null};w.current=C}else C=w.current;w=o(function(){function S(N){if(!x){if(x=!0,y=N,N=_(N),v!==void 0&&C.hasValue){var D=C.value;if(v(D,N))return E=D}return E=N}if(D=E,r(y,N))return D;var T=_(N);return v!==void 0&&v(D,T)?(y=N,D):(y=N,E=T)}var x=!1,y,E,R=d===void 0?null:d;return[function(){return S(p())},R===null?void 0:function(){return S(R())}]},[p,d,_,v]);var b=a(f,w[0],w[1]);return u(function(){C.hasValue=!0,C.value=b},[b]),c(b),b},xp}var uS;function hH(){return uS||(uS=1,Sp.exports=uH()),Sp.exports}var fH=hH();const dH=Pu(fH),pH={},hS=e=>{let t;const n=new Set,r=(p,d)=>{const _=typeof p=="function"?p(t):p;if(!Object.is(_,t)){const v=t;t=d??(typeof _!="object"||_===null)?_:Object.assign({},t,_),n.forEach(w=>w(t,v))}},a=()=>t,c={setState:r,getState:a,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(pH?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},f=t=e(r,a,c);return c},gH=e=>e?hS(e):hS,{useDebugValue:mH}=dA,{useSyncExternalStoreWithSelector:_H}=dH,vH=e=>e;function w2(e,t=vH,n){const r=_H(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return mH(r),r}const fS=(e,t)=>{const n=gH(e),r=(a,l=t)=>w2(n,a,l);return Object.assign(r,n),r},yH=(e,t)=>e?fS(e,t):fS;function At(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}FS();const Ch=q.createContext(null),bH=Ch.Provider,C2=ei.error001("react");function tt(e,t){const n=q.useContext(Ch);if(n===null)throw new Error(C2);return w2(n,e,t)}function Ct(){const e=q.useContext(Ch);if(e===null)throw new Error(C2);return q.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const dS={display:"none"},SH={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},E2="react-flow__node-desc",k2="react-flow__edge-desc",xH="react-flow__aria-live",wH=e=>e.ariaLiveMessage,CH=e=>e.ariaLabelConfig;function EH({rfId:e}){const t=tt(wH);return m.jsx("div",{id:`${xH}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:SH,children:t})}function kH({rfId:e,disableKeyboardA11y:t}){const n=tt(CH);return m.jsxs(m.Fragment,{children:[m.jsx("div",{id:`${E2}-${e}`,style:dS,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),m.jsx("div",{id:`${k2}-${e}`,style:dS,children:n["edge.a11yDescription.default"]}),!t&&m.jsx(EH,{rfId:e})]})}const Eh=q.forwardRef(({position:e="top-left",children:t,className:n,style:r,...a},l)=>{const u=`${e}`.split("-");return m.jsx("div",{className:Ft(["react-flow__panel",n,...u]),style:r,ref:l,...a,children:t})});Eh.displayName="Panel";const pS="https://reactflow.dev?utm_source=attribution";function AH({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:m.jsx(Eh,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${pS}`,children:m.jsx("a",{href:pS,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const NH=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},ru=e=>e.id;function TH(e,t){return At(e.selectedNodes.map(ru),t.selectedNodes.map(ru))&&At(e.selectedEdges.map(ru),t.selectedEdges.map(ru))}function RH({onSelectionChange:e}){const t=Ct(),{selectedNodes:n,selectedEdges:r}=tt(NH,TH);return q.useEffect(()=>{const a={nodes:n,edges:r};e==null||e(a),t.getState().onSelectionChangeHandlers.forEach(l=>l(a))},[n,r,e]),null}const DH=e=>!!e.onSelectionChangeHandlers;function MH({onSelectionChange:e}){const t=tt(DH);return e||t?m.jsx(RH,{onSelectionChange:e}):null}const A2=[0,0],jH={x:0,y:0,zoom:1},LH=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],gS=[...LH,"rfId"],OH=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),mS={translateExtent:tl,nodeOrigin:A2,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function BH(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:a,setTranslateExtent:l,setNodeExtent:u,reset:o,setDefaultNodesAndEdges:c}=tt(OH,At),f=Ct();q.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{p.current=mS,o()}),[]);const p=q.useRef(mS);return q.useEffect(()=>{for(const d of gS){const _=e[d],v=p.current[d];_!==v&&(typeof e[d]>"u"||(d==="nodes"?t(_):d==="edges"?n(_):d==="minZoom"?r(_):d==="maxZoom"?a(_):d==="translateExtent"?l(_):d==="nodeExtent"?u(_):d==="ariaLabelConfig"?f.setState({ariaLabelConfig:bz(_)}):d==="fitView"?f.setState({fitViewQueued:_}):d==="fitViewOptions"?f.setState({fitViewOptions:_}):f.setState({[d]:_})))}p.current=e},gS.map(d=>e[d])),null}function _S(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function IH(e){var r;const[t,n]=q.useState(e==="system"?null:e);return q.useEffect(()=>{if(e!=="system"){n(e);return}const a=_S(),l=()=>n(a!=null&&a.matches?"dark":"light");return l(),a==null||a.addEventListener("change",l),()=>{a==null||a.removeEventListener("change",l)}},[e]),t!==null?t:(r=_S())!=null&&r.matches?"dark":"light"}const vS=typeof document<"u"?document:null;function sl(e=null,t={target:vS,actInsideInputWithModifier:!0}){const[n,r]=q.useState(!1),a=q.useRef(!1),l=q.useRef(new Set([])),[u,o]=q.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",` + */var cS;function oH(){if(cS)return xp;cS=1;var e=al(),t=aH();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,l=e.useRef,u=e.useEffect,o=e.useMemo,c=e.useDebugValue;return xp.useSyncExternalStoreWithSelector=function(f,p,d,_,v){var w=l(null);if(w.current===null){var C={hasValue:!1,value:null};w.current=C}else C=w.current;w=o(function(){function S(N){if(!x){if(x=!0,y=N,N=_(N),v!==void 0&&C.hasValue){var D=C.value;if(v(D,N))return E=D}return E=N}if(D=E,r(y,N))return D;var T=_(N);return v!==void 0&&v(D,T)?(y=N,D):(y=N,E=T)}var x=!1,y,E,R=d===void 0?null:d;return[function(){return S(p())},R===null?void 0:function(){return S(R())}]},[p,d,_,v]);var b=a(f,w[0],w[1]);return u(function(){C.hasValue=!0,C.value=b},[b]),c(b),b},xp}var uS;function lH(){return uS||(uS=1,Sp.exports=oH()),Sp.exports}var cH=lH();const uH=Pu(cH),hH={},hS=e=>{let t;const n=new Set,r=(p,d)=>{const _=typeof p=="function"?p(t):p;if(!Object.is(_,t)){const v=t;t=d??(typeof _!="object"||_===null)?_:Object.assign({},t,_),n.forEach(w=>w(t,v))}},a=()=>t,c={setState:r,getState:a,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(hH?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},f=t=e(r,a,c);return c},fH=e=>e?hS(e):hS,{useDebugValue:dH}=cA,{useSyncExternalStoreWithSelector:pH}=uH,gH=e=>e;function b2(e,t=gH,n){const r=pH(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return dH(r),r}const fS=(e,t)=>{const n=fH(e),r=(a,l=t)=>b2(n,a,l);return Object.assign(r,n),r},mH=(e,t)=>e?fS(e,t):fS;function kt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}zS();const Ch=V.createContext(null),_H=Ch.Provider,S2=ei.error001("react");function tt(e,t){const n=V.useContext(Ch);if(n===null)throw new Error(S2);return b2(n,e,t)}function At(){const e=V.useContext(Ch);if(e===null)throw new Error(S2);return V.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const dS={display:"none"},vH={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},x2="react-flow__node-desc",w2="react-flow__edge-desc",yH="react-flow__aria-live",bH=e=>e.ariaLiveMessage,SH=e=>e.ariaLabelConfig;function xH({rfId:e}){const t=tt(bH);return m.jsx("div",{id:`${yH}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:vH,children:t})}function wH({rfId:e,disableKeyboardA11y:t}){const n=tt(SH);return m.jsxs(m.Fragment,{children:[m.jsx("div",{id:`${x2}-${e}`,style:dS,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),m.jsx("div",{id:`${w2}-${e}`,style:dS,children:n["edge.a11yDescription.default"]}),!t&&m.jsx(xH,{rfId:e})]})}const Eh=V.forwardRef(({position:e="top-left",children:t,className:n,style:r,...a},l)=>{const u=`${e}`.split("-");return m.jsx("div",{className:Ft(["react-flow__panel",n,...u]),style:r,ref:l,...a,children:t})});Eh.displayName="Panel";const pS="https://reactflow.dev?utm_source=attribution";function CH({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:m.jsx(Eh,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${pS}`,children:m.jsx("a",{href:pS,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const EH=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},ru=e=>e.id;function kH(e,t){return kt(e.selectedNodes.map(ru),t.selectedNodes.map(ru))&&kt(e.selectedEdges.map(ru),t.selectedEdges.map(ru))}function AH({onSelectionChange:e}){const t=At(),{selectedNodes:n,selectedEdges:r}=tt(EH,kH);return V.useEffect(()=>{const a={nodes:n,edges:r};e==null||e(a),t.getState().onSelectionChangeHandlers.forEach(l=>l(a))},[n,r,e]),null}const NH=e=>!!e.onSelectionChangeHandlers;function TH({onSelectionChange:e}){const t=tt(NH);return e||t?m.jsx(AH,{onSelectionChange:e}):null}const C2=[0,0],RH={x:0,y:0,zoom:1},DH=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],gS=[...DH,"rfId"],MH=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),mS={translateExtent:tl,nodeOrigin:C2,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function jH(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:a,setTranslateExtent:l,setNodeExtent:u,reset:o,setDefaultNodesAndEdges:c}=tt(MH,kt),f=At();V.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{p.current=mS,o()}),[]);const p=V.useRef(mS);return V.useEffect(()=>{for(const d of gS){const _=e[d],v=p.current[d];_!==v&&(typeof e[d]>"u"||(d==="nodes"?t(_):d==="edges"?n(_):d==="minZoom"?r(_):d==="maxZoom"?a(_):d==="translateExtent"?l(_):d==="nodeExtent"?u(_):d==="ariaLabelConfig"?f.setState({ariaLabelConfig:_z(_)}):d==="fitView"?f.setState({fitViewQueued:_}):d==="fitViewOptions"?f.setState({fitViewOptions:_}):f.setState({[d]:_})))}p.current=e},gS.map(d=>e[d])),null}function _S(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function LH(e){var r;const[t,n]=V.useState(e==="system"?null:e);return V.useEffect(()=>{if(e!=="system"){n(e);return}const a=_S(),l=()=>n(a!=null&&a.matches?"dark":"light");return l(),a==null||a.addEventListener("change",l),()=>{a==null||a.removeEventListener("change",l)}},[e]),t!==null?t:(r=_S())!=null&&r.matches?"dark":"light"}const vS=typeof document<"u"?document:null;function sl(e=null,t={target:vS,actInsideInputWithModifier:!0}){const[n,r]=V.useState(!1),a=V.useRef(!1),l=V.useRef(new Set([])),[u,o]=V.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",` `).replace(` `,` +`).split(` -`)),p=f.reduce((d,_)=>d.concat(..._),[]);return[f,p]}return[[],[]]},[e]);return q.useEffect(()=>{const c=(t==null?void 0:t.target)??vS,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=v=>{var b,S;if(a.current=v.ctrlKey||v.metaKey||v.shiftKey||v.altKey,(!a.current||a.current&&!f)&&a2(v))return!1;const C=bS(v.code,o);if(l.current.add(v[C]),yS(u,l.current,!1)){const x=((S=(b=v.composedPath)==null?void 0:b.call(v))==null?void 0:S[0])||v.target,y=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(a.current||!y)&&v.preventDefault(),r(!0)}},d=v=>{const w=bS(v.code,o);yS(u,l.current,!0)?(r(!1),l.current.clear()):l.current.delete(v[w]),v.key==="Meta"&&l.current.clear(),a.current=!1},_=()=>{l.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",p),c==null||c.addEventListener("keyup",d),window.addEventListener("blur",_),window.addEventListener("contextmenu",_),()=>{c==null||c.removeEventListener("keydown",p),c==null||c.removeEventListener("keyup",d),window.removeEventListener("blur",_),window.removeEventListener("contextmenu",_)}}},[e,r]),n}function yS(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(a=>t.has(a)))}function bS(e,t){return t.includes(e)?"code":"key"}const zH=()=>{const e=Ct();return q.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,a,l],panZoom:u}=e.getState();return u?(await u.setViewport({x:t.x??r,y:t.y??a,zoom:t.zoom??l},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:a,minZoom:l,maxZoom:u,panZoom:o}=e.getState(),c=Om(t,r,a,l,u,(n==null?void 0:n.padding)??.1);return o?(await o.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:a,snapToGrid:l,domNode:u}=e.getState();if(!u)return t;const{x:o,y:c}=u.getBoundingClientRect(),f={x:t.x-o,y:t.y-c},p=n.snapGrid??a,d=n.snapToGrid??l;return vl(f,r,d,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:a,y:l}=r.getBoundingClientRect(),u=va(t,n);return{x:u.x+a,y:u.y+l}}}),[])};function N2(e,t){const n=[],r=new Map,a=[];for(const l of e)if(l.type==="add"){a.push(l);continue}else if(l.type==="remove"||l.type==="replace")r.set(l.id,[l]);else{const u=r.get(l.id);u?u.push(l):r.set(l.id,[l])}for(const l of t){const u=r.get(l.id);if(!u){n.push(l);continue}if(u[0].type==="remove")continue;if(u[0].type==="replace"){n.push({...u[0].item});continue}const o={...l};for(const c of u)HH(c,o);n.push(o)}return a.length&&a.forEach(l=>{l.index!==void 0?n.splice(l.index,0,{...l.item}):n.push({...l.item})}),n}function HH(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function FH(e,t){return N2(e,t)}function PH(e,t){return N2(e,t)}function Zr(e,t){return{id:e,type:"select",selected:t}}function ca(e,t=new Set,n=!1){const r=[];for(const[a,l]of e){const u=t.has(a);!(l.selected===void 0&&!u)&&l.selected!==u&&(n&&(l.selected=u),r.push(Zr(l.id,u)))}return r}function SS({items:e=[],lookup:t}){var a;const n=[],r=new Map(e.map(l=>[l.id,l]));for(const[l,u]of e.entries()){const o=t.get(u.id),c=((a=o==null?void 0:o.internals)==null?void 0:a.userNode)??o;c!==void 0&&c!==u&&n.push({id:u.id,item:u,type:"replace"}),c===void 0&&n.push({item:u,type:"add",index:l})}for(const[l]of t)r.get(l)===void 0&&n.push({id:l,type:"remove"});return n}function xS(e){return{id:e.id,type:"remove"}}const UH=n2();function $H(e,t,n={}){return kz(e,t,{...n,onError:n.onError??UH})}const wS=e=>hz(e),GH=e=>ZC(e);function T2(e){return q.forwardRef(e)}const R2=typeof window<"u"?q.useLayoutEffect:q.useEffect;function CS(e){const[t,n]=q.useState(BigInt(0)),[r]=q.useState(()=>qH(()=>n(a=>a+BigInt(1))));return R2(()=>{const a=r.get();a.length&&(e(a),r.reset())},[t]),r}function qH(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const D2=q.createContext(null);function VH({children:e}){const t=Ct(),n=q.useCallback(o=>{const{nodes:c=[],setNodes:f,hasDefaultNodes:p,onNodesChange:d,nodeLookup:_,fitViewQueued:v,onNodesChangeMiddlewareMap:w}=t.getState();let C=c;for(const S of o)C=typeof S=="function"?S(C):S;let b=SS({items:C,lookup:_});for(const S of w.values())b=S(b);p&&f(C),b.length>0?d==null||d(b):v&&window.requestAnimationFrame(()=>{const{fitViewQueued:S,nodes:x,setNodes:y}=t.getState();S&&y(x)})},[]),r=CS(n),a=q.useCallback(o=>{const{edges:c=[],setEdges:f,hasDefaultEdges:p,onEdgesChange:d,edgeLookup:_}=t.getState();let v=c;for(const w of o)v=typeof w=="function"?w(v):w;p?f(v):d&&d(SS({items:v,lookup:_}))},[]),l=CS(a),u=q.useMemo(()=>({nodeQueue:r,edgeQueue:l}),[]);return m.jsx(D2.Provider,{value:u,children:e})}function YH(){const e=q.useContext(D2);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const WH=e=>!!e.panZoom;function Um(){const e=zH(),t=Ct(),n=YH(),r=tt(WH),a=q.useMemo(()=>{const l=d=>t.getState().nodeLookup.get(d),u=d=>{n.nodeQueue.push(d)},o=d=>{n.edgeQueue.push(d)},c=d=>{var S,x;const{nodeLookup:_,nodeOrigin:v}=t.getState(),w=wS(d)?d:_.get(d.id),C=w.parentId?r2(w.position,w.measured,w.parentId,_,v):w.position,b={...w,position:C,width:((S=w.measured)==null?void 0:S.width)??w.width,height:((x=w.measured)==null?void 0:x.height)??w.height};return il(b)},f=(d,_,v={replace:!1})=>{u(w=>w.map(C=>{if(C.id===d){const b=typeof _=="function"?_(C):_;return v.replace&&wS(b)?b:{...C,...b}}return C}))},p=(d,_,v={replace:!1})=>{o(w=>w.map(C=>{if(C.id===d){const b=typeof _=="function"?_(C):_;return v.replace&&GH(b)?b:{...C,...b}}return C}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>{var _;return(_=l(d))==null?void 0:_.internals.userNode},getInternalNode:l,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(_=>({..._}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:u,setEdges:o,addNodes:d=>{const _=Array.isArray(d)?d:[d];n.nodeQueue.push(v=>[...v,..._])},addEdges:d=>{const _=Array.isArray(d)?d:[d];n.edgeQueue.push(v=>[...v,..._])},toObject:()=>{const{nodes:d=[],edges:_=[],transform:v}=t.getState(),[w,C,b]=v;return{nodes:d.map(S=>({...S})),edges:_.map(S=>({...S})),viewport:{x:w,y:C,zoom:b}}},deleteElements:async({nodes:d=[],edges:_=[]})=>{const{nodes:v,edges:w,onNodesDelete:C,onEdgesDelete:b,triggerNodeChanges:S,triggerEdgeChanges:x,onDelete:y,onBeforeDelete:E}=t.getState(),{nodes:R,edges:N}=await mz({nodesToRemove:d,edgesToRemove:_,nodes:v,edges:w,onBeforeDelete:E}),D=N.length>0,T=R.length>0;if(D){const j=N.map(xS);b==null||b(N),x(j)}if(T){const j=R.map(xS);C==null||C(R),S(j)}return(T||D)&&(y==null||y({nodes:R,edges:N})),{deletedNodes:R,deletedEdges:N}},getIntersectingNodes:(d,_=!0,v)=>{const w=Wb(d),C=w?d:c(d),b=v!==void 0;return C?(v||t.getState().nodes).filter(S=>{const x=t.getState().nodeLookup.get(S.id);if(x&&!w&&(S.id===d.id||!x.internals.positionAbsolute))return!1;const y=il(b?S:x),E=zu(y,C);return _&&E>0||E>=y.width*y.height||E>=C.width*C.height}):[]},isNodeIntersecting:(d,_,v=!0)=>{const C=Wb(d)?d:c(d);if(!C)return!1;const b=zu(C,_);return v&&b>0||b>=_.width*_.height||b>=C.width*C.height},updateNode:f,updateNodeData:(d,_,v={replace:!1})=>{f(d,w=>{const C=typeof _=="function"?_(w):_;return v.replace?{...w,data:C}:{...w,data:{...w.data,...C}}},v)},updateEdge:p,updateEdgeData:(d,_,v={replace:!1})=>{p(d,w=>{const C=typeof _=="function"?_(w):_;return v.replace?{...w,data:C}:{...w,data:{...w.data,...C}}},v)},getNodesBounds:d=>{const{nodeLookup:_,nodeOrigin:v}=t.getState();return fz(d,{nodeLookup:_,nodeOrigin:v})},getHandleConnections:({type:d,id:_,nodeId:v})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${v}-${d}${_?`-${_}`:""}`))==null?void 0:w.values())??[])},getNodeConnections:({type:d,handleId:_,nodeId:v})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${v}${d?_?`-${d}-${_}`:`-${d}`:""}`))==null?void 0:w.values())??[])},fitView:async d=>{const _=t.getState().fitViewResolver??yz();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:_}),n.nodeQueue.push(v=>[...v]),_.promise}}},[]);return q.useMemo(()=>({...a,...e,viewportInitialized:r}),[r])}const ES=e=>e.selected,XH=typeof window<"u"?window:void 0;function KH({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Ct(),{deleteElements:r}=Um(),a=sl(e,{actInsideInputWithModifier:!1}),l=sl(t,{target:XH});q.useEffect(()=>{if(a){const{edges:u,nodes:o}=n.getState();r({nodes:o.filter(ES),edges:u.filter(ES)}),n.setState({nodesSelectionActive:!1})}},[a]),q.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])}function ZH(e){const t=Ct();q.useEffect(()=>{const n=()=>{var a,l,u,o;if(!e.current||!(((l=(a=e.current).checkVisibility)==null?void 0:l.call(a))??!0))return!1;const r=Bm(e.current);(r.height===0||r.width===0)&&((o=(u=t.getState()).onError)==null||o.call(u,"004",ei.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const kh={position:"absolute",width:"100%",height:"100%",top:0,left:0},QH=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function JH({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=ts.Free,zoomOnDoubleClick:u=!0,panOnDrag:o=!0,defaultViewport:c,translateExtent:f,minZoom:p,maxZoom:d,zoomActivationKeyCode:_,preventScrolling:v=!0,children:w,noWheelClassName:C,noPanClassName:b,onViewportChange:S,isControlledViewport:x,paneClickDistance:y,selectionOnDrag:E}){const R=Ct(),N=q.useRef(null),{userSelectionActive:D,lib:T,connectionInProgress:j}=tt(QH,At),B=sl(_),F=q.useRef();ZH(N);const Y=q.useCallback(H=>{S==null||S({x:H[0],y:H[1],zoom:H[2]}),x||R.setState({transform:H})},[S,x]);return q.useEffect(()=>{if(N.current){F.current=nH({domNode:N.current,minZoom:p,maxZoom:d,translateExtent:f,viewport:c,onDraggingChange:G=>R.setState(X=>X.paneDragging===G?X:{paneDragging:G}),onPanZoomStart:(G,X)=>{const{onViewportChangeStart:K,onMoveStart:L}=R.getState();L==null||L(G,X),K==null||K(X)},onPanZoom:(G,X)=>{const{onViewportChange:K,onMove:L}=R.getState();L==null||L(G,X),K==null||K(X)},onPanZoomEnd:(G,X)=>{const{onViewportChangeEnd:K,onMoveEnd:L}=R.getState();L==null||L(G,X),K==null||K(X)}});const{x:H,y:z,zoom:V}=F.current.getViewport();return R.setState({panZoom:F.current,transform:[H,z,V],domNode:N.current.closest(".react-flow")}),()=>{var G;(G=F.current)==null||G.destroy()}}},[]),q.useEffect(()=>{var H;(H=F.current)==null||H.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:a,panOnScrollMode:l,zoomOnDoubleClick:u,panOnDrag:o,zoomActivationKeyPressed:B,preventScrolling:v,noPanClassName:b,userSelectionActive:D,noWheelClassName:C,lib:T,onTransformChange:Y,connectionInProgress:j,selectionOnDrag:E,paneClickDistance:y})},[e,t,n,r,a,l,u,o,B,v,b,D,C,T,Y,j,E,y]),m.jsx("div",{className:"react-flow__renderer",ref:N,style:kh,children:w})}const eF=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function tF(){const{userSelectionActive:e,userSelectionRect:t}=tt(eF,At);return e&&t?m.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Ep=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},nF=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function iF({isSelecting:e,selectionKeyPressed:t,selectionMode:n=nl.Full,panOnDrag:r,autoPanOnSelection:a,paneClickDistance:l,selectionOnDrag:u,onSelectionStart:o,onSelectionEnd:c,onPaneClick:f,onPaneContextMenu:p,onPaneScroll:d,onPaneMouseEnter:_,onPaneMouseMove:v,onPaneMouseLeave:w,children:C}){const b=q.useRef(0),S=Ct(),{userSelectionActive:x,elementsSelectable:y,dragging:E,panBy:R,autoPanSpeed:N}=tt(nF,At),D=y&&(e||x),T=q.useRef(null),j=q.useRef(),B=q.useRef(new Set),F=q.useRef(new Set),Y=q.useRef(!1),H=q.useRef(!1),z=q.useRef({x:0,y:0}),V=q.useRef(!1),G=P=>{if(H.current||Y.current||S.getState().connection.inProgress){H.current=!1,Y.current=!1;return}f==null||f(P),S.getState().resetSelectedElements(),S.setState({nodesSelectionActive:!1})},X=P=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){P.preventDefault();return}p==null||p(P)},K=d?P=>d(P):void 0,L=P=>{H.current&&(P.stopPropagation(),H.current=!1)},M=P=>{var Ce,rt;const{domNode:ee,transform:ne}=S.getState();if(j.current=ee==null?void 0:ee.getBoundingClientRect(),!j.current)return;const ge=P.target===T.current;if(!ge&&!!P.target.closest(".nokey")||!e||!(u&&ge||t)||P.button!==0||!P.isPrimary)return;(rt=(Ce=P.target)==null?void 0:Ce.setPointerCapture)==null||rt.call(Ce,P.pointerId),H.current=!1;const{x:be,y:ke}=Qn(P.nativeEvent,j.current),Ee=vl({x:be,y:ke},ne);S.setState({userSelectionRect:{width:0,height:0,startX:Ee.x,startY:Ee.y,x:be,y:ke}}),ge||(P.stopPropagation(),P.preventDefault())};function O(P,ee){const{userSelectionRect:ne}=S.getState();if(!ne)return;const{transform:ge,nodeLookup:he,edgeLookup:ye,connectionLookup:be,triggerNodeChanges:ke,triggerEdgeChanges:Ee,defaultEdgeOptions:Ce}=S.getState(),rt={x:ne.startX,y:ne.startY},{x:bt,y:Ge}=va(rt,ge),ct={startX:rt.x,startY:rt.y,x:Pfe.id)),F.current=new Set;const Fe=(Ce==null?void 0:Ce.selectable)??!0;for(const fe of B.current){const ie=be.get(fe);if(ie)for(const{edgeId:de}of ie.values()){const Se=ye.get(de);Se&&(Se.selectable??Fe)&&F.current.add(de)}}if(!Xb(Pt,B.current)){const fe=ca(he,B.current,!0);ke(fe)}if(!Xb(ht,F.current)){const fe=ca(ye,F.current);Ee(fe)}S.setState({userSelectionRect:ct,userSelectionActive:!0,nodesSelectionActive:!1})}function $(){if(!a||!j.current)return;const[P,ee]=Lm(z.current,j.current,N);R({x:P,y:ee}).then(ne=>{if(!H.current||!ne){b.current=requestAnimationFrame($);return}const{x:ge,y:he}=z.current;O(ge,he),b.current=requestAnimationFrame($)})}const U=()=>{cancelAnimationFrame(b.current),b.current=0,V.current=!1};q.useEffect(()=>()=>U(),[]);const Q=P=>{const{userSelectionRect:ee,transform:ne,resetSelectedElements:ge}=S.getState();if(!j.current||!ee)return;const{x:he,y:ye}=Qn(P.nativeEvent,j.current);z.current={x:he,y:ye};const be=va({x:ee.startX,y:ee.startY},ne);if(!H.current){const ke=t?0:l;if(Math.hypot(he-be.x,ye-be.y)<=ke)return;ge(),o==null||o(P)}H.current=!0,V.current||($(),V.current=!0),O(he,ye)},re=P=>{var ee,ne;if(!D){P.target===T.current&&S.getState().connection.inProgress&&(Y.current=!0);return}P.button===0&&((ne=(ee=P.target)==null?void 0:ee.releasePointerCapture)==null||ne.call(ee,P.pointerId),!x&&P.target===T.current&&S.getState().userSelectionRect&&(G==null||G(P)),S.setState({userSelectionActive:!1,userSelectionRect:null}),H.current&&(c==null||c(P),S.setState({nodesSelectionActive:B.current.size>0})),U())},ae=P=>{var ee,ne;(ne=(ee=P.target)==null?void 0:ee.releasePointerCapture)==null||ne.call(ee,P.pointerId),U()},Z=r===!0||Array.isArray(r)&&r.includes(0);return m.jsxs("div",{className:Ft(["react-flow__pane",{draggable:Z,dragging:E,selection:e}]),onClick:D?void 0:Ep(G,T),onContextMenu:Ep(X,T),onWheel:Ep(K,T),onPointerEnter:D?void 0:_,onPointerMove:D?Q:v,onPointerUp:re,onPointerCancel:D?ae:void 0,onPointerDownCapture:D?M:void 0,onClickCapture:D?L:void 0,onPointerLeave:w,ref:T,style:kh,children:[C,m.jsx(tF,{})]})}function mg({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:u,nodeLookup:o,onError:c}=t.getState(),f=o.get(e);if(!f){c==null||c("012",ei.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(n||f.selected&&u)&&(l({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var p;return(p=r==null?void 0:r.current)==null?void 0:p.blur()})):a([e])}function M2({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:a,isSelectable:l,nodeClickDistance:u}){const o=Ct(),[c,f]=q.useState(!1),p=q.useRef();return q.useEffect(()=>{if(!t)return p.current=Uz({getStoreItems:()=>o.getState(),onNodeMouseDown:d=>{mg({id:d,store:o,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}}),()=>{var d;(d=p.current)==null||d.destroy(),p.current=void 0}},[t,o,e]),q.useEffect(()=>{t||!e.current||!p.current||p.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:l,nodeId:a,nodeClickDistance:u})},[n,r,t,l,e,a,u]),c}const rF=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function j2(){const e=Ct();return q.useCallback(n=>{const{nodeExtent:r,snapToGrid:a,snapGrid:l,nodesDraggable:u,onError:o,updateNodePositions:c,nodeLookup:f,nodeOrigin:p}=e.getState(),d=new Map,_=rF(u),v=a?l[0]:5,w=a?l[1]:5,C=n.direction.x*v*n.factor,b=n.direction.y*w*n.factor;for(const[,S]of f){if(!_(S))continue;let x={x:S.internals.positionAbsolute.x+C,y:S.internals.positionAbsolute.y+b};a&&(x=_l(x,l));const{position:y,positionAbsolute:E}=QC({nodeId:S.id,nextPosition:x,nodeLookup:f,nodeExtent:r,nodeOrigin:p,onError:o});S.position=y,S.internals.positionAbsolute=E,d.set(S.id,S)}c(d)},[])}const $m=q.createContext(null),sF=$m.Provider;$m.Consumer;const L2=()=>q.useContext($m),aF=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),O2=q.createContext(null);function oF({children:e}){const t=tt(aF,At);return m.jsx(O2.Provider,{value:t,children:e})}function lF(){const e=q.useContext(O2);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const cF={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},uF=(e,t,n)=>r=>{const{connectionClickStartHandle:a,connectionMode:l,connection:u}=r,{fromHandle:o,toHandle:c,isValid:f}=u;if(!o&&!a)return cF;const p=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,connectingTo:p,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,isPossibleEndHandle:l===ma.Strict?(o==null?void 0:o.type)!==n:e!==(o==null?void 0:o.nodeId)||t!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!a,valid:p&&f}};function hF({type:e="source",position:t=Me.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:u,onConnect:o,children:c,className:f,onMouseDown:p,onTouchStart:d,..._},v){var V,G;const w=u||null,C=e==="target",b=Ct(),S=L2(),{connectOnClick:x,noPanClassName:y,rfId:E}=lF(),{connectingFrom:R,connectingTo:N,clickConnecting:D,isPossibleEndHandle:T,connectionInProcess:j,clickConnectionInProcess:B,valid:F}=tt(uF(S,w,e),At);S||(G=(V=b.getState()).onError)==null||G.call(V,"010",ei.error010());const Y=X=>{const{defaultEdgeOptions:K,onConnect:L,hasDefaultEdges:M}=b.getState(),O={...K,...X};if(M){const{edges:$,setEdges:U,onError:Q}=b.getState();U($H(O,$,{onError:Q}))}L==null||L(O),o==null||o(O)},H=X=>{if(!S)return;const K=o2(X.nativeEvent);if(a&&(K&&X.button===0||!K)){const L=b.getState();gg.onPointerDown(X.nativeEvent,{handleDomNode:X.currentTarget,autoPanOnConnect:L.autoPanOnConnect,connectionMode:L.connectionMode,connectionRadius:L.connectionRadius,domNode:L.domNode,nodeLookup:L.nodeLookup,lib:L.lib,isTarget:C,handleId:w,nodeId:S,flowId:L.rfId,panBy:L.panBy,cancelConnection:L.cancelConnection,onConnectStart:L.onConnectStart,onConnectEnd:(...M)=>{var O,$;return($=(O=b.getState()).onConnectEnd)==null?void 0:$.call(O,...M)},updateConnection:L.updateConnection,onConnect:Y,isValidConnection:n||((...M)=>{var O,$;return(($=(O=b.getState()).isValidConnection)==null?void 0:$.call(O,...M))??!0}),getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:L.autoPanSpeed,dragThreshold:L.connectionDragThreshold})}K?p==null||p(X):d==null||d(X)},z=X=>{const{onClickConnectStart:K,onClickConnectEnd:L,connectionClickStartHandle:M,connectionMode:O,isValidConnection:$,lib:U,rfId:Q,nodeLookup:re,connection:ae}=b.getState();if(!S||!M&&!a)return;if(!M){K==null||K(X.nativeEvent,{nodeId:S,handleId:w,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:S,type:e,id:w}});return}const Z=s2(X.target),P=n||$,{connection:ee,isValid:ne}=gg.isValid(X.nativeEvent,{handle:{nodeId:S,id:w,type:e},connectionMode:O,fromNodeId:M.nodeId,fromHandleId:M.id||null,fromType:M.type,isValidConnection:P,flowId:Q,doc:Z,lib:U,nodeLookup:re});ne&&ee&&Y(ee);const ge=structuredClone(ae);delete ge.inProgress,ge.toPosition=ge.toHandle?ge.toHandle.position:null,L==null||L(X,ge),b.setState({connectionClickStartHandle:null})};return m.jsx("div",{"data-handleid":w,"data-nodeid":S,"data-handlepos":t,"data-id":`${E}-${S}-${w}-${e}`,className:Ft(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",y,f,{source:!C,target:C,connectable:r,connectablestart:a,connectableend:l,clickconnecting:D,connectingfrom:R,connectingto:N,valid:F,connectionindicator:r&&(!j||T)&&(j||B?l:a)}]),onMouseDown:H,onTouchStart:H,onClick:x?z:void 0,ref:v,..._,children:c})}const ba=q.memo(T2(hF));function fF({data:e,isConnectable:t,sourcePosition:n=Me.Bottom}){return m.jsxs(m.Fragment,{children:[e==null?void 0:e.label,m.jsx(ba,{type:"source",position:n,isConnectable:t})]})}function dF({data:e,isConnectable:t,targetPosition:n=Me.Top,sourcePosition:r=Me.Bottom}){return m.jsxs(m.Fragment,{children:[m.jsx(ba,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,m.jsx(ba,{type:"source",position:r,isConnectable:t})]})}function pF(){return null}function gF({data:e,isConnectable:t,targetPosition:n=Me.Top}){return m.jsxs(m.Fragment,{children:[m.jsx(ba,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Hu={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},kS={input:fF,default:dF,output:gF,group:pF};function mF(e){var t,n,r,a;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((a=e.style)==null?void 0:a.height)}}const _F=e=>{const{width:t,height:n,x:r,y:a}=ml(e.nodeLookup,{filter:l=>!!l.selected});return{width:Zn(t)?t:null,height:Zn(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${a}px)`}};function vF({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Ct(),{width:a,height:l,transformString:u,userSelectionActive:o}=tt(_F,At),c=j2(),f=q.useRef(null);q.useEffect(()=>{var v;n||(v=f.current)==null||v.focus({preventScroll:!0})},[n]);const p=!o&&a!==null&&l!==null;if(M2({nodeRef:f,disabled:!p}),!p)return null;const d=e?v=>{const w=r.getState().nodes.filter(C=>C.selected);e(v,w)}:void 0,_=v=>{Object.prototype.hasOwnProperty.call(Hu,v.key)&&(v.preventDefault(),c({direction:Hu[v.key],factor:v.shiftKey?4:1}))};return m.jsx("div",{className:Ft(["react-flow__nodesselection","react-flow__container",t]),style:{transform:u},children:m.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:_,style:{width:a,height:l}})})}const AS=typeof window<"u"?window:void 0,yF=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function B2({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:u,paneClickDistance:o,deleteKeyCode:c,selectionKeyCode:f,selectionOnDrag:p,selectionMode:d,onSelectionStart:_,onSelectionEnd:v,multiSelectionKeyCode:w,panActivationKeyCode:C,zoomActivationKeyCode:b,elementsSelectable:S,zoomOnScroll:x,zoomOnPinch:y,panOnScroll:E,panOnScrollSpeed:R,panOnScrollMode:N,zoomOnDoubleClick:D,panOnDrag:T,autoPanOnSelection:j,defaultViewport:B,translateExtent:F,minZoom:Y,maxZoom:H,preventScrolling:z,onSelectionContextMenu:V,noWheelClassName:G,noPanClassName:X,disableKeyboardA11y:K,onViewportChange:L,isControlledViewport:M}){const{nodesSelectionActive:O,userSelectionActive:$}=tt(yF,At),U=sl(f,{target:AS}),Q=sl(C,{target:AS}),re=Q||T,ae=Q||E,Z=p&&re!==!0,P=U||$||Z;return KH({deleteKeyCode:c,multiSelectionKeyCode:w}),m.jsx(JH,{onPaneContextMenu:l,elementsSelectable:S,zoomOnScroll:x,zoomOnPinch:y,panOnScroll:ae,panOnScrollSpeed:R,panOnScrollMode:N,zoomOnDoubleClick:D,panOnDrag:!U&&re,defaultViewport:B,translateExtent:F,minZoom:Y,maxZoom:H,zoomActivationKeyCode:b,preventScrolling:z,noWheelClassName:G,noPanClassName:X,onViewportChange:L,isControlledViewport:M,paneClickDistance:o,selectionOnDrag:Z,children:m.jsxs(iF,{onSelectionStart:_,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:re,autoPanOnSelection:j,isSelecting:!!P,selectionMode:d,selectionKeyPressed:U,paneClickDistance:o,selectionOnDrag:Z,children:[e,O&&m.jsx(vF,{onSelectionContextMenu:V,noPanClassName:X,disableKeyboardA11y:K})]})})}B2.displayName="FlowRenderer";const bF=q.memo(B2),SF=e=>t=>e?jm(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function xF(e){return tt(q.useCallback(SF(e),[e]),At)}const wF=e=>e.updateNodeInternals;function CF(){const e=tt(wF),[t]=q.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(a=>{const l=a.target.getAttribute("data-id");r.set(l,{id:l,nodeElement:a.target,force:!0})}),e(r)}));return q.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function EF({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const a=Ct(),l=q.useRef(null),u=q.useRef(null),o=q.useRef(e.sourcePosition),c=q.useRef(e.targetPosition),f=q.useRef(t),p=n&&!!e.internals.handleBounds;return q.useEffect(()=>{l.current&&!e.hidden&&(!p||u.current!==l.current)&&(u.current&&(r==null||r.unobserve(u.current)),r==null||r.observe(l.current),u.current=l.current)},[p,e.hidden]),q.useEffect(()=>()=>{u.current&&(r==null||r.unobserve(u.current),u.current=null)},[]),q.useEffect(()=>{if(l.current){const d=f.current!==t,_=o.current!==e.sourcePosition,v=c.current!==e.targetPosition;(d||_||v)&&(f.current=t,o.current=e.sourcePosition,c.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:l.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),l}function kF({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:a,onContextMenu:l,onDoubleClick:u,nodesDraggable:o,elementsSelectable:c,nodesConnectable:f,nodesFocusable:p,resizeObserver:d,noDragClassName:_,noPanClassName:v,disableKeyboardA11y:w,rfId:C,nodeTypes:b,nodeClickDistance:S,onError:x}){const{node:y,internals:E,isParent:R}=tt(P=>{const ee=P.nodeLookup.get(e),ne=P.parentLookup.has(e);return{node:ee,internals:ee.internals,isParent:ne}},At);let N=y.type||"default",D=(b==null?void 0:b[N])||kS[N];D===void 0&&(x==null||x("003",ei.error003(N)),N="default",D=(b==null?void 0:b.default)||kS.default);const T=!!(y.draggable||o&&typeof y.draggable>"u"),j=!!(y.selectable||c&&typeof y.selectable>"u"),B=!!(y.connectable||f&&typeof y.connectable>"u"),F=!!(y.focusable||p&&typeof y.focusable>"u"),Y=Ct(),H=i2(y),z=EF({node:y,nodeType:N,hasDimensions:H,resizeObserver:d}),V=M2({nodeRef:z,disabled:y.hidden||!T,noDragClassName:_,handleSelector:y.dragHandle,nodeId:e,isSelectable:j,nodeClickDistance:S}),G=j2();if(y.hidden)return null;const X=gi(y),K=mF(y),L=j||T||t||n||r||a,M=n?P=>n(P,{...E.userNode}):void 0,O=r?P=>r(P,{...E.userNode}):void 0,$=a?P=>a(P,{...E.userNode}):void 0,U=l?P=>l(P,{...E.userNode}):void 0,Q=u?P=>u(P,{...E.userNode}):void 0,re=P=>{const{selectNodesOnDrag:ee,nodeDragThreshold:ne}=Y.getState();j&&(!ee||!T||ne>0)&&mg({id:e,store:Y,nodeRef:z}),t&&t(P,{...E.userNode})},ae=P=>{if(!(a2(P.nativeEvent)||w)){if(YC.includes(P.key)&&j){const ee=P.key==="Escape";mg({id:e,store:Y,unselect:ee,nodeRef:z})}else if(T&&y.selected&&Object.prototype.hasOwnProperty.call(Hu,P.key)){P.preventDefault();const{ariaLabelConfig:ee}=Y.getState();Y.setState({ariaLiveMessage:ee["node.a11yDescription.ariaLiveMessage"]({direction:P.key.replace("Arrow","").toLowerCase(),x:~~E.positionAbsolute.x,y:~~E.positionAbsolute.y})}),G({direction:Hu[P.key],factor:P.shiftKey?4:1})}}},Z=()=>{var be;if(w||!((be=z.current)!=null&&be.matches(":focus-visible")))return;const{transform:P,width:ee,height:ne,autoPanOnNodeFocus:ge,setCenter:he}=Y.getState();if(!ge)return;jm(new Map([[e,y]]),{x:0,y:0,width:ee,height:ne},P,!0).length>0||he(y.position.x+X.width/2,y.position.y+X.height/2,{zoom:P[2]})};return m.jsx("div",{className:Ft(["react-flow__node",`react-flow__node-${N}`,{[v]:T},y.className,{selected:y.selected,selectable:j,parent:R,draggable:T,dragging:V}]),ref:z,style:{zIndex:E.z,transform:`translate(${E.positionAbsolute.x}px,${E.positionAbsolute.y}px)`,pointerEvents:L?"all":"none",visibility:H?"visible":"hidden",...y.style,...K},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:M,onMouseMove:O,onMouseLeave:$,onContextMenu:U,onClick:re,onDoubleClick:Q,onKeyDown:F?ae:void 0,tabIndex:F?0:void 0,onFocus:F?Z:void 0,role:y.ariaRole??(F?"group":void 0),"aria-roledescription":"node","aria-describedby":w?void 0:`${E2}-${C}`,"aria-label":y.ariaLabel,...y.domAttributes,children:m.jsx(sF,{value:e,children:m.jsx(D,{id:e,data:y.data,type:N,positionAbsoluteX:E.positionAbsolute.x,positionAbsoluteY:E.positionAbsolute.y,selected:y.selected??!1,selectable:j,draggable:T,deletable:y.deletable??!0,isConnectable:B,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:V,dragHandle:y.dragHandle,zIndex:E.z,parentId:y.parentId,...X})})})}var AF=q.memo(kF);const NF=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function I2(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:a}=tt(NF,At),l=xF(e.onlyRenderVisibleElements),u=CF();return m.jsx("div",{className:"react-flow__nodes",style:kh,children:l.map(o=>m.jsx(AF,{id:o,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:u,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}I2.displayName="NodeRenderer";const TF=q.memo(I2);function RF(e){return tt(q.useCallback(n=>{if(!e)return n.edges.map(a=>a.id);const r=[];if(n.width&&n.height)for(const a of n.edges){const l=n.nodeLookup.get(a.source),u=n.nodeLookup.get(a.target);l&&u&&wz({sourceNode:l,targetNode:u,width:n.width,height:n.height,transform:n.transform})&&r.push(a.id)}return r},[e]),At)}const DF=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return m.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},MF=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return m.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},NS={[Bu.Arrow]:DF,[Bu.ArrowClosed]:MF};function jF(e){const t=Ct();return q.useMemo(()=>{var a,l;return Object.prototype.hasOwnProperty.call(NS,e)?NS[e]:((l=(a=t.getState()).onError)==null||l.call(a,"009",ei.error009(e)),null)},[e])}const LF=({id:e,type:t,color:n,width:r=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:u,orient:o="auto-start-reverse"})=>{const c=jF(t);return c?m.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:o,refX:"0",refY:"0",children:m.jsx(c,{color:n,strokeWidth:u})}):null},z2=({defaultColor:e,rfId:t})=>{const n=tt(l=>l.edges),r=tt(l=>l.defaultEdgeOptions),a=q.useMemo(()=>Dz(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return a.length?m.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:m.jsx("defs",{children:a.map(l=>m.jsx(LF,{id:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,strokeWidth:l.strokeWidth,orient:l.orient},l.id))})}):null};z2.displayName="MarkerDefinitions";var OF=q.memo(z2);function H2({x:e,y:t,label:n,labelStyle:r,labelShowBg:a=!0,labelBgStyle:l,labelBgPadding:u=[2,4],labelBgBorderRadius:o=2,children:c,className:f,...p}){const[d,_]=q.useState({x:1,y:0,width:0,height:0}),v=Ft(["react-flow__edge-textwrapper",f]),w=q.useRef(null);return q.useEffect(()=>{if(w.current){const C=w.current.getBBox();_({x:C.x,y:C.y,width:C.width,height:C.height})}},[n]),n?m.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:v,visibility:d.width?"visible":"hidden",...p,children:[a&&m.jsx("rect",{width:d.width+2*u[0],x:-u[0],y:-u[1],height:d.height+2*u[1],className:"react-flow__edge-textbg",style:l,rx:o,ry:o}),m.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:w,style:r,children:n}),c]}):null}H2.displayName="EdgeText";const BF=q.memo(H2);function Ah({path:e,labelX:t,labelY:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:o,labelBgBorderRadius:c,interactionWidth:f=20,...p}){return m.jsxs(m.Fragment,{children:[m.jsx("path",{...p,d:e,fill:"none",className:Ft(["react-flow__edge-path",p.className])}),f?m.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}):null,r&&Zn(t)&&Zn(n)?m.jsx(BF,{x:t,y:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:o,labelBgBorderRadius:c}):null]})}function TS({pos:e,x1:t,y1:n,x2:r,y2:a}){return e===Me.Left||e===Me.Right?[.5*(t+r),n]:[t,.5*(n+a)]}function F2({sourceX:e,sourceY:t,sourcePosition:n=Me.Bottom,targetX:r,targetY:a,targetPosition:l=Me.Top}){const[u,o]=TS({pos:n,x1:e,y1:t,x2:r,y2:a}),[c,f]=TS({pos:l,x1:r,y1:a,x2:e,y2:t}),[p,d,_,v]=l2({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:u,sourceControlY:o,targetControlX:c,targetControlY:f});return[`M${e},${t} C${u},${o} ${c},${f} ${r},${a}`,p,d,_,v]}function P2(e){return q.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:u,targetPosition:o,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:b,interactionWidth:S})=>{const[x,y,E]=F2({sourceX:n,sourceY:r,sourcePosition:u,targetX:a,targetY:l,targetPosition:o}),R=e.isInternal?void 0:t;return m.jsx(Ah,{id:R,path:x,labelX:y,labelY:E,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:b,interactionWidth:S})})}const IF=P2({isInternal:!1}),U2=P2({isInternal:!0});IF.displayName="SimpleBezierEdge";U2.displayName="SimpleBezierEdgeInternal";function $2(e){return q.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,sourcePosition:v=Me.Bottom,targetPosition:w=Me.Top,markerEnd:C,markerStart:b,pathOptions:S,interactionWidth:x})=>{const[y,E,R]=fg({sourceX:n,sourceY:r,sourcePosition:v,targetX:a,targetY:l,targetPosition:w,borderRadius:S==null?void 0:S.borderRadius,offset:S==null?void 0:S.offset,stepPosition:S==null?void 0:S.stepPosition}),N=e.isInternal?void 0:t;return m.jsx(Ah,{id:N,path:y,labelX:E,labelY:R,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,markerEnd:C,markerStart:b,interactionWidth:x})})}const G2=$2({isInternal:!1}),q2=$2({isInternal:!0});G2.displayName="SmoothStepEdge";q2.displayName="SmoothStepEdgeInternal";function V2(e){return q.memo(({id:t,...n})=>{var a;const r=e.isInternal?void 0:t;return m.jsx(G2,{...n,id:r,pathOptions:q.useMemo(()=>{var l;return{borderRadius:0,offset:(l=n.pathOptions)==null?void 0:l.offset}},[(a=n.pathOptions)==null?void 0:a.offset])})})}const zF=V2({isInternal:!1}),Y2=V2({isInternal:!0});zF.displayName="StepEdge";Y2.displayName="StepEdgeInternal";function W2(e){return q.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,markerEnd:v,markerStart:w,interactionWidth:C})=>{const[b,S,x]=h2({sourceX:n,sourceY:r,targetX:a,targetY:l}),y=e.isInternal?void 0:t;return m.jsx(Ah,{id:y,path:b,labelX:S,labelY:x,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,markerEnd:v,markerStart:w,interactionWidth:C})})}const HF=W2({isInternal:!1}),X2=W2({isInternal:!0});HF.displayName="StraightEdge";X2.displayName="StraightEdgeInternal";function K2(e){return q.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:u=Me.Bottom,targetPosition:o=Me.Top,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:b,pathOptions:S,interactionWidth:x})=>{const[y,E,R]=c2({sourceX:n,sourceY:r,sourcePosition:u,targetX:a,targetY:l,targetPosition:o,curvature:S==null?void 0:S.curvature}),N=e.isInternal?void 0:t;return m.jsx(Ah,{id:N,path:y,labelX:E,labelY:R,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:b,interactionWidth:x})})}const FF=K2({isInternal:!1}),Z2=K2({isInternal:!0});FF.displayName="BezierEdge";Z2.displayName="BezierEdgeInternal";const RS={default:Z2,straight:X2,step:Y2,smoothstep:q2,simplebezier:U2},DS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},PF=(e,t,n)=>n===Me.Left?e-t:n===Me.Right?e+t:e,UF=(e,t,n)=>n===Me.Top?e-t:n===Me.Bottom?e+t:e,MS="react-flow__edgeupdater";function jS({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:a,onMouseEnter:l,onMouseOut:u,type:o}){return m.jsx("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:u,className:Ft([MS,`${MS}-${o}`]),cx:PF(t,r,e),cy:UF(n,r,e),r,stroke:"transparent",fill:"transparent"})}function $F({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:a,targetX:l,targetY:u,sourcePosition:o,targetPosition:c,onReconnect:f,onReconnectStart:p,onReconnectEnd:d,setReconnecting:_,setUpdateHover:v}){const w=Ct(),C=(E,R)=>{if(E.button!==0)return;const{autoPanOnConnect:N,domNode:D,connectionMode:T,connectionRadius:j,lib:B,onConnectStart:F,cancelConnection:Y,nodeLookup:H,rfId:z,panBy:V,updateConnection:G}=w.getState(),X=R.type==="target",K=(O,$)=>{_(!1),d==null||d(O,n,R.type,$)},L=O=>f==null?void 0:f(n,O),M=(O,$)=>{_(!0),p==null||p(E,n,R.type),F==null||F(O,$)};gg.onPointerDown(E.nativeEvent,{autoPanOnConnect:N,connectionMode:T,connectionRadius:j,domNode:D,handleId:R.id,nodeId:R.nodeId,nodeLookup:H,isTarget:X,edgeUpdaterType:R.type,lib:B,flowId:z,cancelConnection:Y,panBy:V,isValidConnection:(...O)=>{var $,U;return((U=($=w.getState()).isValidConnection)==null?void 0:U.call($,...O))??!0},onConnect:L,onConnectStart:M,onConnectEnd:(...O)=>{var $,U;return(U=($=w.getState()).onConnectEnd)==null?void 0:U.call($,...O)},onReconnectEnd:K,updateConnection:G,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:E.currentTarget})},b=E=>C(E,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),S=E=>C(E,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>v(!0),y=()=>v(!1);return m.jsxs(m.Fragment,{children:[(e===!0||e==="source")&&m.jsx(jS,{position:o,centerX:r,centerY:a,radius:t,onMouseDown:b,onMouseEnter:x,onMouseOut:y,type:"source"}),(e===!0||e==="target")&&m.jsx(jS,{position:c,centerX:l,centerY:u,radius:t,onMouseDown:S,onMouseEnter:x,onMouseOut:y,type:"target"})]})}function GF({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:a,onDoubleClick:l,onContextMenu:u,onMouseEnter:o,onMouseMove:c,onMouseLeave:f,reconnectRadius:p,onReconnect:d,onReconnectStart:_,onReconnectEnd:v,rfId:w,edgeTypes:C,noPanClassName:b,onError:S,disableKeyboardA11y:x}){let y=tt(he=>he.edgeLookup.get(e));const E=tt(he=>he.defaultEdgeOptions);y=E?{...E,...y}:y;let R=y.type||"default",N=(C==null?void 0:C[R])||RS[R];N===void 0&&(S==null||S("011",ei.error011(R)),R="default",N=(C==null?void 0:C.default)||RS.default);const D=!!(y.focusable||t&&typeof y.focusable>"u"),T=typeof d<"u"&&(y.reconnectable||n&&typeof y.reconnectable>"u"),j=!!(y.selectable||r&&typeof y.selectable>"u"),B=q.useRef(null),[F,Y]=q.useState(!1),[H,z]=q.useState(!1),V=Ct(),{zIndex:G=y.zIndex,sourceX:X,sourceY:K,targetX:L,targetY:M,sourcePosition:O,targetPosition:$}=tt(q.useCallback(he=>{const ye=he.nodeLookup.get(y.source),be=he.nodeLookup.get(y.target);if(!ye||!be)return DS;const ke=Rz({id:e,sourceNode:ye,targetNode:be,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:he.connectionMode,onError:S}),Ee=xz({selected:y.selected,zIndex:y.zIndex,sourceNode:ye,targetNode:be,elevateOnSelect:he.elevateEdgesOnSelect,zIndexMode:he.zIndexMode});return{...ke||DS,zIndex:Ee}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),At),U=q.useMemo(()=>y.markerStart?`url('#${dg(y.markerStart,w)}')`:void 0,[y.markerStart,w]),Q=q.useMemo(()=>y.markerEnd?`url('#${dg(y.markerEnd,w)}')`:void 0,[y.markerEnd,w]);if(y.hidden||X===null||K===null||L===null||M===null)return null;const re=he=>{var Ee;const{addSelectedEdges:ye,unselectNodesAndEdges:be,multiSelectionActive:ke}=V.getState();j&&(V.setState({nodesSelectionActive:!1}),y.selected&&ke?(be({nodes:[],edges:[y]}),(Ee=B.current)==null||Ee.blur()):ye([e])),a&&a(he,y)},ae=l?he=>{l(he,{...y})}:void 0,Z=u?he=>{u(he,{...y})}:void 0,P=o?he=>{o(he,{...y})}:void 0,ee=c?he=>{c(he,{...y})}:void 0,ne=f?he=>{f(he,{...y})}:void 0,ge=he=>{var ye;if(!x&&YC.includes(he.key)&&j){const{unselectNodesAndEdges:be,addSelectedEdges:ke}=V.getState();he.key==="Escape"?((ye=B.current)==null||ye.blur(),be({edges:[y]})):ke([e])}};return m.jsx("svg",{style:{zIndex:G},children:m.jsxs("g",{className:Ft(["react-flow__edge",`react-flow__edge-${R}`,y.className,b,{selected:y.selected,animated:y.animated,inactive:!j&&!a,updating:F,selectable:j}]),onClick:re,onDoubleClick:ae,onContextMenu:Z,onMouseEnter:P,onMouseMove:ee,onMouseLeave:ne,onKeyDown:D?ge:void 0,tabIndex:D?0:void 0,role:y.ariaRole??(D?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":D?`${k2}-${w}`:void 0,ref:B,...y.domAttributes,children:[!H&&m.jsx(N,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:j,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:X,sourceY:K,targetX:L,targetY:M,sourcePosition:O,targetPosition:$,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:U,markerEnd:Q,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),T&&m.jsx($F,{edge:y,isReconnectable:T,reconnectRadius:p,onReconnect:d,onReconnectStart:_,onReconnectEnd:v,sourceX:X,sourceY:K,targetX:L,targetY:M,sourcePosition:O,targetPosition:$,setUpdateHover:Y,setReconnecting:z})]})})}var qF=q.memo(GF);const VF=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Q2({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:a,onReconnect:l,onEdgeContextMenu:u,onEdgeMouseEnter:o,onEdgeMouseMove:c,onEdgeMouseLeave:f,onEdgeClick:p,reconnectRadius:d,onEdgeDoubleClick:_,onReconnectStart:v,onReconnectEnd:w,disableKeyboardA11y:C}){const{edgesFocusable:b,edgesReconnectable:S,elementsSelectable:x,onError:y}=tt(VF,At),E=RF(t);return m.jsxs("div",{className:"react-flow__edges",children:[m.jsx(OF,{defaultColor:e,rfId:n}),E.map(R=>m.jsx(qF,{id:R,edgesFocusable:b,edgesReconnectable:S,elementsSelectable:x,noPanClassName:a,onReconnect:l,onContextMenu:u,onMouseEnter:o,onMouseMove:c,onMouseLeave:f,onClick:p,reconnectRadius:d,onDoubleClick:_,onReconnectStart:v,onReconnectEnd:w,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:C},R))]})}Q2.displayName="EdgeRenderer";const YF=q.memo(Q2),LS=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function WF({children:e}){const t=Ct(),n=q.useRef(null),[r]=q.useState(()=>t.getState().transform);return R2(()=>{let a=null;const l=()=>{const u=t.getState().transform;a&&u[0]===a[0]&&u[1]===a[1]&&u[2]===a[2]||(a=u,n.current&&(n.current.style.transform=LS(u)))};return l(),t.subscribe(l)},[t]),m.jsx("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:LS(r)},children:e})}function XF(e){const t=Um(),n=q.useRef(!1);q.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const KF=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function ZF(e){const t=tt(KF),n=Ct();return q.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function QF(e){return e.connection.inProgress?{...e.connection,to:vl(e.connection.to,e.transform)}:{...e.connection}}function JF(e){return QF}function eP(e){const t=JF();return tt(t,At)}const tP=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function nP({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:a,width:l,height:u,isValid:o,inProgress:c}=tt(tP,At);return!(l&&a&&c)?null:m.jsx("svg",{style:e,width:l,height:u,className:"react-flow__connectionline react-flow__container",children:m.jsx("g",{className:Ft(["react-flow__connection",KC(o)]),children:m.jsx(J2,{style:t,type:n,CustomComponent:r,isValid:o})})})}const J2=({style:e,type:t=Er.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:a,from:l,fromNode:u,fromHandle:o,fromPosition:c,to:f,toNode:p,toHandle:d,toPosition:_,pointer:v}=eP();if(!a)return;if(n)return m.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:u,fromHandle:o,fromX:l.x,fromY:l.y,toX:f.x,toY:f.y,fromPosition:c,toPosition:_,connectionStatus:KC(r),toNode:p,toHandle:d,pointer:v});let w="";const C={sourceX:l.x,sourceY:l.y,sourcePosition:c,targetX:f.x,targetY:f.y,targetPosition:_};switch(t){case Er.Bezier:[w]=c2(C);break;case Er.SimpleBezier:[w]=F2(C);break;case Er.Step:[w]=fg({...C,borderRadius:0});break;case Er.SmoothStep:[w]=fg(C);break;default:[w]=h2(C)}return m.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:e})};J2.displayName="ConnectionLine";const iP={};function OS(e=iP){q.useRef(e),Ct(),q.useEffect(()=>{},[e])}function rP(){Ct(),q.useRef(!1),q.useEffect(()=>{},[])}function eE({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:d,onSelectionStart:_,onSelectionEnd:v,connectionLineType:w,connectionLineStyle:C,connectionLineComponent:b,connectionLineContainerStyle:S,selectionKeyCode:x,selectionOnDrag:y,selectionMode:E,multiSelectionKeyCode:R,panActivationKeyCode:N,zoomActivationKeyCode:D,deleteKeyCode:T,onlyRenderVisibleElements:j,elementsSelectable:B,defaultViewport:F,translateExtent:Y,minZoom:H,maxZoom:z,preventScrolling:V,defaultMarkerColor:G,zoomOnScroll:X,zoomOnPinch:K,panOnScroll:L,panOnScrollSpeed:M,panOnScrollMode:O,zoomOnDoubleClick:$,panOnDrag:U,autoPanOnSelection:Q,onPaneClick:re,onPaneMouseEnter:ae,onPaneMouseMove:Z,onPaneMouseLeave:P,onPaneScroll:ee,onPaneContextMenu:ne,paneClickDistance:ge,nodeClickDistance:he,onEdgeContextMenu:ye,onEdgeMouseEnter:be,onEdgeMouseMove:ke,onEdgeMouseLeave:Ee,reconnectRadius:Ce,onReconnect:rt,onReconnectStart:bt,onReconnectEnd:Ge,noDragClassName:ct,noWheelClassName:Pt,noPanClassName:ht,disableKeyboardA11y:Fe,nodeExtent:fe,rfId:ie,viewport:de,onViewportChange:Se,nodesDraggable:Ae}){return OS(e),OS(t),rP(),XF(n),ZF(de),m.jsx(bF,{onPaneClick:re,onPaneMouseEnter:ae,onPaneMouseMove:Z,onPaneMouseLeave:P,onPaneContextMenu:ne,onPaneScroll:ee,paneClickDistance:ge,deleteKeyCode:T,selectionKeyCode:x,selectionOnDrag:y,selectionMode:E,onSelectionStart:_,onSelectionEnd:v,multiSelectionKeyCode:R,panActivationKeyCode:N,zoomActivationKeyCode:D,elementsSelectable:B,zoomOnScroll:X,zoomOnPinch:K,zoomOnDoubleClick:$,panOnScroll:L,panOnScrollSpeed:M,panOnScrollMode:O,panOnDrag:U,autoPanOnSelection:Q,defaultViewport:F,translateExtent:Y,minZoom:H,maxZoom:z,onSelectionContextMenu:d,preventScrolling:V,noDragClassName:ct,noWheelClassName:Pt,noPanClassName:ht,disableKeyboardA11y:Fe,onViewportChange:Se,isControlledViewport:!!de,children:m.jsxs(WF,{children:[m.jsx(YF,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:u,onReconnect:rt,onReconnectStart:bt,onReconnectEnd:Ge,onlyRenderVisibleElements:j,onEdgeContextMenu:ye,onEdgeMouseEnter:be,onEdgeMouseMove:ke,onEdgeMouseLeave:Ee,reconnectRadius:Ce,defaultMarkerColor:G,noPanClassName:ht,disableKeyboardA11y:Fe,rfId:ie}),m.jsx(nP,{style:C,type:w,component:b,containerStyle:S}),m.jsx("div",{className:"react-flow__edgelabel-renderer"}),m.jsx(TF,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:l,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:f,onNodeContextMenu:p,nodeClickDistance:he,onlyRenderVisibleElements:j,noPanClassName:ht,noDragClassName:ct,disableKeyboardA11y:Fe,nodeExtent:fe,rfId:ie,nodesDraggable:Ae}),m.jsx("div",{className:"react-flow__viewport-portal"})]})})}eE.displayName="GraphView";const sP=q.memo(eE),aP=n2(),BS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:u,fitViewOptions:o,minZoom:c=.5,maxZoom:f=2,nodeOrigin:p,nodeExtent:d,zIndexMode:_="basic"}={})=>{const v=new Map,w=new Map,C=new Map,b=new Map,S=r??t??[],x=n??e??[],y=p??[0,0],E=d??tl;p2(C,b,S);const{nodesInitialized:R}=pg(x,v,w,{nodeOrigin:y,nodeExtent:E,zIndexMode:_});let N=[0,0,1];if(u&&a&&l){const D=ml(v,{filter:F=>!!((F.width||F.initialWidth)&&(F.height||F.initialHeight))}),{x:T,y:j,zoom:B}=Om(D,a,l,c,f,(o==null?void 0:o.padding)??.1);N=[T,j,B]}return{rfId:"1",width:a??0,height:l??0,transform:N,nodes:x,nodesInitialized:R,nodeLookup:v,parentLookup:w,edges:S,edgeLookup:b,connectionLookup:C,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:f,translateExtent:tl,nodeExtent:E,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ma.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:u??!1,fitViewOptions:o,fitViewResolver:null,connection:{...XC},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:aP,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:WC,zIndexMode:_,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},oP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:u,fitViewOptions:o,minZoom:c,maxZoom:f,nodeOrigin:p,nodeExtent:d,zIndexMode:_})=>yH((v,w)=>{async function C(){const{nodeLookup:b,panZoom:S,fitViewOptions:x,fitViewResolver:y,width:E,height:R,minZoom:N,maxZoom:D}=w();S&&(await gz({nodes:b,width:E,height:R,panZoom:S,minZoom:N,maxZoom:D},x),y==null||y.resolve(!0),v({fitViewResolver:null}))}return{...BS({nodes:e,edges:t,width:a,height:l,fitView:u,fitViewOptions:o,minZoom:c,maxZoom:f,nodeOrigin:p,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:_}),setNodes:b=>{const{nodeLookup:S,parentLookup:x,nodeOrigin:y,elevateNodesOnSelect:E,fitViewQueued:R,zIndexMode:N,nodesSelectionActive:D}=w(),{nodesInitialized:T,hasSelectedNodes:j}=pg(b,S,x,{nodeOrigin:y,nodeExtent:d,elevateNodesOnSelect:E,checkEquality:!0,zIndexMode:N}),B=D&&j;R&&T?(C(),v({nodes:b,nodesInitialized:T,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:B})):v({nodes:b,nodesInitialized:T,nodesSelectionActive:B})},setEdges:b=>{const{connectionLookup:S,edgeLookup:x}=w();p2(S,x,b),v({edges:b})},setDefaultNodesAndEdges:(b,S)=>{if(b){const{setNodes:x}=w();x(b),v({hasDefaultNodes:!0})}if(S){const{setEdges:x}=w();x(S),v({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:S,nodeLookup:x,parentLookup:y,domNode:E,nodeOrigin:R,nodeExtent:N,debug:D,fitViewQueued:T,zIndexMode:j}=w(),{changes:B,updatedInternals:F}=zz(b,x,y,E,R,N,j);F&&(Lz(x,y,{nodeOrigin:R,nodeExtent:N,zIndexMode:j}),T?(C(),v({fitViewQueued:!1,fitViewOptions:void 0})):v({}),(B==null?void 0:B.length)>0&&(D&&console.log("React Flow: trigger node changes",B),S==null||S(B)))},updateNodePositions:(b,S=!1)=>{const x=[];let y=[];const{nodeLookup:E,triggerNodeChanges:R,connection:N,updateConnection:D,onNodesChangeMiddlewareMap:T}=w();for(const[j,B]of b){const F=E.get(j),Y=!!(F!=null&&F.expandParent&&(F!=null&&F.parentId)&&(B!=null&&B.position)),H={id:j,type:"position",position:Y?{x:Math.max(0,B.position.x),y:Math.max(0,B.position.y)}:B.position,dragging:S};if(F&&N.inProgress&&N.fromNode.id===F.id){const z=ls(F,N.fromHandle,Me.Left,!0);D({...N,from:z})}Y&&F.parentId&&x.push({id:j,parentId:F.parentId,rect:{...B.internals.positionAbsolute,width:B.measured.width??0,height:B.measured.height??0}}),y.push(H)}if(x.length>0){const{parentLookup:j,nodeOrigin:B}=w(),F=Pm(x,E,j,B);y.push(...F)}for(const j of T.values())y=j(y);R(y)},triggerNodeChanges:b=>{const{onNodesChange:S,setNodes:x,nodes:y,hasDefaultNodes:E,debug:R}=w();if(b!=null&&b.length){if(E){const N=FH(b,y);x(N)}R&&console.log("React Flow: trigger node changes",b),S==null||S(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:S,setEdges:x,edges:y,hasDefaultEdges:E,debug:R}=w();if(b!=null&&b.length){if(E){const N=PH(b,y);x(N)}R&&console.log("React Flow: trigger edge changes",b),S==null||S(b)}},addSelectedNodes:b=>{const{multiSelectionActive:S,edgeLookup:x,nodeLookup:y,triggerNodeChanges:E,triggerEdgeChanges:R}=w();if(S){const N=b.map(D=>Zr(D,!0));E(N);return}E(ca(y,new Set([...b]),!0)),R(ca(x))},addSelectedEdges:b=>{const{multiSelectionActive:S,edgeLookup:x,nodeLookup:y,triggerNodeChanges:E,triggerEdgeChanges:R}=w();if(S){const N=b.map(D=>Zr(D,!0));R(N);return}R(ca(x,new Set([...b]))),E(ca(y,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:S}={})=>{const{edges:x,nodes:y,nodeLookup:E,triggerNodeChanges:R,triggerEdgeChanges:N}=w(),D=b||y,T=S||x,j=[];for(const F of D){if(!F.selected)continue;const Y=E.get(F.id);Y&&(Y.selected=!1),j.push(Zr(F.id,!1))}const B=[];for(const F of T)F.selected&&B.push(Zr(F.id,!1));R(j),N(B)},setMinZoom:b=>{const{panZoom:S,maxZoom:x}=w();S==null||S.setScaleExtent([b,x]),v({minZoom:b})},setMaxZoom:b=>{const{panZoom:S,minZoom:x}=w();S==null||S.setScaleExtent([x,b]),v({maxZoom:b})},setTranslateExtent:b=>{var S;(S=w().panZoom)==null||S.setTranslateExtent(b),v({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:S,triggerNodeChanges:x,triggerEdgeChanges:y,elementsSelectable:E}=w();if(!E)return;const R=S.reduce((D,T)=>T.selected?[...D,Zr(T.id,!1)]:D,[]),N=b.reduce((D,T)=>T.selected?[...D,Zr(T.id,!1)]:D,[]);x(R),y(N)},setNodeExtent:b=>{const{nodes:S,nodeLookup:x,parentLookup:y,nodeOrigin:E,elevateNodesOnSelect:R,nodeExtent:N,zIndexMode:D}=w();b[0][0]===N[0][0]&&b[0][1]===N[0][1]&&b[1][0]===N[1][0]&&b[1][1]===N[1][1]||(pg(S,x,y,{nodeOrigin:E,nodeExtent:b,elevateNodesOnSelect:R,checkEquality:!1,zIndexMode:D}),v({nodeExtent:b}))},panBy:b=>{const{transform:S,width:x,height:y,panZoom:E,translateExtent:R}=w();return Hz({delta:b,panZoom:E,transform:S,translateExtent:R,width:x,height:y})},setCenter:async(b,S,x)=>{const{width:y,height:E,maxZoom:R,panZoom:N}=w();if(!N)return!1;const D=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:R;return await N.setViewport({x:y/2-b*D,y:E/2-S*D,zoom:D},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{v({connection:{...XC}})},updateConnection:b=>{v({connection:b})},reset:()=>v({...BS()})}},Object.is);function lP({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:a,initialHeight:l,initialMinZoom:u,initialMaxZoom:o,initialFitViewOptions:c,fitView:f,nodeOrigin:p,nodeExtent:d,zIndexMode:_,children:v}){const[w]=q.useState(()=>oP({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:f,minZoom:u,maxZoom:o,fitViewOptions:c,nodeOrigin:p,nodeExtent:d,zIndexMode:_}));return m.jsx(bH,{value:w,children:m.jsx(VH,{children:m.jsx(oF,{children:v})})})}function cP({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:a,width:l,height:u,fitView:o,fitViewOptions:c,minZoom:f,maxZoom:p,nodeOrigin:d,nodeExtent:_,zIndexMode:v}){return q.useContext(Ch)?m.jsx(m.Fragment,{children:e}):m.jsx(lP,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:a,initialWidth:l,initialHeight:u,fitView:o,initialFitViewOptions:c,initialMinZoom:f,initialMaxZoom:p,nodeOrigin:d,nodeExtent:_,zIndexMode:v,children:e})}const uP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function hP({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:a,nodeTypes:l,edgeTypes:u,onNodeClick:o,onEdgeClick:c,onInit:f,onMove:p,onMoveStart:d,onMoveEnd:_,onConnect:v,onConnectStart:w,onConnectEnd:C,onClickConnectStart:b,onClickConnectEnd:S,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:E,onNodeContextMenu:R,onNodeDoubleClick:N,onNodeDragStart:D,onNodeDrag:T,onNodeDragStop:j,onNodesDelete:B,onEdgesDelete:F,onDelete:Y,onSelectionChange:H,onSelectionDragStart:z,onSelectionDrag:V,onSelectionDragStop:G,onSelectionContextMenu:X,onSelectionStart:K,onSelectionEnd:L,onBeforeDelete:M,connectionMode:O,connectionLineType:$=Er.Bezier,connectionLineStyle:U,connectionLineComponent:Q,connectionLineContainerStyle:re,deleteKeyCode:ae="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:P=!1,selectionMode:ee=nl.Full,panActivationKeyCode:ne="Space",multiSelectionKeyCode:ge=rl()?"Meta":"Control",zoomActivationKeyCode:he=rl()?"Meta":"Control",snapToGrid:ye,snapGrid:be,onlyRenderVisibleElements:ke=!1,selectNodesOnDrag:Ee,nodesDraggable:Ce,autoPanOnNodeFocus:rt,nodesConnectable:bt,nodesFocusable:Ge,nodeOrigin:ct=A2,edgesFocusable:Pt,edgesReconnectable:ht,elementsSelectable:Fe=!0,defaultViewport:fe=jH,minZoom:ie=.5,maxZoom:de=2,translateExtent:Se=tl,preventScrolling:Ae=!0,nodeExtent:De,defaultMarkerColor:Ve="#b1b1b7",zoomOnScroll:Ie=!0,zoomOnPinch:Nt=!0,panOnScroll:Et=!1,panOnScrollSpeed:qt=.5,panOnScrollMode:st=ts.Free,zoomOnDoubleClick:Ln=!0,panOnDrag:Ut=!0,onPaneClick:ps,onPaneMouseEnter:mi,onPaneMouseMove:_i,onPaneMouseLeave:vi,onPaneScroll:On,onPaneContextMenu:yi,paneClickDistance:ni=1,nodeClickDistance:oe=0,children:we,onReconnect:Ne,onReconnectStart:qe,onReconnectEnd:at,onEdgeContextMenu:bi,onEdgeDoubleClick:nn,onEdgeMouseEnter:gs,onEdgeMouseMove:ka,onEdgeMouseLeave:Aa,reconnectRadius:yl=10,onNodesChange:bl,onEdgesChange:ii,noDragClassName:$t="nodrag",noWheelClassName:Qt="nowheel",noPanClassName:Si="nopan",fitView:ms,fitViewOptions:Sl,connectOnClick:Nh,attributionPosition:xl,proOptions:Rr,defaultEdgeOptions:Na,elevateNodesOnSelect:Yi=!0,elevateEdgesOnSelect:Wi=!1,disableKeyboardA11y:Xi=!1,autoPanOnConnect:Ki,autoPanOnNodeDrag:Lt,autoPanOnSelection:wl=!0,autoPanSpeed:Cl,connectionRadius:xi,isValidConnection:Zi,onError:Th,style:El,id:Ta,nodeDragThreshold:Rh,connectionDragThreshold:_s,viewport:vs,onViewportChange:qn,width:an,height:kl,colorMode:Dh="light",debug:Ra,onScroll:Dr,ariaLabelConfig:ys,zIndexMode:Al="basic",...on},Da){const bs=Ta||"1",Ma=IH(Dh),Qi=q.useCallback(ja=>{ja.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Dr==null||Dr(ja)},[Dr]);return m.jsx("div",{"data-testid":"rf__wrapper",...on,onScroll:Qi,style:{...El,...uP},ref:Da,className:Ft(["react-flow",a,Ma]),id:Ta,role:"application",children:m.jsxs(cP,{nodes:e,edges:t,width:an,height:kl,fitView:ms,fitViewOptions:Sl,minZoom:ie,maxZoom:de,nodeOrigin:ct,nodeExtent:De,zIndexMode:Al,children:[m.jsx(BH,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:v,onConnectStart:w,onConnectEnd:C,onClickConnectStart:b,onClickConnectEnd:S,nodesDraggable:Ce,autoPanOnNodeFocus:rt,nodesConnectable:bt,nodesFocusable:Ge,edgesFocusable:Pt,edgesReconnectable:ht,elementsSelectable:Fe,elevateNodesOnSelect:Yi,elevateEdgesOnSelect:Wi,minZoom:ie,maxZoom:de,nodeExtent:De,onNodesChange:bl,onEdgesChange:ii,snapToGrid:ye,snapGrid:be,connectionMode:O,translateExtent:Se,connectOnClick:Nh,defaultEdgeOptions:Na,fitView:ms,fitViewOptions:Sl,onNodesDelete:B,onEdgesDelete:F,onDelete:Y,onNodeDragStart:D,onNodeDrag:T,onNodeDragStop:j,onSelectionDrag:V,onSelectionDragStart:z,onSelectionDragStop:G,onMove:p,onMoveStart:d,onMoveEnd:_,noPanClassName:Si,nodeOrigin:ct,rfId:bs,autoPanOnConnect:Ki,autoPanOnNodeDrag:Lt,autoPanSpeed:Cl,onError:Th,connectionRadius:xi,isValidConnection:Zi,selectNodesOnDrag:Ee,nodeDragThreshold:Rh,connectionDragThreshold:_s,onBeforeDelete:M,debug:Ra,ariaLabelConfig:ys,zIndexMode:Al}),m.jsx(sP,{onInit:f,onNodeClick:o,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:E,onNodeContextMenu:R,onNodeDoubleClick:N,nodeTypes:l,edgeTypes:u,connectionLineType:$,connectionLineStyle:U,connectionLineComponent:Q,connectionLineContainerStyle:re,selectionKeyCode:Z,selectionOnDrag:P,selectionMode:ee,deleteKeyCode:ae,multiSelectionKeyCode:ge,panActivationKeyCode:ne,zoomActivationKeyCode:he,onlyRenderVisibleElements:ke,defaultViewport:fe,translateExtent:Se,minZoom:ie,maxZoom:de,preventScrolling:Ae,zoomOnScroll:Ie,zoomOnPinch:Nt,zoomOnDoubleClick:Ln,panOnScroll:Et,panOnScrollSpeed:qt,panOnScrollMode:st,panOnDrag:Ut,autoPanOnSelection:wl,onPaneClick:ps,onPaneMouseEnter:mi,onPaneMouseMove:_i,onPaneMouseLeave:vi,onPaneScroll:On,onPaneContextMenu:yi,paneClickDistance:ni,nodeClickDistance:oe,onSelectionContextMenu:X,onSelectionStart:K,onSelectionEnd:L,onReconnect:Ne,onReconnectStart:qe,onReconnectEnd:at,onEdgeContextMenu:bi,onEdgeDoubleClick:nn,onEdgeMouseEnter:gs,onEdgeMouseMove:ka,onEdgeMouseLeave:Aa,reconnectRadius:yl,defaultMarkerColor:Ve,noDragClassName:$t,noWheelClassName:Qt,noPanClassName:Si,rfId:bs,disableKeyboardA11y:Xi,nodeExtent:De,viewport:vs,onViewportChange:qn,nodesDraggable:Ce}),m.jsx(MH,{onSelectionChange:H}),we,m.jsx(AH,{proOptions:Rr,position:xl}),m.jsx(kH,{rfId:bs,disableKeyboardA11y:Xi})]})})}var fP=T2(hP);function dP({dimensions:e,lineWidth:t,variant:n,className:r}){return m.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Ft(["react-flow__background-pattern",n,r])})}function pP({radius:e,className:t}){return m.jsx("circle",{cx:e,cy:e,r:e,className:Ft(["react-flow__background-pattern","dots",t])})}var Ui;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ui||(Ui={}));const gP={[Ui.Dots]:1,[Ui.Lines]:1,[Ui.Cross]:6},mP=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function tE({id:e,variant:t=Ui.Dots,gap:n=20,size:r,lineWidth:a=1,offset:l=0,color:u,bgColor:o,style:c,className:f,patternClassName:p}){const d=q.useRef(null),{transform:_,patternId:v}=tt(mP,At),w=r||gP[t],C=t===Ui.Dots,b=t===Ui.Cross,S=Array.isArray(n)?n:[n,n],x=[S[0]*_[2]||1,S[1]*_[2]||1],y=w*_[2],E=Array.isArray(l)?l:[l,l],R=b?[y,y]:x,N=[E[0]*_[2]||1+R[0]/2,E[1]*_[2]||1+R[1]/2],D=`${v}${e||""}`;return m.jsxs("svg",{className:Ft(["react-flow__background",f]),style:{...c,...kh,"--xy-background-color-props":o,"--xy-background-pattern-color-props":u},ref:d,"data-testid":"rf__background",children:[m.jsx("pattern",{id:D,x:_[0]%x[0],y:_[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${N[0]},-${N[1]})`,children:C?m.jsx(pP,{radius:y/2,className:p}):m.jsx(dP,{dimensions:R,lineWidth:a,variant:t,className:p})}),m.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${D})`})]})}tE.displayName="Background";const _P=q.memo(tE);function vP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:m.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function yP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:m.jsx("path",{d:"M0 0h32v4.2H0z"})})}function bP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:m.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function SP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function xP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function su({children:e,className:t,...n}){return m.jsx("button",{type:"button",className:Ft(["react-flow__controls-button",t]),...n,children:e})}const wP=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function nE({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:u,onFitView:o,onInteractiveChange:c,className:f,children:p,position:d="bottom-left",orientation:_="vertical","aria-label":v}){const w=Ct(),{isInteractive:C,minZoomReached:b,maxZoomReached:S,ariaLabelConfig:x}=tt(wP,At),{zoomIn:y,zoomOut:E,fitView:R}=Um(),N=()=>{y(),l==null||l()},D=()=>{E(),u==null||u()},T=()=>{R(a),o==null||o()},j=()=>{w.setState({nodesDraggable:!C,nodesConnectable:!C,elementsSelectable:!C}),c==null||c(!C)},B=_==="horizontal"?"horizontal":"vertical";return m.jsxs(Eh,{className:Ft(["react-flow__controls",B,f]),position:d,style:e,"data-testid":"rf__controls","aria-label":v??x["controls.ariaLabel"],children:[t&&m.jsxs(m.Fragment,{children:[m.jsx(su,{onClick:N,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:S,children:m.jsx(vP,{})}),m.jsx(su,{onClick:D,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:b,children:m.jsx(yP,{})})]}),n&&m.jsx(su,{className:"react-flow__controls-fitview",onClick:T,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:m.jsx(bP,{})}),r&&m.jsx(su,{className:"react-flow__controls-interactive",onClick:j,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:C?m.jsx(xP,{}):m.jsx(SP,{})}),p]})}nE.displayName="Controls";q.memo(nE);function CP({id:e,x:t,y:n,width:r,height:a,style:l,color:u,strokeColor:o,strokeWidth:c,className:f,borderRadius:p,shapeRendering:d,selected:_,onClick:v}){const{background:w,backgroundColor:C}=l||{},b=u||w||C;return m.jsx("rect",{className:Ft(["react-flow__minimap-node",{selected:_},f]),x:t,y:n,rx:p,ry:p,width:r,height:a,style:{fill:b,stroke:o,strokeWidth:c},shapeRendering:d,onClick:v?S=>v(S,e):void 0})}const EP=q.memo(CP),kP=e=>e.nodes.map(t=>t.id),kp=e=>e instanceof Function?e:()=>e;function AP({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:l=EP,onClick:u}){const o=tt(kP,At),c=kp(t),f=kp(e),p=kp(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return m.jsx(m.Fragment,{children:o.map(_=>m.jsx(TP,{id:_,nodeColorFunc:c,nodeStrokeColorFunc:f,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:a,NodeComponent:l,onClick:u,shapeRendering:d},_))})}function NP({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:a,nodeStrokeWidth:l,shapeRendering:u,NodeComponent:o,onClick:c}){const{node:f,x:p,y:d,width:_,height:v}=tt(w=>{const C=w.nodeLookup.get(e);if(!C)return{node:void 0,x:0,y:0,width:0,height:0};const b=C.internals.userNode,{x:S,y:x}=C.internals.positionAbsolute,{width:y,height:E}=gi(b);return{node:b,x:S,y:x,width:y,height:E}},At);return!f||f.hidden||!i2(f)?null:m.jsx(o,{x:p,y:d,width:_,height:v,style:f.style,selected:!!f.selected,className:r(f),color:t(f),borderRadius:a,strokeColor:n(f),strokeWidth:l,shapeRendering:u,onClick:c,id:f.id})}const TP=q.memo(NP);var RP=q.memo(AP);const DP=200,MP=150,jP=e=>!e.hidden,LP=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?e2(ml(e.nodeLookup,{filter:jP}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},IS=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,OP=(e,t)=>IS(e.viewBB,t.viewBB)&&IS(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,BP="react-flow__minimap-desc";function iE({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:u,nodeComponent:o,bgColor:c,maskColor:f,maskStrokeColor:p,maskStrokeWidth:d,position:_="bottom-right",onClick:v,onNodeClick:w,pannable:C=!1,zoomable:b=!1,ariaLabel:S,inversePan:x,zoomStep:y=1,offsetScale:E=5}){const R=Ct(),N=q.useRef(null),{boundingRect:D,viewBB:T,rfId:j,panZoom:B,translateExtent:F,flowWidth:Y,flowHeight:H,ariaLabelConfig:z}=tt(LP,OP),V=(e==null?void 0:e.width)??DP,G=(e==null?void 0:e.height)??MP,X=D.width/V,K=D.height/G,L=Math.max(X,K),M=L*V,O=L*G,$=E*L,U=D.x-(M-D.width)/2-$,Q=D.y-(O-D.height)/2-$,re=M+$*2,ae=O+$*2,Z=`${BP}-${j}`,P=q.useRef(0),ee=q.useRef();P.current=L,q.useEffect(()=>{if(N.current&&B)return ee.current=Wz({domNode:N.current,panZoom:B,getTransform:()=>R.getState().transform,getViewScale:()=>P.current}),()=>{var ye;(ye=ee.current)==null||ye.destroy()}},[B]),q.useEffect(()=>{var ye;(ye=ee.current)==null||ye.update({translateExtent:F,width:Y,height:H,inversePan:x,pannable:C,zoomStep:y,zoomable:b})},[C,b,x,y,F,Y,H]);const ne=v?ye=>{var Ee;const[be,ke]=((Ee=ee.current)==null?void 0:Ee.pointer(ye))||[0,0];v(ye,{x:be,y:ke})}:void 0,ge=w?q.useCallback((ye,be)=>{const ke=R.getState().nodeLookup.get(be).internals.userNode;w(ye,ke)},[]):void 0,he=S??z["minimap.ariaLabel"];return m.jsx(Eh,{position:_,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*L:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof u=="number"?u:void 0},className:Ft(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:m.jsxs("svg",{width:V,height:G,viewBox:`${U} ${Q} ${re} ${ae}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:N,onClick:ne,children:[he&&m.jsx("title",{id:Z,children:he}),m.jsx(RP,{onClick:ge,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:u,nodeComponent:o}),m.jsx("path",{className:"react-flow__minimap-mask",d:`M${U-$},${Q-$}h${re+$*2}v${ae+$*2}h${-re-$*2}z - M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}iE.displayName="MiniMap";q.memo(iE);const IP=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,zP={[ya.Line]:"right",[ya.Handle]:"bottom-right"};function HP({nodeId:e,position:t,variant:n=ya.Handle,className:r,style:a=void 0,children:l,color:u,minWidth:o=10,minHeight:c=10,maxWidth:f=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:_,autoScale:v=!0,shouldResize:w,onResizeStart:C,onResize:b,onResizeEnd:S}){const x=L2(),y=typeof e=="string"?e:x,E=Ct(),R=q.useRef(null),N=n===ya.Handle,D=tt(q.useCallback(IP(N&&v),[N,v]),At),T=q.useRef(null),j=t??zP[n];q.useEffect(()=>{if(!(!R.current||!y))return T.current||(T.current=oH({domNode:R.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:F,transform:Y,snapGrid:H,snapToGrid:z,nodeOrigin:V,domNode:G}=E.getState();return{nodeLookup:F,transform:Y,snapGrid:H,snapToGrid:z,nodeOrigin:V,paneDomNode:G}},onChange:(F,Y)=>{const{triggerNodeChanges:H,nodeLookup:z,parentLookup:V,nodeOrigin:G}=E.getState(),X=[],K={x:F.x,y:F.y},L=z.get(y);if(L&&L.expandParent&&L.parentId){const M=L.origin??G,O=F.width??L.measured.width??0,$=F.height??L.measured.height??0,U={id:L.id,parentId:L.parentId,rect:{width:O,height:$,...r2({x:F.x??L.position.x,y:F.y??L.position.y},{width:O,height:$},L.parentId,z,M)}},Q=Pm([U],z,V,G);X.push(...Q),K.x=F.x?Math.max(M[0]*O,F.x):void 0,K.y=F.y?Math.max(M[1]*$,F.y):void 0}if(K.x!==void 0&&K.y!==void 0){const M={id:y,type:"position",position:{...K}};X.push(M)}if(F.width!==void 0&&F.height!==void 0){const O={id:y,type:"dimensions",resizing:!0,setAttributes:_?_==="horizontal"?"width":"height":!0,dimensions:{width:F.width,height:F.height}};X.push(O)}for(const M of Y){const O={...M,type:"position"};X.push(O)}H(X)},onEnd:({width:F,height:Y})=>{const H={id:y,type:"dimensions",resizing:!1,dimensions:{width:F,height:Y}};E.getState().triggerNodeChanges([H])}})),T.current.update({controlPosition:j,boundaries:{minWidth:o,minHeight:c,maxWidth:f,maxHeight:p},keepAspectRatio:d,resizeDirection:_,onResizeStart:C,onResize:b,onResizeEnd:S,shouldResize:w}),()=>{var F;(F=T.current)==null||F.destroy()}},[j,o,c,f,p,d,C,b,S,w]);const B=j.split("-");return m.jsx("div",{className:Ft(["react-flow__resize-control","nodrag",...B,n,r]),ref:R,style:{...a,scale:D,...u&&{[N?"backgroundColor":"borderColor"]:u}},children:l})}q.memo(HP);const _g=264,FP=132,yu=44,PP=72;function UP(e){const t=new Map(e.map(l=>[l.id,{exp:l,children:[]}])),n=[];for(const l of e){const u=t.get(l.id),o=l.parentExperimentId?t.get(l.parentExperimentId):void 0;o?o.children.push(u):n.push(u)}const r=(l,u)=>l.exp.createdAt-u.exp.createdAt,a=l=>{l.children.sort(r),l.children.forEach(a)};return n.sort(r),n.forEach(a),n}function bu(e){if(e.children.length===0)return _g;const t=e.children.reduce((n,r)=>n+bu(r),0)+yu*(e.children.length-1);return Math.max(_g,t)}function $P(e){return e==="done"?"pass":e==="failed"?"fail":e==="running"||e==="starting"?"live":"other"}const GP=q.memo(function({data:t}){const{exp:n,latestRun:r,runs:a,isBaseline:l,githubOwner:u,githubRepo:o,onOpenView:c,onOpenCodeBranch:f}=t,p=r==null?void 0:r.status,d=p==="running"||p==="starting",_=l?"BASELINE":d?"RUNNING":"EXPERIMENT",v=a.slice(-8);return m.jsxs("div",{className:`exp-node ${d?"live":""}`,children:[m.jsx(ba,{type:"target",position:Me.Top}),m.jsxs("div",{className:"node-eyebrow",children:[m.jsx("span",{children:_}),m.jsx(Vo,{status:p??"idle"})]}),m.jsx("div",{className:"node-head",children:m.jsx("span",{className:"node-slug",children:n.slug})}),(n.title||n.description)&&m.jsx("div",{className:"node-title",children:n.title||n.description}),m.jsxs("div",{className:"node-meta",children:[m.jsx("span",{children:"RUNS"}),v.length>0?m.jsx("span",{className:"run-squares",children:v.map(w=>m.jsx("span",{className:`run-sq ${$P(w.status)}`,title:w.status},w.id))}):m.jsx("span",{children:"no runs"}),m.jsx("span",{style:{flex:1}}),r&&m.jsx("span",{children:Sa(r.createdAt)})]}),m.jsxs("div",{className:"node-actions",onClick:w=>w.stopPropagation(),children:[m.jsxs("button",{className:"node-action",title:"Open changes",onClick:()=>c(n.id,"changes"),children:[m.jsx($u,{size:13}),"Changes"]}),a.length>0&&m.jsxs("button",{className:"node-action",title:"Open logs",onClick:()=>c(n.id,"terminal"),children:[m.jsx(XS,{size:13}),"Logs"]}),m.jsxs("button",{className:"node-action",title:`Browse code on ${n.branchName}`,onClick:()=>f(n.branchName),children:[m.jsx(VS,{size:13}),"Code"]}),m.jsx("a",{className:"node-action node-action-ext",title:`Open ${n.branchName} on GitHub`,"aria-label":`Open ${n.branchName} on GitHub`,href:xg(u,o,n.branchName),target:"_blank",rel:"noopener noreferrer",onClick:w=>w.stopPropagation(),children:m.jsx(pm,{size:13})})]}),m.jsx(ba,{type:"source",position:Me.Bottom})]})}),qP={exp:GP},VP={type:"default",style:{stroke:"var(--text)",strokeWidth:1.5,opacity:.3}};function YP({experiments:e,runs:t,project:n,onOpenView:r,onOpenCodeBranch:a}){const{nodes:l,edges:u}=q.useMemo(()=>{const o=new Map;for(const v of t){const w=o.get(v.experimentId);w?w.push(v):o.set(v.experimentId,[v])}for(const v of o.values())v.sort((w,C)=>w.createdAt-C.createdAt);const c=[],f=[],p=UP(e);function d(v,w,C){const b=o.get(v.exp.id)??[];if(c.push({id:v.exp.id,type:"exp",position:{x:w-_g/2,y:C},data:{exp:v.exp,latestRun:b[b.length-1]??null,runs:b,isBaseline:!v.exp.parentExperimentId,githubOwner:n.githubOwner,githubRepo:n.githubRepo,onOpenView:r,onOpenCodeBranch:a}}),v.children.length===0)return;const S=v.children.reduce((y,E)=>y+bu(E),0)+yu*(v.children.length-1);let x=w-S/2;for(const y of v.children){const E=bu(y);f.push({id:`e-${v.exp.id}-${y.exp.id}`,source:v.exp.id,target:y.exp.id}),d(y,x+E/2,C+FP+PP),x+=E+yu}}let _=0;for(const v of p){const w=bu(v);d(v,_+w/2,0),_+=w+yu}return{nodes:c,edges:f}},[e,t,r,a,n.githubOwner,n.githubRepo]);return e.length===0?m.jsxs("div",{className:"empty-state empty-state-cta",children:[m.jsx("p",{className:"empty-state-title",children:"No experiments yet"}),m.jsx("p",{className:"empty-state-hint",children:"Ask the agent in chat to create and run your first experiment."})]}):m.jsx(fP,{nodes:l,edges:u,nodeTypes:qP,defaultEdgeOptions:VP,nodesDraggable:!1,nodesConnectable:!1,nodesFocusable:!1,minZoom:.15,fitView:!0,fitViewOptions:{padding:.25,maxZoom:1},children:m.jsx(_P,{variant:Ui.Dots,color:"var(--dots-strong)",gap:28,size:1.6})})}const au=(e,t)=>e.id===t.id&&e.view===t.view,ou=(e,t)=>e.path===t.path&&e.sessionId===t.sessionId&&e.ref===t.ref,zS=e=>`${e.sessionId??""}:${e.ref??""}:${e.path}`;function WP(e,t,n){let r=e,a;const l=t==null?void 0:t.replace(/\/+$/,"");if(!r.startsWith("/"))a=n;else if(l&&(r===l||r.startsWith(`${l}/`)))r=r.slice(l.length).replace(/^\/+/,"");else{const u=r.match(/\/openresearch\/worktrees\/[^/]+\/[^/]+\/([^/]+)\/(.+)$/),o=u?null:r.match(/\/openresearch\/repos\/[^/]+\/[^/]+\/(.+)$/);u?(a=u[1],r=u[2]):o&&(r=o[1])}return r?{path:r,sessionId:a}:null}const HS="orx:onboarded",rE="orx:panel-width",Fu=360,XP=10,KP=232,ZP=380,QP=KP+56,JP=80;function vg(){return Math.max(Fu,window.innerWidth-QP-ZP)}function eU(){const e=vg();try{const t=Number(localStorage.getItem(rE));if(Number.isFinite(t)&&t>=Fu)return Math.min(t,e)}catch{}return Math.max(Fu,Math.min(760,e,Math.round(window.innerWidth*.42)))}function lu(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const r=e.slice();return r[n]=t,r}function tU(){var ht,Fe;const[e,t]=q.useState(null),[n,r]=q.useState(null),[a,l]=q.useState([]),[u,o]=q.useState([]),[c,f]=q.useState(null),[p,d]=q.useState("tree"),[_,v]=q.useState(null),[w,C]=q.useState("experiments"),[b,S]=q.useState([]),[x,y]=q.useState([]),[E,R]=q.useState([]),[N,D]=q.useState(null),[T,j]=q.useState(!0),[B,F]=q.useState(!1),[Y,H]=q.useState(eU),[z,V]=q.useState(!0),[G,X]=q.useState(!1),[K,L]=q.useState("chat"),[M,O]=q.useState(()=>{try{return localStorage.getItem(HS)==="1"}catch{return!0}}),$=q.useRef(n);$.current=n,q.useEffect(()=>{DN().then(fe=>{t(fe),r(ie=>{var de;return ie??((de=fe[0])==null?void 0:de.id)??null})}).catch(()=>t([]))},[]),q.useEffect(()=>{const fe=()=>H(ie=>Math.min(ie,vg()));return window.addEventListener("resize",fe),()=>window.removeEventListener("resize",fe)},[]),q.useEffect(()=>{n&&(ON(n).catch(()=>{}),l([]),o([]),f(null),v(null),S([]),y([]),R([]),D(null),C("experiments"),IN(n).then(l).catch(()=>{}),zN(n).then(o).catch(()=>{}),Iy(n).then(f).catch(()=>{}))},[n]);const U=q.useCallback(()=>{const fe=$.current;fe&&Iy(fe).then(f).catch(()=>{})},[]);DT({onRun:fe=>{fe.projectId===$.current&&o(ie=>lu(ie,fe))},onExperiment:fe=>{fe.projectId===$.current&&l(ie=>lu(ie,fe))},onProject:fe=>{t(ie=>ie?lu(ie,fe):[fe])},onFiles:fe=>{fe===$.current&&U()}});const Q=q.useCallback((fe,ie="changes")=>{const de={id:fe,view:ie};S(Se=>Se.some(Ae=>au(Ae,de))?Se:[...Se,de]),C(de),j(!0)},[]),re=q.useCallback(fe=>{const ie=b.findIndex(Se=>au(Se,fe));if(ie===-1)return;const de=b.filter((Se,Ae)=>Ae!==ie);S(de),typeof w=="object"&&"view"in w&&au(w,fe)&&C(de[Math.min(ie,de.length-1)]??"experiments")},[b,w]),ae=q.useCallback((fe,ie,de)=>{var De;const Se=(De=e==null?void 0:e.find(Ve=>Ve.id===n))==null?void 0:De.repoPath,Ae=WP(fe,Se,ie);Ae&&(de&&(Ae.ref=de),y(Ve=>Ve.some(Ie=>ou(Ie,Ae))?Ve:[...Ve,Ae]),C(Ae),j(!0))},[e,n]),Z=q.useCallback(fe=>{const ie=x.findIndex(Se=>ou(Se,fe));if(ie===-1)return;const de=x.filter((Se,Ae)=>Ae!==ie);y(de),typeof w=="object"&&"path"in w&&ou(w,fe)&&C(de[Math.min(ie,de.length-1)]??"experiments")},[x,w]),P=q.useCallback((fe,ie,de)=>{const Se={kind:"plan",sessionId:ie,promptId:de,plan:fe};R(Ae=>{const De=Ae.findIndex(Ie=>Ie.promptId===de);if(De===-1)return[...Ae,Se];const Ve=Ae.slice();return Ve[De]=Se,Ve}),C(Se),j(!0)},[]),ee=q.useCallback(fe=>{const ie=E.findIndex(Se=>Se.promptId===fe.promptId);if(ie===-1)return;const de=E.filter((Se,Ae)=>Ae!==ie);R(de),typeof w=="object"&&"kind"in w&&w.promptId===fe.promptId&&C(de[Math.min(ie,de.length-1)]??"experiments")},[E,w]),ne=q.useCallback(fe=>{const ie={code:!0,sel:fe,toggled:new Set};D(de=>de?{...de,sel:fe}:ie),C(ie),j(!0)},[]),ge=q.useCallback(fe=>{D(ie=>ie&&{...ie,...fe})},[]),he=q.useCallback(()=>{D(null),C(fe=>typeof fe=="object"&&"code"in fe?"experiments":fe)},[]),ye=fe=>{fe.preventDefault(),fe.currentTarget.setPointerCapture(fe.pointerId);const ie=document.body.style.userSelect;document.body.style.userSelect="none";const de=Ae=>{const De=Math.round(window.innerWidth-Ae.clientX-XP),Ve=vg();if(De>Ve+JP){F(!0);return}F(!1);const Ie=Math.min(Math.max(De,Fu),Ve);H(Ie);try{localStorage.setItem(rE,String(Ie))}catch{}},Se=()=>{window.removeEventListener("pointermove",de),window.removeEventListener("pointerup",Se),window.removeEventListener("pointercancel",Se),document.body.style.userSelect=ie};window.addEventListener("pointermove",de),window.addEventListener("pointerup",Se),window.addEventListener("pointercancel",Se)},be=fe=>{t(ie=>ie?lu(ie,fe):[fe]),r(fe.id),X(!1)},ke=fe=>{t(ie=>ie&&ie.filter(de=>de.id!==fe)),n===fe&&r(null)},Ee=typeof w=="object"&&"view"in w?w:null,Ce=typeof w=="object"&&"path"in w?w:null,rt=typeof w=="object"&&"kind"in w?w:null,bt=typeof w=="object"&&"code"in w,Ge=(e==null?void 0:e.find(fe=>fe.id===n))??null,ct=Ee?a.find(fe=>fe.id===Ee.id)??null:null;if(e===null)return m.jsx("div",{className:"app",children:m.jsx("div",{className:"empty-state",children:m.jsx("span",{className:"spinner"})})});if(e.length===0)return m.jsx("div",{className:"app",children:M?m.jsx(Nb,{projects:e,onOpen:r,onCreated:be,onDeleted:ke}):m.jsx(SB,{onDone:()=>{try{localStorage.setItem(HS,"1")}catch{}O(!0)}})});const Pt=m.jsx(bB,{projectName:((ht=e.find(fe=>fe.id===n))==null?void 0:ht.name)??"",onHome:()=>X(!0),onCollapse:()=>V(!1)});return m.jsx("div",{className:"app",children:G?m.jsx(Nb,{projects:e,onOpen:fe=>{r(fe),X(!1)},onCreated:be,onDeleted:ke}):m.jsxs("div",{className:"app-body",children:[n&&m.jsx(ML,{projectId:n,paperId:(Fe=e.find(fe=>fe.id===n))==null?void 0:Fe.paperId,railHeader:Pt,railOpen:z,onShowRail:()=>V(!0),mainView:K,onSelectMainView:L,panelOpen:T,onTogglePanel:()=>{T&&F(!1),j(!T)},onOpenFile:ae,onOpenPlan:P,children:K==="files"?(()=>{const fe=e.find(ie=>ie.id===n);return fe?m.jsx(GL,{project:fe,files:c,onChanged:U,onOpenStorage:()=>L("storage")}):null})():K!=="chat"?m.jsx(_L,{tab:K}):null}),K==="chat"&&T&&m.jsxs("aside",{className:`right-pane floating-panel ${B?"max":""}`,style:B?void 0:{width:Y},children:[!B&&m.jsx("div",{className:"panel-resizer",onPointerDown:ye}),m.jsxs("div",{className:"tabs",children:[m.jsxs("div",{className:"tab-strip",children:[m.jsx("button",{className:`tab ${w==="experiments"?"active":""}`,onClick:()=>C("experiments"),children:"Experiments"}),b.map(fe=>{const ie=a.find(de=>de.id===fe.id);return m.jsx(Gc,{active:Ee!==null&&au(Ee,fe),label:ie?ie.title||ie.slug:"…",icon:fe.view==="terminal"?m.jsx(XS,{size:12,style:{flexShrink:0}}):m.jsx($u,{size:12,style:{flexShrink:0}}),onSelect:()=>C(fe),onClose:()=>re(fe)},`${fe.id}:${fe.view}`)}),x.map(fe=>m.jsx(Gc,{active:Ce!==null&&ou(Ce,fe),label:fe.path.split("/").pop()||fe.path,icon:m.jsx(GS,{size:12,style:{flexShrink:0}}),onSelect:()=>C(fe),onClose:()=>Z(fe)},`file:${zS(fe)}`)),E.map(fe=>m.jsx(Gc,{active:rt!==null&&rt.promptId===fe.promptId,label:"Plan",icon:m.jsx(WS,{size:12,style:{flexShrink:0}}),onSelect:()=>C(fe),onClose:()=>ee(fe)},`plan:${fe.promptId}`)),N&&m.jsx(Gc,{active:bt,label:"Code",icon:m.jsx(VS,{size:12,style:{flexShrink:0}}),onSelect:()=>C(N),onClose:he},"code")]}),m.jsxs("div",{className:"panel-controls",children:[m.jsx("button",{className:"icon-btn",title:B?"Restore panel":"Expand panel","aria-label":B?"Restore panel":"Expand panel",onClick:()=>F(fe=>!fe),children:B?m.jsx(_N,{size:14}):m.jsx(gN,{size:14})}),m.jsx("button",{className:"icon-btn",title:"Close panel","aria-label":"Close panel",onClick:()=>{j(!1),F(!1)},children:m.jsx(Fo,{size:14})})]})]}),w==="experiments"?m.jsxs("div",{className:"tab-body",children:[m.jsx("div",{className:"pane-toolbar",children:m.jsxs("div",{className:"seg",children:[m.jsx("button",{className:p==="tree"?"active":"",onClick:()=>d("tree"),children:"Tree"}),m.jsx("button",{className:p==="table"?"active":"",onClick:()=>d("table"),children:"Table"})]})}),m.jsx("div",{className:"pane-content",children:p==="tree"?Ge&&m.jsx(YP,{experiments:a,runs:u,project:Ge,onOpenView:Q,onOpenCodeBranch:ne}):m.jsx(DB,{runs:u,experiments:a,onOpen:fe=>{v(fe.id),Q(fe.experimentId,"terminal")},onOpenChanges:fe=>Q(fe,"changes"),onCancel:fe=>void ZS(fe).catch(()=>{})})})]}):Ce?m.jsx("div",{className:"tab-body",children:n&&m.jsx(yB,{projectId:n,path:Ce.path,sessionId:Ce.sessionId,gitRef:Ce.ref,onOpenFile:ae},zS(Ce))}):rt?m.jsx("div",{className:"tab-body",children:m.jsx("div",{className:"pane-content plan-tab-content",children:m.jsx(qo,{text:rt.plan,onOpenFile:fe=>ae(fe,rt.sessionId)})})}):bt?m.jsx("div",{className:"tab-body",children:n&&Ge&&N&&m.jsx(OL,{projectId:n,project:Ge,experiments:a,sel:N.sel,toggled:N.toggled,onSelChange:fe=>ge({sel:fe}),onToggledChange:fe=>ge({toggled:fe}),onOpenFile:ae},"code")}):m.jsx("div",{className:"tab-body",children:Ee&&ct&&Ge&&m.jsx(gB,{experiment:ct,project:Ge,view:Ee.view,runs:u,selectedRunId:_,onSelectRun:v},`${Ee.id}:${Ee.view}`)})]})]})})}yA.createRoot(document.getElementById("root")).render(m.jsx(q.StrictMode,{children:m.jsx(tU,{})})); +`)),p=f.reduce((d,_)=>d.concat(..._),[]);return[f,p]}return[[],[]]},[e]);return V.useEffect(()=>{const c=(t==null?void 0:t.target)??vS,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=v=>{var b,S;if(a.current=v.ctrlKey||v.metaKey||v.shiftKey||v.altKey,(!a.current||a.current&&!f)&&i2(v))return!1;const C=bS(v.code,o);if(l.current.add(v[C]),yS(u,l.current,!1)){const x=((S=(b=v.composedPath)==null?void 0:b.call(v))==null?void 0:S[0])||v.target,y=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(a.current||!y)&&v.preventDefault(),r(!0)}},d=v=>{const w=bS(v.code,o);yS(u,l.current,!0)?(r(!1),l.current.clear()):l.current.delete(v[w]),v.key==="Meta"&&l.current.clear(),a.current=!1},_=()=>{l.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",p),c==null||c.addEventListener("keyup",d),window.addEventListener("blur",_),window.addEventListener("contextmenu",_),()=>{c==null||c.removeEventListener("keydown",p),c==null||c.removeEventListener("keyup",d),window.removeEventListener("blur",_),window.removeEventListener("contextmenu",_)}}},[e,r]),n}function yS(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(a=>t.has(a)))}function bS(e,t){return t.includes(e)?"code":"key"}const OH=()=>{const e=At();return V.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,a,l],panZoom:u}=e.getState();return u?(await u.setViewport({x:t.x??r,y:t.y??a,zoom:t.zoom??l},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:a,minZoom:l,maxZoom:u,panZoom:o}=e.getState(),c=Om(t,r,a,l,u,(n==null?void 0:n.padding)??.1);return o?(await o.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:a,snapToGrid:l,domNode:u}=e.getState();if(!u)return t;const{x:o,y:c}=u.getBoundingClientRect(),f={x:t.x-o,y:t.y-c},p=n.snapGrid??a,d=n.snapToGrid??l;return vl(f,r,d,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:a,y:l}=r.getBoundingClientRect(),u=va(t,n);return{x:u.x+a,y:u.y+l}}}),[])};function E2(e,t){const n=[],r=new Map,a=[];for(const l of e)if(l.type==="add"){a.push(l);continue}else if(l.type==="remove"||l.type==="replace")r.set(l.id,[l]);else{const u=r.get(l.id);u?u.push(l):r.set(l.id,[l])}for(const l of t){const u=r.get(l.id);if(!u){n.push(l);continue}if(u[0].type==="remove")continue;if(u[0].type==="replace"){n.push({...u[0].item});continue}const o={...l};for(const c of u)BH(c,o);n.push(o)}return a.length&&a.forEach(l=>{l.index!==void 0?n.splice(l.index,0,{...l.item}):n.push({...l.item})}),n}function BH(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function IH(e,t){return E2(e,t)}function zH(e,t){return E2(e,t)}function Zr(e,t){return{id:e,type:"select",selected:t}}function ca(e,t=new Set,n=!1){const r=[];for(const[a,l]of e){const u=t.has(a);!(l.selected===void 0&&!u)&&l.selected!==u&&(n&&(l.selected=u),r.push(Zr(l.id,u)))}return r}function SS({items:e=[],lookup:t}){var a;const n=[],r=new Map(e.map(l=>[l.id,l]));for(const[l,u]of e.entries()){const o=t.get(u.id),c=((a=o==null?void 0:o.internals)==null?void 0:a.userNode)??o;c!==void 0&&c!==u&&n.push({id:u.id,item:u,type:"replace"}),c===void 0&&n.push({item:u,type:"add",index:l})}for(const[l]of t)r.get(l)===void 0&&n.push({id:l,type:"remove"});return n}function xS(e){return{id:e.id,type:"remove"}}const HH=JC();function FH(e,t,n={}){return wz(e,t,{...n,onError:n.onError??HH})}const wS=e=>lz(e),PH=e=>WC(e);function k2(e){return V.forwardRef(e)}const UH=typeof window<"u"?V.useLayoutEffect:V.useEffect;function CS(e){const[t,n]=V.useState(BigInt(0)),[r]=V.useState(()=>$H(()=>n(a=>a+BigInt(1))));return UH(()=>{const a=r.get();a.length&&(e(a),r.reset())},[t]),r}function $H(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const A2=V.createContext(null);function GH({children:e}){const t=At(),n=V.useCallback(o=>{const{nodes:c=[],setNodes:f,hasDefaultNodes:p,onNodesChange:d,nodeLookup:_,fitViewQueued:v,onNodesChangeMiddlewareMap:w}=t.getState();let C=c;for(const S of o)C=typeof S=="function"?S(C):S;let b=SS({items:C,lookup:_});for(const S of w.values())b=S(b);p&&f(C),b.length>0?d==null||d(b):v&&window.requestAnimationFrame(()=>{const{fitViewQueued:S,nodes:x,setNodes:y}=t.getState();S&&y(x)})},[]),r=CS(n),a=V.useCallback(o=>{const{edges:c=[],setEdges:f,hasDefaultEdges:p,onEdgesChange:d,edgeLookup:_}=t.getState();let v=c;for(const w of o)v=typeof w=="function"?w(v):w;p?f(v):d&&d(SS({items:v,lookup:_}))},[]),l=CS(a),u=V.useMemo(()=>({nodeQueue:r,edgeQueue:l}),[]);return m.jsx(A2.Provider,{value:u,children:e})}function qH(){const e=V.useContext(A2);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const VH=e=>!!e.panZoom;function Um(){const e=OH(),t=At(),n=qH(),r=tt(VH),a=V.useMemo(()=>{const l=d=>t.getState().nodeLookup.get(d),u=d=>{n.nodeQueue.push(d)},o=d=>{n.edgeQueue.push(d)},c=d=>{var S,x;const{nodeLookup:_,nodeOrigin:v}=t.getState(),w=wS(d)?d:_.get(d.id),C=w.parentId?t2(w.position,w.measured,w.parentId,_,v):w.position,b={...w,position:C,width:((S=w.measured)==null?void 0:S.width)??w.width,height:((x=w.measured)==null?void 0:x.height)??w.height};return il(b)},f=(d,_,v={replace:!1})=>{u(w=>w.map(C=>{if(C.id===d){const b=typeof _=="function"?_(C):_;return v.replace&&wS(b)?b:{...C,...b}}return C}))},p=(d,_,v={replace:!1})=>{o(w=>w.map(C=>{if(C.id===d){const b=typeof _=="function"?_(C):_;return v.replace&&PH(b)?b:{...C,...b}}return C}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>{var _;return(_=l(d))==null?void 0:_.internals.userNode},getInternalNode:l,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(_=>({..._}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:u,setEdges:o,addNodes:d=>{const _=Array.isArray(d)?d:[d];n.nodeQueue.push(v=>[...v,..._])},addEdges:d=>{const _=Array.isArray(d)?d:[d];n.edgeQueue.push(v=>[...v,..._])},toObject:()=>{const{nodes:d=[],edges:_=[],transform:v}=t.getState(),[w,C,b]=v;return{nodes:d.map(S=>({...S})),edges:_.map(S=>({...S})),viewport:{x:w,y:C,zoom:b}}},deleteElements:async({nodes:d=[],edges:_=[]})=>{const{nodes:v,edges:w,onNodesDelete:C,onEdgesDelete:b,triggerNodeChanges:S,triggerEdgeChanges:x,onDelete:y,onBeforeDelete:E}=t.getState(),{nodes:R,edges:N}=await dz({nodesToRemove:d,edgesToRemove:_,nodes:v,edges:w,onBeforeDelete:E}),D=N.length>0,T=R.length>0;if(D){const j=N.map(xS);b==null||b(N),x(j)}if(T){const j=R.map(xS);C==null||C(R),S(j)}return(T||D)&&(y==null||y({nodes:R,edges:N})),{deletedNodes:R,deletedEdges:N}},getIntersectingNodes:(d,_=!0,v)=>{const w=Wb(d),C=w?d:c(d),b=v!==void 0;return C?(v||t.getState().nodes).filter(S=>{const x=t.getState().nodeLookup.get(S.id);if(x&&!w&&(S.id===d.id||!x.internals.positionAbsolute))return!1;const y=il(b?S:x),E=zu(y,C);return _&&E>0||E>=y.width*y.height||E>=C.width*C.height}):[]},isNodeIntersecting:(d,_,v=!0)=>{const C=Wb(d)?d:c(d);if(!C)return!1;const b=zu(C,_);return v&&b>0||b>=_.width*_.height||b>=C.width*C.height},updateNode:f,updateNodeData:(d,_,v={replace:!1})=>{f(d,w=>{const C=typeof _=="function"?_(w):_;return v.replace?{...w,data:C}:{...w,data:{...w.data,...C}}},v)},updateEdge:p,updateEdgeData:(d,_,v={replace:!1})=>{p(d,w=>{const C=typeof _=="function"?_(w):_;return v.replace?{...w,data:C}:{...w,data:{...w.data,...C}}},v)},getNodesBounds:d=>{const{nodeLookup:_,nodeOrigin:v}=t.getState();return cz(d,{nodeLookup:_,nodeOrigin:v})},getHandleConnections:({type:d,id:_,nodeId:v})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${v}-${d}${_?`-${_}`:""}`))==null?void 0:w.values())??[])},getNodeConnections:({type:d,handleId:_,nodeId:v})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${v}${d?_?`-${d}-${_}`:`-${d}`:""}`))==null?void 0:w.values())??[])},fitView:async d=>{const _=t.getState().fitViewResolver??mz();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:_}),n.nodeQueue.push(v=>[...v]),_.promise}}},[]);return V.useMemo(()=>({...a,...e,viewportInitialized:r}),[r])}const ES=e=>e.selected,YH=typeof window<"u"?window:void 0;function WH({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=At(),{deleteElements:r}=Um(),a=sl(e,{actInsideInputWithModifier:!1}),l=sl(t,{target:YH});V.useEffect(()=>{if(a){const{edges:u,nodes:o}=n.getState();r({nodes:o.filter(ES),edges:u.filter(ES)}),n.setState({nodesSelectionActive:!1})}},[a]),V.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])}function XH(e){const t=At();V.useEffect(()=>{const n=()=>{var a,l,u,o;if(!e.current||!(((l=(a=e.current).checkVisibility)==null?void 0:l.call(a))??!0))return!1;const r=Bm(e.current);(r.height===0||r.width===0)&&((o=(u=t.getState()).onError)==null||o.call(u,"004",ei.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const kh={position:"absolute",width:"100%",height:"100%",top:0,left:0},KH=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function ZH({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=ts.Free,zoomOnDoubleClick:u=!0,panOnDrag:o=!0,defaultViewport:c,translateExtent:f,minZoom:p,maxZoom:d,zoomActivationKeyCode:_,preventScrolling:v=!0,children:w,noWheelClassName:C,noPanClassName:b,onViewportChange:S,isControlledViewport:x,paneClickDistance:y,selectionOnDrag:E}){const R=At(),N=V.useRef(null),{userSelectionActive:D,lib:T,connectionInProgress:j}=tt(KH,kt),B=sl(_),z=V.useRef();XH(N);const G=V.useCallback(U=>{S==null||S({x:U[0],y:U[1],zoom:U[2]}),x||R.setState({transform:U})},[S,x]);return V.useEffect(()=>{if(N.current){z.current=Jz({domNode:N.current,minZoom:p,maxZoom:d,translateExtent:f,viewport:c,onDraggingChange:q=>R.setState(X=>X.paneDragging===q?X:{paneDragging:q}),onPanZoomStart:(q,X)=>{const{onViewportChangeStart:K,onMoveStart:L}=R.getState();L==null||L(q,X),K==null||K(X)},onPanZoom:(q,X)=>{const{onViewportChange:K,onMove:L}=R.getState();L==null||L(q,X),K==null||K(X)},onPanZoomEnd:(q,X)=>{const{onViewportChangeEnd:K,onMoveEnd:L}=R.getState();L==null||L(q,X),K==null||K(X)}});const{x:U,y:H,zoom:Y}=z.current.getViewport();return R.setState({panZoom:z.current,transform:[U,H,Y],domNode:N.current.closest(".react-flow")}),()=>{var q;(q=z.current)==null||q.destroy()}}},[]),V.useEffect(()=>{var U;(U=z.current)==null||U.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:a,panOnScrollMode:l,zoomOnDoubleClick:u,panOnDrag:o,zoomActivationKeyPressed:B,preventScrolling:v,noPanClassName:b,userSelectionActive:D,noWheelClassName:C,lib:T,onTransformChange:G,connectionInProgress:j,selectionOnDrag:E,paneClickDistance:y})},[e,t,n,r,a,l,u,o,B,v,b,D,C,T,G,j,E,y]),m.jsx("div",{className:"react-flow__renderer",ref:N,style:kh,children:w})}const QH=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function JH(){const{userSelectionActive:e,userSelectionRect:t}=tt(QH,kt);return e&&t?m.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Ep=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},eF=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function tF({isSelecting:e,selectionKeyPressed:t,selectionMode:n=nl.Full,panOnDrag:r,autoPanOnSelection:a,paneClickDistance:l,selectionOnDrag:u,onSelectionStart:o,onSelectionEnd:c,onPaneClick:f,onPaneContextMenu:p,onPaneScroll:d,onPaneMouseEnter:_,onPaneMouseMove:v,onPaneMouseLeave:w,children:C}){const b=V.useRef(0),S=At(),{userSelectionActive:x,elementsSelectable:y,dragging:E,panBy:R,autoPanSpeed:N}=tt(eF,kt),D=y&&(e||x),T=V.useRef(null),j=V.useRef(),B=V.useRef(new Set),z=V.useRef(new Set),G=V.useRef(!1),U=V.useRef(!1),H=V.useRef({x:0,y:0}),Y=V.useRef(!1),q=P=>{if(U.current||G.current||S.getState().connection.inProgress){U.current=!1,G.current=!1;return}f==null||f(P),S.getState().resetSelectedElements(),S.setState({nodesSelectionActive:!1})},X=P=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){P.preventDefault();return}p==null||p(P)},K=d?P=>d(P):void 0,L=P=>{U.current&&(P.stopPropagation(),U.current=!1)},M=P=>{var Ce,rt;const{domNode:ee,transform:ne}=S.getState();if(j.current=ee==null?void 0:ee.getBoundingClientRect(),!j.current)return;const ge=P.target===T.current;if(!ge&&!!P.target.closest(".nokey")||!e||!(u&&ge||t)||P.button!==0||!P.isPrimary)return;(rt=(Ce=P.target)==null?void 0:Ce.setPointerCapture)==null||rt.call(Ce,P.pointerId),U.current=!1;const{x:be,y:ke}=Qn(P.nativeEvent,j.current),Ee=vl({x:be,y:ke},ne);S.setState({userSelectionRect:{width:0,height:0,startX:Ee.x,startY:Ee.y,x:be,y:ke}}),ge||(P.stopPropagation(),P.preventDefault())};function O(P,ee){const{userSelectionRect:ne}=S.getState();if(!ne)return;const{transform:ge,nodeLookup:he,edgeLookup:ye,connectionLookup:be,triggerNodeChanges:ke,triggerEdgeChanges:Ee,defaultEdgeOptions:Ce}=S.getState(),rt={x:ne.startX,y:ne.startY},{x:bt,y:Ge}=va(rt,ge),ct={startX:rt.x,startY:rt.y,x:Pfe.id)),z.current=new Set;const Fe=(Ce==null?void 0:Ce.selectable)??!0;for(const fe of B.current){const ie=be.get(fe);if(ie)for(const{edgeId:de}of ie.values()){const Se=ye.get(de);Se&&(Se.selectable??Fe)&&z.current.add(de)}}if(!Xb(Pt,B.current)){const fe=ca(he,B.current,!0);ke(fe)}if(!Xb(ht,z.current)){const fe=ca(ye,z.current);Ee(fe)}S.setState({userSelectionRect:ct,userSelectionActive:!0,nodesSelectionActive:!1})}function $(){if(!a||!j.current)return;const[P,ee]=Lm(H.current,j.current,N);R({x:P,y:ee}).then(ne=>{if(!U.current||!ne){b.current=requestAnimationFrame($);return}const{x:ge,y:he}=H.current;O(ge,he),b.current=requestAnimationFrame($)})}const F=()=>{cancelAnimationFrame(b.current),b.current=0,Y.current=!1};V.useEffect(()=>()=>F(),[]);const Q=P=>{const{userSelectionRect:ee,transform:ne,resetSelectedElements:ge}=S.getState();if(!j.current||!ee)return;const{x:he,y:ye}=Qn(P.nativeEvent,j.current);H.current={x:he,y:ye};const be=va({x:ee.startX,y:ee.startY},ne);if(!U.current){const ke=t?0:l;if(Math.hypot(he-be.x,ye-be.y)<=ke)return;ge(),o==null||o(P)}U.current=!0,Y.current||($(),Y.current=!0),O(he,ye)},re=P=>{var ee,ne;if(!D){P.target===T.current&&S.getState().connection.inProgress&&(G.current=!0);return}P.button===0&&((ne=(ee=P.target)==null?void 0:ee.releasePointerCapture)==null||ne.call(ee,P.pointerId),!x&&P.target===T.current&&S.getState().userSelectionRect&&(q==null||q(P)),S.setState({userSelectionActive:!1,userSelectionRect:null}),U.current&&(c==null||c(P),S.setState({nodesSelectionActive:B.current.size>0})),F())},ae=P=>{var ee,ne;(ne=(ee=P.target)==null?void 0:ee.releasePointerCapture)==null||ne.call(ee,P.pointerId),F()},Z=r===!0||Array.isArray(r)&&r.includes(0);return m.jsxs("div",{className:Ft(["react-flow__pane",{draggable:Z,dragging:E,selection:e}]),onClick:D?void 0:Ep(q,T),onContextMenu:Ep(X,T),onWheel:Ep(K,T),onPointerEnter:D?void 0:_,onPointerMove:D?Q:v,onPointerUp:re,onPointerCancel:D?ae:void 0,onPointerDownCapture:D?M:void 0,onClickCapture:D?L:void 0,onPointerLeave:w,ref:T,style:kh,children:[C,m.jsx(JH,{})]})}function mg({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:u,nodeLookup:o,onError:c}=t.getState(),f=o.get(e);if(!f){c==null||c("012",ei.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(n||f.selected&&u)&&(l({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var p;return(p=r==null?void 0:r.current)==null?void 0:p.blur()})):a([e])}function N2({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:a,isSelectable:l,nodeClickDistance:u}){const o=At(),[c,f]=V.useState(!1),p=V.useRef();return V.useEffect(()=>{p.current=Hz({getStoreItems:()=>o.getState(),onNodeMouseDown:d=>{mg({id:d,store:o,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}})},[]),V.useEffect(()=>{if(!(t||!e.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:l,nodeId:a,nodeClickDistance:u}),()=>{var d;(d=p.current)==null||d.destroy()}},[n,r,t,l,e,a,u]),c}const nF=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function T2(){const e=At();return V.useCallback(n=>{const{nodeExtent:r,snapToGrid:a,snapGrid:l,nodesDraggable:u,onError:o,updateNodePositions:c,nodeLookup:f,nodeOrigin:p}=e.getState(),d=new Map,_=nF(u),v=a?l[0]:5,w=a?l[1]:5,C=n.direction.x*v*n.factor,b=n.direction.y*w*n.factor;for(const[,S]of f){if(!_(S))continue;let x={x:S.internals.positionAbsolute.x+C,y:S.internals.positionAbsolute.y+b};a&&(x=_l(x,l));const{position:y,positionAbsolute:E}=XC({nodeId:S.id,nextPosition:x,nodeLookup:f,nodeExtent:r,nodeOrigin:p,onError:o});S.position=y,S.internals.positionAbsolute=E,d.set(S.id,S)}c(d)},[])}const $m=V.createContext(null),iF=$m.Provider;$m.Consumer;const R2=()=>V.useContext($m),rF=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),D2=V.createContext(null);function sF({children:e}){const t=tt(rF,kt);return m.jsx(D2.Provider,{value:t,children:e})}function aF(){const e=V.useContext(D2);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const oF={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},lF=(e,t,n)=>r=>{const{connectionClickStartHandle:a,connectionMode:l,connection:u}=r,{fromHandle:o,toHandle:c,isValid:f}=u;if(!o&&!a)return oF;const p=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,connectingTo:p,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,isPossibleEndHandle:l===ma.Strict?(o==null?void 0:o.type)!==n:e!==(o==null?void 0:o.nodeId)||t!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!a,valid:p&&f}};function cF({type:e="source",position:t=Me.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:u,onConnect:o,children:c,className:f,onMouseDown:p,onTouchStart:d,..._},v){var Y,q;const w=u||null,C=e==="target",b=At(),S=R2(),{connectOnClick:x,noPanClassName:y,rfId:E}=aF(),{connectingFrom:R,connectingTo:N,clickConnecting:D,isPossibleEndHandle:T,connectionInProcess:j,clickConnectionInProcess:B,valid:z}=tt(lF(S,w,e),kt);S||(q=(Y=b.getState()).onError)==null||q.call(Y,"010",ei.error010());const G=X=>{const{defaultEdgeOptions:K,onConnect:L,hasDefaultEdges:M}=b.getState(),O={...K,...X};if(M){const{edges:$,setEdges:F,onError:Q}=b.getState();F(FH(O,$,{onError:Q}))}L==null||L(O),o==null||o(O)},U=X=>{if(!S)return;const K=r2(X.nativeEvent);if(a&&(K&&X.button===0||!K)){const L=b.getState();gg.onPointerDown(X.nativeEvent,{handleDomNode:X.currentTarget,autoPanOnConnect:L.autoPanOnConnect,connectionMode:L.connectionMode,connectionRadius:L.connectionRadius,domNode:L.domNode,nodeLookup:L.nodeLookup,lib:L.lib,isTarget:C,handleId:w,nodeId:S,flowId:L.rfId,panBy:L.panBy,cancelConnection:L.cancelConnection,onConnectStart:L.onConnectStart,onConnectEnd:(...M)=>{var O,$;return($=(O=b.getState()).onConnectEnd)==null?void 0:$.call(O,...M)},updateConnection:L.updateConnection,onConnect:G,isValidConnection:n||((...M)=>{var O,$;return(($=(O=b.getState()).isValidConnection)==null?void 0:$.call(O,...M))??!0}),getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:L.autoPanSpeed,dragThreshold:L.connectionDragThreshold})}K?p==null||p(X):d==null||d(X)},H=X=>{const{onClickConnectStart:K,onClickConnectEnd:L,connectionClickStartHandle:M,connectionMode:O,isValidConnection:$,lib:F,rfId:Q,nodeLookup:re,connection:ae}=b.getState();if(!S||!M&&!a)return;if(!M){K==null||K(X.nativeEvent,{nodeId:S,handleId:w,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:S,type:e,id:w}});return}const Z=n2(X.target),P=n||$,{connection:ee,isValid:ne}=gg.isValid(X.nativeEvent,{handle:{nodeId:S,id:w,type:e},connectionMode:O,fromNodeId:M.nodeId,fromHandleId:M.id||null,fromType:M.type,isValidConnection:P,flowId:Q,doc:Z,lib:F,nodeLookup:re});ne&&ee&&G(ee);const ge=structuredClone(ae);delete ge.inProgress,ge.toPosition=ge.toHandle?ge.toHandle.position:null,L==null||L(X,ge),b.setState({connectionClickStartHandle:null})};return m.jsx("div",{"data-handleid":w,"data-nodeid":S,"data-handlepos":t,"data-id":`${E}-${S}-${w}-${e}`,className:Ft(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",y,f,{source:!C,target:C,connectable:r,connectablestart:a,connectableend:l,clickconnecting:D,connectingfrom:R,connectingto:N,valid:z,connectionindicator:r&&(!j||T)&&(j||B?l:a)}]),onMouseDown:U,onTouchStart:U,onClick:x?H:void 0,ref:v,..._,children:c})}const ba=V.memo(k2(cF));function uF({data:e,isConnectable:t,sourcePosition:n=Me.Bottom}){return m.jsxs(m.Fragment,{children:[e==null?void 0:e.label,m.jsx(ba,{type:"source",position:n,isConnectable:t})]})}function hF({data:e,isConnectable:t,targetPosition:n=Me.Top,sourcePosition:r=Me.Bottom}){return m.jsxs(m.Fragment,{children:[m.jsx(ba,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,m.jsx(ba,{type:"source",position:r,isConnectable:t})]})}function fF(){return null}function dF({data:e,isConnectable:t,targetPosition:n=Me.Top}){return m.jsxs(m.Fragment,{children:[m.jsx(ba,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Hu={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},kS={input:uF,default:hF,output:dF,group:fF};function pF(e){var t,n,r,a;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((a=e.style)==null?void 0:a.height)}}const gF=e=>{const{width:t,height:n,x:r,y:a}=ml(e.nodeLookup,{filter:l=>!!l.selected});return{width:Zn(t)?t:null,height:Zn(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${a}px)`}};function mF({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=At(),{width:a,height:l,transformString:u,userSelectionActive:o}=tt(gF,kt),c=T2(),f=V.useRef(null);V.useEffect(()=>{var v;n||(v=f.current)==null||v.focus({preventScroll:!0})},[n]);const p=!o&&a!==null&&l!==null;if(N2({nodeRef:f,disabled:!p}),!p)return null;const d=e?v=>{const w=r.getState().nodes.filter(C=>C.selected);e(v,w)}:void 0,_=v=>{Object.prototype.hasOwnProperty.call(Hu,v.key)&&(v.preventDefault(),c({direction:Hu[v.key],factor:v.shiftKey?4:1}))};return m.jsx("div",{className:Ft(["react-flow__nodesselection","react-flow__container",t]),style:{transform:u},children:m.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:_,style:{width:a,height:l}})})}const AS=typeof window<"u"?window:void 0,_F=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function M2({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:u,paneClickDistance:o,deleteKeyCode:c,selectionKeyCode:f,selectionOnDrag:p,selectionMode:d,onSelectionStart:_,onSelectionEnd:v,multiSelectionKeyCode:w,panActivationKeyCode:C,zoomActivationKeyCode:b,elementsSelectable:S,zoomOnScroll:x,zoomOnPinch:y,panOnScroll:E,panOnScrollSpeed:R,panOnScrollMode:N,zoomOnDoubleClick:D,panOnDrag:T,autoPanOnSelection:j,defaultViewport:B,translateExtent:z,minZoom:G,maxZoom:U,preventScrolling:H,onSelectionContextMenu:Y,noWheelClassName:q,noPanClassName:X,disableKeyboardA11y:K,onViewportChange:L,isControlledViewport:M}){const{nodesSelectionActive:O,userSelectionActive:$}=tt(_F,kt),F=sl(f,{target:AS}),Q=sl(C,{target:AS}),re=Q||T,ae=Q||E,Z=p&&re!==!0,P=F||$||Z;return WH({deleteKeyCode:c,multiSelectionKeyCode:w}),m.jsx(ZH,{onPaneContextMenu:l,elementsSelectable:S,zoomOnScroll:x,zoomOnPinch:y,panOnScroll:ae,panOnScrollSpeed:R,panOnScrollMode:N,zoomOnDoubleClick:D,panOnDrag:!F&&re,defaultViewport:B,translateExtent:z,minZoom:G,maxZoom:U,zoomActivationKeyCode:b,preventScrolling:H,noWheelClassName:q,noPanClassName:X,onViewportChange:L,isControlledViewport:M,paneClickDistance:o,selectionOnDrag:Z,children:m.jsxs(tF,{onSelectionStart:_,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:re,autoPanOnSelection:j,isSelecting:!!P,selectionMode:d,selectionKeyPressed:F,paneClickDistance:o,selectionOnDrag:Z,children:[e,O&&m.jsx(mF,{onSelectionContextMenu:Y,noPanClassName:X,disableKeyboardA11y:K})]})})}M2.displayName="FlowRenderer";const vF=V.memo(M2),yF=e=>t=>e?jm(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function bF(e){return tt(V.useCallback(yF(e),[e]),kt)}const SF=e=>e.updateNodeInternals;function xF(){const e=tt(SF),[t]=V.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(a=>{const l=a.target.getAttribute("data-id");r.set(l,{id:l,nodeElement:a.target,force:!0})}),e(r)}));return V.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function wF({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const a=At(),l=V.useRef(null),u=V.useRef(null),o=V.useRef(e.sourcePosition),c=V.useRef(e.targetPosition),f=V.useRef(t),p=n&&!!e.internals.handleBounds;return V.useEffect(()=>{l.current&&!e.hidden&&(!p||u.current!==l.current)&&(u.current&&(r==null||r.unobserve(u.current)),r==null||r.observe(l.current),u.current=l.current)},[p,e.hidden]),V.useEffect(()=>()=>{u.current&&(r==null||r.unobserve(u.current),u.current=null)},[]),V.useEffect(()=>{if(l.current){const d=f.current!==t,_=o.current!==e.sourcePosition,v=c.current!==e.targetPosition;(d||_||v)&&(f.current=t,o.current=e.sourcePosition,c.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:l.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),l}function CF({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:a,onContextMenu:l,onDoubleClick:u,nodesDraggable:o,elementsSelectable:c,nodesConnectable:f,nodesFocusable:p,resizeObserver:d,noDragClassName:_,noPanClassName:v,disableKeyboardA11y:w,rfId:C,nodeTypes:b,nodeClickDistance:S,onError:x}){const{node:y,internals:E,isParent:R}=tt(P=>{const ee=P.nodeLookup.get(e),ne=P.parentLookup.has(e);return{node:ee,internals:ee.internals,isParent:ne}},kt);let N=y.type||"default",D=(b==null?void 0:b[N])||kS[N];D===void 0&&(x==null||x("003",ei.error003(N)),N="default",D=(b==null?void 0:b.default)||kS.default);const T=!!(y.draggable||o&&typeof y.draggable>"u"),j=!!(y.selectable||c&&typeof y.selectable>"u"),B=!!(y.connectable||f&&typeof y.connectable>"u"),z=!!(y.focusable||p&&typeof y.focusable>"u"),G=At(),U=e2(y),H=wF({node:y,nodeType:N,hasDimensions:U,resizeObserver:d}),Y=N2({nodeRef:H,disabled:y.hidden||!T,noDragClassName:_,handleSelector:y.dragHandle,nodeId:e,isSelectable:j,nodeClickDistance:S}),q=T2();if(y.hidden)return null;const X=Vi(y),K=pF(y),L=j||T||t||n||r||a,M=n?P=>n(P,{...E.userNode}):void 0,O=r?P=>r(P,{...E.userNode}):void 0,$=a?P=>a(P,{...E.userNode}):void 0,F=l?P=>l(P,{...E.userNode}):void 0,Q=u?P=>u(P,{...E.userNode}):void 0,re=P=>{const{selectNodesOnDrag:ee,nodeDragThreshold:ne}=G.getState();j&&(!ee||!T||ne>0)&&mg({id:e,store:G,nodeRef:H}),t&&t(P,{...E.userNode})},ae=P=>{if(!(i2(P.nativeEvent)||w)){if(GC.includes(P.key)&&j){const ee=P.key==="Escape";mg({id:e,store:G,unselect:ee,nodeRef:H})}else if(T&&y.selected&&Object.prototype.hasOwnProperty.call(Hu,P.key)){P.preventDefault();const{ariaLabelConfig:ee}=G.getState();G.setState({ariaLiveMessage:ee["node.a11yDescription.ariaLiveMessage"]({direction:P.key.replace("Arrow","").toLowerCase(),x:~~E.positionAbsolute.x,y:~~E.positionAbsolute.y})}),q({direction:Hu[P.key],factor:P.shiftKey?4:1})}}},Z=()=>{var be;if(w||!((be=H.current)!=null&&be.matches(":focus-visible")))return;const{transform:P,width:ee,height:ne,autoPanOnNodeFocus:ge,setCenter:he}=G.getState();if(!ge)return;jm(new Map([[e,y]]),{x:0,y:0,width:ee,height:ne},P,!0).length>0||he(y.position.x+X.width/2,y.position.y+X.height/2,{zoom:P[2]})};return m.jsx("div",{className:Ft(["react-flow__node",`react-flow__node-${N}`,{[v]:T},y.className,{selected:y.selected,selectable:j,parent:R,draggable:T,dragging:Y}]),ref:H,style:{zIndex:E.z,transform:`translate(${E.positionAbsolute.x}px,${E.positionAbsolute.y}px)`,pointerEvents:L?"all":"none",visibility:U?"visible":"hidden",...y.style,...K},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:M,onMouseMove:O,onMouseLeave:$,onContextMenu:F,onClick:re,onDoubleClick:Q,onKeyDown:z?ae:void 0,tabIndex:z?0:void 0,onFocus:z?Z:void 0,role:y.ariaRole??(z?"group":void 0),"aria-roledescription":"node","aria-describedby":w?void 0:`${x2}-${C}`,"aria-label":y.ariaLabel,...y.domAttributes,children:m.jsx(iF,{value:e,children:m.jsx(D,{id:e,data:y.data,type:N,positionAbsoluteX:E.positionAbsolute.x,positionAbsoluteY:E.positionAbsolute.y,selected:y.selected??!1,selectable:j,draggable:T,deletable:y.deletable??!0,isConnectable:B,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:Y,dragHandle:y.dragHandle,zIndex:E.z,parentId:y.parentId,...X})})})}var EF=V.memo(CF);const kF=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function j2(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:a,onError:l}=tt(kF,kt),u=bF(e.onlyRenderVisibleElements),o=xF();return m.jsx("div",{className:"react-flow__nodes",style:kh,children:u.map(c=>m.jsx(EF,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:a,nodeClickDistance:e.nodeClickDistance,onError:l},c))})}j2.displayName="NodeRenderer";const AF=V.memo(j2);function NF(e){return tt(V.useCallback(n=>{if(!e)return n.edges.map(a=>a.id);const r=[];if(n.width&&n.height)for(const a of n.edges){const l=n.nodeLookup.get(a.source),u=n.nodeLookup.get(a.target);l&&u&&bz({sourceNode:l,targetNode:u,width:n.width,height:n.height,transform:n.transform})&&r.push(a.id)}return r},[e]),kt)}const TF=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return m.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},RF=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return m.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},NS={[Bu.Arrow]:TF,[Bu.ArrowClosed]:RF};function DF(e){const t=At();return V.useMemo(()=>{var a,l;return Object.prototype.hasOwnProperty.call(NS,e)?NS[e]:((l=(a=t.getState()).onError)==null||l.call(a,"009",ei.error009(e)),null)},[e])}const MF=({id:e,type:t,color:n,width:r=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:u,orient:o="auto-start-reverse"})=>{const c=DF(t);return c?m.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:o,refX:"0",refY:"0",children:m.jsx(c,{color:n,strokeWidth:u})}):null},L2=({defaultColor:e,rfId:t})=>{const n=tt(l=>l.edges),r=tt(l=>l.defaultEdgeOptions),a=V.useMemo(()=>Nz(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return a.length?m.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:m.jsx("defs",{children:a.map(l=>m.jsx(MF,{id:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,strokeWidth:l.strokeWidth,orient:l.orient},l.id))})}):null};L2.displayName="MarkerDefinitions";var jF=V.memo(L2);function O2({x:e,y:t,label:n,labelStyle:r,labelShowBg:a=!0,labelBgStyle:l,labelBgPadding:u=[2,4],labelBgBorderRadius:o=2,children:c,className:f,...p}){const[d,_]=V.useState({x:1,y:0,width:0,height:0}),v=Ft(["react-flow__edge-textwrapper",f]),w=V.useRef(null);return V.useEffect(()=>{if(w.current){const C=w.current.getBBox();_({x:C.x,y:C.y,width:C.width,height:C.height})}},[n]),n?m.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:v,visibility:d.width?"visible":"hidden",...p,children:[a&&m.jsx("rect",{width:d.width+2*u[0],x:-u[0],y:-u[1],height:d.height+2*u[1],className:"react-flow__edge-textbg",style:l,rx:o,ry:o}),m.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:w,style:r,children:n}),c]}):null}O2.displayName="EdgeText";const LF=V.memo(O2);function Ah({path:e,labelX:t,labelY:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:o,labelBgBorderRadius:c,interactionWidth:f=20,...p}){return m.jsxs(m.Fragment,{children:[m.jsx("path",{...p,d:e,fill:"none",className:Ft(["react-flow__edge-path",p.className])}),f?m.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}):null,r&&Zn(t)&&Zn(n)?m.jsx(LF,{x:t,y:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:o,labelBgBorderRadius:c}):null]})}function TS({pos:e,x1:t,y1:n,x2:r,y2:a}){return e===Me.Left||e===Me.Right?[.5*(t+r),n]:[t,.5*(n+a)]}function B2({sourceX:e,sourceY:t,sourcePosition:n=Me.Bottom,targetX:r,targetY:a,targetPosition:l=Me.Top}){const[u,o]=TS({pos:n,x1:e,y1:t,x2:r,y2:a}),[c,f]=TS({pos:l,x1:r,y1:a,x2:e,y2:t}),[p,d,_,v]=s2({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:u,sourceControlY:o,targetControlX:c,targetControlY:f});return[`M${e},${t} C${u},${o} ${c},${f} ${r},${a}`,p,d,_,v]}function I2(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:u,targetPosition:o,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:b,interactionWidth:S})=>{const[x,y,E]=B2({sourceX:n,sourceY:r,sourcePosition:u,targetX:a,targetY:l,targetPosition:o}),R=e.isInternal?void 0:t;return m.jsx(Ah,{id:R,path:x,labelX:y,labelY:E,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:b,interactionWidth:S})})}const OF=I2({isInternal:!1}),z2=I2({isInternal:!0});OF.displayName="SimpleBezierEdge";z2.displayName="SimpleBezierEdgeInternal";function H2(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,sourcePosition:v=Me.Bottom,targetPosition:w=Me.Top,markerEnd:C,markerStart:b,pathOptions:S,interactionWidth:x})=>{const[y,E,R]=fg({sourceX:n,sourceY:r,sourcePosition:v,targetX:a,targetY:l,targetPosition:w,borderRadius:S==null?void 0:S.borderRadius,offset:S==null?void 0:S.offset,stepPosition:S==null?void 0:S.stepPosition}),N=e.isInternal?void 0:t;return m.jsx(Ah,{id:N,path:y,labelX:E,labelY:R,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,markerEnd:C,markerStart:b,interactionWidth:x})})}const F2=H2({isInternal:!1}),P2=H2({isInternal:!0});F2.displayName="SmoothStepEdge";P2.displayName="SmoothStepEdgeInternal";function U2(e){return V.memo(({id:t,...n})=>{var a;const r=e.isInternal?void 0:t;return m.jsx(F2,{...n,id:r,pathOptions:V.useMemo(()=>{var l;return{borderRadius:0,offset:(l=n.pathOptions)==null?void 0:l.offset}},[(a=n.pathOptions)==null?void 0:a.offset])})})}const BF=U2({isInternal:!1}),$2=U2({isInternal:!0});BF.displayName="StepEdge";$2.displayName="StepEdgeInternal";function G2(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,markerEnd:v,markerStart:w,interactionWidth:C})=>{const[b,S,x]=l2({sourceX:n,sourceY:r,targetX:a,targetY:l}),y=e.isInternal?void 0:t;return m.jsx(Ah,{id:y,path:b,labelX:S,labelY:x,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,markerEnd:v,markerStart:w,interactionWidth:C})})}const IF=G2({isInternal:!1}),q2=G2({isInternal:!0});IF.displayName="StraightEdge";q2.displayName="StraightEdgeInternal";function V2(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:u=Me.Bottom,targetPosition:o=Me.Top,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:b,pathOptions:S,interactionWidth:x})=>{const[y,E,R]=a2({sourceX:n,sourceY:r,sourcePosition:u,targetX:a,targetY:l,targetPosition:o,curvature:S==null?void 0:S.curvature}),N=e.isInternal?void 0:t;return m.jsx(Ah,{id:N,path:y,labelX:E,labelY:R,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:b,interactionWidth:x})})}const zF=V2({isInternal:!1}),Y2=V2({isInternal:!0});zF.displayName="BezierEdge";Y2.displayName="BezierEdgeInternal";const RS={default:Y2,straight:q2,step:$2,smoothstep:P2,simplebezier:z2},DS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},HF=(e,t,n)=>n===Me.Left?e-t:n===Me.Right?e+t:e,FF=(e,t,n)=>n===Me.Top?e-t:n===Me.Bottom?e+t:e,MS="react-flow__edgeupdater";function jS({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:a,onMouseEnter:l,onMouseOut:u,type:o}){return m.jsx("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:u,className:Ft([MS,`${MS}-${o}`]),cx:HF(t,r,e),cy:FF(n,r,e),r,stroke:"transparent",fill:"transparent"})}function PF({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:a,targetX:l,targetY:u,sourcePosition:o,targetPosition:c,onReconnect:f,onReconnectStart:p,onReconnectEnd:d,setReconnecting:_,setUpdateHover:v}){const w=At(),C=(E,R)=>{if(E.button!==0)return;const{autoPanOnConnect:N,domNode:D,connectionMode:T,connectionRadius:j,lib:B,onConnectStart:z,cancelConnection:G,nodeLookup:U,rfId:H,panBy:Y,updateConnection:q}=w.getState(),X=R.type==="target",K=(O,$)=>{_(!1),d==null||d(O,n,R.type,$)},L=O=>f==null?void 0:f(n,O),M=(O,$)=>{_(!0),p==null||p(E,n,R.type),z==null||z(O,$)};gg.onPointerDown(E.nativeEvent,{autoPanOnConnect:N,connectionMode:T,connectionRadius:j,domNode:D,handleId:R.id,nodeId:R.nodeId,nodeLookup:U,isTarget:X,edgeUpdaterType:R.type,lib:B,flowId:H,cancelConnection:G,panBy:Y,isValidConnection:(...O)=>{var $,F;return((F=($=w.getState()).isValidConnection)==null?void 0:F.call($,...O))??!0},onConnect:L,onConnectStart:M,onConnectEnd:(...O)=>{var $,F;return(F=($=w.getState()).onConnectEnd)==null?void 0:F.call($,...O)},onReconnectEnd:K,updateConnection:q,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:E.currentTarget})},b=E=>C(E,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),S=E=>C(E,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>v(!0),y=()=>v(!1);return m.jsxs(m.Fragment,{children:[(e===!0||e==="source")&&m.jsx(jS,{position:o,centerX:r,centerY:a,radius:t,onMouseDown:b,onMouseEnter:x,onMouseOut:y,type:"source"}),(e===!0||e==="target")&&m.jsx(jS,{position:c,centerX:l,centerY:u,radius:t,onMouseDown:S,onMouseEnter:x,onMouseOut:y,type:"target"})]})}function UF({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:a,onDoubleClick:l,onContextMenu:u,onMouseEnter:o,onMouseMove:c,onMouseLeave:f,reconnectRadius:p,onReconnect:d,onReconnectStart:_,onReconnectEnd:v,rfId:w,edgeTypes:C,noPanClassName:b,onError:S,disableKeyboardA11y:x}){let y=tt(he=>he.edgeLookup.get(e));const E=tt(he=>he.defaultEdgeOptions);y=E?{...E,...y}:y;let R=y.type||"default",N=(C==null?void 0:C[R])||RS[R];N===void 0&&(S==null||S("011",ei.error011(R)),R="default",N=(C==null?void 0:C.default)||RS.default);const D=!!(y.focusable||t&&typeof y.focusable>"u"),T=typeof d<"u"&&(y.reconnectable||n&&typeof y.reconnectable>"u"),j=!!(y.selectable||r&&typeof y.selectable>"u"),B=V.useRef(null),[z,G]=V.useState(!1),[U,H]=V.useState(!1),Y=At(),{zIndex:q=y.zIndex,sourceX:X,sourceY:K,targetX:L,targetY:M,sourcePosition:O,targetPosition:$}=tt(V.useCallback(he=>{const ye=he.nodeLookup.get(y.source),be=he.nodeLookup.get(y.target);if(!ye||!be)return DS;const ke=Az({id:e,sourceNode:ye,targetNode:be,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:he.connectionMode,onError:S}),Ee=yz({selected:y.selected,zIndex:y.zIndex,sourceNode:ye,targetNode:be,elevateOnSelect:he.elevateEdgesOnSelect,zIndexMode:he.zIndexMode});return{...ke||DS,zIndex:Ee}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),kt),F=V.useMemo(()=>y.markerStart?`url('#${dg(y.markerStart,w)}')`:void 0,[y.markerStart,w]),Q=V.useMemo(()=>y.markerEnd?`url('#${dg(y.markerEnd,w)}')`:void 0,[y.markerEnd,w]);if(y.hidden||X===null||K===null||L===null||M===null)return null;const re=he=>{var Ee;const{addSelectedEdges:ye,unselectNodesAndEdges:be,multiSelectionActive:ke}=Y.getState();j&&(Y.setState({nodesSelectionActive:!1}),y.selected&&ke?(be({nodes:[],edges:[y]}),(Ee=B.current)==null||Ee.blur()):ye([e])),a&&a(he,y)},ae=l?he=>{l(he,{...y})}:void 0,Z=u?he=>{u(he,{...y})}:void 0,P=o?he=>{o(he,{...y})}:void 0,ee=c?he=>{c(he,{...y})}:void 0,ne=f?he=>{f(he,{...y})}:void 0,ge=he=>{var ye;if(!x&&GC.includes(he.key)&&j){const{unselectNodesAndEdges:be,addSelectedEdges:ke}=Y.getState();he.key==="Escape"?((ye=B.current)==null||ye.blur(),be({edges:[y]})):ke([e])}};return m.jsx("svg",{style:{zIndex:q},children:m.jsxs("g",{className:Ft(["react-flow__edge",`react-flow__edge-${R}`,y.className,b,{selected:y.selected,animated:y.animated,inactive:!j&&!a,updating:z,selectable:j}]),onClick:re,onDoubleClick:ae,onContextMenu:Z,onMouseEnter:P,onMouseMove:ee,onMouseLeave:ne,onKeyDown:D?ge:void 0,tabIndex:D?0:void 0,role:y.ariaRole??(D?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":D?`${w2}-${w}`:void 0,ref:B,...y.domAttributes,children:[!U&&m.jsx(N,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:j,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:X,sourceY:K,targetX:L,targetY:M,sourcePosition:O,targetPosition:$,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:F,markerEnd:Q,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),T&&m.jsx(PF,{edge:y,isReconnectable:T,reconnectRadius:p,onReconnect:d,onReconnectStart:_,onReconnectEnd:v,sourceX:X,sourceY:K,targetX:L,targetY:M,sourcePosition:O,targetPosition:$,setUpdateHover:G,setReconnecting:H})]})})}var $F=V.memo(UF);const GF=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function W2({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:a,onReconnect:l,onEdgeContextMenu:u,onEdgeMouseEnter:o,onEdgeMouseMove:c,onEdgeMouseLeave:f,onEdgeClick:p,reconnectRadius:d,onEdgeDoubleClick:_,onReconnectStart:v,onReconnectEnd:w,disableKeyboardA11y:C}){const{edgesFocusable:b,edgesReconnectable:S,elementsSelectable:x,onError:y}=tt(GF,kt),E=NF(t);return m.jsxs("div",{className:"react-flow__edges",children:[m.jsx(jF,{defaultColor:e,rfId:n}),E.map(R=>m.jsx($F,{id:R,edgesFocusable:b,edgesReconnectable:S,elementsSelectable:x,noPanClassName:a,onReconnect:l,onContextMenu:u,onMouseEnter:o,onMouseMove:c,onMouseLeave:f,onClick:p,reconnectRadius:d,onDoubleClick:_,onReconnectStart:v,onReconnectEnd:w,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:C},R))]})}W2.displayName="EdgeRenderer";const qF=V.memo(W2),VF=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function YF({children:e}){const t=tt(VF);return m.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function WF(e){const t=Um(),n=V.useRef(!1);V.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const XF=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function KF(e){const t=tt(XF),n=At();return V.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function ZF(e){return e.connection.inProgress?{...e.connection,to:vl(e.connection.to,e.transform)}:{...e.connection}}function QF(e){return ZF}function JF(e){const t=QF();return tt(t,kt)}const eP=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function tP({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:a,width:l,height:u,isValid:o,inProgress:c}=tt(eP,kt);return!(l&&a&&c)?null:m.jsx("svg",{style:e,width:l,height:u,className:"react-flow__connectionline react-flow__container",children:m.jsx("g",{className:Ft(["react-flow__connection",YC(o)]),children:m.jsx(X2,{style:t,type:n,CustomComponent:r,isValid:o})})})}const X2=({style:e,type:t=Er.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:a,from:l,fromNode:u,fromHandle:o,fromPosition:c,to:f,toNode:p,toHandle:d,toPosition:_,pointer:v}=JF();if(!a)return;if(n)return m.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:u,fromHandle:o,fromX:l.x,fromY:l.y,toX:f.x,toY:f.y,fromPosition:c,toPosition:_,connectionStatus:YC(r),toNode:p,toHandle:d,pointer:v});let w="";const C={sourceX:l.x,sourceY:l.y,sourcePosition:c,targetX:f.x,targetY:f.y,targetPosition:_};switch(t){case Er.Bezier:[w]=a2(C);break;case Er.SimpleBezier:[w]=B2(C);break;case Er.Step:[w]=fg({...C,borderRadius:0});break;case Er.SmoothStep:[w]=fg(C);break;default:[w]=l2(C)}return m.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:e})};X2.displayName="ConnectionLine";const nP={};function LS(e=nP){V.useRef(e),At(),V.useEffect(()=>{},[e])}function iP(){At(),V.useRef(!1),V.useEffect(()=>{},[])}function K2({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:d,onSelectionStart:_,onSelectionEnd:v,connectionLineType:w,connectionLineStyle:C,connectionLineComponent:b,connectionLineContainerStyle:S,selectionKeyCode:x,selectionOnDrag:y,selectionMode:E,multiSelectionKeyCode:R,panActivationKeyCode:N,zoomActivationKeyCode:D,deleteKeyCode:T,onlyRenderVisibleElements:j,elementsSelectable:B,defaultViewport:z,translateExtent:G,minZoom:U,maxZoom:H,preventScrolling:Y,defaultMarkerColor:q,zoomOnScroll:X,zoomOnPinch:K,panOnScroll:L,panOnScrollSpeed:M,panOnScrollMode:O,zoomOnDoubleClick:$,panOnDrag:F,autoPanOnSelection:Q,onPaneClick:re,onPaneMouseEnter:ae,onPaneMouseMove:Z,onPaneMouseLeave:P,onPaneScroll:ee,onPaneContextMenu:ne,paneClickDistance:ge,nodeClickDistance:he,onEdgeContextMenu:ye,onEdgeMouseEnter:be,onEdgeMouseMove:ke,onEdgeMouseLeave:Ee,reconnectRadius:Ce,onReconnect:rt,onReconnectStart:bt,onReconnectEnd:Ge,noDragClassName:ct,noWheelClassName:Pt,noPanClassName:ht,disableKeyboardA11y:Fe,nodeExtent:fe,rfId:ie,viewport:de,onViewportChange:Se}){return LS(e),LS(t),iP(),WF(n),KF(de),m.jsx(vF,{onPaneClick:re,onPaneMouseEnter:ae,onPaneMouseMove:Z,onPaneMouseLeave:P,onPaneContextMenu:ne,onPaneScroll:ee,paneClickDistance:ge,deleteKeyCode:T,selectionKeyCode:x,selectionOnDrag:y,selectionMode:E,onSelectionStart:_,onSelectionEnd:v,multiSelectionKeyCode:R,panActivationKeyCode:N,zoomActivationKeyCode:D,elementsSelectable:B,zoomOnScroll:X,zoomOnPinch:K,zoomOnDoubleClick:$,panOnScroll:L,panOnScrollSpeed:M,panOnScrollMode:O,panOnDrag:F,autoPanOnSelection:Q,defaultViewport:z,translateExtent:G,minZoom:U,maxZoom:H,onSelectionContextMenu:d,preventScrolling:Y,noDragClassName:ct,noWheelClassName:Pt,noPanClassName:ht,disableKeyboardA11y:Fe,onViewportChange:Se,isControlledViewport:!!de,children:m.jsxs(YF,{children:[m.jsx(qF,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:u,onReconnect:rt,onReconnectStart:bt,onReconnectEnd:Ge,onlyRenderVisibleElements:j,onEdgeContextMenu:ye,onEdgeMouseEnter:be,onEdgeMouseMove:ke,onEdgeMouseLeave:Ee,reconnectRadius:Ce,defaultMarkerColor:q,noPanClassName:ht,disableKeyboardA11y:Fe,rfId:ie}),m.jsx(tP,{style:C,type:w,component:b,containerStyle:S}),m.jsx("div",{className:"react-flow__edgelabel-renderer"}),m.jsx(AF,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:l,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:f,onNodeContextMenu:p,nodeClickDistance:he,onlyRenderVisibleElements:j,noPanClassName:ht,noDragClassName:ct,disableKeyboardA11y:Fe,nodeExtent:fe,rfId:ie}),m.jsx("div",{className:"react-flow__viewport-portal"})]})})}K2.displayName="GraphView";const rP=V.memo(K2),sP=JC(),OS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:u,fitViewOptions:o,minZoom:c=.5,maxZoom:f=2,nodeOrigin:p,nodeExtent:d,zIndexMode:_="basic"}={})=>{const v=new Map,w=new Map,C=new Map,b=new Map,S=r??t??[],x=n??e??[],y=p??[0,0],E=d??tl;h2(C,b,S);const{nodesInitialized:R}=pg(x,v,w,{nodeOrigin:y,nodeExtent:E,zIndexMode:_});let N=[0,0,1];if(u&&a&&l){const D=ml(v,{filter:z=>!!((z.width||z.initialWidth)&&(z.height||z.initialHeight))}),{x:T,y:j,zoom:B}=Om(D,a,l,c,f,(o==null?void 0:o.padding)??.1);N=[T,j,B]}return{rfId:"1",width:a??0,height:l??0,transform:N,nodes:x,nodesInitialized:R,nodeLookup:v,parentLookup:w,edges:S,edgeLookup:b,connectionLookup:C,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:f,translateExtent:tl,nodeExtent:E,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ma.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:u??!1,fitViewOptions:o,fitViewResolver:null,connection:{...VC},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:sP,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:qC,zIndexMode:_,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},aP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:u,fitViewOptions:o,minZoom:c,maxZoom:f,nodeOrigin:p,nodeExtent:d,zIndexMode:_})=>mH((v,w)=>{async function C(){const{nodeLookup:b,panZoom:S,fitViewOptions:x,fitViewResolver:y,width:E,height:R,minZoom:N,maxZoom:D}=w();S&&(await fz({nodes:b,width:E,height:R,panZoom:S,minZoom:N,maxZoom:D},x),y==null||y.resolve(!0),v({fitViewResolver:null}))}return{...OS({nodes:e,edges:t,width:a,height:l,fitView:u,fitViewOptions:o,minZoom:c,maxZoom:f,nodeOrigin:p,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:_}),setNodes:b=>{const{nodeLookup:S,parentLookup:x,nodeOrigin:y,elevateNodesOnSelect:E,fitViewQueued:R,zIndexMode:N,nodesSelectionActive:D}=w(),{nodesInitialized:T,hasSelectedNodes:j}=pg(b,S,x,{nodeOrigin:y,nodeExtent:d,elevateNodesOnSelect:E,checkEquality:!0,zIndexMode:N}),B=D&&j;R&&T?(C(),v({nodes:b,nodesInitialized:T,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:B})):v({nodes:b,nodesInitialized:T,nodesSelectionActive:B})},setEdges:b=>{const{connectionLookup:S,edgeLookup:x}=w();h2(S,x,b),v({edges:b})},setDefaultNodesAndEdges:(b,S)=>{if(b){const{setNodes:x}=w();x(b),v({hasDefaultNodes:!0})}if(S){const{setEdges:x}=w();x(S),v({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:S,nodeLookup:x,parentLookup:y,domNode:E,nodeOrigin:R,nodeExtent:N,debug:D,fitViewQueued:T,zIndexMode:j}=w(),{changes:B,updatedInternals:z}=Oz(b,x,y,E,R,N,j);z&&(Dz(x,y,{nodeOrigin:R,nodeExtent:N,zIndexMode:j}),T?(C(),v({fitViewQueued:!1,fitViewOptions:void 0})):v({}),(B==null?void 0:B.length)>0&&(D&&console.log("React Flow: trigger node changes",B),S==null||S(B)))},updateNodePositions:(b,S=!1)=>{const x=[];let y=[];const{nodeLookup:E,triggerNodeChanges:R,connection:N,updateConnection:D,onNodesChangeMiddlewareMap:T}=w();for(const[j,B]of b){const z=E.get(j),G=!!(z!=null&&z.expandParent&&(z!=null&&z.parentId)&&(B!=null&&B.position)),U={id:j,type:"position",position:G?{x:Math.max(0,B.position.x),y:Math.max(0,B.position.y)}:B.position,dragging:S};if(z&&N.inProgress&&N.fromNode.id===z.id){const H=ls(z,N.fromHandle,Me.Left,!0);D({...N,from:H})}G&&z.parentId&&x.push({id:j,parentId:z.parentId,rect:{...B.internals.positionAbsolute,width:B.measured.width??0,height:B.measured.height??0}}),y.push(U)}if(x.length>0){const{parentLookup:j,nodeOrigin:B}=w(),z=Pm(x,E,j,B);y.push(...z)}for(const j of T.values())y=j(y);R(y)},triggerNodeChanges:b=>{const{onNodesChange:S,setNodes:x,nodes:y,hasDefaultNodes:E,debug:R}=w();if(b!=null&&b.length){if(E){const N=IH(b,y);x(N)}R&&console.log("React Flow: trigger node changes",b),S==null||S(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:S,setEdges:x,edges:y,hasDefaultEdges:E,debug:R}=w();if(b!=null&&b.length){if(E){const N=zH(b,y);x(N)}R&&console.log("React Flow: trigger edge changes",b),S==null||S(b)}},addSelectedNodes:b=>{const{multiSelectionActive:S,edgeLookup:x,nodeLookup:y,triggerNodeChanges:E,triggerEdgeChanges:R}=w();if(S){const N=b.map(D=>Zr(D,!0));E(N);return}E(ca(y,new Set([...b]),!0)),R(ca(x))},addSelectedEdges:b=>{const{multiSelectionActive:S,edgeLookup:x,nodeLookup:y,triggerNodeChanges:E,triggerEdgeChanges:R}=w();if(S){const N=b.map(D=>Zr(D,!0));R(N);return}R(ca(x,new Set([...b]))),E(ca(y,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:S}={})=>{const{edges:x,nodes:y,nodeLookup:E,triggerNodeChanges:R,triggerEdgeChanges:N}=w(),D=b||y,T=S||x,j=[];for(const z of D){if(!z.selected)continue;const G=E.get(z.id);G&&(G.selected=!1),j.push(Zr(z.id,!1))}const B=[];for(const z of T)z.selected&&B.push(Zr(z.id,!1));R(j),N(B)},setMinZoom:b=>{const{panZoom:S,maxZoom:x}=w();S==null||S.setScaleExtent([b,x]),v({minZoom:b})},setMaxZoom:b=>{const{panZoom:S,minZoom:x}=w();S==null||S.setScaleExtent([x,b]),v({maxZoom:b})},setTranslateExtent:b=>{var S;(S=w().panZoom)==null||S.setTranslateExtent(b),v({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:S,triggerNodeChanges:x,triggerEdgeChanges:y,elementsSelectable:E}=w();if(!E)return;const R=S.reduce((D,T)=>T.selected?[...D,Zr(T.id,!1)]:D,[]),N=b.reduce((D,T)=>T.selected?[...D,Zr(T.id,!1)]:D,[]);x(R),y(N)},setNodeExtent:b=>{const{nodes:S,nodeLookup:x,parentLookup:y,nodeOrigin:E,elevateNodesOnSelect:R,nodeExtent:N,zIndexMode:D}=w();b[0][0]===N[0][0]&&b[0][1]===N[0][1]&&b[1][0]===N[1][0]&&b[1][1]===N[1][1]||(pg(S,x,y,{nodeOrigin:E,nodeExtent:b,elevateNodesOnSelect:R,checkEquality:!1,zIndexMode:D}),v({nodeExtent:b}))},panBy:b=>{const{transform:S,width:x,height:y,panZoom:E,translateExtent:R}=w();return Bz({delta:b,panZoom:E,transform:S,translateExtent:R,width:x,height:y})},setCenter:async(b,S,x)=>{const{width:y,height:E,maxZoom:R,panZoom:N}=w();if(!N)return!1;const D=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:R;return await N.setViewport({x:y/2-b*D,y:E/2-S*D,zoom:D},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{v({connection:{...VC}})},updateConnection:b=>{v({connection:b})},reset:()=>v({...OS()})}},Object.is);function oP({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:a,initialHeight:l,initialMinZoom:u,initialMaxZoom:o,initialFitViewOptions:c,fitView:f,nodeOrigin:p,nodeExtent:d,zIndexMode:_,children:v}){const[w]=V.useState(()=>aP({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:f,minZoom:u,maxZoom:o,fitViewOptions:c,nodeOrigin:p,nodeExtent:d,zIndexMode:_}));return m.jsx(_H,{value:w,children:m.jsx(GH,{children:m.jsx(sF,{children:v})})})}function lP({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:a,width:l,height:u,fitView:o,fitViewOptions:c,minZoom:f,maxZoom:p,nodeOrigin:d,nodeExtent:_,zIndexMode:v}){return V.useContext(Ch)?m.jsx(m.Fragment,{children:e}):m.jsx(oP,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:a,initialWidth:l,initialHeight:u,fitView:o,initialFitViewOptions:c,initialMinZoom:f,initialMaxZoom:p,nodeOrigin:d,nodeExtent:_,zIndexMode:v,children:e})}const cP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function uP({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:a,nodeTypes:l,edgeTypes:u,onNodeClick:o,onEdgeClick:c,onInit:f,onMove:p,onMoveStart:d,onMoveEnd:_,onConnect:v,onConnectStart:w,onConnectEnd:C,onClickConnectStart:b,onClickConnectEnd:S,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:E,onNodeContextMenu:R,onNodeDoubleClick:N,onNodeDragStart:D,onNodeDrag:T,onNodeDragStop:j,onNodesDelete:B,onEdgesDelete:z,onDelete:G,onSelectionChange:U,onSelectionDragStart:H,onSelectionDrag:Y,onSelectionDragStop:q,onSelectionContextMenu:X,onSelectionStart:K,onSelectionEnd:L,onBeforeDelete:M,connectionMode:O,connectionLineType:$=Er.Bezier,connectionLineStyle:F,connectionLineComponent:Q,connectionLineContainerStyle:re,deleteKeyCode:ae="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:P=!1,selectionMode:ee=nl.Full,panActivationKeyCode:ne="Space",multiSelectionKeyCode:ge=rl()?"Meta":"Control",zoomActivationKeyCode:he=rl()?"Meta":"Control",snapToGrid:ye,snapGrid:be,onlyRenderVisibleElements:ke=!1,selectNodesOnDrag:Ee,nodesDraggable:Ce,autoPanOnNodeFocus:rt,nodesConnectable:bt,nodesFocusable:Ge,nodeOrigin:ct=C2,edgesFocusable:Pt,edgesReconnectable:ht,elementsSelectable:Fe=!0,defaultViewport:fe=RH,minZoom:ie=.5,maxZoom:de=2,translateExtent:Se=tl,preventScrolling:Ae=!0,nodeExtent:De,defaultMarkerColor:Ve="#b1b1b7",zoomOnScroll:Ie=!0,zoomOnPinch:Nt=!0,panOnScroll:Ct=!1,panOnScrollSpeed:qt=.5,panOnScrollMode:st=ts.Free,zoomOnDoubleClick:Ln=!0,panOnDrag:Ut=!0,onPaneClick:ps,onPaneMouseEnter:gi,onPaneMouseMove:mi,onPaneMouseLeave:_i,onPaneScroll:On,onPaneContextMenu:vi,paneClickDistance:ni=1,nodeClickDistance:oe=0,children:we,onReconnect:Ne,onReconnectStart:qe,onReconnectEnd:at,onEdgeContextMenu:yi,onEdgeDoubleClick:nn,onEdgeMouseEnter:gs,onEdgeMouseMove:ka,onEdgeMouseLeave:Aa,reconnectRadius:yl=10,onNodesChange:bl,onEdgesChange:ii,noDragClassName:$t="nodrag",noWheelClassName:Qt="nowheel",noPanClassName:bi="nopan",fitView:ms,fitViewOptions:Sl,connectOnClick:Nh,attributionPosition:xl,proOptions:Rr,defaultEdgeOptions:Na,elevateNodesOnSelect:Yi=!0,elevateEdgesOnSelect:Wi=!1,disableKeyboardA11y:Xi=!1,autoPanOnConnect:Ki,autoPanOnNodeDrag:Lt,autoPanOnSelection:wl=!0,autoPanSpeed:Cl,connectionRadius:Si,isValidConnection:Zi,onError:Th,style:El,id:Ta,nodeDragThreshold:Rh,connectionDragThreshold:_s,viewport:vs,onViewportChange:qn,width:an,height:kl,colorMode:Dh="light",debug:Ra,onScroll:Dr,ariaLabelConfig:ys,zIndexMode:Al="basic",...on},Da){const bs=Ta||"1",Ma=LH(Dh),Qi=V.useCallback(ja=>{ja.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Dr==null||Dr(ja)},[Dr]);return m.jsx("div",{"data-testid":"rf__wrapper",...on,onScroll:Qi,style:{...El,...cP},ref:Da,className:Ft(["react-flow",a,Ma]),id:Ta,role:"application",children:m.jsxs(lP,{nodes:e,edges:t,width:an,height:kl,fitView:ms,fitViewOptions:Sl,minZoom:ie,maxZoom:de,nodeOrigin:ct,nodeExtent:De,zIndexMode:Al,children:[m.jsx(jH,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:v,onConnectStart:w,onConnectEnd:C,onClickConnectStart:b,onClickConnectEnd:S,nodesDraggable:Ce,autoPanOnNodeFocus:rt,nodesConnectable:bt,nodesFocusable:Ge,edgesFocusable:Pt,edgesReconnectable:ht,elementsSelectable:Fe,elevateNodesOnSelect:Yi,elevateEdgesOnSelect:Wi,minZoom:ie,maxZoom:de,nodeExtent:De,onNodesChange:bl,onEdgesChange:ii,snapToGrid:ye,snapGrid:be,connectionMode:O,translateExtent:Se,connectOnClick:Nh,defaultEdgeOptions:Na,fitView:ms,fitViewOptions:Sl,onNodesDelete:B,onEdgesDelete:z,onDelete:G,onNodeDragStart:D,onNodeDrag:T,onNodeDragStop:j,onSelectionDrag:Y,onSelectionDragStart:H,onSelectionDragStop:q,onMove:p,onMoveStart:d,onMoveEnd:_,noPanClassName:bi,nodeOrigin:ct,rfId:bs,autoPanOnConnect:Ki,autoPanOnNodeDrag:Lt,autoPanSpeed:Cl,onError:Th,connectionRadius:Si,isValidConnection:Zi,selectNodesOnDrag:Ee,nodeDragThreshold:Rh,connectionDragThreshold:_s,onBeforeDelete:M,debug:Ra,ariaLabelConfig:ys,zIndexMode:Al}),m.jsx(rP,{onInit:f,onNodeClick:o,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:E,onNodeContextMenu:R,onNodeDoubleClick:N,nodeTypes:l,edgeTypes:u,connectionLineType:$,connectionLineStyle:F,connectionLineComponent:Q,connectionLineContainerStyle:re,selectionKeyCode:Z,selectionOnDrag:P,selectionMode:ee,deleteKeyCode:ae,multiSelectionKeyCode:ge,panActivationKeyCode:ne,zoomActivationKeyCode:he,onlyRenderVisibleElements:ke,defaultViewport:fe,translateExtent:Se,minZoom:ie,maxZoom:de,preventScrolling:Ae,zoomOnScroll:Ie,zoomOnPinch:Nt,zoomOnDoubleClick:Ln,panOnScroll:Ct,panOnScrollSpeed:qt,panOnScrollMode:st,panOnDrag:Ut,autoPanOnSelection:wl,onPaneClick:ps,onPaneMouseEnter:gi,onPaneMouseMove:mi,onPaneMouseLeave:_i,onPaneScroll:On,onPaneContextMenu:vi,paneClickDistance:ni,nodeClickDistance:oe,onSelectionContextMenu:X,onSelectionStart:K,onSelectionEnd:L,onReconnect:Ne,onReconnectStart:qe,onReconnectEnd:at,onEdgeContextMenu:yi,onEdgeDoubleClick:nn,onEdgeMouseEnter:gs,onEdgeMouseMove:ka,onEdgeMouseLeave:Aa,reconnectRadius:yl,defaultMarkerColor:Ve,noDragClassName:$t,noWheelClassName:Qt,noPanClassName:bi,rfId:bs,disableKeyboardA11y:Xi,nodeExtent:De,viewport:vs,onViewportChange:qn}),m.jsx(TH,{onSelectionChange:U}),we,m.jsx(CH,{proOptions:Rr,position:xl}),m.jsx(wH,{rfId:bs,disableKeyboardA11y:Xi})]})})}var hP=k2(uP);function fP({dimensions:e,lineWidth:t,variant:n,className:r}){return m.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Ft(["react-flow__background-pattern",n,r])})}function dP({radius:e,className:t}){return m.jsx("circle",{cx:e,cy:e,r:e,className:Ft(["react-flow__background-pattern","dots",t])})}var Pi;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Pi||(Pi={}));const pP={[Pi.Dots]:1,[Pi.Lines]:1,[Pi.Cross]:6},gP=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Z2({id:e,variant:t=Pi.Dots,gap:n=20,size:r,lineWidth:a=1,offset:l=0,color:u,bgColor:o,style:c,className:f,patternClassName:p}){const d=V.useRef(null),{transform:_,patternId:v}=tt(gP,kt),w=r||pP[t],C=t===Pi.Dots,b=t===Pi.Cross,S=Array.isArray(n)?n:[n,n],x=[S[0]*_[2]||1,S[1]*_[2]||1],y=w*_[2],E=Array.isArray(l)?l:[l,l],R=b?[y,y]:x,N=[E[0]*_[2]||1+R[0]/2,E[1]*_[2]||1+R[1]/2],D=`${v}${e||""}`;return m.jsxs("svg",{className:Ft(["react-flow__background",f]),style:{...c,...kh,"--xy-background-color-props":o,"--xy-background-pattern-color-props":u},ref:d,"data-testid":"rf__background",children:[m.jsx("pattern",{id:D,x:_[0]%x[0],y:_[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${N[0]},-${N[1]})`,children:C?m.jsx(dP,{radius:y/2,className:p}):m.jsx(fP,{dimensions:R,lineWidth:a,variant:t,className:p})}),m.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${D})`})]})}Z2.displayName="Background";const mP=V.memo(Z2);function _P(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:m.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function vP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:m.jsx("path",{d:"M0 0h32v4.2H0z"})})}function yP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:m.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function bP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function SP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function su({children:e,className:t,...n}){return m.jsx("button",{type:"button",className:Ft(["react-flow__controls-button",t]),...n,children:e})}const xP=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Q2({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:u,onFitView:o,onInteractiveChange:c,className:f,children:p,position:d="bottom-left",orientation:_="vertical","aria-label":v}){const w=At(),{isInteractive:C,minZoomReached:b,maxZoomReached:S,ariaLabelConfig:x}=tt(xP,kt),{zoomIn:y,zoomOut:E,fitView:R}=Um(),N=()=>{y(),l==null||l()},D=()=>{E(),u==null||u()},T=()=>{R(a),o==null||o()},j=()=>{w.setState({nodesDraggable:!C,nodesConnectable:!C,elementsSelectable:!C}),c==null||c(!C)},B=_==="horizontal"?"horizontal":"vertical";return m.jsxs(Eh,{className:Ft(["react-flow__controls",B,f]),position:d,style:e,"data-testid":"rf__controls","aria-label":v??x["controls.ariaLabel"],children:[t&&m.jsxs(m.Fragment,{children:[m.jsx(su,{onClick:N,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:S,children:m.jsx(_P,{})}),m.jsx(su,{onClick:D,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:b,children:m.jsx(vP,{})})]}),n&&m.jsx(su,{className:"react-flow__controls-fitview",onClick:T,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:m.jsx(yP,{})}),r&&m.jsx(su,{className:"react-flow__controls-interactive",onClick:j,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:C?m.jsx(SP,{}):m.jsx(bP,{})}),p]})}Q2.displayName="Controls";V.memo(Q2);function wP({id:e,x:t,y:n,width:r,height:a,style:l,color:u,strokeColor:o,strokeWidth:c,className:f,borderRadius:p,shapeRendering:d,selected:_,onClick:v}){const{background:w,backgroundColor:C}=l||{},b=u||w||C;return m.jsx("rect",{className:Ft(["react-flow__minimap-node",{selected:_},f]),x:t,y:n,rx:p,ry:p,width:r,height:a,style:{fill:b,stroke:o,strokeWidth:c},shapeRendering:d,onClick:v?S=>v(S,e):void 0})}const CP=V.memo(wP),EP=e=>e.nodes.map(t=>t.id),kp=e=>e instanceof Function?e:()=>e;function kP({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:l=CP,onClick:u}){const o=tt(EP,kt),c=kp(t),f=kp(e),p=kp(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return m.jsx(m.Fragment,{children:o.map(_=>m.jsx(NP,{id:_,nodeColorFunc:c,nodeStrokeColorFunc:f,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:a,NodeComponent:l,onClick:u,shapeRendering:d},_))})}function AP({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:a,nodeStrokeWidth:l,shapeRendering:u,NodeComponent:o,onClick:c}){const{node:f,x:p,y:d,width:_,height:v}=tt(w=>{const C=w.nodeLookup.get(e);if(!C)return{node:void 0,x:0,y:0,width:0,height:0};const b=C.internals.userNode,{x:S,y:x}=C.internals.positionAbsolute,{width:y,height:E}=Vi(b);return{node:b,x:S,y:x,width:y,height:E}},kt);return!f||f.hidden||!e2(f)?null:m.jsx(o,{x:p,y:d,width:_,height:v,style:f.style,selected:!!f.selected,className:r(f),color:t(f),borderRadius:a,strokeColor:n(f),strokeWidth:l,shapeRendering:u,onClick:c,id:f.id})}const NP=V.memo(AP);var TP=V.memo(kP);const RP=200,DP=150,MP=e=>!e.hidden,jP=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?ZC(ml(e.nodeLookup,{filter:MP}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},LP="react-flow__minimap-desc";function J2({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:u,nodeComponent:o,bgColor:c,maskColor:f,maskStrokeColor:p,maskStrokeWidth:d,position:_="bottom-right",onClick:v,onNodeClick:w,pannable:C=!1,zoomable:b=!1,ariaLabel:S,inversePan:x,zoomStep:y=1,offsetScale:E=5}){const R=At(),N=V.useRef(null),{boundingRect:D,viewBB:T,rfId:j,panZoom:B,translateExtent:z,flowWidth:G,flowHeight:U,ariaLabelConfig:H}=tt(jP,kt),Y=(e==null?void 0:e.width)??RP,q=(e==null?void 0:e.height)??DP,X=D.width/Y,K=D.height/q,L=Math.max(X,K),M=L*Y,O=L*q,$=E*L,F=D.x-(M-D.width)/2-$,Q=D.y-(O-D.height)/2-$,re=M+$*2,ae=O+$*2,Z=`${LP}-${j}`,P=V.useRef(0),ee=V.useRef();P.current=L,V.useEffect(()=>{if(N.current&&B)return ee.current=qz({domNode:N.current,panZoom:B,getTransform:()=>R.getState().transform,getViewScale:()=>P.current}),()=>{var ye;(ye=ee.current)==null||ye.destroy()}},[B]),V.useEffect(()=>{var ye;(ye=ee.current)==null||ye.update({translateExtent:z,width:G,height:U,inversePan:x,pannable:C,zoomStep:y,zoomable:b})},[C,b,x,y,z,G,U]);const ne=v?ye=>{var Ee;const[be,ke]=((Ee=ee.current)==null?void 0:Ee.pointer(ye))||[0,0];v(ye,{x:be,y:ke})}:void 0,ge=w?V.useCallback((ye,be)=>{const ke=R.getState().nodeLookup.get(be).internals.userNode;w(ye,ke)},[]):void 0,he=S??H["minimap.ariaLabel"];return m.jsx(Eh,{position:_,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*L:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof u=="number"?u:void 0},className:Ft(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:m.jsxs("svg",{width:Y,height:q,viewBox:`${F} ${Q} ${re} ${ae}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:N,onClick:ne,children:[he&&m.jsx("title",{id:Z,children:he}),m.jsx(TP,{onClick:ge,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:u,nodeComponent:o}),m.jsx("path",{className:"react-flow__minimap-mask",d:`M${F-$},${Q-$}h${re+$*2}v${ae+$*2}h${-re-$*2}z + M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}J2.displayName="MiniMap";V.memo(J2);const OP=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,BP={[ya.Line]:"right",[ya.Handle]:"bottom-right"};function IP({nodeId:e,position:t,variant:n=ya.Handle,className:r,style:a=void 0,children:l,color:u,minWidth:o=10,minHeight:c=10,maxWidth:f=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:_,autoScale:v=!0,shouldResize:w,onResizeStart:C,onResize:b,onResizeEnd:S}){const x=R2(),y=typeof e=="string"?e:x,E=At(),R=V.useRef(null),N=n===ya.Handle,D=tt(V.useCallback(OP(N&&v),[N,v]),kt),T=V.useRef(null),j=t??BP[n];V.useEffect(()=>{if(!(!R.current||!y))return T.current||(T.current=rH({domNode:R.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:z,transform:G,snapGrid:U,snapToGrid:H,nodeOrigin:Y,domNode:q}=E.getState();return{nodeLookup:z,transform:G,snapGrid:U,snapToGrid:H,nodeOrigin:Y,paneDomNode:q}},onChange:(z,G)=>{const{triggerNodeChanges:U,nodeLookup:H,parentLookup:Y,nodeOrigin:q}=E.getState(),X=[],K={x:z.x,y:z.y},L=H.get(y);if(L&&L.expandParent&&L.parentId){const M=L.origin??q,O=z.width??L.measured.width??0,$=z.height??L.measured.height??0,F={id:L.id,parentId:L.parentId,rect:{width:O,height:$,...t2({x:z.x??L.position.x,y:z.y??L.position.y},{width:O,height:$},L.parentId,H,M)}},Q=Pm([F],H,Y,q);X.push(...Q),K.x=z.x?Math.max(M[0]*O,z.x):void 0,K.y=z.y?Math.max(M[1]*$,z.y):void 0}if(K.x!==void 0&&K.y!==void 0){const M={id:y,type:"position",position:{...K}};X.push(M)}if(z.width!==void 0&&z.height!==void 0){const O={id:y,type:"dimensions",resizing:!0,setAttributes:_?_==="horizontal"?"width":"height":!0,dimensions:{width:z.width,height:z.height}};X.push(O)}for(const M of G){const O={...M,type:"position"};X.push(O)}U(X)},onEnd:({width:z,height:G})=>{const U={id:y,type:"dimensions",resizing:!1,dimensions:{width:z,height:G}};E.getState().triggerNodeChanges([U])}})),T.current.update({controlPosition:j,boundaries:{minWidth:o,minHeight:c,maxWidth:f,maxHeight:p},keepAspectRatio:d,resizeDirection:_,onResizeStart:C,onResize:b,onResizeEnd:S,shouldResize:w}),()=>{var z;(z=T.current)==null||z.destroy()}},[j,o,c,f,p,d,C,b,S,w]);const B=j.split("-");return m.jsx("div",{className:Ft(["react-flow__resize-control","nodrag",...B,n,r]),ref:R,style:{...a,scale:D,...u&&{[N?"backgroundColor":"borderColor"]:u}},children:l})}V.memo(IP);const _g=264,zP=132,yu=44,HP=72;function FP(e){const t=new Map(e.map(l=>[l.id,{exp:l,children:[]}])),n=[];for(const l of e){const u=t.get(l.id),o=l.parentExperimentId?t.get(l.parentExperimentId):void 0;o?o.children.push(u):n.push(u)}const r=(l,u)=>l.exp.createdAt-u.exp.createdAt,a=l=>{l.children.sort(r),l.children.forEach(a)};return n.sort(r),n.forEach(a),n}function bu(e){if(e.children.length===0)return _g;const t=e.children.reduce((n,r)=>n+bu(r),0)+yu*(e.children.length-1);return Math.max(_g,t)}function PP(e){return e==="done"?"pass":e==="failed"?"fail":e==="running"||e==="starting"?"live":"other"}const UP=V.memo(function({data:t}){const{exp:n,latestRun:r,runs:a,isBaseline:l,githubOwner:u,githubRepo:o,onOpenView:c,onOpenCodeBranch:f}=t,p=r==null?void 0:r.status,d=p==="running"||p==="starting",_=l?"BASELINE":d?"RUNNING":"EXPERIMENT",v=a.slice(-8);return m.jsxs("div",{className:`exp-node ${d?"live":""}`,children:[m.jsx(ba,{type:"target",position:Me.Top}),m.jsxs("div",{className:"node-eyebrow",children:[m.jsx("span",{children:_}),m.jsx(Vo,{status:p??"idle"})]}),m.jsx("div",{className:"node-head",children:m.jsx("span",{className:"node-slug",children:n.slug})}),(n.title||n.description)&&m.jsx("div",{className:"node-title",children:n.title||n.description}),m.jsxs("div",{className:"node-meta",children:[m.jsx("span",{children:"RUNS"}),v.length>0?m.jsx("span",{className:"run-squares",children:v.map(w=>m.jsx("span",{className:`run-sq ${PP(w.status)}`,title:w.status},w.id))}):m.jsx("span",{children:"no runs"}),m.jsx("span",{style:{flex:1}}),r&&m.jsx("span",{children:Sa(r.createdAt)})]}),m.jsxs("div",{className:"node-actions",onClick:w=>w.stopPropagation(),children:[m.jsxs("button",{className:"node-action",title:"Open changes",onClick:()=>c(n.id,"changes"),children:[m.jsx($u,{size:13}),"Changes"]}),a.length>0&&m.jsxs("button",{className:"node-action",title:"Open logs",onClick:()=>c(n.id,"terminal"),children:[m.jsx(YS,{size:13}),"Logs"]}),m.jsxs("button",{className:"node-action",title:`Browse code on ${n.branchName}`,onClick:()=>f(n.branchName),children:[m.jsx(GS,{size:13}),"Code"]}),m.jsx("a",{className:"node-action node-action-ext",title:`Open ${n.branchName} on GitHub`,"aria-label":`Open ${n.branchName} on GitHub`,href:xg(u,o,n.branchName),target:"_blank",rel:"noopener noreferrer",onClick:w=>w.stopPropagation(),children:m.jsx(pm,{size:13})})]}),m.jsx(ba,{type:"source",position:Me.Bottom})]})}),$P={exp:UP},GP={type:"default",style:{stroke:"var(--text)",strokeWidth:1.5,opacity:.3}};function qP({experiments:e,runs:t,project:n,onOpenView:r,onOpenCodeBranch:a}){const{nodes:l,edges:u}=V.useMemo(()=>{const o=new Map;for(const v of t){const w=o.get(v.experimentId);w?w.push(v):o.set(v.experimentId,[v])}for(const v of o.values())v.sort((w,C)=>w.createdAt-C.createdAt);const c=[],f=[],p=FP(e);function d(v,w,C){const b=o.get(v.exp.id)??[];if(c.push({id:v.exp.id,type:"exp",position:{x:w-_g/2,y:C},data:{exp:v.exp,latestRun:b[b.length-1]??null,runs:b,isBaseline:!v.exp.parentExperimentId,githubOwner:n.githubOwner,githubRepo:n.githubRepo,onOpenView:r,onOpenCodeBranch:a}}),v.children.length===0)return;const S=v.children.reduce((y,E)=>y+bu(E),0)+yu*(v.children.length-1);let x=w-S/2;for(const y of v.children){const E=bu(y);f.push({id:`e-${v.exp.id}-${y.exp.id}`,source:v.exp.id,target:y.exp.id}),d(y,x+E/2,C+zP+HP),x+=E+yu}}let _=0;for(const v of p){const w=bu(v);d(v,_+w/2,0),_+=w+yu}return{nodes:c,edges:f}},[e,t,r,a,n.githubOwner,n.githubRepo]);return e.length===0?m.jsxs("div",{className:"empty-state empty-state-cta",children:[m.jsx("p",{className:"empty-state-title",children:"No experiments yet"}),m.jsx("p",{className:"empty-state-hint",children:"Ask the agent in chat to create and run your first experiment."})]}):m.jsx(hP,{nodes:l,edges:u,nodeTypes:$P,defaultEdgeOptions:GP,nodesDraggable:!1,nodesConnectable:!1,nodesFocusable:!1,minZoom:.15,fitView:!0,fitViewOptions:{padding:.25,maxZoom:1},children:m.jsx(mP,{variant:Pi.Dots,color:"var(--dots-strong)",gap:28,size:1.6})})}const au=(e,t)=>e.id===t.id&&e.view===t.view,ou=(e,t)=>e.path===t.path&&e.sessionId===t.sessionId&&e.ref===t.ref,BS=e=>`${e.sessionId??""}:${e.ref??""}:${e.path}`;function VP(e,t,n){let r=e,a;const l=t==null?void 0:t.replace(/\/+$/,"");if(!r.startsWith("/"))a=n;else if(l&&(r===l||r.startsWith(`${l}/`)))r=r.slice(l.length).replace(/^\/+/,"");else{const u=r.match(/\/openresearch\/worktrees\/[^/]+\/[^/]+\/([^/]+)\/(.+)$/),o=u?null:r.match(/\/openresearch\/repos\/[^/]+\/[^/]+\/(.+)$/);u?(a=u[1],r=u[2]):o&&(r=o[1])}return r?{path:r,sessionId:a}:null}const IS="orx:onboarded",eE="orx:panel-width",Fu=360,YP=10,WP=232,XP=380,KP=WP+56,ZP=80;function vg(){return Math.max(Fu,window.innerWidth-KP-XP)}function QP(){const e=vg();try{const t=Number(localStorage.getItem(eE));if(Number.isFinite(t)&&t>=Fu)return Math.min(t,e)}catch{}return Math.max(Fu,Math.min(760,e,Math.round(window.innerWidth*.42)))}function lu(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const r=e.slice();return r[n]=t,r}function JP(){var ht,Fe;const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState([]),[u,o]=V.useState([]),[c,f]=V.useState(null),[p,d]=V.useState("tree"),[_,v]=V.useState(null),[w,C]=V.useState("experiments"),[b,S]=V.useState([]),[x,y]=V.useState([]),[E,R]=V.useState([]),[N,D]=V.useState(null),[T,j]=V.useState(!0),[B,z]=V.useState(!1),[G,U]=V.useState(QP),[H,Y]=V.useState(!0),[q,X]=V.useState(!1),[K,L]=V.useState("chat"),[M,O]=V.useState(()=>{try{return localStorage.getItem(IS)==="1"}catch{return!0}}),$=V.useRef(n);$.current=n,V.useEffect(()=>{AN().then(fe=>{t(fe),r(ie=>{var de;return ie??((de=fe[0])==null?void 0:de.id)??null})}).catch(()=>t([]))},[]),V.useEffect(()=>{const fe=()=>U(ie=>Math.min(ie,vg()));return window.addEventListener("resize",fe),()=>window.removeEventListener("resize",fe)},[]),V.useEffect(()=>{n&&(DN(n).catch(()=>{}),l([]),o([]),f(null),v(null),S([]),y([]),R([]),D(null),C("experiments"),jN(n).then(l).catch(()=>{}),LN(n).then(o).catch(()=>{}),Iy(n).then(f).catch(()=>{}))},[n]);const F=V.useCallback(()=>{const fe=$.current;fe&&Iy(fe).then(f).catch(()=>{})},[]);AT({onRun:fe=>{fe.projectId===$.current&&o(ie=>lu(ie,fe))},onExperiment:fe=>{fe.projectId===$.current&&l(ie=>lu(ie,fe))},onProject:fe=>{t(ie=>ie?lu(ie,fe):[fe])},onFiles:fe=>{fe===$.current&&F()}});const Q=V.useCallback((fe,ie="changes")=>{const de={id:fe,view:ie};S(Se=>Se.some(Ae=>au(Ae,de))?Se:[...Se,de]),C(de),j(!0)},[]),re=V.useCallback(fe=>{const ie=b.findIndex(Se=>au(Se,fe));if(ie===-1)return;const de=b.filter((Se,Ae)=>Ae!==ie);S(de),typeof w=="object"&&"view"in w&&au(w,fe)&&C(de[Math.min(ie,de.length-1)]??"experiments")},[b,w]),ae=V.useCallback((fe,ie,de)=>{var De;const Se=(De=e==null?void 0:e.find(Ve=>Ve.id===n))==null?void 0:De.repoPath,Ae=VP(fe,Se,ie);Ae&&(de&&(Ae.ref=de),y(Ve=>Ve.some(Ie=>ou(Ie,Ae))?Ve:[...Ve,Ae]),C(Ae),j(!0))},[e,n]),Z=V.useCallback(fe=>{const ie=x.findIndex(Se=>ou(Se,fe));if(ie===-1)return;const de=x.filter((Se,Ae)=>Ae!==ie);y(de),typeof w=="object"&&"path"in w&&ou(w,fe)&&C(de[Math.min(ie,de.length-1)]??"experiments")},[x,w]),P=V.useCallback((fe,ie,de)=>{const Se={kind:"plan",sessionId:ie,promptId:de,plan:fe};R(Ae=>{const De=Ae.findIndex(Ie=>Ie.promptId===de);if(De===-1)return[...Ae,Se];const Ve=Ae.slice();return Ve[De]=Se,Ve}),C(Se),j(!0)},[]),ee=V.useCallback(fe=>{const ie=E.findIndex(Se=>Se.promptId===fe.promptId);if(ie===-1)return;const de=E.filter((Se,Ae)=>Ae!==ie);R(de),typeof w=="object"&&"kind"in w&&w.promptId===fe.promptId&&C(de[Math.min(ie,de.length-1)]??"experiments")},[E,w]),ne=V.useCallback(fe=>{const ie={code:!0,sel:fe,toggled:new Set};D(de=>de?{...de,sel:fe}:ie),C(ie),j(!0)},[]),ge=V.useCallback(fe=>{D(ie=>ie&&{...ie,...fe})},[]),he=V.useCallback(()=>{D(null),C(fe=>typeof fe=="object"&&"code"in fe?"experiments":fe)},[]),ye=fe=>{fe.preventDefault(),fe.currentTarget.setPointerCapture(fe.pointerId);const ie=document.body.style.userSelect;document.body.style.userSelect="none";const de=Ae=>{const De=Math.round(window.innerWidth-Ae.clientX-YP),Ve=vg();if(De>Ve+ZP){z(!0);return}z(!1);const Ie=Math.min(Math.max(De,Fu),Ve);U(Ie);try{localStorage.setItem(eE,String(Ie))}catch{}},Se=()=>{window.removeEventListener("pointermove",de),window.removeEventListener("pointerup",Se),window.removeEventListener("pointercancel",Se),document.body.style.userSelect=ie};window.addEventListener("pointermove",de),window.addEventListener("pointerup",Se),window.addEventListener("pointercancel",Se)},be=fe=>{t(ie=>ie?lu(ie,fe):[fe]),r(fe.id),X(!1)},ke=fe=>{t(ie=>ie&&ie.filter(de=>de.id!==fe)),n===fe&&r(null)},Ee=typeof w=="object"&&"view"in w?w:null,Ce=typeof w=="object"&&"path"in w?w:null,rt=typeof w=="object"&&"kind"in w?w:null,bt=typeof w=="object"&&"code"in w,Ge=(e==null?void 0:e.find(fe=>fe.id===n))??null,ct=Ee?a.find(fe=>fe.id===Ee.id)??null:null;if(e===null)return m.jsx("div",{className:"app",children:m.jsx("div",{className:"empty-state",children:m.jsx("span",{className:"spinner"})})});if(e.length===0)return m.jsx("div",{className:"app",children:M?m.jsx(Nb,{projects:e,onOpen:r,onCreated:be,onDeleted:ke}):m.jsx(vB,{onDone:()=>{try{localStorage.setItem(IS,"1")}catch{}O(!0)}})});const Pt=m.jsx(_B,{projectName:((ht=e.find(fe=>fe.id===n))==null?void 0:ht.name)??"",onHome:()=>X(!0),onCollapse:()=>Y(!1)});return m.jsx("div",{className:"app",children:q?m.jsx(Nb,{projects:e,onOpen:fe=>{r(fe),X(!1)},onCreated:be,onDeleted:ke}):m.jsxs("div",{className:"app-body",children:[n&&m.jsx(TL,{projectId:n,paperId:(Fe=e.find(fe=>fe.id===n))==null?void 0:Fe.paperId,railHeader:Pt,railOpen:H,onShowRail:()=>Y(!0),mainView:K,onSelectMainView:L,panelOpen:T,onTogglePanel:()=>{T&&z(!1),j(!T)},onOpenFile:ae,onOpenPlan:P,children:K==="files"?(()=>{const fe=e.find(ie=>ie.id===n);return fe?m.jsx(PL,{project:fe,files:c,onChanged:F,onOpenStorage:()=>L("storage")}):null})():K!=="chat"?m.jsx(pL,{tab:K}):null}),K==="chat"&&T&&m.jsxs("aside",{className:`right-pane floating-panel ${B?"max":""}`,style:B?void 0:{width:G},children:[!B&&m.jsx("div",{className:"panel-resizer",onPointerDown:ye}),m.jsxs("div",{className:"tabs",children:[m.jsxs("div",{className:"tab-strip",children:[m.jsx("button",{className:`tab ${w==="experiments"?"active":""}`,onClick:()=>C("experiments"),children:"Experiments"}),b.map(fe=>{const ie=a.find(de=>de.id===fe.id);return m.jsx(Gc,{active:Ee!==null&&au(Ee,fe),label:ie?ie.title||ie.slug:"…",icon:fe.view==="terminal"?m.jsx(YS,{size:12,style:{flexShrink:0}}):m.jsx($u,{size:12,style:{flexShrink:0}}),onSelect:()=>C(fe),onClose:()=>re(fe)},`${fe.id}:${fe.view}`)}),x.map(fe=>m.jsx(Gc,{active:Ce!==null&&ou(Ce,fe),label:fe.path.split("/").pop()||fe.path,icon:m.jsx(US,{size:12,style:{flexShrink:0}}),onSelect:()=>C(fe),onClose:()=>Z(fe)},`file:${BS(fe)}`)),E.map(fe=>m.jsx(Gc,{active:rt!==null&&rt.promptId===fe.promptId,label:"Plan",icon:m.jsx(VS,{size:12,style:{flexShrink:0}}),onSelect:()=>C(fe),onClose:()=>ee(fe)},`plan:${fe.promptId}`)),N&&m.jsx(Gc,{active:bt,label:"Code",icon:m.jsx(GS,{size:12,style:{flexShrink:0}}),onSelect:()=>C(N),onClose:he},"code")]}),m.jsxs("div",{className:"panel-controls",children:[m.jsx("button",{className:"icon-btn",title:B?"Restore panel":"Expand panel","aria-label":B?"Restore panel":"Expand panel",onClick:()=>z(fe=>!fe),children:B?m.jsx(dN,{size:14}):m.jsx(hN,{size:14})}),m.jsx("button",{className:"icon-btn",title:"Close panel","aria-label":"Close panel",onClick:()=>{j(!1),z(!1)},children:m.jsx(Fo,{size:14})})]})]}),w==="experiments"?m.jsxs("div",{className:"tab-body",children:[m.jsx("div",{className:"pane-toolbar",children:m.jsxs("div",{className:"seg",children:[m.jsx("button",{className:p==="tree"?"active":"",onClick:()=>d("tree"),children:"Tree"}),m.jsx("button",{className:p==="table"?"active":"",onClick:()=>d("table"),children:"Table"})]})}),m.jsx("div",{className:"pane-content",children:p==="tree"?Ge&&m.jsx(qP,{experiments:a,runs:u,project:Ge,onOpenView:Q,onOpenCodeBranch:ne}):m.jsx(NB,{runs:u,experiments:a,onOpen:fe=>{v(fe.id),Q(fe.experimentId,"terminal")},onOpenChanges:fe=>Q(fe,"changes"),onCancel:fe=>void XS(fe).catch(()=>{})})})]}):Ce?m.jsx("div",{className:"tab-body",children:n&&m.jsx(mB,{projectId:n,path:Ce.path,sessionId:Ce.sessionId,gitRef:Ce.ref,onOpenFile:ae},BS(Ce))}):rt?m.jsx("div",{className:"tab-body",children:m.jsx("div",{className:"pane-content plan-tab-content",children:m.jsx(qo,{text:rt.plan,onOpenFile:fe=>ae(fe,rt.sessionId)})})}):bt?m.jsx("div",{className:"tab-body",children:n&&Ge&&N&&m.jsx(ML,{projectId:n,project:Ge,experiments:a,sel:N.sel,toggled:N.toggled,onSelChange:fe=>ge({sel:fe}),onToggledChange:fe=>ge({toggled:fe}),onOpenFile:ae},"code")}):m.jsx("div",{className:"tab-body",children:Ee&&ct&&Ge&&m.jsx(fB,{experiment:ct,project:Ge,view:Ee.view,runs:u,selectedRunId:_,onSelectRun:v},`${Ee.id}:${Ee.view}`)})]})]})})}gA.createRoot(document.getElementById("root")).render(m.jsx(V.StrictMode,{children:m.jsx(JP,{})})); diff --git a/ui/dist/assets/index-BsmS7b0n.css b/ui/dist/assets/index-g4cfTv1P.css similarity index 52% rename from ui/dist/assets/index-BsmS7b0n.css rename to ui/dist/assets/index-g4cfTv1P.css index 023c284..f5ccc47 100644 --- a/ui/dist/assets/index-BsmS7b0n.css +++ b/ui/dist/assets/index-g4cfTv1P.css @@ -1,4 +1,4 @@ -:root{--diff-background-color:initial;--diff-text-color:initial;--diff-font-family:Consolas,Courier,monospace;--diff-selection-background-color:#b3d7ff;--diff-selection-text-color:var(--diff-text-color);--diff-gutter-insert-background-color:#d6fedb;--diff-gutter-insert-text-color:var(--diff-text-color);--diff-gutter-delete-background-color:#fadde0;--diff-gutter-delete-text-color:var(--diff-text-color);--diff-gutter-selected-background-color:#fffce0;--diff-gutter-selected-text-color:var(--diff-text-color);--diff-code-insert-background-color:#eaffee;--diff-code-insert-text-color:var(--diff-text-color);--diff-code-delete-background-color:#fdeff0;--diff-code-delete-text-color:var(--diff-text-color);--diff-code-insert-edit-background-color:#c0dc91;--diff-code-insert-edit-text-color:var(--diff-text-color);--diff-code-delete-edit-background-color:#f39ea2;--diff-code-delete-edit-text-color:var(--diff-text-color);--diff-code-selected-background-color:#fffce0;--diff-code-selected-text-color:var(--diff-text-color);--diff-omit-gutter-line-color:#cb2a1d}.diff{background-color:var(--diff-background-color);border-collapse:collapse;color:var(--diff-text-color);table-layout:fixed;width:100%}.diff::-moz-selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff::selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff td{padding-bottom:0;padding-top:0;vertical-align:top}.diff-line{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);line-height:1.5}.diff-gutter>a{color:inherit;display:block}.diff-gutter{cursor:pointer;padding:0 1ch;text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-gutter-insert{background-color:#d6fedb;background-color:var(--diff-gutter-insert-background-color);color:var(--diff-text-color);color:var(--diff-gutter-insert-text-color)}.diff-gutter-delete{background-color:#fadde0;background-color:var(--diff-gutter-delete-background-color);color:var(--diff-text-color);color:var(--diff-gutter-delete-text-color)}.diff-gutter-omit{cursor:default}.diff-gutter-selected{background-color:#fffce0;background-color:var(--diff-gutter-selected-background-color);color:var(--diff-text-color);color:var(--diff-gutter-selected-text-color)}.diff-code{word-wrap:break-word;padding:0 0 0 .5em;white-space:pre-wrap;word-break:break-all}.diff-code-edit{color:inherit}.diff-code-insert{background-color:#eaffee;background-color:var(--diff-code-insert-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-text-color)}.diff-code-insert .diff-code-edit{background-color:#c0dc91;background-color:var(--diff-code-insert-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-edit-text-color)}.diff-code-delete{background-color:#fdeff0;background-color:var(--diff-code-delete-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-text-color)}.diff-code-delete .diff-code-edit{background-color:#f39ea2;background-color:var(--diff-code-delete-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-edit-text-color)}.diff-code-selected{background-color:#fffce0;background-color:var(--diff-code-selected-background-color);color:var(--diff-text-color);color:var(--diff-code-selected-text-color)}.diff-widget-content{vertical-align:top}.diff-gutter-col{width:7ch}.diff-gutter-omit{height:0}.diff-gutter-omit:before{background-color:#cb2a1d;background-color:var(--diff-omit-gutter-line-color);content:" ";display:block;height:100%;margin-left:4.6ch;overflow:hidden;white-space:pre;width:2px}.diff-decoration{line-height:1.5;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-decoration-content{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);padding:0}:root{--base: #ffffff;--canvas: #faf8f4;--panel: #f3f0ea;--surface: #faf7f2;--surface-bright: #fdfbfb;--highlight: #fdf3f1;--text: #1d1b1a;--subtext: #737373;--muted: #a1a1a1;--primary: #9a2036;--primary-subtle: #f7e9ec;--secondary: #4a90e2;--error: #e2a100;--border: #d4d4d4;--border-variant: #e5e5e5;--accent-orange: #da642c;--accent-red: #d94654;--accent-teal: #209a84;--accent-blue: #3a8dff;--accent-pink: #ff2b90;--accent-amber: #da9100;--accent-green: #5eb64c;--accent-purple: #9c5cff;--accent-green-subtle: #e7f4e5;--accent-amber-subtle: #fff3e1;--accent-teal-subtle: #e1f3f0;--accent-red-subtle: #fbe9ea;--accent-blue-subtle: #e5f0ff;--accent-purple-subtle: #f1e8ff;--dots-muted: #e3ded5;--dots-strong: #bdb6a8;--mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;--readable-col: 760px;--bg: var(--base);--bg-canvas: var(--canvas);--surface-2: var(--panel);--border-strong: var(--border);--accent: var(--primary);--teal: var(--accent-teal);--green: var(--accent-green);--red: var(--accent-red);--amber: var(--accent-amber);--purple: var(--accent-purple);color-scheme:light}@media(prefers-color-scheme:dark){:root{--base: #0e0c0c;--canvas: #141110;--panel: #221f1e;--surface: #1d1b1a;--surface-bright: #130f0f;--highlight: #393433;--text: #e6e1e0;--subtext: #a68e8b;--muted: #737373;--primary: #ffb3ad;--primary-subtle: #33191b;--secondary: #3e7fcf;--error: #ffb951;--border: #525252;--border-variant: #404040;--accent-amber: #e67e22;--accent-green-subtle: #1c2b18;--accent-amber-subtle: #33260f;--accent-teal-subtle: #12332d;--accent-red-subtle: #331418;--accent-blue-subtle: #10233a;--accent-purple-subtle: #251933;--dots-muted: #2a2523;--dots-strong: #555555;color-scheme:dark}}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{background:var(--base);color:var(--text);font-family:var(--sans);font-size:14px;line-height:1.45;overflow:hidden}::selection{background:var(--highlight)}button{font:inherit;color:inherit;background:none;border:none;cursor:pointer;padding:0}input,textarea,select{font:inherit;color:var(--text);background:var(--base);border:1px solid var(--border);border-radius:0;padding:6px 10px;outline:none}input:focus,textarea:focus,select:focus{border-color:var(--text)}input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-thumb{background:var(--border);border-radius:5px;border:2px solid transparent;background-clip:padding-box}::-webkit-scrollbar-track{background:transparent}@keyframes pulse{50%{opacity:.35}}@keyframes spin{to{transform:rotate(360deg)}}.app{display:flex;flex-direction:column;height:100%}.app-body{display:flex;flex:1;min-height:0;padding:0 14px}.home{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges;background:var(--canvas)}.home-inner{max-width:620px;margin:0 auto;padding:48px 24px 64px}.home-brand{font-weight:800;font-size:28px;letter-spacing:-.02em;margin-bottom:36px}.home-brand span{color:var(--primary)}.home-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}.home-head h2{margin:0;font-size:18px;letter-spacing:-.01em}.home-list{display:flex;flex-direction:column;gap:10px}.project-card{position:relative;display:flex;flex-direction:column;gap:4px;text-align:left;padding:14px 16px;background:var(--base);border:1px solid var(--border);border-radius:10px;cursor:pointer;transition:border-color .12s ease,box-shadow .12s ease}.project-card:hover{border-color:var(--text);box-shadow:0 2px 10px #0000000f}.project-delete{position:absolute;top:10px;right:10px;display:none;padding:5px;border-radius:6px;color:var(--muted);line-height:0}.project-card:hover .project-delete{display:block}.project-delete:hover{color:var(--danger, #d33);background:var(--overlay, rgba(0, 0, 0, .05))}.project-card .name{font-weight:600;font-size:14px}.project-card .repo{color:var(--subtext)}.project-card .paper,.project-card .time{font-size:11px;color:var(--muted)}.rail-brand{display:flex;align-items:center;gap:4px;height:48px;padding:0 8px 0 12px;border-bottom:1px solid var(--border);flex-shrink:0}.rail-brand .brand{display:flex;align-items:center;gap:8px;flex:1;min-width:0;font-weight:600;font-size:13px;color:var(--text);padding:4px 6px 4px 0;border-radius:6px}.rail-brand .brand:hover{color:var(--subtext)}.rail-brand .brand svg{flex-shrink:0}.rail-brand .brand .brand-project{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.icon-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;color:var(--subtext)}.icon-btn:hover{color:var(--text);background:var(--surface)}.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:6px 14px;font-size:12px;font-weight:600;border:1px solid var(--border);border-radius:8px;background:var(--base);color:var(--text);white-space:nowrap;transition:background .12s ease,border-color .12s ease,color .12s ease}.btn:hover:not(:disabled){background:var(--surface)}.btn:active:not(:disabled){background:var(--highlight)}.btn:disabled{opacity:.45;cursor:default}.btn.primary{background:var(--primary);border-color:var(--primary);color:var(--base)}.btn.primary:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text));border-color:color-mix(in oklab,var(--primary) 88%,var(--text))}.btn.primary:active:not(:disabled){background:color-mix(in oklab,var(--primary) 80%,var(--text));border-color:color-mix(in oklab,var(--primary) 80%,var(--text))}.btn.danger{color:var(--accent-red)}.btn.danger:hover:not(:disabled){background:color-mix(in oklab,var(--accent-red) 8%,transparent)}.btn.danger:active:not(:disabled){background:color-mix(in oklab,var(--accent-red) 14%,transparent)}.btn.ghost{border-color:transparent;color:var(--subtext)}.btn.ghost:hover:not(:disabled){color:var(--text);background:var(--surface)}.btn.sm{padding:3px 9px;font-size:11px;border-radius:6px}.status-badge{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:500;color:var(--subtext);text-transform:capitalize;white-space:nowrap}.status-badge .dot{width:7px;height:7px;border-radius:50%;background:currentColor;flex-shrink:0}.status-badge.live .dot{animation:pulse 1.2s ease-in-out infinite}.st-done .dot{color:var(--accent-green)}.st-failed .dot{color:var(--accent-red)}.st-running .dot{color:var(--accent-teal)}.st-starting .dot{color:var(--accent-amber)}.st-cancelled .dot{color:var(--accent-orange)}.st-editing .dot{color:var(--accent-purple)}.st-idle .dot{color:var(--muted)}.floating-panel{border:1px solid var(--border);border-radius:10px;box-shadow:0 6px 24px color-mix(in oklab,var(--text) 5%,transparent),0 1px 4px color-mix(in oklab,var(--text) 4%,transparent);overflow:hidden}.session-rail{width:232px;flex-shrink:0;display:flex;flex-direction:column;margin:10px 14px 10px 0;background:var(--base);min-height:0}.rail-nav{display:flex;flex-direction:column;gap:2px;padding:8px;flex-shrink:0}.rail-nav-item{display:flex;align-items:center;gap:10px;padding:7px 10px;font-size:12.5px;color:var(--subtext);border-radius:8px;text-align:left}.rail-nav-item:hover{background:var(--surface);color:var(--text)}.rail-nav-item.active{background:var(--panel);color:var(--text);font-weight:600}.rail-section-label{padding:10px 10px 6px;font-size:12px;font-weight:500;color:var(--muted)}.rail-section-head{display:flex;align-items:center;justify-content:space-between}.rail-filter{position:relative;display:inline-flex;margin-right:2px}.rail-filter-btn{width:24px;height:24px;border-radius:6px}.rail-empty{padding:6px 10px;font-size:12px;color:var(--muted)}.session-rail .rail-body{flex:1;min-height:0;overflow-y:auto;padding:4px 8px}.chat-pane{flex:1;min-width:0;display:flex;flex-direction:column;background:var(--base);min-height:0}.right-pane{position:relative;flex-shrink:0;min-width:0;display:flex;flex-direction:column;margin:10px 0 10px 14px;background:var(--canvas)}.right-pane.max{position:fixed;top:10px;right:10px;bottom:10px;left:10px;margin:0;z-index:60;box-shadow:0 12px 40px color-mix(in oklab,var(--text) 22%,transparent)}.panel-resizer{position:absolute;left:0;top:0;bottom:0;width:6px;cursor:col-resize;z-index:30}.panel-resizer:hover,.panel-resizer:active{background:color-mix(in oklab,var(--text) 12%,transparent)}.panel-controls{display:inline-flex;align-items:center;gap:2px;flex-shrink:0}.tabs{display:flex;align-items:center;gap:4px;padding:0 10px;height:40px;border-bottom:1px solid var(--border);background:var(--base);flex-shrink:0}.tab-strip{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow-x:auto;scrollbar-width:none}.tab-strip::-webkit-scrollbar{display:none}.tab.closable{max-width:176px;padding-right:4px}.tab .tab-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tab .tab-close{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:4px;color:var(--muted);flex-shrink:0}.tab .tab-close:hover{background:color-mix(in oklab,var(--text) 15%,transparent);color:var(--text)}.tab{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;font-size:12px;font-weight:600;color:var(--subtext);border-radius:6px;white-space:nowrap;flex-shrink:0}.tab:hover{color:var(--text)}.tab.active{color:var(--text);background:var(--surface)}.tab .tab-count{font-family:var(--mono);font-weight:400;color:var(--muted)}.tab-body{flex:1;min-height:0;position:relative;display:flex;flex-direction:column}.pane-toolbar{display:flex;align-items:center;justify-content:flex-end;padding:10px 12px 0;flex-shrink:0}.pane-content{flex:1;min-height:0;position:relative}.plan-tab-content{overflow-y:auto;background:var(--base);padding:18px 24px}.plan-tab-content .md{max-width:var(--readable-col)}.seg{display:inline-flex;align-items:center;gap:2px;padding:3px;border-radius:9px;background:color-mix(in oklab,var(--text) 10%,transparent)}.seg button{padding:3px 12px;font-size:12px;font-weight:600;color:var(--subtext);border-radius:6px}.seg button:hover{color:var(--text)}.seg button.active{background:var(--base);color:var(--text);box-shadow:0 1px 3px color-mix(in oklab,var(--text) 25%,transparent)}.chat-header{display:flex;align-items:center;gap:8px;padding:0 16px;background:var(--base);flex-shrink:0;height:48px;position:relative;z-index:4;width:100%;max-width:var(--readable-col);margin:0 auto}.chat-header.rail-hidden{max-width:none;padding:0 2px}.chat-header.rail-hidden>.icon-btn:first-child{margin-right:12px}.chat-header:after{content:"";position:absolute;top:100%;left:0;right:0;height:24px;background:linear-gradient(to bottom,var(--base),transparent);pointer-events:none}.chat-header .title{font-size:13px;font-weight:600;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-row{position:relative;display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:7px 10px;border-radius:8px;font-size:12.5px;color:var(--subtext);cursor:pointer;-webkit-user-select:none;user-select:none}.session-row:hover{background:var(--surface);color:var(--text)}.session-row.active{color:var(--text);background:var(--surface);font-weight:500}.session-row .session-dot{width:14px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.session-row .session-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-row .session-time{font-size:10px;font-family:var(--mono);color:var(--muted);flex-shrink:0}.session-row .session-menu-btn{display:none;align-items:center;justify-content:center;width:18px;height:18px;margin:-2px 0;border-radius:5px;color:var(--muted);flex-shrink:0}.session-row .session-menu-btn:hover{color:var(--text);background:var(--panel)}.session-row:hover .session-menu-btn,.session-row:focus-within .session-menu-btn,.session-row.menu-open .session-menu-btn{display:inline-flex}.session-row:hover .session-time,.session-row:focus-within .session-time,.session-row.menu-open .session-time{display:none}.session-row .busy-dot{width:7px;height:7px;border-radius:50%;background:var(--primary);animation:pulse 1.2s infinite;flex-shrink:0}.session-row .busy-dot.waiting{animation:none}.session-row .session-title-input{flex:1;min-width:0;padding:1px 5px;margin:-2px 0;font:inherit;color:var(--text);background:var(--base);border:1px solid var(--primary);border-radius:5px;outline:none}.session-row.editing{background:var(--surface);cursor:default}.session-row.editing .session-menu-btn,.session-row.editing .session-time{display:none}.chat-thread{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.chat-thread-inner{max-width:var(--readable-col);margin:0 auto;padding:16px 16px 32px;display:flex;flex-direction:column;gap:16px}.chat-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;color:var(--subtext);padding:20px;text-align:center}.chat-empty h2{margin:0;font-size:34px;font-weight:700;letter-spacing:-.02em;color:var(--text)}.chat-empty h2 span{color:var(--primary)}.chat-empty .chat-empty-hint{font-size:12px;color:var(--muted);max-width:340px;text-align:center}.chat-empty p{margin:0;font-size:13px;max-width:320px}.chat-empty .chat-suggest{font-family:var(--mono);font-size:12px;color:var(--text);background:var(--surface);border:1px solid var(--border);border-radius:999px;padding:6px 14px;cursor:pointer;transition:border-color .12s ease}.chat-empty .chat-suggest:hover{border-color:var(--text)}.msg-user{align-self:flex-end;max-width:88%;background:var(--surface);border-radius:16px;padding:10px 15px;font-size:13px;white-space:pre-wrap;word-break:break-word}.msg-images{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}.msg-images img{max-width:220px;max-height:160px;border:1px solid var(--border-variant);border-radius:4px;display:block}.msg-assistant{font-size:14px;line-height:1.62;color:var(--text);min-width:0}.reasoning{color:var(--muted);font-size:12px;margin:2px 0}.reasoning summary{cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;font-weight:600}.reasoning[open]{white-space:pre-wrap}.tool-group{margin:2px 0}.tool-group-summary{display:flex;align-items:center;gap:8px;width:100%;padding:3px 2px;cursor:pointer;color:var(--muted);font-size:12.5px;text-align:left;border-radius:6px}.tool-group-summary:hover{color:var(--subtext);background:var(--surface)}.tool-group.has-error .tool-group-summary{color:var(--accent-red)}.tool-chevron{flex-shrink:0;color:var(--muted);transition:transform .12s ease}.tool-chevron.open{transform:rotate(90deg)}.tool-group-rows{display:flex;flex-direction:column;gap:1px;margin:2px 0 4px 7px;padding-left:10px;border-left:1px solid var(--border-variant)}.tool-row{display:flex;flex-direction:column}.tool-row summary{display:flex;align-items:center;gap:8px;padding:3px 4px;cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;min-width:0;border-radius:5px}.tool-row summary:hover{background:var(--surface)}.tool-row summary::-webkit-details-marker{display:none}.tool-line{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;color:var(--subtext)}.tool-open{flex-shrink:0;font-size:11px;color:var(--primary)}.tool-open:hover{text-decoration:underline}.tool-status{width:6px;height:6px;border-radius:50%;flex-shrink:0;background:var(--muted)}.tool-status.running{background:var(--accent-amber);animation:pulse 1.2s ease-in-out infinite}.tool-status.error{background:var(--accent-red)}.tool-detail{margin:2px 0 4px 14px}.tool-cmd-full{padding:6px 10px;font-family:var(--mono);font-size:11px;color:var(--text);background:var(--surface);border-radius:5px;white-space:pre-wrap;word-break:break-word}.tool-output{margin-top:3px;padding:6px 10px;font-family:var(--mono);font-size:11px;color:var(--subtext);white-space:pre-wrap;word-break:break-word;max-height:260px;overflow-y:auto;background:var(--base);border:1px solid var(--border-variant);border-radius:5px}.working{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:12.5px;padding:2px 0 8px}.working.awaiting{font-style:italic}.spinner{width:13px;height:13px;border:2px solid var(--border);border-top-color:var(--primary);border-radius:50%;animation:spin .8s linear infinite;flex-shrink:0}.composer{padding:0 12px 12px;flex-shrink:0;position:relative;z-index:4;background:var(--base);width:100%;max-width:var(--readable-col);margin:0 auto}.composer:before{content:"";position:absolute;bottom:100%;left:0;right:0;height:24px;background:linear-gradient(to top,var(--base),transparent);pointer-events:none}.composer-box{position:relative;display:flex;flex-direction:column;border:1px solid var(--border);border-radius:8px;background:var(--base)}.composer textarea{border:none;background:none;resize:none;padding:10px 12px 4px;font-size:13px;min-height:42px;max-height:180px}.composer-attachments{display:flex;flex-wrap:wrap;gap:6px;padding:8px 12px 0}.attachment-thumb{position:relative}.attachment-thumb img{width:52px;height:52px;object-fit:cover;border:1px solid var(--border);border-radius:6px;display:block}.attachment-thumb button{position:absolute;top:-5px;right:-5px;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:1px solid var(--border);border-radius:50%;background:var(--surface);color:var(--text);cursor:pointer}.attachment-thumb button:hover{background:var(--text);color:var(--base)}.composer-actions{display:flex;justify-content:flex-end;align-items:center;gap:8px;padding:6px 8px 8px}.send-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--primary);color:var(--base);transition:background .1s ease,opacity .1s ease}.send-btn:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text))}.send-btn:disabled{opacity:.4;cursor:default}.send-btn.stop{background:var(--surface);color:var(--text)}.send-btn.stop:hover:not(:disabled){background:color-mix(in oklab,var(--surface) 88%,var(--text))}.md{min-width:0;word-break:break-word;color:var(--text);line-height:1.62}.md>*:first-child{margin-top:0}.md>*:last-child{margin-bottom:0}.md p{margin:10px 0}.md strong{color:var(--text);font-weight:600}.md pre{background:var(--surface);border:1px solid color-mix(in oklab,var(--border) 50%,transparent);border-radius:8px;padding:8px 12px;overflow-x:auto;font-size:12px;color:var(--text)}.md code{font-family:var(--mono);font-size:.9em;font-weight:500;color:var(--primary);background:var(--panel);border:1px solid var(--border-variant);padding:1px 5px}.md .file-chip{display:inline-flex;align-items:center;gap:4px;max-width:100%;margin:0 1px;padding:0 6px;vertical-align:baseline;font-family:var(--mono);font-size:.9em;font-weight:500;color:var(--text);background:var(--panel);border:1px solid var(--border-variant);cursor:pointer}.md .file-chip:hover:not(:disabled){background:var(--surface);color:var(--primary)}.md .file-chip svg{flex:none;opacity:.6}.md .file-chip-label{max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.md pre code{background:none;border:none;color:inherit;padding:0;font-weight:400}.md-code{position:relative;margin:10px 0}.md-code pre{margin:0}.md-code-copy{position:absolute;top:6px;right:6px;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:var(--muted);background:var(--base);border:1px solid var(--border-variant);border-radius:6px;opacity:0;transition:opacity .12s ease,color .12s ease}.md-code:hover .md-code-copy{opacity:1}.md-code-copy:hover{color:var(--text);border-color:var(--muted)}.md h1,.md h2,.md h3,.md h4{color:var(--text);font-size:1.05em;font-weight:600;margin:12px 0 6px}.md ul,.md ol{margin:6px 0;padding-left:22px}.md li::marker{color:var(--primary)}.md a{color:var(--primary)}.md table{border-collapse:collapse;width:100%;font-size:13px;margin:10px 0;border:1px solid var(--border);border-radius:8px;overflow:hidden}.md th,.md td{border-bottom:1px solid var(--border-variant);padding:8px 14px;text-align:left;color:var(--text)}.md tr:last-child td{border-bottom:none}.md thead th{background:var(--surface);font-weight:500;color:var(--subtext);border-bottom:1px solid var(--border)}.md tbody tr:hover td{background:var(--surface-bright)}.md blockquote{margin:6px 0;padding:2px 0 2px 10px;border-left:3px solid var(--border);color:var(--subtext)}.react-flow__node.react-flow__node-exp.selectable{cursor:default}.exp-node{width:264px;border:1px solid var(--border);background:var(--base);padding:10px 12px;box-shadow:0 1px 2px #0000000a;font-size:12.5px;transition:box-shadow .12s ease}.exp-node:hover{box-shadow:0 2px 8px #00000014}.exp-node.live{border-color:var(--accent-teal);box-shadow:0 2px 12px #209a8433}.exp-node .node-eyebrow{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;font-family:var(--mono);font-size:9.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}.exp-node .node-head{display:flex;align-items:center;gap:7px;min-width:0}.exp-node .node-status{width:8px;height:8px;border-radius:50%;flex-shrink:0}.exp-node .node-slug{font-family:var(--mono);font-size:12px;font-weight:700;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.exp-node .node-title{margin-top:4px;color:var(--subtext);font-size:11.5px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.exp-node .node-meta{margin-top:8px;display:flex;align-items:center;gap:8px;font-size:10px;color:var(--muted);font-family:var(--mono);text-transform:uppercase;letter-spacing:.05em}.exp-node .baseline-chip{font-size:9px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);border:1px solid var(--border);padding:0 4px;flex-shrink:0}.exp-node .node-actions{margin-top:8px;padding-top:6px;border-top:1px solid var(--border-variant);display:flex;align-items:center;gap:3px}.exp-node .node-action{display:inline-flex;align-items:center;gap:5px;padding:3px 6px;font-size:10.5px;font-weight:700;color:var(--subtext);border-radius:6px;text-decoration:none}.exp-node .node-action:hover{color:var(--text);background:var(--surface)}.exp-node .node-action-ext{margin-left:auto;padding:3px 5px}.run-squares{display:flex;align-items:center;gap:3px}.run-sq{width:9px;height:9px;flex-shrink:0}.run-sq.pass{background:var(--accent-green)}.run-sq.fail{border:1.5px solid color-mix(in oklab,var(--accent-red) 55%,transparent)}.run-sq.live{background:var(--accent-teal);animation:pulse 1.2s ease-in-out infinite}.run-sq.other{border:1.5px solid var(--border)}.react-flow__handle{opacity:0;pointer-events:none}.react-flow__attribution{display:none!important}.runs-table-wrap{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto;padding:12px}.runs-table{width:100%;border-collapse:separate;border-spacing:0;font-size:12.5px;background:var(--base);border:1px solid var(--border);border-radius:10px;overflow:hidden}.runs-table th{text-align:left;color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;font-weight:600;padding:8px 12px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--base);z-index:1}.runs-table td{padding:8px 12px;border-bottom:1px solid color-mix(in oklab,var(--text) 6%,transparent);white-space:nowrap}.runs-table tr:last-child td{border-bottom:none}.runs-table tr.clickable{cursor:pointer}.runs-table tr.clickable:hover td{background:var(--canvas)}.mono{font-family:var(--mono);font-size:11.5px}.instances-section-title{display:flex;align-items:center;gap:8px;margin:22px 0 10px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}.instances-section-title .count-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--canvas);border:1px solid var(--border);font-size:11px;font-weight:500;letter-spacing:0;color:var(--text)}.instances-table-wrap{overflow-x:auto}.instances-empty{margin:0;padding:14px 16px;border:1px solid var(--border);border-radius:10px;background:var(--base);color:var(--subtext);font-size:12.5px}.backend-cell{display:inline-flex;align-items:center;gap:2px}.backend-cell .icon-btn{width:22px;height:22px}.backend-badge{display:inline-flex;align-items:center;gap:7px}.backend-badge svg{flex:none;display:block}.backend-badge .backend-name{font-weight:500}.backend-badge .backend-detail,.backend-badge.muted{color:var(--muted)}.status-chip{display:inline-flex;align-items:center;gap:6px;font-size:10px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;font-family:var(--mono)}.status-chip .dot{width:8px;height:8px;border-radius:50%}.drawer{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--base);display:flex;flex-direction:column;z-index:20}.drawer-body{flex:1;min-height:0;overflow-y:auto;padding:0 16px 24px;display:flex;flex-direction:column;gap:22px}.drawer-body>:first-child{margin-top:18px}.drawer-section h3{margin:0 0 10px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.kv{display:grid;grid-template-columns:auto 1fr;gap:3px 14px;font-size:12.5px}.kv .k{color:var(--muted)}.kv .v{font-family:var(--mono);font-size:11.5px;word-break:break-all}.term-view{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;background:var(--base);z-index:20}.term-bar{display:flex;align-items:center;gap:8px;height:40px;padding:0 10px;border-bottom:1px solid var(--border);flex-shrink:0}.term-title{min-width:0;font-size:13px;font-weight:600;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.term-bar .error{font-size:11.5px;color:var(--accent-red)}.term-bar .btn{display:inline-flex;align-items:center;gap:5px}.term-fill{flex:1;min-height:0;background:#1a1a1a;padding:4px 0 4px 6px}.term-empty{height:100%;display:flex;align-items:center;justify-content:center;padding:24px;text-align:center;font-size:12.5px;color:var(--muted)}.run-history{position:relative;flex-shrink:0}.run-picker{display:inline-flex;align-items:center;gap:8px;padding:4px 6px 4px 10px;border:1px solid var(--border);border-radius:8px;background:var(--base);color:var(--text)}.run-picker:hover{background:var(--surface)}.run-picker .run-label{font-size:12px;font-weight:600}.run-picker-chev{color:var(--muted);flex-shrink:0}.history-menu{position:absolute;top:calc(100% + 6px);right:0;min-width:230px;max-height:320px;overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;padding:5px;z-index:50}.history-item{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:12px;border-radius:6px}.history-item:hover,.history-item.active{background:var(--surface)}.history-item .run-label{font-weight:600}.history-item .when{margin-left:auto;font-size:11px;color:var(--muted)}.changes-branch{display:flex;align-items:center;gap:8px;margin-bottom:10px}.commit-picker{display:flex;align-items:center;gap:8px}.ctl-label{flex-shrink:0;font-family:var(--mono);font-size:9.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}.commit-picker select{flex:1;min-width:0;font-family:var(--mono);font-size:11.5px}.uncommitted-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--accent-purple);flex-shrink:0}.changes-note{font-size:11.5px;color:var(--muted)}.empty-state{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:24px;text-align:center;color:var(--subtext)}.empty-state p{max-width:46ch;margin:0;font-size:13px;line-height:1.5;text-wrap:balance}.empty-state-cta{gap:6px}.empty-state p.empty-state-title{font-size:18px;font-weight:400;color:var(--text)}.empty-state p.empty-state-hint{font-size:15px;color:var(--subtext)}.onboarding .home-inner{max-width:560px;padding-top:96px}.onb-eyebrow{font-family:var(--mono);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin-bottom:14px}.onb-eyebrow span{color:var(--primary)}.onb-title{margin:0 0 6px;font-size:22px;letter-spacing:-.01em}.onb-sub{color:var(--subtext);font-size:13.5px;line-height:1.55;margin:0 0 22px;max-width:480px}.onb-cards{display:flex;flex-direction:column;gap:10px}.onb-card{display:flex;flex-direction:column;gap:5px;background:var(--base);border:1px solid var(--border);border-radius:10px;padding:18px 20px}.onb-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.onb-card-name{font-weight:600;font-size:14px}.onb-card-detail{font-size:12px}.onb-card-meta{font-size:12px;color:var(--subtext)}.onb-card-meta code{font-family:var(--mono);font-size:11px}.onb-card-row{display:grid;grid-template-columns:56px 1fr auto;align-items:baseline;gap:12px;padding:3px 0}.onb-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:13px;padding:8px 0}.onb-gh-options{display:flex;flex-direction:column;gap:16px;margin-top:12px;padding-top:14px;border-top:1px solid var(--border-variant)}.onb-gh-option{display:flex;flex-direction:column;gap:8px}.onb-gh-option-label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--subtext)}.onb-gh-option-body{display:flex;align-items:center;flex-wrap:wrap;gap:10px}.onb-gh-cmd{font-family:var(--mono);font-size:12px;background:var(--panel);border:1px solid var(--border-variant);border-radius:5px;padding:3px 8px}.onb-gh-hint{font-size:12px;color:var(--subtext)}.onb-gh-hint code{font-family:var(--mono);font-size:11px}.onb-gh-or{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.05em}.onb-gh-or:before,.onb-gh-or:after{content:"";flex:1;height:1px;background:var(--border-variant)}.onb-gh-option .onb-token-form{flex:1;min-width:0;margin-top:0}.onb-token-form{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:8px}.onb-token-form input{flex:1;min-width:220px;font-family:var(--mono);font-size:12px}.onb-token-form a{font-size:12px;color:var(--subtext);white-space:nowrap}.onb-token-form .error{flex-basis:100%;color:var(--accent-red);font-size:12.5px;white-space:pre-wrap}.onb-actions{display:flex;align-items:center;gap:10px;margin-top:22px}.form .form-seg{align-self:flex-start;margin-bottom:2px}.form .form-seg button{padding:5px 12px}.form .repo-hint{font-family:var(--mono);font-weight:400;text-transform:none;letter-spacing:normal;font-size:11px;color:var(--muted)}.form .repo-hint.ok{color:var(--accent-teal)}.form .paper-results{display:flex;flex-direction:column;border:1px solid var(--border);border-radius:8px;max-height:240px;overflow-y:auto}.form .paper-results button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:8px 10px;background:none;border:none;border-bottom:1px solid var(--border-variant);text-align:left;font:inherit;color:var(--text);cursor:pointer}.form .paper-results button:last-child{border-bottom:none}.form .paper-results button:hover{background:var(--surface)}.form .paper-results .title{font-size:12.5px;font-weight:500}.form .paper-results .id,.form .paper-pick .id{font-family:var(--mono);font-size:11px;color:var(--muted)}.form .paper-pick{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;border:1px solid var(--border);border-radius:8px;background:var(--surface)}.form .paper-pick .meta{min-width:0}.form .paper-pick .title{font-size:13px;font-weight:600}.form{display:flex;flex-direction:column;gap:10px}.form label{display:flex;flex-direction:column;gap:4px;font-size:11px;color:var(--subtext);font-weight:700;text-transform:uppercase;letter-spacing:.05em}.form .row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}.form .actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.form .error,.report-view .error,.settings-card>.error{color:var(--accent-red);font-size:12.5px;white-space:pre-wrap;text-transform:none}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#1d1b1a66;display:flex;align-items:center;justify-content:center;z-index:100}.modal{width:480px;max-width:94vw;max-height:88vh;overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:12px;box-shadow:0 24px 60px #00000038;padding:24px}.modal h2{margin:0 0 14px;font-size:16px}:is(.modal,.home) :is(input,select,textarea){border-radius:8px}.settings-section+.settings-section{margin-top:18px;padding-top:16px;border-top:1px solid var(--border)}.settings-section h3{margin:0 0 8px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.settings-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:12.5px;padding:4px 0}.settings-note{margin:10px 0 0;font-size:12px;padding:8px 10px;border:2px solid var(--accent-amber);background:var(--accent-amber-subtle);color:var(--accent-amber);font-weight:600}.progress{margin:12px 0 4px}.progress-track{height:8px;border-radius:999px;background:var(--surface);border:1px solid var(--border);overflow:hidden}.progress-fill{height:100%;background:var(--accent);border-radius:999px;transition:width .2s ease}.progress-caption{display:flex;justify-content:space-between;margin-top:6px;font-size:12px;color:var(--muted)}.settings-form{margin-top:14px;padding-top:14px;border-top:1px solid var(--border)}.badge{display:inline-flex;align-items:center;font-size:10px;font-weight:700;font-family:var(--mono);text-transform:uppercase;letter-spacing:.06em;padding:1px 7px;border:1px solid var(--border);color:var(--muted)}.badge.ok{color:var(--accent-green);border-color:var(--accent-green);background:var(--accent-green-subtle)}.badge.err{color:var(--accent-red);border-color:var(--accent-red);background:var(--accent-red-subtle)}.badge.warn{color:var(--accent-amber);border-color:var(--accent-amber);background:var(--accent-amber-subtle)}.files-tab{height:100%;overflow-y:auto;padding:20px 24px 48px}.files-col{max-width:var(--readable-col);margin:0 auto;display:flex;flex-direction:column;gap:10px}.files-meta{display:flex;gap:8px;flex-wrap:wrap}.files-pill{display:inline-flex;align-items:center;gap:8px;min-width:0;border:1px solid var(--border);border-radius:8px;padding:7px 11px;background:var(--base);color:var(--text);text-decoration:none}.files-pill code{font-family:var(--mono);font-size:11.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.files-pill>svg{flex-shrink:0;color:var(--muted)}a.files-pill:hover{border-color:var(--muted)}.files-pill-dir{flex:1;min-width:240px}.files-pill-dir code{flex:1;color:var(--subtext)}.files-pill-dir .icon-btn{width:22px;height:22px;margin:-4px -6px -4px 0}button.files-pill-link{cursor:pointer;font:inherit;font-size:12px;color:var(--muted);white-space:nowrap}button.files-pill-link:hover{border-color:var(--muted);color:var(--text)}.files-hint{margin:0;font-size:11.5px;line-height:1.5;color:var(--muted)}.files-hint code{font-family:var(--mono);font-size:10.5px}.files-card{border:1px solid var(--border);border-radius:10px;background:var(--base);overflow:hidden;margin-top:4px}.files-card>*+*{border-top:1px solid var(--border-variant)}.ftree-row{display:flex;align-items:center;gap:8px;padding:8px 14px}.ftree-row.clickable{cursor:pointer}.ftree-row:hover{background:var(--surface)}.ftree-children{background:var(--canvas);border-top:1px solid var(--border-variant)}.ftree-children .ftree-row:hover{background:var(--panel)}.ftree-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;flex-shrink:0;color:var(--muted);transition:transform .12s ease}.ftree-chevron.open{transform:rotate(90deg)}.ftree-chevron.spacer{visibility:hidden}.ftree-dirname{flex:1;min-width:0;font-family:var(--mono);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-title{flex:1;min-width:0;font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-tag{flex-shrink:0;font-size:11px;color:var(--primary)}.ftree-status{flex-shrink:0;font-family:var(--mono);font-size:10.5px;color:var(--subtext)}.ftree-link{flex:1;min-width:0;display:flex;align-items:center;gap:8px;color:var(--text);text-decoration:none}.ftree-link:hover .ftree-name{text-decoration:underline}.ftree-name{min-width:0;font-size:12.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-thumb{width:22px;height:22px;object-fit:cover;border-radius:4px;border:1px solid var(--border-variant);flex-shrink:0}.ftree-del{width:22px;height:22px;visibility:hidden}.ftree-row:hover .ftree-del{visibility:visible}.ftree-del:hover{color:var(--accent-red)}.ftree-date,.ftree-size{flex-shrink:0}.ftree-size{font-family:var(--mono);font-size:10.5px;color:var(--muted);white-space:nowrap}.ftree-divider{padding:10px 14px 4px;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}.files-empty{font-size:12.5px;line-height:1.55;color:var(--subtext);border:1px solid var(--border);border-radius:10px;background:var(--base);padding:18px;margin:4px 0 0}.files-empty code{font-family:var(--mono);font-size:11.5px}.files-truncated{margin:0;padding:8px 14px;font-size:11px;color:var(--muted)}.report-date,.ftree-date{font-size:11px;color:var(--muted);white-space:nowrap}.report-view{height:100%;overflow-y:auto;padding:16px 24px 48px}.report-view-col{max-width:var(--readable-col);margin:0 auto}.report-view-head{display:flex;align-items:center;gap:10px;margin-bottom:16px;padding-bottom:10px;border-bottom:1px solid var(--border-variant)}.report-md table{display:block;width:max-content;max-width:100%;overflow-x:auto}.report-md .report-img{display:block;margin:12px 0}.report-md .report-img img{max-width:100%;height:auto;border:1px solid var(--border)}.report-md .report-img-caption{display:block;margin-top:4px;text-align:center;font-size:11.5px;color:var(--subtext)}.openresearch-diff{display:flex;flex-direction:column;gap:16px}.diff-file-card{border:1px solid var(--border);border-radius:8px;background:var(--base)}.diff-file-header{position:sticky;top:0;z-index:10;display:flex;align-items:center;justify-content:space-between;gap:12px;margin:-1px -1px 0;width:calc(100% + 2px);text-align:left;padding:8px 12px;cursor:pointer}.diff-file-header:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-2;background:var(--base)}.diff-file-header:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-1;background:var(--canvas);border:1px solid var(--border);border-radius:8px 8px 0 0}.diff-file-header .chev{color:var(--muted);font-size:10px;flex-shrink:0;width:12px}.diff-file-header .path{display:flex;align-items:center;gap:8px;min-width:0;flex:1}.diff-file-header .path code{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--mono);font-size:.7rem;font-weight:700;color:var(--text)}.diff-file-header .stats{display:flex;align-items:center;gap:8px;flex-shrink:0;font-family:var(--mono);font-size:.65rem;font-weight:700;font-variant-numeric:tabular-nums}.diff-stat-add{color:var(--accent-green)}.diff-stat-del{color:var(--accent-red)}.diff-empty{padding:8px 12px;color:var(--muted);font-size:12.5px}.truncated-notice{border:2px solid var(--accent-amber);background:var(--accent-amber-subtle);padding:12px 14px;font-size:12.5px}.truncated-notice h4{margin:0 0 4px;font-size:13px;color:var(--accent-amber)}.truncated-notice p{margin:0;color:var(--subtext)}.openresearch-diff .openresearch-diff-file{--openresearch-diff-selection-background-color: color-mix( in oklab, var(--surface) 76%, var(--primary) );--openresearch-diff-gutter-selection-background-color: color-mix( in oklab, var(--surface) 68%, var(--primary) );--openresearch-diff-insert-gutter-background-color: color-mix( in oklab, var(--base) 84%, var(--accent-green) );--openresearch-diff-delete-gutter-background-color: color-mix( in oklab, var(--base) 86%, var(--accent-red) );--openresearch-diff-insert-code-background-color: color-mix( in oklab, var(--base) 91%, var(--accent-green) );--openresearch-diff-delete-code-background-color: color-mix( in oklab, var(--base) 92%, var(--accent-red) );--openresearch-diff-insert-edit-background-color: color-mix( in oklab, var(--base) 72%, var(--accent-green) );--openresearch-diff-delete-edit-background-color: color-mix( in oklab, var(--base) 78%, var(--accent-red) );--openresearch-diff-divider-color: var(--border);--openresearch-diff-omit-gutter-line-color: color-mix(in oklab, var(--base) 86%, var(--text));--openresearch-diff-unified-gutter-text-color: color-mix(in oklab, var(--text) 45%, var(--base));--diff-background-color: var(--base);--diff-text-color: var(--text);--diff-font-family: var(--mono);--diff-selection-text-color: var(--primary);--diff-selection-background-color: var(--openresearch-diff-selection-background-color);--diff-gutter-selected-text-color: var(--diff-selection-text-color);--diff-gutter-selected-background-color: var( --openresearch-diff-gutter-selection-background-color );--diff-code-selected-text-color: var(--diff-selection-text-color);--diff-code-selected-background-color: var(--diff-selection-background-color);--diff-gutter-insert-text-color: var(--accent-green);--diff-gutter-insert-background-color: var(--openresearch-diff-insert-gutter-background-color);--diff-gutter-delete-text-color: var(--accent-red);--diff-gutter-delete-background-color: var(--openresearch-diff-delete-gutter-background-color);--diff-code-insert-text-color: var(--diff-text-color);--diff-code-insert-background-color: var(--openresearch-diff-insert-code-background-color);--diff-code-delete-text-color: var(--diff-text-color);--diff-code-delete-background-color: var(--openresearch-diff-delete-code-background-color);--diff-code-insert-edit-text-color: var(--diff-text-color);--diff-code-insert-edit-background-color: var(--openresearch-diff-insert-edit-background-color);--diff-code-delete-edit-text-color: var(--diff-text-color);--diff-code-delete-edit-background-color: var(--openresearch-diff-delete-edit-background-color);--diff-omit-gutter-line-color: var(--openresearch-diff-omit-gutter-line-color);width:100%;font-size:12px;line-height:1.5}.openresearch-diff .openresearch-diff-file.diff-unified{table-layout:auto}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:first-child{display:none}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:nth-child(2){width:0%;padding:0 .5rem 0 .625rem;white-space:nowrap;text-align:right;color:var(--openresearch-diff-unified-gutter-text-color);border-right:1px solid var(--openresearch-diff-divider-color);-webkit-user-select:none;user-select:none;cursor:default}.openresearch-diff .openresearch-diff-file .diff-line{line-height:1.5}.openresearch-diff .openresearch-diff-file .diff-hunk+.diff-hunk .diff-line:first-child>td{border-top:1px solid var(--openresearch-diff-divider-color)}:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#a0a1a7}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#383a42}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#a626a4}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#4078f2}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#383a42}@media(prefers-color-scheme:dark){:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#7f848e}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#abb2bf}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#c678dd}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#61afef}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#abb2bf}}.report-back{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:600;color:var(--subtext);padding:4px 8px;border-radius:6px}.report-back:hover{color:var(--text);background:var(--surface)}.settings-view-scroll{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.settings-view{max-width:var(--readable-col);margin:0 auto;padding:24px 32px 60px}.settings-view h1{margin:0 0 6px;font-size:22px}.settings-head-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.settings-head-row h1{margin:0}.settings-view>.error{color:var(--accent-red);font-size:12.5px;white-space:pre-wrap;text-transform:none;margin:0 0 12px}.settings-sub{margin:0 0 18px;color:var(--subtext);font-size:13px}.settings-card{background:var(--base);border:1px solid var(--border);border-radius:10px;padding:16px 18px;margin-bottom:16px}.settings-card h3{margin:0 0 10px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.settings-card .settings-sub{margin-bottom:12px}.settings-card-head{display:flex;align-items:center;gap:10px;margin-bottom:12px}.settings-card .kv{gap:6px 18px}.settings-empty{color:var(--muted);font-size:12.5px;margin:4px 0 0}.muted{color:var(--muted)}.compute-list{display:flex;flex-direction:column;gap:10px;margin-bottom:14px}.compute-row{background:var(--base);border:1px solid var(--border);border-radius:10px}.compute-row-head{display:flex;align-items:center;gap:10px;padding:12px 14px;cursor:pointer;-webkit-user-select:none;user-select:none}.compute-row-head:hover{background:var(--surface);border-radius:10px}.compute-row.open .compute-row-head:hover{border-radius:10px 10px 0 0}.compute-row-logo{display:inline-flex;align-items:center;flex:none}.compute-row-name{font-size:13px;font-weight:600;color:var(--text);flex:none}.compute-row-summary{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:12px}.compute-row-head .badge,.compute-make-default,.compute-default-pill{flex:none}.compute-default-pill{color:var(--primary);border-color:var(--primary)}.compute-chevron-btn{flex:none;display:inline-flex;align-items:center;padding:2px;border-radius:6px}.compute-chevron-btn:hover{background:var(--panel)}.compute-chevron{color:var(--muted);transition:transform .12s ease}.compute-row.open .compute-chevron{transform:rotate(180deg)}.compute-row-body{border-top:1px solid var(--border);padding:14px}.compute-row-body .settings-card{margin-bottom:0;margin-top:14px}.compute-default-note{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.compute-flavor-form{margin-bottom:14px}.compute-flavor-form label{max-width:320px}.compute-flavor-hint{font-size:12px}.compute-footnote{display:flex;align-items:flex-start;gap:6px;margin:2px 0 0;font-size:12px;color:var(--muted)}.compute-footnote svg{flex:none;margin-top:1px}.harness-tabs{display:flex;gap:4px;margin-bottom:14px;border-bottom:1px solid var(--border-variant)}.harness-tabs button{display:inline-flex;align-items:center;gap:7px;padding:7px 12px;font-size:13px;font-weight:600;color:var(--subtext);border-bottom:2px solid transparent;margin-bottom:-1px}.harness-tabs button:hover{color:var(--text)}.harness-tabs button.active{color:var(--text);border-bottom-color:var(--primary)}.harness-dot{width:7px;height:7px;border-radius:50%;background:var(--muted)}.harness-dot.ok{background:var(--accent-green)}.harness-dot.err{background:var(--accent-red)}.harness-dot.warn{background:var(--accent-amber)}.env-table{width:100%;border-collapse:collapse;font-size:12.5px;table-layout:fixed}.env-table td:first-child{width:32%;overflow-wrap:anywhere}.env-table .badge{margin-left:8px}.env-table input{width:100%;border:none;background:transparent;padding:0}.env-table input:focus{box-shadow:0 1px 0 0 var(--text)}.env-table td{height:36px;padding:0 10px 0 0;vertical-align:middle;border-bottom:1px solid var(--border-variant)}.env-table td:last-child{width:116px;white-space:nowrap;text-align:right}.env-table td[colspan]{white-space:normal;text-align:left}.env-table .icon-btn{margin-left:8px;vertical-align:middle}.env-table .icon-btn:hover{color:var(--accent-red)}.flavor-table{width:100%;border-collapse:collapse;font-size:12.5px}.flavor-table th{padding:5px 10px 5px 0;border-bottom:1px solid var(--border);text-align:left;font-weight:500;color:var(--muted)}.flavor-table td{padding:5px 10px 5px 0;border-bottom:1px solid var(--border-variant)}.ssh-table{table-layout:fixed}.ssh-table th:nth-child(1){width:20%}.ssh-table th:nth-child(2){width:26%}.ssh-table th:nth-child(4){width:108px}.ssh-table th:nth-child(5){width:52px}.ssh-table td{overflow-wrap:anywhere}.ssh-table td:last-child{padding-right:0;text-align:right}.ssh-tested-at{display:block;margin-top:2px;color:var(--muted);font-size:11px}@keyframes settings-spin{to{transform:rotate(360deg)}}.spin{animation:settings-spin .9s linear infinite}.model-picker,.option-picker{position:relative;display:inline-flex}.composer-pill{display:inline-flex;align-items:center;gap:5px;font-family:var(--mono);font-size:11.5px;color:var(--subtext);padding:5px 8px;border-radius:6px}.composer-pill:hover{background:var(--surface);color:var(--text)}.composer-bare{display:inline-flex;align-items:center;gap:3px;font-size:11.5px;color:var(--subtext);padding:5px 4px;border-radius:6px}.composer-bare:hover{color:var(--text)}.model-menu,.option-menu{position:absolute;bottom:calc(100% + 8px);left:0;max-height:380px;display:flex;flex-direction:column;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.model-menu{width:320px}.option-menu{min-width:190px;padding:6px}.model-menu.align-right,.option-menu.align-right{left:auto;right:0}.option-menu.drop-down{bottom:auto;top:calc(100% + 4px)}.option-menu.session-menu{left:auto;right:6px;top:calc(100% - 2px);min-width:140px}.model-item.danger,.model-item.danger:hover{color:var(--accent-red)}.option-default{color:var(--muted);font-weight:400}.option-sep{height:1px;margin:5px 4px;background:var(--border-variant)}.option-num{color:var(--muted);font-size:11px;font-variant-numeric:tabular-nums}.model-menu input{border:none;border-bottom:1px solid var(--border-variant);background:none;padding:9px 12px;font-size:12.5px;outline:none}.model-menu-list{overflow-y:auto;padding:6px}.model-group{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--muted);padding:8px 8px 4px}.model-item{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:12.5px;border-radius:6px}.model-item:hover{background:var(--surface)}.model-item .model-id{display:block;font-family:var(--mono);font-size:10px;color:var(--muted)}.model-more{padding:4px 8px 8px;font-size:11px;color:var(--muted)}.model-locked-note{display:flex;align-items:center;gap:6px;padding:7px 12px;font-size:11px;color:var(--muted);border-top:1px solid var(--border-variant)}.model-locked-note svg{flex-shrink:0}.skill-menu{position:absolute;bottom:calc(100% + 8px);left:0;min-width:340px;max-width:100%;padding:6px;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.skill-item{display:flex;flex-direction:column;gap:2px;width:100%;text-align:left;padding:7px 8px;border-radius:6px}.skill-item.active{background:var(--surface)}.skill-item .skill-name{font-family:var(--mono);font-size:12px}.skill-item .skill-hint{color:var(--muted)}.skill-item .skill-desc{font-size:11px;color:var(--subtext)}.file-view{display:flex;flex-direction:column;height:100%;min-height:0}.file-view-header{display:flex;align-items:center;gap:8px;padding:4px 12px;border-bottom:1px solid var(--border-variant);color:var(--subtext);flex-shrink:0}.file-view-path{font-family:var(--mono);font-size:12px;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-view-ref{font-family:var(--mono);font-size:11px;color:var(--muted);border:1px solid var(--border-variant);border-radius:6px;padding:1px 6px;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-shrink:0}.file-view-body{flex:1;min-height:0;overflow:auto;background:var(--base)}.file-view-codewrap{display:flex;align-items:flex-start;min-width:max-content}.file-view-gutter,.file-view-code{margin:0;padding-top:14px;padding-bottom:14px;font-family:var(--mono);font-size:12px;line-height:1.55}.file-view-gutter{padding-left:14px;padding-right:10px;text-align:right;color:var(--muted);-webkit-user-select:none;user-select:none;position:sticky;left:0;background:var(--base);border-right:1px solid var(--border-variant);flex-shrink:0}.file-view-code{padding-left:16px;padding-right:16px;-moz-tab-size:4;tab-size:4;min-width:max-content}.file-view-note{padding:10px 16px;font-size:12px;color:var(--muted)}.file-view-md{max-width:var(--readable-col);padding:18px 20px 32px}.file-view-md .md{font-size:13.5px}.file-view-md .md h1{font-size:1.5em;margin:18px 0 8px}.file-view-md .md h2{font-size:1.25em;margin:16px 0 8px}.file-view-md .md h3{font-size:1.1em}.icon-btn.active{color:var(--primary);background:var(--surface)}.prompt-card{margin:8px 0;padding:12px 14px;border:1px solid var(--border);border-left:3px solid var(--border);border-radius:6px;background:var(--surface);display:flex;flex-direction:column;gap:9px}.prompt-card.plan{border-left-color:var(--accent-blue)}.prompt-card.permission{border-left-color:var(--accent-amber)}.prompt-card.question{border-left-color:var(--accent-purple)}.prompt-card.readonly{opacity:.6}.prompt-head{font-size:11px;font-weight:600;letter-spacing:.03em;text-transform:uppercase;color:var(--muted)}.prompt-head code{font-family:var(--mono);font-size:11.5px;text-transform:none;color:var(--text)}.prompt-sub{font-family:var(--mono);font-size:12px;color:var(--subtext);word-break:break-word}.prompt-q{font-size:14px;font-weight:600;line-height:1.5;color:var(--text)}.prompt-plan{font-size:13.5px;line-height:1.6;color:var(--text);max-height:340px;overflow-y:auto}.prompt-options{display:flex;flex-direction:column;gap:6px}.prompt-option{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;padding:8px 11px;text-align:left;border:1px solid var(--border);border-radius:5px;background:var(--base);color:var(--text);cursor:pointer;transition:border-color 80ms ease,background 80ms ease}.prompt-option:hover:not(:disabled){border-color:var(--border-strong);background:var(--surface)}.prompt-option.sel{border-color:var(--primary);background:var(--primary-subtle)}.prompt-option:disabled{cursor:default}.prompt-option-label{display:block;font-size:13px;font-weight:600}.prompt-option-desc{display:block;font-size:12px;font-weight:400;line-height:1.45;color:var(--subtext)}.prompt-actions{display:flex;flex-wrap:wrap;gap:8px}.prompt-actions .btn-primary,.prompt-actions .btn-ghost{display:inline-flex;align-items:center;gap:6px;padding:6px 13px;font-family:inherit;font-size:12px;font-weight:600;border:1px solid transparent;border-radius:5px;cursor:pointer;transition:background 80ms ease,border-color 80ms ease}.prompt-actions .btn-primary{background:var(--primary);color:var(--base)}.prompt-actions .btn-primary:hover:not(:disabled){opacity:.9}.prompt-actions .btn-ghost{background:transparent;border-color:var(--border);color:var(--subtext)}.prompt-actions .btn-ghost:hover:not(:disabled){border-color:var(--border-strong);color:var(--text);background:var(--surface)}.prompt-actions button:disabled{opacity:.5;cursor:default}.prompt-collapsed{color:var(--muted);font-size:13px;margin:4px 0}.prompt-collapsed summary{display:flex;align-items:baseline;gap:8px;cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none}.prompt-collapsed summary::-webkit-details-marker{display:none}.prompt-collapsed summary:after{content:"›";color:var(--muted);transition:transform 80ms ease}.prompt-collapsed[open] summary:after{transform:rotate(90deg)}.prompt-collapsed-title{font-weight:600;word-break:break-word}.prompt-outcome{font-size:12px;color:var(--subtext);word-break:break-word}.prompt-outcome.approved,.prompt-outcome.chosen{color:var(--accent-green)}.prompt-outcome.approved:before,.prompt-outcome.chosen:before{content:"✓ "}.prompt-outcome.revised,.prompt-outcome.rejected{color:var(--accent-amber)}.prompt-collapsed-body{margin-top:6px;padding-left:12px;border-left:2px solid var(--border);font-size:13px;color:var(--subtext)}.prompt-collapsed-options{margin:6px 0 0;padding-left:18px}.prompt-collapsed-options .sel{color:var(--text);font-weight:600}.prompt-collapsed-note{margin-top:6px;font-style:italic}.plan-strip{position:relative;width:100%;margin:0 0 10px;padding:11px 13px;display:flex;flex-direction:column;align-items:stretch;gap:10px;border:1px solid var(--border);border-left:3px solid var(--accent-blue);border-radius:8px;background:var(--surface);box-shadow:0 2px 10px #0000000f}.plan-strip-info{display:flex;align-items:baseline;gap:8px;min-width:0}.plan-strip-open{margin-left:auto;padding:0;border:none;background:none;color:var(--accent-blue);font-size:12.5px;cursor:pointer;white-space:nowrap;flex-shrink:0}.plan-strip-open:hover{text-decoration:underline}.plan-strip-spacer{flex:1}.plan-strip-revise-input{width:100%;resize:none;border:1px solid var(--border);border-radius:8px;padding:9px 11px;font-size:13px;font-family:inherit;background:var(--base);color:var(--text)}.plan-strip-revise-input:focus{border-color:var(--accent-blue)}.plan-strip-icon{color:var(--accent-blue);flex-shrink:0;align-self:center}.plan-strip-title{font-size:13px;font-weight:600;white-space:nowrap}.plan-strip-actions{gap:6px 8px;justify-content:flex-end}.plan-strip-actions .btn-primary,.plan-strip-actions .btn-ghost{background:transparent;border:1px solid var(--text);color:var(--text)}.plan-strip-actions .btn-primary:hover:not(:disabled),.plan-strip-actions .btn-ghost:hover:not(:disabled){background:var(--surface-2, rgb(0 0 0 / 5%));border-color:var(--text);color:var(--text);opacity:1}.plan-strip-actions .plan-strip-primary{background:var(--text);border-color:var(--text);color:var(--base)}.plan-strip-actions .plan-strip-primary:hover:not(:disabled){background:color-mix(in oklab,var(--text) 85%,var(--base));border-color:var(--text);color:var(--base)}.plan-strip-approve{position:relative;display:flex}.plan-strip-approve .btn-primary:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.plan-strip-actions .plan-strip-caret{border-top-left-radius:0;border-bottom-left-radius:0;padding:0 6px;display:flex;align-items:center;border-left:1px solid color-mix(in oklab,var(--base) 35%,var(--text))}.plan-strip-menu{position:absolute;right:0;bottom:calc(100% + 4px);display:flex;flex-direction:column;min-width:190px;padding:4px;border:1px solid var(--border);border-radius:8px;background:var(--surface);box-shadow:0 6px 20px #0000001f;z-index:6}.plan-strip-menu button{text-align:left;padding:7px 9px;border:none;border-radius:5px;background:transparent;color:var(--text);font-size:12.5px;cursor:pointer}.plan-strip-menu button:hover{background:var(--surface-2, rgb(0 0 0 / 5%))}.prompt-plan.clamped{max-height:9.5em;overflow:hidden;position:relative}.prompt-plan.clamped:after{content:"";position:absolute;inset:auto 0 0 0;height:34px;background:linear-gradient(to bottom,transparent,var(--surface));pointer-events:none}.prompt-plan-open{align-self:flex-start;border:none;background:transparent;color:var(--accent-blue);font-size:12px;padding:0;cursor:pointer}.prompt-plan-open:hover{text-decoration:underline}.code-tab{display:flex;flex-direction:column;height:100%;min-height:0}.code-tab-header{display:flex;align-items:center;gap:8px;padding:4px 12px;border-bottom:1px solid var(--border-variant);flex-shrink:0}.code-tab-select{max-width:280px;min-width:0;padding:3px 8px;font-size:12px}.code-tab-note{padding:8px 16px;font-size:12px;color:var(--muted);border-bottom:1px solid var(--border-variant);flex-shrink:0}.code-tab-body{flex:1;min-height:0;overflow:auto;background:var(--base)}.code-tree{padding:6px 0;font-size:12.5px}.code-tree-row{display:flex;align-items:center;gap:6px;width:100%;padding:3px 10px;border:none;background:transparent;color:var(--text);text-align:left;cursor:pointer;font-family:inherit;font-size:inherit}.code-tree-row:hover{background:var(--panel)}.code-tree-row>svg{flex-shrink:0;color:var(--subtext)}.code-tree-row>svg.code-tree-chev{color:var(--muted)}.code-tree-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #555;--xy-background-pattern-lines-color-default: #333;--xy-background-pattern-cross-color-default: #333;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}/** +:root{--diff-background-color:initial;--diff-text-color:initial;--diff-font-family:Consolas,Courier,monospace;--diff-selection-background-color:#b3d7ff;--diff-selection-text-color:var(--diff-text-color);--diff-gutter-insert-background-color:#d6fedb;--diff-gutter-insert-text-color:var(--diff-text-color);--diff-gutter-delete-background-color:#fadde0;--diff-gutter-delete-text-color:var(--diff-text-color);--diff-gutter-selected-background-color:#fffce0;--diff-gutter-selected-text-color:var(--diff-text-color);--diff-code-insert-background-color:#eaffee;--diff-code-insert-text-color:var(--diff-text-color);--diff-code-delete-background-color:#fdeff0;--diff-code-delete-text-color:var(--diff-text-color);--diff-code-insert-edit-background-color:#c0dc91;--diff-code-insert-edit-text-color:var(--diff-text-color);--diff-code-delete-edit-background-color:#f39ea2;--diff-code-delete-edit-text-color:var(--diff-text-color);--diff-code-selected-background-color:#fffce0;--diff-code-selected-text-color:var(--diff-text-color);--diff-omit-gutter-line-color:#cb2a1d}.diff{background-color:var(--diff-background-color);border-collapse:collapse;color:var(--diff-text-color);table-layout:fixed;width:100%}.diff::-moz-selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff::selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff td{padding-bottom:0;padding-top:0;vertical-align:top}.diff-line{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);line-height:1.5}.diff-gutter>a{color:inherit;display:block}.diff-gutter{cursor:pointer;padding:0 1ch;text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-gutter-insert{background-color:#d6fedb;background-color:var(--diff-gutter-insert-background-color);color:var(--diff-text-color);color:var(--diff-gutter-insert-text-color)}.diff-gutter-delete{background-color:#fadde0;background-color:var(--diff-gutter-delete-background-color);color:var(--diff-text-color);color:var(--diff-gutter-delete-text-color)}.diff-gutter-omit{cursor:default}.diff-gutter-selected{background-color:#fffce0;background-color:var(--diff-gutter-selected-background-color);color:var(--diff-text-color);color:var(--diff-gutter-selected-text-color)}.diff-code{word-wrap:break-word;padding:0 0 0 .5em;white-space:pre-wrap;word-break:break-all}.diff-code-edit{color:inherit}.diff-code-insert{background-color:#eaffee;background-color:var(--diff-code-insert-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-text-color)}.diff-code-insert .diff-code-edit{background-color:#c0dc91;background-color:var(--diff-code-insert-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-edit-text-color)}.diff-code-delete{background-color:#fdeff0;background-color:var(--diff-code-delete-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-text-color)}.diff-code-delete .diff-code-edit{background-color:#f39ea2;background-color:var(--diff-code-delete-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-edit-text-color)}.diff-code-selected{background-color:#fffce0;background-color:var(--diff-code-selected-background-color);color:var(--diff-text-color);color:var(--diff-code-selected-text-color)}.diff-widget-content{vertical-align:top}.diff-gutter-col{width:7ch}.diff-gutter-omit{height:0}.diff-gutter-omit:before{background-color:#cb2a1d;background-color:var(--diff-omit-gutter-line-color);content:" ";display:block;height:100%;margin-left:4.6ch;overflow:hidden;white-space:pre;width:2px}.diff-decoration{line-height:1.5;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-decoration-content{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);padding:0}:root{--base: #ffffff;--canvas: #faf8f4;--panel: #f3f0ea;--surface: #faf7f2;--surface-bright: #fdfbfb;--highlight: #fdf3f1;--text: #1d1b1a;--subtext: #737373;--muted: #a1a1a1;--primary: #9a2036;--primary-subtle: #f7e9ec;--secondary: #4a90e2;--error: #e2a100;--border: #d4d4d4;--border-variant: #e5e5e5;--accent-orange: #da642c;--accent-red: #d94654;--accent-teal: #209a84;--accent-blue: #3a8dff;--accent-pink: #ff2b90;--accent-amber: #da9100;--accent-green: #5eb64c;--accent-purple: #9c5cff;--accent-green-subtle: #e7f4e5;--accent-amber-subtle: #fff3e1;--accent-teal-subtle: #e1f3f0;--accent-red-subtle: #fbe9ea;--accent-blue-subtle: #e5f0ff;--accent-purple-subtle: #f1e8ff;--dots-muted: #e3ded5;--dots-strong: #bdb6a8;--mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;--readable-col: 760px;--bg: var(--base);--bg-canvas: var(--canvas);--surface-2: var(--panel);--border-strong: var(--border);--accent: var(--primary);--teal: var(--accent-teal);--green: var(--accent-green);--red: var(--accent-red);--amber: var(--accent-amber);--purple: var(--accent-purple);color-scheme:light}@media(prefers-color-scheme:dark){:root{--base: #0e0c0c;--canvas: #141110;--panel: #221f1e;--surface: #1d1b1a;--surface-bright: #130f0f;--highlight: #393433;--text: #e6e1e0;--subtext: #a68e8b;--muted: #737373;--primary: #ffb3ad;--primary-subtle: #33191b;--secondary: #3e7fcf;--error: #ffb951;--border: #525252;--border-variant: #404040;--accent-amber: #e67e22;--accent-green-subtle: #1c2b18;--accent-amber-subtle: #33260f;--accent-teal-subtle: #12332d;--accent-red-subtle: #331418;--accent-blue-subtle: #10233a;--accent-purple-subtle: #251933;--dots-muted: #2a2523;--dots-strong: #555555;color-scheme:dark}}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{background:var(--base);color:var(--text);font-family:var(--sans);font-size:14px;line-height:1.45;overflow:hidden}::selection{background:var(--highlight)}button{font:inherit;color:inherit;background:none;border:none;cursor:pointer;padding:0}input,textarea,select{font:inherit;color:var(--text);background:var(--base);border:1px solid var(--border);border-radius:0;padding:6px 10px;outline:none}input:focus,textarea:focus,select:focus{border-color:var(--text)}input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-thumb{background:var(--border);border-radius:5px;border:2px solid transparent;background-clip:padding-box}::-webkit-scrollbar-track{background:transparent}@keyframes pulse{50%{opacity:.35}}@keyframes spin{to{transform:rotate(360deg)}}.app{display:flex;flex-direction:column;height:100%}.app-body{display:flex;flex:1;min-height:0;padding:0 14px}.home{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges;background:var(--canvas)}.home-inner{max-width:620px;margin:0 auto;padding:48px 24px 64px}.home-brand{font-weight:800;font-size:28px;letter-spacing:-.02em;margin-bottom:36px}.home-brand span{color:var(--primary)}.home-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}.home-head h2{margin:0;font-size:18px;letter-spacing:-.01em}.home-list{display:flex;flex-direction:column;gap:10px}.project-card{position:relative;display:flex;flex-direction:column;gap:4px;text-align:left;padding:14px 16px;background:var(--base);border:1px solid var(--border);border-radius:10px;cursor:pointer;transition:border-color .12s ease,box-shadow .12s ease}.project-card:hover{border-color:var(--text);box-shadow:0 2px 10px #0000000f}.project-delete{position:absolute;top:10px;right:10px;display:none;padding:5px;border-radius:6px;color:var(--muted);line-height:0}.project-card:hover .project-delete{display:block}.project-delete:hover{color:var(--danger, #d33);background:var(--overlay, rgba(0, 0, 0, .05))}.project-card .name{font-weight:600;font-size:14px}.project-card .repo{color:var(--subtext)}.project-card .paper,.project-card .time{font-size:11px;color:var(--muted)}.rail-brand{display:flex;align-items:center;gap:4px;height:48px;padding:0 8px 0 12px;border-bottom:1px solid var(--border);flex-shrink:0}.rail-brand .brand{display:flex;align-items:center;gap:8px;flex:1;min-width:0;font-weight:600;font-size:13px;color:var(--text);padding:4px 6px 4px 0;border-radius:6px}.rail-brand .brand:hover{color:var(--subtext)}.rail-brand .brand svg{flex-shrink:0}.rail-brand .brand .brand-project{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.icon-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;color:var(--subtext)}.icon-btn:hover{color:var(--text);background:var(--surface)}.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:6px 14px;font-size:12px;font-weight:600;border:1px solid var(--border);border-radius:8px;background:var(--base);color:var(--text);white-space:nowrap;transition:background .12s ease,border-color .12s ease,color .12s ease}.btn:hover:not(:disabled){background:var(--surface)}.btn:active:not(:disabled){background:var(--highlight)}.btn:disabled{opacity:.45;cursor:default}.btn.primary{background:var(--primary);border-color:var(--primary);color:var(--base)}.btn.primary:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text));border-color:color-mix(in oklab,var(--primary) 88%,var(--text))}.btn.primary:active:not(:disabled){background:color-mix(in oklab,var(--primary) 80%,var(--text));border-color:color-mix(in oklab,var(--primary) 80%,var(--text))}.btn.danger{color:var(--accent-red)}.btn.danger:hover:not(:disabled){background:color-mix(in oklab,var(--accent-red) 8%,transparent)}.btn.danger:active:not(:disabled){background:color-mix(in oklab,var(--accent-red) 14%,transparent)}.btn.ghost{border-color:transparent;color:var(--subtext)}.btn.ghost:hover:not(:disabled){color:var(--text);background:var(--surface)}.btn.sm{padding:3px 9px;font-size:11px;border-radius:6px}.status-badge{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:500;color:var(--subtext);text-transform:capitalize;white-space:nowrap}.status-badge .dot{width:7px;height:7px;border-radius:50%;background:currentColor;flex-shrink:0}.status-badge.live .dot{animation:pulse 1.2s ease-in-out infinite}.st-done .dot{color:var(--accent-green)}.st-failed .dot{color:var(--accent-red)}.st-running .dot{color:var(--accent-teal)}.st-starting .dot{color:var(--accent-amber)}.st-cancelled .dot{color:var(--accent-orange)}.st-editing .dot{color:var(--accent-purple)}.st-idle .dot{color:var(--muted)}.floating-panel{border:1px solid var(--border);border-radius:10px;box-shadow:0 6px 24px color-mix(in oklab,var(--text) 5%,transparent),0 1px 4px color-mix(in oklab,var(--text) 4%,transparent);overflow:hidden}.session-rail{width:232px;flex-shrink:0;display:flex;flex-direction:column;margin:10px 14px 10px 0;background:var(--base);min-height:0}.rail-nav{display:flex;flex-direction:column;gap:2px;padding:8px;flex-shrink:0}.rail-nav-item{display:flex;align-items:center;gap:10px;padding:7px 10px;font-size:12.5px;color:var(--subtext);border-radius:8px;text-align:left}.rail-nav-item:hover{background:var(--surface);color:var(--text)}.rail-nav-item.active{background:var(--panel);color:var(--text);font-weight:600}.rail-section-label{padding:10px 10px 6px;font-size:12px;font-weight:500;color:var(--muted)}.rail-section-head{display:flex;align-items:center;justify-content:space-between}.rail-filter{position:relative;display:inline-flex;margin-right:2px}.rail-filter-btn{width:24px;height:24px;border-radius:6px}.rail-empty{padding:6px 10px;font-size:12px;color:var(--muted)}.session-rail .rail-body{flex:1;min-height:0;overflow-y:auto;padding:4px 8px}.chat-pane{flex:1;min-width:0;display:flex;flex-direction:column;background:var(--base);min-height:0}.right-pane{position:relative;flex-shrink:0;min-width:0;display:flex;flex-direction:column;margin:10px 0 10px 14px;background:var(--canvas)}.right-pane.max{position:fixed;top:10px;right:10px;bottom:10px;left:10px;margin:0;z-index:60;box-shadow:0 12px 40px color-mix(in oklab,var(--text) 22%,transparent)}.panel-resizer{position:absolute;left:0;top:0;bottom:0;width:6px;cursor:col-resize;z-index:30}.panel-resizer:hover,.panel-resizer:active{background:color-mix(in oklab,var(--text) 12%,transparent)}.panel-controls{display:inline-flex;align-items:center;gap:2px;flex-shrink:0}.tabs{display:flex;align-items:center;gap:4px;padding:0 10px;height:40px;border-bottom:1px solid var(--border);background:var(--base);flex-shrink:0}.tab-strip{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow-x:auto;scrollbar-width:none}.tab-strip::-webkit-scrollbar{display:none}.tab.closable{max-width:176px;padding-right:4px}.tab .tab-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tab .tab-close{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:4px;color:var(--muted);flex-shrink:0}.tab .tab-close:hover{background:color-mix(in oklab,var(--text) 15%,transparent);color:var(--text)}.tab{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;font-size:12px;font-weight:600;color:var(--subtext);border-radius:6px;white-space:nowrap;flex-shrink:0}.tab:hover{color:var(--text)}.tab.active{color:var(--text);background:var(--surface)}.tab .tab-count{font-family:var(--mono);font-weight:400;color:var(--muted)}.tab-body{flex:1;min-height:0;position:relative;display:flex;flex-direction:column}.pane-toolbar{display:flex;align-items:center;justify-content:flex-end;padding:10px 12px 0;flex-shrink:0}.pane-content{flex:1;min-height:0;position:relative}.plan-tab-content{overflow-y:auto;background:var(--base);padding:18px 24px}.plan-tab-content .md{max-width:var(--readable-col)}.seg{display:inline-flex;align-items:center;gap:2px;padding:3px;border-radius:9px;background:color-mix(in oklab,var(--text) 10%,transparent)}.seg button{padding:3px 12px;font-size:12px;font-weight:600;color:var(--subtext);border-radius:6px}.seg button:hover{color:var(--text)}.seg button.active{background:var(--base);color:var(--text);box-shadow:0 1px 3px color-mix(in oklab,var(--text) 25%,transparent)}.chat-header{display:flex;align-items:center;gap:8px;padding:0 16px;background:var(--base);flex-shrink:0;height:48px;position:relative;z-index:4;width:100%;max-width:var(--readable-col);margin:0 auto}.chat-header.rail-hidden{max-width:none;padding:0 2px}.chat-header.rail-hidden>.icon-btn:first-child{margin-right:12px}.chat-header:after{content:"";position:absolute;top:100%;left:0;right:0;height:24px;background:linear-gradient(to bottom,var(--base),transparent);pointer-events:none}.chat-header .title{font-size:13px;font-weight:600;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-row{position:relative;display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:7px 10px;border-radius:8px;font-size:12.5px;color:var(--subtext);cursor:pointer;-webkit-user-select:none;user-select:none}.session-row:hover{background:var(--surface);color:var(--text)}.session-row.active{color:var(--text);background:var(--surface);font-weight:500}.session-row .session-dot{width:14px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.session-row .session-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-row .session-time{font-size:10px;font-family:var(--mono);color:var(--muted);flex-shrink:0}.session-row .session-menu-btn{display:none;align-items:center;justify-content:center;width:18px;height:18px;margin:-2px 0;border-radius:5px;color:var(--muted);flex-shrink:0}.session-row .session-menu-btn:hover{color:var(--text);background:var(--panel)}.session-row:hover .session-menu-btn,.session-row:focus-within .session-menu-btn,.session-row.menu-open .session-menu-btn{display:inline-flex}.session-row:hover .session-time,.session-row:focus-within .session-time,.session-row.menu-open .session-time{display:none}.session-row .busy-dot{width:7px;height:7px;border-radius:50%;background:var(--primary);animation:pulse 1.2s infinite;flex-shrink:0}.session-row .busy-dot.waiting{animation:none}.session-row .session-title-input{flex:1;min-width:0;padding:1px 5px;margin:-2px 0;font:inherit;color:var(--text);background:var(--base);border:1px solid var(--primary);border-radius:5px;outline:none}.session-row.editing{background:var(--surface);cursor:default}.session-row.editing .session-menu-btn,.session-row.editing .session-time{display:none}.chat-thread{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.chat-thread-inner{max-width:var(--readable-col);margin:0 auto;padding:16px 16px 32px;display:flex;flex-direction:column;gap:16px}.chat-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;color:var(--subtext);padding:20px;text-align:center}.chat-empty h2{margin:0;font-size:34px;font-weight:700;letter-spacing:-.02em;color:var(--text)}.chat-empty h2 span{color:var(--primary)}.chat-empty .chat-empty-hint{font-size:12px;color:var(--muted);max-width:340px;text-align:center}.chat-empty p{margin:0;font-size:13px;max-width:320px}.chat-empty .chat-suggest{font-family:var(--mono);font-size:12px;color:var(--text);background:var(--surface);border:1px solid var(--border);border-radius:999px;padding:6px 14px;cursor:pointer;transition:border-color .12s ease}.chat-empty .chat-suggest:hover{border-color:var(--text)}.msg-user{align-self:flex-end;max-width:88%;background:var(--surface);border-radius:16px;padding:10px 15px;font-size:13px;white-space:pre-wrap;word-break:break-word}.msg-images{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}.msg-images img{max-width:220px;max-height:160px;border:1px solid var(--border-variant);border-radius:4px;display:block}.msg-assistant{font-size:14px;line-height:1.62;color:var(--text);min-width:0}.reasoning{color:var(--muted);font-size:12px;margin:2px 0}.reasoning summary{cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;font-weight:600}.reasoning[open]{white-space:pre-wrap}.tool-group{margin:2px 0}.tool-group-summary{display:flex;align-items:center;gap:8px;width:100%;padding:3px 2px;cursor:pointer;color:var(--muted);font-size:12.5px;text-align:left;border-radius:6px}.tool-group-summary:hover{color:var(--subtext);background:var(--surface)}.tool-group.has-error .tool-group-summary{color:var(--accent-red)}.tool-chevron{flex-shrink:0;color:var(--muted);transition:transform .12s ease}.tool-chevron.open{transform:rotate(90deg)}.tool-group-rows{display:flex;flex-direction:column;gap:1px;margin:2px 0 4px 7px;padding-left:10px;border-left:1px solid var(--border-variant)}.tool-row{display:flex;flex-direction:column}.tool-row summary{display:flex;align-items:center;gap:8px;padding:3px 4px;cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;min-width:0;border-radius:5px}.tool-row summary:hover{background:var(--surface)}.tool-row summary::-webkit-details-marker{display:none}.tool-line{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;color:var(--subtext)}.tool-open{flex-shrink:0;font-size:11px;color:var(--primary)}.tool-open:hover{text-decoration:underline}.tool-status{width:6px;height:6px;border-radius:50%;flex-shrink:0;background:var(--muted)}.tool-status.running{background:var(--accent-amber);animation:pulse 1.2s ease-in-out infinite}.tool-status.error{background:var(--accent-red)}.tool-detail{margin:2px 0 4px 14px}.tool-cmd-full{padding:6px 10px;font-family:var(--mono);font-size:11px;color:var(--text);background:var(--surface);border-radius:5px;white-space:pre-wrap;word-break:break-word}.tool-output{margin-top:3px;padding:6px 10px;font-family:var(--mono);font-size:11px;color:var(--subtext);white-space:pre-wrap;word-break:break-word;max-height:260px;overflow-y:auto;background:var(--base);border:1px solid var(--border-variant);border-radius:5px}.working{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:12.5px;padding:2px 0 8px}.working.awaiting{font-style:italic}.spinner{width:13px;height:13px;border:2px solid var(--border);border-top-color:var(--primary);border-radius:50%;animation:spin .8s linear infinite;flex-shrink:0}.composer{padding:0 12px 12px;flex-shrink:0;position:relative;z-index:4;background:var(--base);width:100%;max-width:var(--readable-col);margin:0 auto}.composer:before{content:"";position:absolute;bottom:100%;left:0;right:0;height:24px;background:linear-gradient(to top,var(--base),transparent);pointer-events:none}.composer-box{position:relative;display:flex;flex-direction:column;border:1px solid var(--border);border-radius:8px;background:var(--base)}.composer textarea{border:none;background:none;resize:none;padding:10px 12px 4px;font-size:13px;min-height:42px;max-height:180px}.composer-attachments{display:flex;flex-wrap:wrap;gap:6px;padding:8px 12px 0}.attachment-thumb{position:relative}.attachment-thumb img{width:52px;height:52px;object-fit:cover;border:1px solid var(--border);border-radius:6px;display:block}.attachment-thumb button{position:absolute;top:-5px;right:-5px;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:1px solid var(--border);border-radius:50%;background:var(--surface);color:var(--text);cursor:pointer}.attachment-thumb button:hover{background:var(--text);color:var(--base)}.composer-actions{display:flex;justify-content:flex-end;align-items:center;gap:8px;padding:6px 8px 8px}.send-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--primary);color:var(--base);transition:background .1s ease,opacity .1s ease}.send-btn:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text))}.send-btn:disabled{opacity:.4;cursor:default}.send-btn.stop{background:var(--surface);color:var(--text)}.send-btn.stop:hover:not(:disabled){background:color-mix(in oklab,var(--surface) 88%,var(--text))}.md{min-width:0;word-break:break-word;color:var(--text);line-height:1.62}.md>*:first-child{margin-top:0}.md>*:last-child{margin-bottom:0}.md p{margin:10px 0}.md strong{color:var(--text);font-weight:600}.md pre{background:var(--surface);border:1px solid color-mix(in oklab,var(--border) 50%,transparent);border-radius:8px;padding:8px 12px;overflow-x:auto;font-size:12px;color:var(--text)}.md code{font-family:var(--mono);font-size:.9em;font-weight:500;color:var(--primary);background:var(--panel);border:1px solid var(--border-variant);padding:1px 5px}.md .file-chip{display:inline-flex;align-items:center;gap:4px;max-width:100%;margin:0 1px;padding:0 6px;vertical-align:baseline;font-family:var(--mono);font-size:.9em;font-weight:500;color:var(--text);background:var(--panel);border:1px solid var(--border-variant);cursor:pointer}.md .file-chip:hover:not(:disabled){background:var(--surface);color:var(--primary)}.md .file-chip svg{flex:none;opacity:.6}.md .file-chip-label{max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.md pre code{background:none;border:none;color:inherit;padding:0;font-weight:400}.md-code{position:relative;margin:10px 0}.md-code pre{margin:0}.md-code-copy{position:absolute;top:6px;right:6px;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:var(--muted);background:var(--base);border:1px solid var(--border-variant);border-radius:6px;opacity:0;transition:opacity .12s ease,color .12s ease}.md-code:hover .md-code-copy{opacity:1}.md-code-copy:hover{color:var(--text);border-color:var(--muted)}.md h1,.md h2,.md h3,.md h4{color:var(--text);font-size:1.05em;font-weight:600;margin:12px 0 6px}.md ul,.md ol{margin:6px 0;padding-left:22px}.md li::marker{color:var(--primary)}.md a{color:var(--primary)}.md table{border-collapse:collapse;width:100%;font-size:13px;margin:10px 0;border:1px solid var(--border);border-radius:8px;overflow:hidden}.md th,.md td{border-bottom:1px solid var(--border-variant);padding:8px 14px;text-align:left;color:var(--text)}.md tr:last-child td{border-bottom:none}.md thead th{background:var(--surface);font-weight:500;color:var(--subtext);border-bottom:1px solid var(--border)}.md tbody tr:hover td{background:var(--surface-bright)}.md blockquote{margin:6px 0;padding:2px 0 2px 10px;border-left:3px solid var(--border);color:var(--subtext)}.react-flow__node.react-flow__node-exp.selectable{cursor:default}.exp-node{width:264px;border:1px solid var(--border);background:var(--base);padding:10px 12px;box-shadow:0 1px 2px #0000000a;font-size:12.5px;transition:box-shadow .12s ease}.exp-node:hover{box-shadow:0 2px 8px #00000014}.exp-node.live{border-color:var(--accent-teal);box-shadow:0 2px 12px #209a8433}.exp-node .node-eyebrow{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;font-family:var(--mono);font-size:9.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}.exp-node .node-head{display:flex;align-items:center;gap:7px;min-width:0}.exp-node .node-status{width:8px;height:8px;border-radius:50%;flex-shrink:0}.exp-node .node-slug{font-family:var(--mono);font-size:12px;font-weight:700;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.exp-node .node-title{margin-top:4px;color:var(--subtext);font-size:11.5px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.exp-node .node-meta{margin-top:8px;display:flex;align-items:center;gap:8px;font-size:10px;color:var(--muted);font-family:var(--mono);text-transform:uppercase;letter-spacing:.05em}.exp-node .baseline-chip{font-size:9px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);border:1px solid var(--border);padding:0 4px;flex-shrink:0}.exp-node .node-actions{margin-top:8px;padding-top:6px;border-top:1px solid var(--border-variant);display:flex;align-items:center;gap:3px}.exp-node .node-action{display:inline-flex;align-items:center;gap:5px;padding:3px 6px;font-size:10.5px;font-weight:700;color:var(--subtext);border-radius:6px;text-decoration:none}.exp-node .node-action:hover{color:var(--text);background:var(--surface)}.exp-node .node-action-ext{margin-left:auto;padding:3px 5px}.run-squares{display:flex;align-items:center;gap:3px}.run-sq{width:9px;height:9px;flex-shrink:0}.run-sq.pass{background:var(--accent-green)}.run-sq.fail{border:1.5px solid color-mix(in oklab,var(--accent-red) 55%,transparent)}.run-sq.live{background:var(--accent-teal);animation:pulse 1.2s ease-in-out infinite}.run-sq.other{border:1.5px solid var(--border)}.react-flow__handle{opacity:0;pointer-events:none}.react-flow__attribution{display:none!important}.runs-table-wrap{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto;padding:12px}.runs-table{width:100%;border-collapse:separate;border-spacing:0;font-size:12.5px;background:var(--base);border:1px solid var(--border);border-radius:10px;overflow:hidden}.runs-table th{text-align:left;color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;font-weight:600;padding:8px 12px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--base);z-index:1}.runs-table td{padding:8px 12px;border-bottom:1px solid color-mix(in oklab,var(--text) 6%,transparent);white-space:nowrap}.runs-table tr:last-child td{border-bottom:none}.runs-table tr.clickable{cursor:pointer}.runs-table tr.clickable:hover td{background:var(--canvas)}.mono{font-family:var(--mono);font-size:11.5px}.instances-section-title{display:flex;align-items:center;gap:8px;margin:22px 0 10px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}.instances-section-title .count-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--canvas);border:1px solid var(--border);font-size:11px;font-weight:500;letter-spacing:0;color:var(--text)}.instances-table-wrap{overflow-x:auto}.instances-empty{margin:0;padding:14px 16px;border:1px solid var(--border);border-radius:10px;background:var(--base);color:var(--subtext);font-size:12.5px}.backend-cell{display:inline-flex;align-items:center;gap:2px}.backend-cell .icon-btn{width:22px;height:22px}.backend-badge{display:inline-flex;align-items:center;gap:7px}.backend-badge svg{flex:none;display:block}.backend-badge .backend-name{font-weight:500}.backend-badge .backend-detail,.backend-badge.muted{color:var(--muted)}.status-chip{display:inline-flex;align-items:center;gap:6px;font-size:10px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;font-family:var(--mono)}.status-chip .dot{width:8px;height:8px;border-radius:50%}.drawer{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--base);display:flex;flex-direction:column;z-index:20}.drawer-body{flex:1;min-height:0;overflow-y:auto;padding:0 16px 24px;display:flex;flex-direction:column;gap:22px}.drawer-body>:first-child{margin-top:18px}.drawer-section h3{margin:0 0 10px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.kv{display:grid;grid-template-columns:auto 1fr;gap:3px 14px;font-size:12.5px}.kv .k{color:var(--muted)}.kv .v{font-family:var(--mono);font-size:11.5px;word-break:break-all}.term-view{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;background:var(--base);z-index:20}.term-bar{display:flex;align-items:center;gap:8px;height:40px;padding:0 10px;border-bottom:1px solid var(--border);flex-shrink:0}.term-title{min-width:0;font-size:13px;font-weight:600;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.term-bar .error{font-size:11.5px;color:var(--accent-red)}.term-bar .btn{display:inline-flex;align-items:center;gap:5px}.term-fill{flex:1;min-height:0;background:#1a1a1a;padding:4px 0 4px 6px}.term-empty{height:100%;display:flex;align-items:center;justify-content:center;padding:24px;text-align:center;font-size:12.5px;color:var(--muted)}.run-history{position:relative;flex-shrink:0}.run-picker{display:inline-flex;align-items:center;gap:8px;padding:4px 6px 4px 10px;border:1px solid var(--border);border-radius:8px;background:var(--base);color:var(--text)}.run-picker:hover{background:var(--surface)}.run-picker .run-label{font-size:12px;font-weight:600}.run-picker-chev{color:var(--muted);flex-shrink:0}.history-menu{position:absolute;top:calc(100% + 6px);right:0;min-width:230px;max-height:320px;overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;padding:5px;z-index:50}.history-item{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:12px;border-radius:6px}.history-item:hover,.history-item.active{background:var(--surface)}.history-item .run-label{font-weight:600}.history-item .when{margin-left:auto;font-size:11px;color:var(--muted)}.changes-branch{display:flex;align-items:center;gap:8px;margin-bottom:10px}.commit-picker{display:flex;align-items:center;gap:8px}.ctl-label{flex-shrink:0;font-family:var(--mono);font-size:9.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}.commit-picker select{flex:1;min-width:0;font-family:var(--mono);font-size:11.5px}.uncommitted-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--accent-purple);flex-shrink:0}.changes-note{font-size:11.5px;color:var(--muted)}.empty-state{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:24px;text-align:center;color:var(--subtext)}.empty-state p{max-width:46ch;margin:0;font-size:13px;line-height:1.5;text-wrap:balance}.empty-state-cta{gap:6px}.empty-state p.empty-state-title{font-size:18px;font-weight:400;color:var(--text)}.empty-state p.empty-state-hint{font-size:15px;color:var(--subtext)}.onboarding .home-inner{max-width:560px;padding-top:96px}.onb-eyebrow{font-family:var(--mono);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin-bottom:14px}.onb-eyebrow span{color:var(--primary)}.onb-title{margin:0 0 6px;font-size:22px;letter-spacing:-.01em}.onb-sub{color:var(--subtext);font-size:13.5px;line-height:1.55;margin:0 0 22px;max-width:480px}.onb-cards{display:flex;flex-direction:column;gap:10px}.onb-card{display:flex;flex-direction:column;gap:5px;background:var(--base);border:1px solid var(--border);border-radius:10px;padding:18px 20px}.onb-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.onb-card-name{font-weight:600;font-size:14px}.onb-card-detail{font-size:12px}.onb-card-meta{font-size:12px;color:var(--subtext)}.onb-card-meta code{font-family:var(--mono);font-size:11px}.onb-card-row{display:grid;grid-template-columns:56px 1fr auto;align-items:baseline;gap:12px;padding:3px 0}.onb-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:13px;padding:8px 0}.onb-gh-options{display:flex;flex-direction:column;gap:16px;margin-top:12px;padding-top:14px;border-top:1px solid var(--border-variant)}.onb-gh-option{display:flex;flex-direction:column;gap:8px}.onb-gh-option-label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--subtext)}.onb-gh-option-body{display:flex;align-items:center;flex-wrap:wrap;gap:10px}.onb-gh-cmd{font-family:var(--mono);font-size:12px;background:var(--panel);border:1px solid var(--border-variant);border-radius:5px;padding:3px 8px}.onb-gh-hint{font-size:12px;color:var(--subtext)}.onb-gh-hint code{font-family:var(--mono);font-size:11px}.onb-gh-or{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.05em}.onb-gh-or:before,.onb-gh-or:after{content:"";flex:1;height:1px;background:var(--border-variant)}.onb-gh-option .onb-token-form{flex:1;min-width:0;margin-top:0}.onb-token-form{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:8px}.onb-token-form input{flex:1;min-width:220px;font-family:var(--mono);font-size:12px}.onb-token-form a{font-size:12px;color:var(--subtext);white-space:nowrap}.onb-token-form .error{flex-basis:100%;color:var(--accent-red);font-size:12.5px;white-space:pre-wrap}.onb-actions{display:flex;align-items:center;gap:10px;margin-top:22px}.form .form-seg{align-self:flex-start;margin-bottom:2px}.form .form-seg button{padding:5px 12px}.form .repo-hint{font-family:var(--mono);font-weight:400;text-transform:none;letter-spacing:normal;font-size:11px;color:var(--muted)}.form .repo-hint.ok{color:var(--accent-teal)}.form .paper-results{display:flex;flex-direction:column;border:1px solid var(--border);border-radius:8px;max-height:240px;overflow-y:auto}.form .paper-results button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:8px 10px;background:none;border:none;border-bottom:1px solid var(--border-variant);text-align:left;font:inherit;color:var(--text);cursor:pointer}.form .paper-results button:last-child{border-bottom:none}.form .paper-results button:hover{background:var(--surface)}.form .paper-results .title{font-size:12.5px;font-weight:500}.form .paper-results .id,.form .paper-pick .id{font-family:var(--mono);font-size:11px;color:var(--muted)}.form .paper-pick{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;border:1px solid var(--border);border-radius:8px;background:var(--surface)}.form .paper-pick .meta{min-width:0}.form .paper-pick .title{font-size:13px;font-weight:600}.form{display:flex;flex-direction:column;gap:10px}.form label{display:flex;flex-direction:column;gap:4px;font-size:11px;color:var(--subtext);font-weight:700;text-transform:uppercase;letter-spacing:.05em}.form .row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}.form .actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.form .error,.report-view .error,.settings-card>.error{color:var(--accent-red);font-size:12.5px;white-space:pre-wrap;text-transform:none}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#1d1b1a66;display:flex;align-items:center;justify-content:center;z-index:100}.modal{width:480px;max-width:94vw;max-height:88vh;overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:12px;box-shadow:0 24px 60px #00000038;padding:24px}.modal h2{margin:0 0 14px;font-size:16px}:is(.modal,.home) :is(input,select,textarea){border-radius:8px}.settings-section+.settings-section{margin-top:18px;padding-top:16px;border-top:1px solid var(--border)}.settings-section h3{margin:0 0 8px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.settings-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:12.5px;padding:4px 0}.settings-note{margin:10px 0 0;font-size:12px;padding:8px 10px;border:2px solid var(--accent-amber);background:var(--accent-amber-subtle);color:var(--accent-amber);font-weight:600}.progress{margin:12px 0 4px}.progress-track{height:8px;border-radius:999px;background:var(--surface);border:1px solid var(--border);overflow:hidden}.progress-fill{height:100%;background:var(--accent);border-radius:999px;transition:width .2s ease}.progress-caption{display:flex;justify-content:space-between;margin-top:6px;font-size:12px;color:var(--muted)}.settings-form{margin-top:14px;padding-top:14px;border-top:1px solid var(--border)}.badge{display:inline-flex;align-items:center;font-size:10px;font-weight:700;font-family:var(--mono);text-transform:uppercase;letter-spacing:.06em;padding:1px 7px;border:1px solid var(--border);color:var(--muted)}.badge.ok{color:var(--accent-green);border-color:var(--accent-green);background:var(--accent-green-subtle)}.badge.err{color:var(--accent-red);border-color:var(--accent-red);background:var(--accent-red-subtle)}.badge.warn{color:var(--accent-amber);border-color:var(--accent-amber);background:var(--accent-amber-subtle)}.files-tab{height:100%;overflow-y:auto;padding:20px 24px 48px}.files-col{max-width:var(--readable-col);margin:0 auto;display:flex;flex-direction:column;gap:10px}.files-meta{display:flex;gap:8px;flex-wrap:wrap}.files-pill{display:inline-flex;align-items:center;gap:8px;min-width:0;border:1px solid var(--border);border-radius:8px;padding:7px 11px;background:var(--base);color:var(--text);text-decoration:none}.files-pill code{font-family:var(--mono);font-size:11.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.files-pill>svg{flex-shrink:0;color:var(--muted)}a.files-pill:hover{border-color:var(--muted)}.files-pill-dir{flex:1;min-width:240px}.files-pill-dir code{flex:1;color:var(--subtext)}.files-pill-dir .icon-btn{width:22px;height:22px;margin:-4px -6px -4px 0}button.files-pill-link{cursor:pointer;font:inherit;font-size:12px;color:var(--muted);white-space:nowrap}button.files-pill-link:hover{border-color:var(--muted);color:var(--text)}.files-hint{margin:0;font-size:11.5px;line-height:1.5;color:var(--muted)}.files-hint code{font-family:var(--mono);font-size:10.5px}.files-card{border:1px solid var(--border);border-radius:10px;background:var(--base);overflow:hidden;margin-top:4px}.files-card>*+*{border-top:1px solid var(--border-variant)}.ftree-row{display:flex;align-items:center;gap:8px;padding:8px 14px}.ftree-row.clickable{cursor:pointer}.ftree-row:hover{background:var(--surface)}.ftree-children{background:var(--canvas);border-top:1px solid var(--border-variant)}.ftree-children .ftree-row:hover{background:var(--panel)}.ftree-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;flex-shrink:0;color:var(--muted);transition:transform .12s ease}.ftree-chevron.open{transform:rotate(90deg)}.ftree-chevron.spacer{visibility:hidden}.ftree-dirname{flex:1;min-width:0;font-family:var(--mono);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-title{flex:1;min-width:0;font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-tag{flex-shrink:0;font-size:11px;color:var(--primary)}.ftree-status{flex-shrink:0;font-family:var(--mono);font-size:10.5px;color:var(--subtext)}.ftree-link{flex:1;min-width:0;display:flex;align-items:center;gap:8px;color:var(--text);text-decoration:none}.ftree-link:hover .ftree-name{text-decoration:underline}.ftree-name{min-width:0;font-size:12.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-thumb{width:22px;height:22px;object-fit:cover;border-radius:4px;border:1px solid var(--border-variant);flex-shrink:0}.ftree-del{width:22px;height:22px;visibility:hidden}.ftree-row:hover .ftree-del{visibility:visible}.ftree-del:hover{color:var(--accent-red)}.ftree-date,.ftree-size{flex-shrink:0}.ftree-size{font-family:var(--mono);font-size:10.5px;color:var(--muted);white-space:nowrap}.ftree-divider{padding:10px 14px 4px;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}.files-empty{font-size:12.5px;line-height:1.55;color:var(--subtext);border:1px solid var(--border);border-radius:10px;background:var(--base);padding:18px;margin:4px 0 0}.files-empty code{font-family:var(--mono);font-size:11.5px}.files-truncated{margin:0;padding:8px 14px;font-size:11px;color:var(--muted)}.report-date,.ftree-date{font-size:11px;color:var(--muted);white-space:nowrap}.report-view{height:100%;overflow-y:auto;padding:16px 24px 48px}.report-view-col{max-width:var(--readable-col);margin:0 auto}.report-view-head{display:flex;align-items:center;gap:10px;margin-bottom:16px;padding-bottom:10px;border-bottom:1px solid var(--border-variant)}.report-md{font-size:15px}.report-md h1{font-size:2em;line-height:1.18;margin:28px 0 14px}.report-md h2{font-size:1.5em;line-height:1.25;margin:28px 0 10px}.report-md h3{font-size:1.2em;line-height:1.35;margin:22px 0 8px}.report-md h4{font-size:1em;line-height:1.4;margin:18px 0 6px}.report-md table{display:block;width:max-content;max-width:100%;overflow-x:auto}.report-md .report-img{display:block;margin:12px 0}.report-md .report-img img{max-width:100%;height:auto;border:1px solid var(--border)}.report-md .report-img-caption{display:block;margin-top:4px;text-align:center;font-size:11.5px;color:var(--subtext)}.openresearch-diff{display:flex;flex-direction:column;gap:16px}.diff-file-card{border:1px solid var(--border);border-radius:8px;background:var(--base)}.diff-file-header{position:sticky;top:0;z-index:10;display:flex;align-items:center;justify-content:space-between;gap:12px;margin:-1px -1px 0;width:calc(100% + 2px);text-align:left;padding:8px 12px;cursor:pointer}.diff-file-header:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-2;background:var(--base)}.diff-file-header:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-1;background:var(--canvas);border:1px solid var(--border);border-radius:8px 8px 0 0}.diff-file-header .chev{color:var(--muted);font-size:10px;flex-shrink:0;width:12px}.diff-file-header .path{display:flex;align-items:center;gap:8px;min-width:0;flex:1}.diff-file-header .path code{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--mono);font-size:.7rem;font-weight:700;color:var(--text)}.diff-file-header .stats{display:flex;align-items:center;gap:8px;flex-shrink:0;font-family:var(--mono);font-size:.65rem;font-weight:700;font-variant-numeric:tabular-nums}.diff-stat-add{color:var(--accent-green)}.diff-stat-del{color:var(--accent-red)}.diff-empty{padding:8px 12px;color:var(--muted);font-size:12.5px}.truncated-notice{border:2px solid var(--accent-amber);background:var(--accent-amber-subtle);padding:12px 14px;font-size:12.5px}.truncated-notice h4{margin:0 0 4px;font-size:13px;color:var(--accent-amber)}.truncated-notice p{margin:0;color:var(--subtext)}.openresearch-diff .openresearch-diff-file{--openresearch-diff-selection-background-color: color-mix( in oklab, var(--surface) 76%, var(--primary) );--openresearch-diff-gutter-selection-background-color: color-mix( in oklab, var(--surface) 68%, var(--primary) );--openresearch-diff-insert-gutter-background-color: color-mix( in oklab, var(--base) 84%, var(--accent-green) );--openresearch-diff-delete-gutter-background-color: color-mix( in oklab, var(--base) 86%, var(--accent-red) );--openresearch-diff-insert-code-background-color: color-mix( in oklab, var(--base) 91%, var(--accent-green) );--openresearch-diff-delete-code-background-color: color-mix( in oklab, var(--base) 92%, var(--accent-red) );--openresearch-diff-insert-edit-background-color: color-mix( in oklab, var(--base) 72%, var(--accent-green) );--openresearch-diff-delete-edit-background-color: color-mix( in oklab, var(--base) 78%, var(--accent-red) );--openresearch-diff-divider-color: var(--border);--openresearch-diff-omit-gutter-line-color: color-mix(in oklab, var(--base) 86%, var(--text));--openresearch-diff-unified-gutter-text-color: color-mix(in oklab, var(--text) 45%, var(--base));--diff-background-color: var(--base);--diff-text-color: var(--text);--diff-font-family: var(--mono);--diff-selection-text-color: var(--primary);--diff-selection-background-color: var(--openresearch-diff-selection-background-color);--diff-gutter-selected-text-color: var(--diff-selection-text-color);--diff-gutter-selected-background-color: var( --openresearch-diff-gutter-selection-background-color );--diff-code-selected-text-color: var(--diff-selection-text-color);--diff-code-selected-background-color: var(--diff-selection-background-color);--diff-gutter-insert-text-color: var(--accent-green);--diff-gutter-insert-background-color: var(--openresearch-diff-insert-gutter-background-color);--diff-gutter-delete-text-color: var(--accent-red);--diff-gutter-delete-background-color: var(--openresearch-diff-delete-gutter-background-color);--diff-code-insert-text-color: var(--diff-text-color);--diff-code-insert-background-color: var(--openresearch-diff-insert-code-background-color);--diff-code-delete-text-color: var(--diff-text-color);--diff-code-delete-background-color: var(--openresearch-diff-delete-code-background-color);--diff-code-insert-edit-text-color: var(--diff-text-color);--diff-code-insert-edit-background-color: var(--openresearch-diff-insert-edit-background-color);--diff-code-delete-edit-text-color: var(--diff-text-color);--diff-code-delete-edit-background-color: var(--openresearch-diff-delete-edit-background-color);--diff-omit-gutter-line-color: var(--openresearch-diff-omit-gutter-line-color);width:100%;font-size:12px;line-height:1.5}.openresearch-diff .openresearch-diff-file.diff-unified{table-layout:auto}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:first-child{display:none}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:nth-child(2){width:0%;padding:0 .5rem 0 .625rem;white-space:nowrap;text-align:right;color:var(--openresearch-diff-unified-gutter-text-color);border-right:1px solid var(--openresearch-diff-divider-color);-webkit-user-select:none;user-select:none;cursor:default}.openresearch-diff .openresearch-diff-file .diff-line{line-height:1.5}.openresearch-diff .openresearch-diff-file .diff-hunk+.diff-hunk .diff-line:first-child>td{border-top:1px solid var(--openresearch-diff-divider-color)}:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#a0a1a7}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#383a42}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#a626a4}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#4078f2}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#383a42}@media(prefers-color-scheme:dark){:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#7f848e}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#abb2bf}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#c678dd}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#61afef}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#abb2bf}}.report-back{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:600;color:var(--subtext);padding:4px 8px;border-radius:6px}.report-back:hover{color:var(--text);background:var(--surface)}.settings-view-scroll{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.settings-view{max-width:var(--readable-col);margin:0 auto;padding:24px 32px 60px}.settings-view h1{margin:0 0 6px;font-size:22px}.settings-head-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.settings-head-row h1{margin:0}.settings-view>.error{color:var(--accent-red);font-size:12.5px;white-space:pre-wrap;text-transform:none;margin:0 0 12px}.settings-sub{margin:0 0 18px;color:var(--subtext);font-size:13px}.settings-card{background:var(--base);border:1px solid var(--border);border-radius:10px;padding:16px 18px;margin-bottom:16px}.settings-card h3{margin:0 0 10px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.settings-card .settings-sub{margin-bottom:12px}.settings-card-head{display:flex;align-items:center;gap:10px;margin-bottom:12px}.settings-card .kv{gap:6px 18px}.settings-empty{color:var(--muted);font-size:12.5px;margin:4px 0 0}.muted{color:var(--muted)}.compute-list{display:flex;flex-direction:column;gap:10px;margin-bottom:14px}.compute-row{background:var(--base);border:1px solid var(--border);border-radius:10px}.compute-row-head{display:flex;align-items:center;gap:10px;padding:12px 14px;cursor:pointer;-webkit-user-select:none;user-select:none}.compute-row-head:hover{background:var(--surface);border-radius:10px}.compute-row.open .compute-row-head:hover{border-radius:10px 10px 0 0}.compute-row-logo{display:inline-flex;align-items:center;flex:none}.compute-row-name{font-size:13px;font-weight:600;color:var(--text);flex:none}.compute-row-summary{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:12px}.compute-row-head .badge,.compute-make-default,.compute-default-pill{flex:none}.compute-default-pill{color:var(--primary);border-color:var(--primary)}.compute-chevron-btn{flex:none;display:inline-flex;align-items:center;padding:2px;border-radius:6px}.compute-chevron-btn:hover{background:var(--panel)}.compute-chevron{color:var(--muted);transition:transform .12s ease}.compute-row.open .compute-chevron{transform:rotate(180deg)}.compute-row-body{border-top:1px solid var(--border);padding:14px}.compute-row-body .settings-card{margin-bottom:0;margin-top:14px}.compute-default-note{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.compute-flavor-form{margin-bottom:14px}.compute-flavor-form label{max-width:320px}.compute-flavor-hint{font-size:12px}.compute-footnote{display:flex;align-items:flex-start;gap:6px;margin:2px 0 0;font-size:12px;color:var(--muted)}.compute-footnote svg{flex:none;margin-top:1px}.harness-tabs{display:flex;gap:4px;margin-bottom:14px;border-bottom:1px solid var(--border-variant)}.harness-tabs button{display:inline-flex;align-items:center;gap:7px;padding:7px 12px;font-size:13px;font-weight:600;color:var(--subtext);border-bottom:2px solid transparent;margin-bottom:-1px}.harness-tabs button:hover{color:var(--text)}.harness-tabs button.active{color:var(--text);border-bottom-color:var(--primary)}.harness-dot{width:7px;height:7px;border-radius:50%;background:var(--muted)}.harness-dot.ok{background:var(--accent-green)}.harness-dot.err{background:var(--accent-red)}.harness-dot.warn{background:var(--accent-amber)}.env-table{width:100%;border-collapse:collapse;font-size:12.5px;table-layout:fixed}.env-table td:first-child{width:32%;overflow-wrap:anywhere}.env-table .badge{margin-left:8px}.env-table input{width:100%;border:none;background:transparent;padding:0}.env-table input:focus{box-shadow:0 1px 0 0 var(--text)}.env-table td{height:36px;padding:0 10px 0 0;vertical-align:middle;border-bottom:1px solid var(--border-variant)}.env-table td:last-child{width:116px;white-space:nowrap;text-align:right}.env-table td[colspan]{white-space:normal;text-align:left}.env-table .icon-btn{margin-left:8px;vertical-align:middle}.env-table .icon-btn:hover{color:var(--accent-red)}.flavor-table{width:100%;border-collapse:collapse;font-size:12.5px}.flavor-table th{padding:5px 10px 5px 0;border-bottom:1px solid var(--border);text-align:left;font-weight:500;color:var(--muted)}.flavor-table td{padding:5px 10px 5px 0;border-bottom:1px solid var(--border-variant)}.ssh-table{table-layout:fixed}.ssh-table th:nth-child(1){width:20%}.ssh-table th:nth-child(2){width:26%}.ssh-table th:nth-child(4){width:108px}.ssh-table th:nth-child(5){width:52px}.ssh-table td{overflow-wrap:anywhere}.ssh-table td:last-child{padding-right:0;text-align:right}.ssh-tested-at{display:block;margin-top:2px;color:var(--muted);font-size:11px}@keyframes settings-spin{to{transform:rotate(360deg)}}.spin{animation:settings-spin .9s linear infinite}.model-picker,.option-picker{position:relative;display:inline-flex}.composer-pill{display:inline-flex;align-items:center;gap:5px;font-family:var(--mono);font-size:11.5px;color:var(--subtext);padding:5px 8px;border-radius:6px}.composer-pill:hover{background:var(--surface);color:var(--text)}.composer-bare{display:inline-flex;align-items:center;gap:3px;font-size:11.5px;color:var(--subtext);padding:5px 4px;border-radius:6px}.composer-bare:hover{color:var(--text)}.model-menu,.option-menu{position:absolute;bottom:calc(100% + 8px);left:0;max-height:380px;display:flex;flex-direction:column;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.model-menu{width:320px}.option-menu{min-width:190px;padding:6px}.model-menu.align-right,.option-menu.align-right{left:auto;right:0}.option-menu.drop-down{bottom:auto;top:calc(100% + 4px)}.option-menu.session-menu{left:auto;right:6px;top:calc(100% - 2px);min-width:140px}.model-item.danger,.model-item.danger:hover{color:var(--accent-red)}.option-default{color:var(--muted);font-weight:400}.option-sep{height:1px;margin:5px 4px;background:var(--border-variant)}.option-num{color:var(--muted);font-size:11px;font-variant-numeric:tabular-nums}.model-menu input{border:none;border-bottom:1px solid var(--border-variant);background:none;padding:9px 12px;font-size:12.5px;outline:none}.model-menu-list{overflow-y:auto;padding:6px}.model-group{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--muted);padding:8px 8px 4px}.model-item{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:12.5px;border-radius:6px}.model-item:hover{background:var(--surface)}.model-item .model-id{display:block;font-family:var(--mono);font-size:10px;color:var(--muted)}.model-more{padding:4px 8px 8px;font-size:11px;color:var(--muted)}.model-locked-note{display:flex;align-items:center;gap:6px;padding:7px 12px;font-size:11px;color:var(--muted);border-top:1px solid var(--border-variant)}.model-locked-note svg{flex-shrink:0}.skill-menu{position:absolute;bottom:calc(100% + 8px);left:0;min-width:340px;max-width:100%;padding:6px;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.skill-item{display:flex;flex-direction:column;gap:2px;width:100%;text-align:left;padding:7px 8px;border-radius:6px}.skill-item.active{background:var(--surface)}.skill-item .skill-name{font-family:var(--mono);font-size:12px}.skill-item .skill-hint{color:var(--muted)}.skill-item .skill-desc{font-size:11px;color:var(--subtext)}.file-view{display:flex;flex-direction:column;height:100%;min-height:0}.file-view-header{display:flex;align-items:center;gap:8px;padding:4px 12px;border-bottom:1px solid var(--border-variant);color:var(--subtext);flex-shrink:0}.file-view-path{font-family:var(--mono);font-size:12px;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-view-ref{font-family:var(--mono);font-size:11px;color:var(--muted);border:1px solid var(--border-variant);border-radius:6px;padding:1px 6px;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-shrink:0}.file-view-body{flex:1;min-height:0;overflow:auto;background:var(--base)}.file-view-codewrap{display:flex;align-items:flex-start;min-width:max-content}.file-view-gutter,.file-view-code{margin:0;padding-top:14px;padding-bottom:14px;font-family:var(--mono);font-size:12px;line-height:1.55}.file-view-gutter{padding-left:14px;padding-right:10px;text-align:right;color:var(--muted);-webkit-user-select:none;user-select:none;position:sticky;left:0;background:var(--base);border-right:1px solid var(--border-variant);flex-shrink:0}.file-view-code{padding-left:16px;padding-right:16px;-moz-tab-size:4;tab-size:4;min-width:max-content}.file-view-note{padding:10px 16px;font-size:12px;color:var(--muted)}.file-view-md{max-width:var(--readable-col);padding:18px 20px 32px}.file-view-md .md{font-size:13.5px}.file-view-md .md h1{font-size:1.5em;margin:18px 0 8px}.file-view-md .md h2{font-size:1.25em;margin:16px 0 8px}.file-view-md .md h3{font-size:1.1em}.icon-btn.active{color:var(--primary);background:var(--surface)}.prompt-card{margin:8px 0;padding:12px 14px;border:1px solid var(--border);border-left:3px solid var(--border);border-radius:6px;background:var(--surface);display:flex;flex-direction:column;gap:9px}.prompt-card.plan{border-left-color:var(--accent-blue)}.prompt-card.permission{border-left-color:var(--accent-amber)}.prompt-card.question{border-left-color:var(--accent-purple)}.prompt-card.readonly{opacity:.6}.prompt-head{font-size:11px;font-weight:600;letter-spacing:.03em;text-transform:uppercase;color:var(--muted)}.prompt-head code{font-family:var(--mono);font-size:11.5px;text-transform:none;color:var(--text)}.prompt-sub{font-family:var(--mono);font-size:12px;color:var(--subtext);word-break:break-word}.prompt-q{font-size:14px;font-weight:600;line-height:1.5;color:var(--text)}.prompt-plan{font-size:13.5px;line-height:1.6;color:var(--text);max-height:340px;overflow-y:auto}.prompt-options{display:flex;flex-direction:column;gap:6px}.prompt-option{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;padding:8px 11px;text-align:left;border:1px solid var(--border);border-radius:5px;background:var(--base);color:var(--text);cursor:pointer;transition:border-color 80ms ease,background 80ms ease}.prompt-option:hover:not(:disabled){border-color:var(--border-strong);background:var(--surface)}.prompt-option.sel{border-color:var(--primary);background:var(--primary-subtle)}.prompt-option:disabled{cursor:default}.prompt-option-label{display:block;font-size:13px;font-weight:600}.prompt-option-desc{display:block;font-size:12px;font-weight:400;line-height:1.45;color:var(--subtext)}.prompt-actions{display:flex;flex-wrap:wrap;gap:8px}.prompt-actions .btn-primary,.prompt-actions .btn-ghost{display:inline-flex;align-items:center;gap:6px;padding:6px 13px;font-family:inherit;font-size:12px;font-weight:600;border:1px solid transparent;border-radius:5px;cursor:pointer;transition:background 80ms ease,border-color 80ms ease}.prompt-actions .btn-primary{background:var(--primary);color:var(--base)}.prompt-actions .btn-primary:hover:not(:disabled){opacity:.9}.prompt-actions .btn-ghost{background:transparent;border-color:var(--border);color:var(--subtext)}.prompt-actions .btn-ghost:hover:not(:disabled){border-color:var(--border-strong);color:var(--text);background:var(--surface)}.prompt-actions button:disabled{opacity:.5;cursor:default}.prompt-collapsed{color:var(--muted);font-size:13px;margin:4px 0}.prompt-collapsed summary{display:flex;align-items:baseline;gap:8px;cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none}.prompt-collapsed summary::-webkit-details-marker{display:none}.prompt-collapsed summary:after{content:"›";color:var(--muted);transition:transform 80ms ease}.prompt-collapsed[open] summary:after{transform:rotate(90deg)}.prompt-collapsed-title{font-weight:600;word-break:break-word}.prompt-outcome{font-size:12px;color:var(--subtext);word-break:break-word}.prompt-outcome.approved,.prompt-outcome.chosen{color:var(--accent-green)}.prompt-outcome.approved:before,.prompt-outcome.chosen:before{content:"✓ "}.prompt-outcome.revised,.prompt-outcome.rejected{color:var(--accent-amber)}.prompt-collapsed-body{margin-top:6px;padding-left:12px;border-left:2px solid var(--border);font-size:13px;color:var(--subtext)}.prompt-collapsed-options{margin:6px 0 0;padding-left:18px}.prompt-collapsed-options .sel{color:var(--text);font-weight:600}.prompt-collapsed-note{margin-top:6px;font-style:italic}.plan-strip{position:relative;width:100%;margin:0 0 10px;padding:11px 13px;display:flex;flex-direction:column;align-items:stretch;gap:10px;border:1px solid var(--border);border-left:3px solid var(--accent-blue);border-radius:8px;background:var(--surface);box-shadow:0 2px 10px #0000000f}.plan-strip-info{display:flex;align-items:baseline;gap:8px;min-width:0}.plan-strip-open{margin-left:auto;padding:0;border:none;background:none;color:var(--accent-blue);font-size:12.5px;cursor:pointer;white-space:nowrap;flex-shrink:0}.plan-strip-open:hover{text-decoration:underline}.plan-strip-spacer{flex:1}.plan-strip-revise-input{width:100%;resize:none;border:1px solid var(--border);border-radius:8px;padding:9px 11px;font-size:13px;font-family:inherit;background:var(--base);color:var(--text)}.plan-strip-revise-input:focus{border-color:var(--accent-blue)}.plan-strip-icon{color:var(--accent-blue);flex-shrink:0;align-self:center}.plan-strip-title{font-size:13px;font-weight:600;white-space:nowrap}.plan-strip-actions{gap:6px 8px;justify-content:flex-end}.plan-strip-actions .btn-primary,.plan-strip-actions .btn-ghost{background:transparent;border:1px solid var(--text);color:var(--text)}.plan-strip-actions .btn-primary:hover:not(:disabled),.plan-strip-actions .btn-ghost:hover:not(:disabled){background:var(--surface-2, rgb(0 0 0 / 5%));border-color:var(--text);color:var(--text);opacity:1}.plan-strip-actions .plan-strip-primary{background:var(--text);border-color:var(--text);color:var(--base)}.plan-strip-actions .plan-strip-primary:hover:not(:disabled){background:color-mix(in oklab,var(--text) 85%,var(--base));border-color:var(--text);color:var(--base)}.plan-strip-approve{position:relative;display:flex}.plan-strip-approve .btn-primary:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.plan-strip-actions .plan-strip-caret{border-top-left-radius:0;border-bottom-left-radius:0;padding:0 6px;display:flex;align-items:center;border-left:1px solid color-mix(in oklab,var(--base) 35%,var(--text))}.plan-strip-menu{position:absolute;right:0;bottom:calc(100% + 4px);display:flex;flex-direction:column;min-width:190px;padding:4px;border:1px solid var(--border);border-radius:8px;background:var(--surface);box-shadow:0 6px 20px #0000001f;z-index:6}.plan-strip-menu button{text-align:left;padding:7px 9px;border:none;border-radius:5px;background:transparent;color:var(--text);font-size:12.5px;cursor:pointer}.plan-strip-menu button:hover{background:var(--surface-2, rgb(0 0 0 / 5%))}.prompt-plan.clamped{max-height:9.5em;overflow:hidden;position:relative}.prompt-plan.clamped:after{content:"";position:absolute;inset:auto 0 0 0;height:34px;background:linear-gradient(to bottom,transparent,var(--surface));pointer-events:none}.prompt-plan-open{align-self:flex-start;border:none;background:transparent;color:var(--accent-blue);font-size:12px;padding:0;cursor:pointer}.prompt-plan-open:hover{text-decoration:underline}.code-tab{display:flex;flex-direction:column;height:100%;min-height:0}.code-tab-header{display:flex;align-items:center;gap:8px;padding:4px 12px;border-bottom:1px solid var(--border-variant);flex-shrink:0}.code-tab-select{max-width:280px;min-width:0;padding:3px 8px;font-size:12px}.code-tab-note{padding:8px 16px;font-size:12px;color:var(--muted);border-bottom:1px solid var(--border-variant);flex-shrink:0}.code-tab-body{flex:1;min-height:0;overflow:auto;background:var(--base)}.code-tree{padding:6px 0;font-size:12.5px}.code-tree-row{display:flex;align-items:center;gap:6px;width:100%;padding:3px 10px;border:none;background:transparent;color:var(--text);text-align:left;cursor:pointer;font-family:inherit;font-size:inherit}.code-tree-row:hover{background:var(--panel)}.code-tree-row>svg{flex-shrink:0;color:var(--subtext)}.code-tree-row>svg.code-tree-chev{color:var(--muted)}.code-tree-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #777;--xy-background-pattern-lines-color-default: #777;--xy-background-pattern-cross-color-default: #777;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}/** * Copyright (c) 2014 The xterm.js authors. All rights reserved. * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) * https://github.com/chjj/term.js diff --git a/ui/dist/index.html b/ui/dist/index.html index 15a3269..ab01aa1 100644 --- a/ui/dist/index.html +++ b/ui/dist/index.html @@ -8,8 +8,8 @@ html { background: #ffffff; } @media (prefers-color-scheme: dark) { html { background: #0e0c0c; } } - - + +
diff --git a/ui/src/styles.css b/ui/src/styles.css index 2b63809..8b320d1 100644 --- a/ui/src/styles.css +++ b/ui/src/styles.css @@ -2646,6 +2646,31 @@ button.files-pill-link:hover { padding-bottom: 10px; border-bottom: 1px solid var(--border-variant); } +/* Reports are long-form documents, so preserve their Markdown hierarchy. + The shared .md rules intentionally keep chat headings compact. */ +.report-md { + font-size: 15px; +} +.report-md h1 { + font-size: 2em; + line-height: 1.18; + margin: 28px 0 14px; +} +.report-md h2 { + font-size: 1.5em; + line-height: 1.25; + margin: 28px 0 10px; +} +.report-md h3 { + font-size: 1.2em; + line-height: 1.35; + margin: 22px 0 8px; +} +.report-md h4 { + font-size: 1em; + line-height: 1.4; + margin: 18px 0 6px; +} /* Wide GFM tables scroll in place instead of widening the report pane. */ .report-md table { display: block; From 1bb18690eb4b91e59c4c42815a3d48cb07b2a54d Mon Sep 17 00:00:00 2001 From: Rehaan Ahmad Date: Fri, 17 Jul 2026 19:55:17 -0700 Subject: [PATCH 2/2] Bump version to 0.1.63 Co-Authored-By: Claude Fable 5 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f40cc43..ab6a908 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -928,7 +928,7 @@ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "openresearch-cli" -version = "0.1.62" +version = "0.1.63" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index c06888f..d8524f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "openresearch-cli" -version = "0.1.62" +version = "0.1.63" edition = "2021" description = "OpenResearch CLI (orx) — Rust port" repository = "https://github.com/alphaXiv/openresearch-cli"