@treeport/treeport 0.1.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,146 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ee=/\/+/g;function te(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function A(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,j(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+te(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ee,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ee,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+te(a,u),c+=j(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+te(a,u++),c+=j(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return j(A(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ne(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var N=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},P={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=P,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ne}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,N)}catch(e){N(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&te(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&te(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function te(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,te(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.7`})),h=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),ee=Symbol.for(`react.memo_cache_sentinel`),te=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=te&&e[te]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var ne=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},ie=[],ae=-1;function F(e){return{current:e}}function I(e){0>ae||(e.current=ie[ae],ie[ae]=null,ae--)}function L(e,t){ae++,ie[ae]=e.current,e.current=t}var oe=F(null),se=F(null),ce=F(null),le=F(null);function ue(e,t){switch(L(ce,t),L(se,e),L(oe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Zd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Zd(t),e=Qd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}I(oe),L(oe,e)}function de(){I(oe),I(se),I(ce)}function fe(e){e.memoizedState!==null&&L(le,e);var t=oe.current,n=Qd(t,e.type);t!==n&&(L(se,e),L(oe,n))}function pe(e){se.current===e&&(I(oe),I(se)),le.current===e&&(I(le),sp._currentValue=re)}var me,he;function ge(e){if(me===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);me=t&&t[1]||``,he=-1<e.stack.indexOf(`
2
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
+ `+me+e+he}var _e=!1;function ve(e,t){if(!e||_e)return``;_e=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4
+ `),l=s.split(`
5
+ `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
6
+ `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{_e=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ge(n):``}function ye(e,t){switch(e.tag){case 26:case 27:case 5:return ge(e.type);case 16:return ge(`Lazy`);case 13:return e.child!==t&&t!==null?ge(`Suspense Fallback`):ge(`Suspense`);case 19:return ge(`SuspenseList`);case 0:case 15:return ve(e.type,!1);case 11:return ve(e.type.render,!1);case 1:return ve(e.type,!0);case 31:return ge(`Activity`);default:return``}}function be(e){try{var t=``,n=null;do t+=ye(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
+ Error generating stack: `+e.message+`
8
+ `+e.stack}}var xe=Object.prototype.hasOwnProperty,Se=t.unstable_scheduleCallback,Ce=t.unstable_cancelCallback,we=t.unstable_shouldYield,Te=t.unstable_requestPaint,Ee=t.unstable_now,De=t.unstable_getCurrentPriorityLevel,Oe=t.unstable_ImmediatePriority,ke=t.unstable_UserBlockingPriority,Ae=t.unstable_NormalPriority,je=t.unstable_LowPriority,Me=t.unstable_IdlePriority,Ne=t.log,Pe=t.unstable_setDisableYieldValue,Fe=null,Ie=null;function Le(e){if(typeof Ne==`function`&&Pe(e),Ie&&typeof Ie.setStrictMode==`function`)try{Ie.setStrictMode(Fe,e)}catch{}}var Re=Math.clz32?Math.clz32:Ve,ze=Math.log,Be=Math.LN2;function Ve(e){return e>>>=0,e===0?32:31-(ze(e)/Be|0)|0}var He=256,Ue=262144,We=4194304;function Ge(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ke(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ge(n))):i=Ge(o):i=Ge(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ge(n))):i=Ge(o)):i=Ge(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function qe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function R(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 z(){var e=We;return We<<=1,!(We&62914560)&&(We=4194304),e}function Je(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ye(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Xe(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Re(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ze(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ze(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Re(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Qe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Re(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function $e(e,t){var n=t&-t;return n=n&42?1:et(n),(n&(e.suspendedLanes|t))===0?n:0}function et(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function tt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function nt(){var e=P.p;return e===0?(e=window.event,e===void 0?32:Cp(e.type)):e}function rt(e,t){var n=P.p;try{return P.p=e,t()}finally{P.p=n}}var it=Math.random().toString(36).slice(2),at=`__reactFiber$`+it,ot=`__reactProps$`+it,st=`__reactContainer$`+it,ct=`__reactEvents$`+it,lt=`__reactListeners$`+it,ut=`__reactHandles$`+it,dt=`__reactResources$`+it,ft=`__reactMarker$`+it;function pt(e){delete e[at],delete e[ot],delete e[ct],delete e[lt],delete e[ut]}function mt(e){var t=e[at];if(t)return t;for(var n=e.parentNode;n;){if(t=n[st]||n[at]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=bf(e);e!==null;){if(n=e[at])return n;e=bf(e)}return t}e=n,n=e.parentNode}return null}function ht(e){if(e=e[at]||e[st]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function gt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function _t(e){var t=e[dt];return t||=e[dt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function vt(e){e[ft]=!0}var yt=new Set,bt={};function xt(e,t){St(e,t),St(e+`Capture`,t)}function St(e,t){for(bt[e]=t,e=0;e<t.length;e++)yt.add(t[e])}var Ct=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),wt={},Tt={};function Et(e){return xe.call(Tt,e)?!0:xe.call(wt,e)?!1:Ct.test(e)?Tt[e]=!0:(wt[e]=!0,!1)}function Dt(e,t,n){if(Et(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Ot(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function kt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function At(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function jt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Mt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Nt(e){if(!e._valueTracker){var t=jt(e)?`checked`:`value`;e._valueTracker=Mt(e,t,``+e[t])}}function Pt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=jt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Ft(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var It=/[\n"\\]/g;function Lt(e){return e.replace(It,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Rt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+At(t)):e.value!==``+At(t)&&(e.value=``+At(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Bt(e,o,At(n)):Bt(e,o,At(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+At(s):e.removeAttribute(`name`)}function zt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Nt(e);return}n=n==null?``:``+At(n),t=t==null?n:``+At(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Nt(e)}function Bt(e,t,n){t===`number`&&Ft(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Vt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+At(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ht(e,t,n){if(t!=null&&(t=``+At(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+At(n)}function Ut(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ne(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=At(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Nt(e)}function Wt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Gt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Kt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Gt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function qt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Kt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Kt(e,o,t[o])}function Jt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Yt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Xt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Zt(e){return Xt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Qt(){}var $t=null;function en(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var tn=null,nn=null;function rn(e){var t=ht(e);if(t&&(e=t.stateNode)){var n=e[ot]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Rt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Lt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[ot]||null;if(!a)throw Error(i(90));Rt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Pt(r)}break a;case`textarea`:Ht(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Vt(e,!!n.multiple,t,!1)}}}var an=!1;function on(e,t,n){if(an)return e(t,n);an=!0;try{return e(t)}finally{if(an=!1,(tn!==null||nn!==null)&&(Au(),tn&&(t=tn,e=nn,nn=tn=null,rn(t),e)))for(t=0;t<e.length;t++)rn(e[t])}}function sn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[ot]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var cn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),ln=!1;if(cn)try{var un={};Object.defineProperty(un,"passive",{get:function(){ln=!0}}),window.addEventListener(`test`,un,un),window.removeEventListener(`test`,un,un)}catch{ln=!1}var dn=null,fn=null,pn=null;function mn(){if(pn)return pn;var e,t=fn,n=t.length,r,i=`value`in dn?dn.value:dn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return pn=i.slice(e,1<r?1-r:void 0)}function hn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function gn(){return!0}function _n(){return!1}function vn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?gn:_n,this.isPropagationStopped=_n,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=gn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=gn)},persist:function(){},isPersistent:gn}),t}var yn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bn=vn(yn),xn=m({},yn,{view:0,detail:0}),Sn=vn(xn),Cn,wn,Tn,En=m({},xn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ln,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Tn&&(Tn&&e.type===`mousemove`?(Cn=e.screenX-Tn.screenX,wn=e.screenY-Tn.screenY):wn=Cn=0,Tn=e),Cn)},movementY:function(e){return`movementY`in e?e.movementY:wn}}),Dn=vn(En),On=vn(m({},En,{dataTransfer:0})),kn=vn(m({},xn,{relatedTarget:0})),An=vn(m({},yn,{animationName:0,elapsedTime:0,pseudoElement:0})),jn=vn(m({},yn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Mn=vn(m({},yn,{data:0})),Nn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Pn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Fn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function In(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Fn[e])?!!t[e]:!1}function Ln(){return In}var Rn=vn(m({},xn,{key:function(e){if(e.key){var t=Nn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=hn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Pn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ln,charCode:function(e){return e.type===`keypress`?hn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?hn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),zn=vn(m({},En,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Bn=vn(m({},xn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ln})),Vn=vn(m({},yn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Hn=vn(m({},En,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Un=vn(m({},yn,{newState:0,oldState:0})),Wn=[9,13,27,32],Gn=cn&&`CompositionEvent`in window,Kn=null;cn&&`documentMode`in document&&(Kn=document.documentMode);var qn=cn&&`TextEvent`in window&&!Kn,Jn=cn&&(!Gn||Kn&&8<Kn&&11>=Kn),Yn=` `,Xn=!1;function Zn(e,t){switch(e){case`keyup`:return Wn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var $n=!1;function er(e,t){switch(e){case`compositionend`:return Qn(t);case`keypress`:return t.which===32?(Xn=!0,Yn):null;case`textInput`:return e=t.data,e===Yn&&Xn?null:e;default:return null}}function tr(e,t){if($n)return e===`compositionend`||!Gn&&Zn(e,t)?(e=mn(),pn=fn=dn=null,$n=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Jn&&t.locale!==`ko`?null:t.data;default:return null}}var nr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function rr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!nr[e.type]:t===`textarea`}function ir(e,t,n,r){tn?nn?nn.push(r):nn=[r]:tn=r,t=U(t,`onChange`),0<t.length&&(n=new bn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var ar=null,or=null;function sr(e){V(e,0)}function cr(e){if(Pt(gt(e)))return e}function lr(e,t){if(e===`change`)return t}var ur=!1;if(cn){var dr;if(cn){var fr=`oninput`in document;if(!fr){var pr=document.createElement(`div`);pr.setAttribute(`oninput`,`return;`),fr=typeof pr.oninput==`function`}dr=fr}else dr=!1;ur=dr&&(!document.documentMode||9<document.documentMode)}function mr(){ar&&(ar.detachEvent(`onpropertychange`,hr),or=ar=null)}function hr(e){if(e.propertyName===`value`&&cr(or)){var t=[];ir(t,or,e,en(e)),on(sr,t)}}function gr(e,t,n){e===`focusin`?(mr(),ar=t,or=n,ar.attachEvent(`onpropertychange`,hr)):e===`focusout`&&mr()}function _r(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return cr(or)}function vr(e,t){if(e===`click`)return cr(t)}function yr(e,t){if(e===`input`||e===`change`)return cr(t)}function br(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var xr=typeof Object.is==`function`?Object.is:br;function Sr(e,t){if(xr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!xe.call(t,i)||!xr(e[i],t[i]))return!1}return!0}function Cr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function wr(e,t){var n=Cr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Cr(n)}}function Tr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Tr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Er(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ft(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ft(e.document)}return t}function Dr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Or=cn&&`documentMode`in document&&11>=document.documentMode,kr=null,Ar=null,jr=null,Mr=!1;function Nr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mr||kr==null||kr!==Ft(r)||(r=kr,`selectionStart`in r&&Dr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),jr&&Sr(jr,r)||(jr=r,r=U(Ar,`onSelect`),0<r.length&&(t=new bn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=kr)))}function Pr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Fr={animationend:Pr(`Animation`,`AnimationEnd`),animationiteration:Pr(`Animation`,`AnimationIteration`),animationstart:Pr(`Animation`,`AnimationStart`),transitionrun:Pr(`Transition`,`TransitionRun`),transitionstart:Pr(`Transition`,`TransitionStart`),transitioncancel:Pr(`Transition`,`TransitionCancel`),transitionend:Pr(`Transition`,`TransitionEnd`)},Ir={},Lr={};cn&&(Lr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Fr.animationend.animation,delete Fr.animationiteration.animation,delete Fr.animationstart.animation),`TransitionEvent`in window||delete Fr.transitionend.transition);function Rr(e){if(Ir[e])return Ir[e];if(!Fr[e])return e;var t=Fr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Lr)return Ir[e]=t[n];return e}var zr=Rr(`animationend`),Br=Rr(`animationiteration`),Vr=Rr(`animationstart`),Hr=Rr(`transitionrun`),Ur=Rr(`transitionstart`),Wr=Rr(`transitioncancel`),Gr=Rr(`transitionend`),Kr=new Map,qr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);qr.push(`scrollEnd`);function Jr(e,t){Kr.set(e,t),xt(t,[e])}var Yr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Xr=[],Zr=0,Qr=0;function $r(){for(var e=Zr,t=Qr=Zr=0;t<e;){var n=Xr[t];Xr[t++]=null;var r=Xr[t];Xr[t++]=null;var i=Xr[t];Xr[t++]=null;var a=Xr[t];if(Xr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ri(n,i,a)}}function ei(e,t,n,r){Xr[Zr++]=e,Xr[Zr++]=t,Xr[Zr++]=n,Xr[Zr++]=r,Qr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ti(e,t,n,r){return ei(e,t,n,r),ii(e)}function ni(e,t){return ei(e,null,null,t),ii(e)}function ri(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Re(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ii(e){if(50<xu)throw xu=0,Su=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ai={};function oi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function si(e,t,n,r){return new oi(e,t,n,r)}function ci(e){return e=e.prototype,!(!e||!e.isReactComponent)}function li(e,t){var n=e.alternate;return n===null?(n=si(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ui(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function di(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ci(e)&&(s=1);else if(typeof e==`string`)s=Qf(e,n,oe.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=si(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return fi(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=si(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=si(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=si(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=si(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function fi(e,t,n,r){return e=si(7,e,r,t),e.lanes=n,e}function pi(e,t,n){return e=si(6,e,null,t),e.lanes=n,e}function mi(e){var t=si(18,null,null,0);return t.stateNode=e,t}function hi(e,t,n){return t=si(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var gi=new WeakMap;function _i(e,t){if(typeof e==`object`&&e){var n=gi.get(e);return n===void 0?(t={value:e,source:t,stack:be(t)},gi.set(e,t),t):n}return{value:e,source:t,stack:be(t)}}var vi=[],yi=0,bi=null,xi=0,Si=[],Ci=0,wi=null,Ti=1,Ei=``;function Di(e,t){vi[yi++]=xi,vi[yi++]=bi,bi=e,xi=t}function Oi(e,t,n){Si[Ci++]=Ti,Si[Ci++]=Ei,Si[Ci++]=wi,wi=e;var r=Ti;e=Ei;var i=32-Re(r)-1;r&=~(1<<i),n+=1;var a=32-Re(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ti=1<<32-Re(t)+i|n<<i|r,Ei=a+e}else Ti=1<<a|n<<i|r,Ei=e}function ki(e){e.return!==null&&(Di(e,1),Oi(e,1,0))}function Ai(e){for(;e===bi;)bi=vi[--yi],vi[yi]=null,xi=vi[--yi],vi[yi]=null;for(;e===wi;)wi=Si[--Ci],Si[Ci]=null,Ei=Si[--Ci],Si[Ci]=null,Ti=Si[--Ci],Si[Ci]=null}function ji(e,t){Si[Ci++]=Ti,Si[Ci++]=Ei,Si[Ci++]=wi,Ti=t.id,Ei=t.overflow,wi=e}var Mi=null,Ni=null,Pi=!1,Fi=null,Ii=!1,Li=Error(i(519));function Ri(e){throw Wi(_i(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Li}function zi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[at]=e,t[ot]=r,n){case`dialog`:H(`cancel`,t),H(`close`,t);break;case`iframe`:case`object`:case`embed`:H(`load`,t);break;case`video`:case`audio`:for(n=0;n<Od.length;n++)H(Od[n],t);break;case`source`:H(`error`,t);break;case`img`:case`image`:case`link`:H(`error`,t),H(`load`,t);break;case`details`:H(`toggle`,t);break;case`input`:H(`invalid`,t),zt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:H(`invalid`,t);break;case`textarea`:H(`invalid`,t),Ut(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Vd(t.textContent,n)?(r.popover!=null&&(H(`beforetoggle`,t),H(`toggle`,t)),r.onScroll!=null&&H(`scroll`,t),r.onScrollEnd!=null&&H(`scrollend`,t),r.onClick!=null&&(t.onclick=Qt),t=!0):t=!1,t||Ri(e,!0)}function Bi(e){for(Mi=e.return;Mi;)switch(Mi.tag){case 5:case 31:case 13:Ii=!1;return;case 27:case 3:Ii=!0;return;default:Mi=Mi.return}}function Vi(e){if(e!==Mi)return!1;if(!Pi)return Bi(e),Pi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||$d(e.type,e.memoizedProps)),n=!n),n&&Ni&&Ri(e),Bi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ni=yf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ni=yf(e)}else t===27?(t=Ni,sf(e.type)?(e=vf,vf=null,Ni=e):Ni=t):Ni=Mi?_f(e.stateNode.nextSibling):null;return!0}function Hi(){Ni=Mi=null,Pi=!1}function Ui(){var e=Fi;return e!==null&&(su===null?su=e:su.push.apply(su,e),Fi=null),e}function Wi(e){Fi===null?Fi=[e]:Fi.push(e)}var Gi=F(null),Ki=null,qi=null;function Ji(e,t,n){L(Gi,t._currentValue),t._currentValue=n}function Yi(e){e._currentValue=Gi.current,I(Gi)}function Xi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Zi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Xi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Xi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Qi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;xr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===le.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[sp]:e.push(sp))}a=a.return}e!==null&&Zi(t,e,n,r),t.flags|=262144}function $i(e){for(e=e.firstContext;e!==null;){if(!xr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ea(e){Ki=e,qi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ta(e){return ra(Ki,e)}function na(e,t){return Ki===null&&ea(e),ra(e,t)}function ra(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},qi===null){if(e===null)throw Error(i(308));qi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else qi=qi.next=t;return n}var ia=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},aa=t.unstable_scheduleCallback,oa=t.unstable_NormalPriority,sa={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ca(){return{controller:new ia,data:new Map,refCount:0}}function la(e){e.refCount--,e.refCount===0&&aa(oa,function(){e.controller.abort()})}var ua=null,da=0,fa=0,pa=null;function ma(e,t){if(ua===null){var n=ua=[];da=0,fa=Sd(),pa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return da++,t.then(ha,ha),t}function ha(){if(--da===0&&ua!==null){pa!==null&&(pa.status=`fulfilled`);var e=ua;ua=null,fa=0,pa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ga(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var _a=N.S;N.S=function(e,t){uu=Ee(),typeof t==`object`&&t&&typeof t.then==`function`&&ma(e,t),_a!==null&&_a(e,t)};var va=F(null);function ya(){var e=va.current;return e===null?Gl.pooledCache:e}function ba(e,t){t===null?L(va,va.current):L(va,t.pool)}function xa(){var e=ya();return e===null?null:{parent:sa._currentValue,pool:e}}var Sa=Error(i(460)),Ca=Error(i(474)),wa=Error(i(542)),Ta={then:function(){}};function Ea(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Da(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Qt,Qt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ja(e),e;default:if(typeof t.status==`string`)t.then(Qt,Qt);else{if(e=Gl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ja(e),e}throw ka=t,Sa}}function Oa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ka=e,Sa):e}}var ka=null;function Aa(){if(ka===null)throw Error(i(459));var e=ka;return ka=null,e}function ja(e){if(e===Sa||e===wa)throw Error(i(483))}var Ma=null,Na=0;function Pa(e){var t=Na;return Na+=1,Ma===null&&(Ma=[]),Da(Ma,e,t)}function Fa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ia(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function La(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=li(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=pi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&Oa(i)===t.type)?(t=a(t,n.props),Fa(t,n),t.return=e,t):(t=di(n.type,n.key,n.props,null,e.mode,r),Fa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=hi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=fi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=pi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=di(t.type,t.key,t.props,null,e.mode,n),Fa(n,t),n.return=e,n;case v:return t=hi(t,e.mode,n),t.return=e,t;case O:return t=Oa(t),f(e,t,n)}if(ne(t)||A(t))return t=fi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Pa(t),n);if(t.$$typeof===C)return f(e,na(e,t),n);Ia(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=Oa(n),p(e,t,n,r)}if(ne(n)||A(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Pa(n),r);if(n.$$typeof===C)return p(e,t,na(e,n),r);Ia(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=Oa(r),m(e,t,n,r,i)}if(ne(r)||A(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Pa(r),i);if(r.$$typeof===C)return m(e,t,n,na(t,r),i);Ia(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Pi&&Di(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Pi&&Di(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Pi&&Di(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Pi&&Di(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Pi&&Di(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Pi&&Di(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Oa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Fa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=fi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=di(o.type,o.key,o.props,null,e.mode,c),Fa(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=hi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Oa(o),b(e,r,o,c)}if(ne(o))return h(e,r,o,c);if(A(o)){if(l=A(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Pa(o),c);if(o.$$typeof===C)return b(e,r,na(e,o),c);Ia(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=pi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Na=0;var i=b(e,t,n,r);return Ma=null,i}catch(t){if(t===Sa||t===wa)throw t;var a=si(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ra=La(!0),za=La(!1),Ba=!1;function Va(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ha(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ua(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Wa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Wl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ii(e),ri(e,null,n),t}return ei(e,r,t,n),ii(e)}function Ga(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Qe(e,n)}}function Ka(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var qa=!1;function Ja(){if(qa){var e=pa;if(e!==null)throw e}}function Ya(e,t,n,r){qa=!1;var i=e.updateQueue;Ba=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(ql&f)===f:(r&f)===f){f!==0&&f===fa&&(qa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Ba=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),tu|=o,e.lanes=o,e.memoizedState=d}}function Xa(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Za(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Xa(n[e],t)}var Qa=F(null),$a=F(0);function eo(e,t){e=$l,L($a,e),L(Qa,t),$l=e|t.baseLanes}function to(){L($a,$l),L(Qa,Qa.current)}function no(){$l=$a.current,I(Qa),I($a)}var ro=F(null),io=null;function ao(e){var t=e.alternate;L(uo,uo.current&1),L(ro,e),io===null&&(t===null||Qa.current!==null||t.memoizedState!==null)&&(io=e)}function oo(e){L(uo,uo.current),L(ro,e),io===null&&(io=e)}function so(e){e.tag===22?(L(uo,uo.current),L(ro,e),io===null&&(io=e)):co(e)}function co(){L(uo,uo.current),L(ro,ro.current)}function lo(e){I(ro),io===e&&(io=null),I(uo)}var uo=F(0);function fo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||mf(n)||hf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var po=0,B=null,mo=null,ho=null,go=!1,_o=!1,vo=!1,yo=0,bo=0,xo=null,So=0;function Co(){throw Error(i(321))}function wo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!xr(e[n],t[n]))return!1;return!0}function To(e,t,n,r,i,a){return po=a,B=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=e===null||e.memoizedState===null?Hs:Us,vo=!1,a=n(r,i),vo=!1,_o&&(a=Do(t,n,r,i)),Eo(e),a}function Eo(e){N.H=Vs;var t=mo!==null&&mo.next!==null;if(po=0,ho=mo=B=null,go=!1,bo=0,xo=null,t)throw Error(i(300));e===null||oc||(e=e.dependencies,e!==null&&$i(e)&&(oc=!0))}function Do(e,t,n,r){B=e;var a=0;do{if(_o&&(xo=null),bo=0,_o=!1,25<=a)throw Error(i(301));if(a+=1,ho=mo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}N.H=Ws,o=t(n,r)}while(_o);return o}function Oo(){var e=N.H,t=e.useState()[0];return t=typeof t.then==`function`?Fo(t):t,e=e.useState()[0],(mo===null?null:mo.memoizedState)!==e&&(B.flags|=1024),t}function ko(){var e=yo!==0;return yo=0,e}function Ao(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function jo(e){if(go){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}go=!1}po=0,ho=mo=B=null,_o=!1,bo=yo=0,xo=null}function Mo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ho===null?B.memoizedState=ho=e:ho=ho.next=e,ho}function No(){if(mo===null){var e=B.alternate;e=e===null?null:e.memoizedState}else e=mo.next;var t=ho===null?B.memoizedState:ho.next;if(t!==null)ho=t,mo=e;else{if(e===null)throw B.alternate===null?Error(i(467)):Error(i(310));mo=e,e={memoizedState:mo.memoizedState,baseState:mo.baseState,baseQueue:mo.baseQueue,queue:mo.queue,next:null},ho===null?B.memoizedState=ho=e:ho=ho.next=e}return ho}function Po(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Fo(e){var t=bo;return bo+=1,xo===null&&(xo=[]),e=Da(xo,e,t),t=B,(ho===null?t.memoizedState:ho.next)===null&&(t=t.alternate,N.H=t===null||t.memoizedState===null?Hs:Us),e}function Io(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Fo(e);if(e.$$typeof===C)return ta(e)}throw Error(i(438,String(e)))}function Lo(e){var t=null,n=B.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=B.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Po(),B.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ee;return t.index++,n}function Ro(e,t){return typeof t==`function`?t(e):t}function zo(e){return Bo(No(),mo,e)}function Bo(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(po&f)===f:(ql&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===fa&&(d=!0);else if((po&p)===p){u=u.next,p===fa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,B.lanes|=p,tu|=p;f=u.action,vo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,B.lanes|=f,tu|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!xr(o,e.memoizedState)&&(oc=!0,d&&(n=pa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Vo(e){var t=No(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);xr(o,t.memoizedState)||(oc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Ho(e,t,n){var r=B,a=No(),o=Pi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!xr((mo||a).memoizedState,n);if(s&&(a.memoizedState=n,oc=!0),a=a.queue,ps(Go.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||ho!==null&&ho.memoizedState.tag&1){if(r.flags|=2048,cs(9,{destroy:void 0},Wo.bind(null,r,a,n,t),null),Gl===null)throw Error(i(349));o||po&127||Uo(r,t,n)}return n}function Uo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=B.updateQueue,t===null?(t=Po(),B.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Wo(e,t,n,r){t.value=n,t.getSnapshot=r,Ko(t)&&qo(e)}function Go(e,t,n){return n(function(){Ko(t)&&qo(e)})}function Ko(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xr(e,n)}catch{return!0}}function qo(e){var t=ni(e,2);t!==null&&Tu(t,e,2)}function Jo(e){var t=Mo();if(typeof e==`function`){var n=e;if(e=n(),vo){Le(!0);try{n()}finally{Le(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:e},t}function Yo(e,t,n,r){return e.baseState=n,Bo(e,mo,typeof r==`function`?r:Ro)}function Xo(e,t,n,r,a){if(Rs(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};N.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Zo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Zo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=N.T,o={};N.T=o;try{var s=n(i,r),c=N.S;c!==null&&c(o,s),Qo(e,t,s)}catch(n){es(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),N.T=a}}else try{a=n(i,r),Qo(e,t,a)}catch(n){es(e,t,n)}}function Qo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){$o(e,t,n)},function(n){return es(e,t,n)}):$o(e,t,n)}function $o(e,t,n){t.status=`fulfilled`,t.value=n,ts(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Zo(e,n)))}function es(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,ts(t),t=t.next;while(t!==r)}e.action=null}function ts(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ns(e,t){return t}function rs(e,t){if(Pi){var n=Gl.formState;if(n!==null){a:{var r=B;if(Pi){if(Ni){b:{for(var i=Ni,a=Ii;i.nodeType!==8;){if(!a){i=null;break b}if(i=_f(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ni=_f(i.nextSibling),r=i.data===`F!`;break a}}Ri(r)}r=!1}r&&(t=n[0])}}return n=Mo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ns,lastRenderedState:t},n.queue=r,n=Fs.bind(null,B,r),r.dispatch=n,r=Jo(!1),a=Ls.bind(null,B,!1,r.queue),r=Mo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Xo.bind(null,B,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function is(e){return as(No(),mo,e)}function as(e,t,n){if(t=Bo(e,t,ns)[0],e=zo(Ro)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Fo(t)}catch(e){throw e===Sa?wa:e}else r=t;t=No();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(B.flags|=2048,cs(9,{destroy:void 0},os.bind(null,i,n),null)),[r,a,e]}function os(e,t){e.action=t}function ss(e){var t=No(),n=mo;if(n!==null)return as(t,n,e);No(),t=t.memoizedState,n=No();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function cs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=B.updateQueue,t===null&&(t=Po(),B.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ls(){return No().memoizedState}function us(e,t,n,r){var i=Mo();B.flags|=e,i.memoizedState=cs(1|t,{destroy:void 0},n,r===void 0?null:r)}function ds(e,t,n,r){var i=No();r=r===void 0?null:r;var a=i.memoizedState.inst;mo!==null&&r!==null&&wo(r,mo.memoizedState.deps)?i.memoizedState=cs(t,a,n,r):(B.flags|=e,i.memoizedState=cs(1|t,a,n,r))}function fs(e,t){us(8390656,8,e,t)}function ps(e,t){ds(2048,8,e,t)}function ms(e){B.flags|=4;var t=B.updateQueue;if(t===null)t=Po(),B.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function hs(e){var t=No().memoizedState;return ms({ref:t,nextImpl:e}),function(){if(Wl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function gs(e,t){return ds(4,2,e,t)}function _s(e,t){return ds(4,4,e,t)}function vs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ys(e,t,n){n=n==null?null:n.concat([e]),ds(4,4,vs.bind(null,t,e),n)}function bs(){}function xs(e,t){var n=No();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&wo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ss(e,t){var n=No();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&wo(t,r[1]))return r[0];if(r=e(),vo){Le(!0);try{e()}finally{Le(!1)}}return n.memoizedState=[r,t],r}function Cs(e,t,n){return n===void 0||po&1073741824&&!(ql&261930)?e.memoizedState=t:(e.memoizedState=n,e=wu(),B.lanes|=e,tu|=e,n)}function ws(e,t,n,r){return xr(n,t)?n:Qa.current===null?!(po&42)||po&1073741824&&!(ql&261930)?(oc=!0,e.memoizedState=n):(e=wu(),B.lanes|=e,tu|=e,t):(e=Cs(e,n,r),xr(e,t)||(oc=!0),e)}function Ts(e,t,n,r,i){var a=P.p;P.p=a!==0&&8>a?a:8;var o=N.T,s={};N.T=s,Ls(e,!1,t,n);try{var c=i(),l=N.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Is(e,t,ga(c,r),Cu(e)):Is(e,t,r,Cu(e))}catch(n){Is(e,t,{then:function(){},status:`rejected`,reason:n},Cu())}finally{P.p=a,o!==null&&s.types!==null&&(o.types=s.types),N.T=o}}function Es(){}function Ds(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Os(e).queue;Ts(e,a,t,re,n===null?Es:function(){return ks(e),n(r)})}function Os(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:re},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ks(e){var t=Os(e);t.next===null&&(t=e.alternate.memoizedState),Is(e,t.next.queue,{},Cu())}function As(){return ta(sp)}function js(){return No().memoizedState}function Ms(){return No().memoizedState}function Ns(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Cu();e=Ua(n);var r=Wa(t,e,n);r!==null&&(Tu(r,t,n),Ga(r,t,n)),t={cache:ca()},e.payload=t;return}t=t.return}}function Ps(e,t,n){var r=Cu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Rs(e)?zs(t,n):(n=ti(e,t,n,r),n!==null&&(Tu(n,e,r),Bs(n,t,r)))}function Fs(e,t,n){Is(e,t,n,Cu())}function Is(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Rs(e))zs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,xr(s,o))return ei(e,t,i,0),Gl===null&&$r(),!1}catch{}if(n=ti(e,t,i,r),n!==null)return Tu(n,e,r),Bs(n,t,r),!0}return!1}function Ls(e,t,n,r){if(r={lane:2,revertLane:Sd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Rs(e)){if(t)throw Error(i(479))}else t=ti(e,n,r,2),t!==null&&Tu(t,e,2)}function Rs(e){var t=e.alternate;return e===B||t!==null&&t===B}function zs(e,t){_o=go=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Bs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Qe(e,n)}}var Vs={readContext:ta,use:Io,useCallback:Co,useContext:Co,useEffect:Co,useImperativeHandle:Co,useLayoutEffect:Co,useInsertionEffect:Co,useMemo:Co,useReducer:Co,useRef:Co,useState:Co,useDebugValue:Co,useDeferredValue:Co,useTransition:Co,useSyncExternalStore:Co,useId:Co,useHostTransitionStatus:Co,useFormState:Co,useActionState:Co,useOptimistic:Co,useMemoCache:Co,useCacheRefresh:Co};Vs.useEffectEvent=Co;var Hs={readContext:ta,use:Io,useCallback:function(e,t){return Mo().memoizedState=[e,t===void 0?null:t],e},useContext:ta,useEffect:fs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),us(4194308,4,vs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return us(4194308,4,e,t)},useInsertionEffect:function(e,t){us(4,2,e,t)},useMemo:function(e,t){var n=Mo();t=t===void 0?null:t;var r=e();if(vo){Le(!0);try{e()}finally{Le(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Mo();if(n!==void 0){var i=n(t);if(vo){Le(!0);try{n(t)}finally{Le(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ps.bind(null,B,e),[r.memoizedState,e]},useRef:function(e){var t=Mo();return e={current:e},t.memoizedState=e},useState:function(e){e=Jo(e);var t=e.queue,n=Fs.bind(null,B,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:bs,useDeferredValue:function(e,t){return Cs(Mo(),e,t)},useTransition:function(){var e=Jo(!1);return e=Ts.bind(null,B,e.queue,!0,!1),Mo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=B,a=Mo();if(Pi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Gl===null)throw Error(i(349));ql&127||Uo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,fs(Go.bind(null,r,o,e),[e]),r.flags|=2048,cs(9,{destroy:void 0},Wo.bind(null,r,o,n,t),null),n},useId:function(){var e=Mo(),t=Gl.identifierPrefix;if(Pi){var n=Ei,r=Ti;n=(r&~(1<<32-Re(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=yo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=So++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:As,useFormState:rs,useActionState:rs,useOptimistic:function(e){var t=Mo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ls.bind(null,B,!0,n),n.dispatch=t,[e,t]},useMemoCache:Lo,useCacheRefresh:function(){return Mo().memoizedState=Ns.bind(null,B)},useEffectEvent:function(e){var t=Mo(),n={impl:e};return t.memoizedState=n,function(){if(Wl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Us={readContext:ta,use:Io,useCallback:xs,useContext:ta,useEffect:ps,useImperativeHandle:ys,useInsertionEffect:gs,useLayoutEffect:_s,useMemo:Ss,useReducer:zo,useRef:ls,useState:function(){return zo(Ro)},useDebugValue:bs,useDeferredValue:function(e,t){return ws(No(),mo.memoizedState,e,t)},useTransition:function(){var e=zo(Ro)[0],t=No().memoizedState;return[typeof e==`boolean`?e:Fo(e),t]},useSyncExternalStore:Ho,useId:js,useHostTransitionStatus:As,useFormState:is,useActionState:is,useOptimistic:function(e,t){return Yo(No(),mo,e,t)},useMemoCache:Lo,useCacheRefresh:Ms};Us.useEffectEvent=hs;var Ws={readContext:ta,use:Io,useCallback:xs,useContext:ta,useEffect:ps,useImperativeHandle:ys,useInsertionEffect:gs,useLayoutEffect:_s,useMemo:Ss,useReducer:Vo,useRef:ls,useState:function(){return Vo(Ro)},useDebugValue:bs,useDeferredValue:function(e,t){var n=No();return mo===null?Cs(n,e,t):ws(n,mo.memoizedState,e,t)},useTransition:function(){var e=Vo(Ro)[0],t=No().memoizedState;return[typeof e==`boolean`?e:Fo(e),t]},useSyncExternalStore:Ho,useId:js,useHostTransitionStatus:As,useFormState:ss,useActionState:ss,useOptimistic:function(e,t){var n=No();return mo===null?(n.baseState=e,[e,n.queue.dispatch]):Yo(n,mo,e,t)},useMemoCache:Lo,useCacheRefresh:Ms};Ws.useEffectEvent=hs;function Gs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ks={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Cu(),i=Ua(r);i.payload=t,n!=null&&(i.callback=n),t=Wa(e,i,r),t!==null&&(Tu(t,e,r),Ga(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Cu(),i=Ua(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Wa(e,i,r),t!==null&&(Tu(t,e,r),Ga(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Cu(),r=Ua(n);r.tag=2,t!=null&&(r.callback=t),t=Wa(e,r,n),t!==null&&(Tu(t,e,n),Ga(t,e,n))}};function qs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Sr(n,r)||!Sr(i,a):!0}function Js(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ks.enqueueReplaceState(t,t.state,null)}function Ys(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Xs(e){Yr(e)}function Zs(e){console.error(e)}function Qs(e){Yr(e)}function $s(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function ec(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function tc(e,t,n){return n=Ua(n),n.tag=3,n.payload={element:null},n.callback=function(){$s(e,t)},n}function nc(e){return e=Ua(e),e.tag=3,e}function rc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){ec(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){ec(t,n,r),typeof i!=`function`&&(pu===null?pu=new Set([this]):pu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function ic(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Qi(t,n,a,!0),n=ro.current,n!==null){switch(n.tag){case 31:case 13:return io===null?Lu():n.alternate===null&&eu===0&&(eu=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Ta?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),nd(e,r,a)),!1;case 22:return n.flags|=65536,r===Ta?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),nd(e,r,a)),!1}throw Error(i(435,n.tag))}return nd(e,r,a),Lu(),!1}if(Pi)return t=ro.current,t===null?(r!==Li&&(t=Error(i(423),{cause:r}),Wi(_i(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=_i(r,n),a=tc(e.stateNode,r,a),Ka(e,a),eu!==4&&(eu=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Li&&(e=Error(i(422),{cause:r}),Wi(_i(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=_i(o,n),ou===null?ou=[o]:ou.push(o),eu!==4&&(eu=2),t===null)return!0;r=_i(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=tc(n.stateNode,r,e),Ka(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(pu===null||!pu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=nc(a),rc(a,e,n,r),Ka(n,a),!1}n=n.return}while(n!==null);return!1}var ac=Error(i(461)),oc=!1;function sc(e,t,n,r){t.child=e===null?za(t,null,n,r):Ra(t,e.child,n,r)}function cc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ea(t),r=To(e,t,n,o,a,i),s=ko(),e!==null&&!oc?(Ao(e,t,i),Mc(e,t,i)):(Pi&&s&&ki(t),t.flags|=1,sc(e,t,r,i),t.child)}function lc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ci(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,uc(e,t,a,r,i)):(e=di(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Nc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Sr:n,n(o,r)&&e.ref===t.ref)return Mc(e,t,i)}return t.flags|=1,e=li(a,r),e.ref=t.ref,e.return=t,t.child=e}function uc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Sr(a,r)&&e.ref===t.ref)if(oc=!1,t.pendingProps=r=a,Nc(e,i))e.flags&131072&&(oc=!0);else return t.lanes=e.lanes,Mc(e,t,i)}return vc(e,t,n,r,i)}function dc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return pc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ba(t,a===null?null:a.cachePool),a===null?to():eo(t,a),so(t);else return r=t.lanes=536870912,pc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ba(t,null),to(),co(t)):(ba(t,a.cachePool),eo(t,a),co(t),t.memoizedState=null);return sc(e,t,i,n),t.child}function fc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function pc(e,t,n,r,i){var a=ya();return a=a===null?null:{parent:sa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ba(t,null),to(),so(t),e!==null&&Qi(e,t,r,!0),t.childLanes=i,null}function mc(e,t){return t=Dc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function hc(e,t,n){return Ra(t,e.child,null,n),e=mc(t,t.pendingProps),e.flags|=2,lo(t),t.memoizedState=null,e}function gc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Pi){if(r.mode===`hidden`)return e=mc(t,r),t.lanes=536870912,fc(null,e);if(oo(t),(e=Ni)?(e=pf(e,Ii),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wi===null?null:{id:Ti,overflow:Ei},retryLane:536870912,hydrationErrors:null},n=mi(e),n.return=t,t.child=n,Mi=t,Ni=null)):e=null,e===null)throw Ri(t);return t.lanes=536870912,null}return mc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(oo(t),a)if(t.flags&256)t.flags&=-257,t=hc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(oc||Qi(e,t,n,!1),a=(n&e.childLanes)!==0,oc||a){if(r=Gl,r!==null&&(s=$e(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ni(e,s),Tu(r,e,s),ac;Lu(),t=hc(e,t,n)}else e=o.treeContext,Ni=_f(s.nextSibling),Mi=t,Pi=!0,Fi=null,Ii=!1,e!==null&&ji(t,e),t=mc(t,r),t.flags|=4096;return t}return e=li(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function _c(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function vc(e,t,n,r,i){return ea(t),n=To(e,t,n,r,void 0,i),r=ko(),e!==null&&!oc?(Ao(e,t,i),Mc(e,t,i)):(Pi&&r&&ki(t),t.flags|=1,sc(e,t,n,i),t.child)}function yc(e,t,n,r,i,a){return ea(t),t.updateQueue=null,n=Do(t,r,n,i),Eo(e),r=ko(),e!==null&&!oc?(Ao(e,t,a),Mc(e,t,a)):(Pi&&r&&ki(t),t.flags|=1,sc(e,t,n,a),t.child)}function bc(e,t,n,r,i){if(ea(t),t.stateNode===null){var a=ai,o=n.contextType;typeof o==`object`&&o&&(a=ta(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ks,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Va(t),o=n.contextType,a.context=typeof o==`object`&&o?ta(o):ai,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Gs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ks.enqueueReplaceState(a,a.state,null),Ya(t,r,a,i),Ja(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Ys(n,s);a.props=c;var l=a.context,u=n.contextType;o=ai,typeof u==`object`&&u&&(o=ta(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Js(t,a,r,o),Ba=!1;var f=t.memoizedState;a.state=f,Ya(t,r,a,i),Ja(),l=t.memoizedState,s||f!==l||Ba?(typeof d==`function`&&(Gs(t,n,d,r),l=t.memoizedState),(c=Ba||qs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ha(e,t),o=t.memoizedProps,u=Ys(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ai,typeof l==`object`&&l&&(c=ta(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Js(t,a,r,c),Ba=!1,f=t.memoizedState,a.state=f,Ya(t,r,a,i),Ja();var p=t.memoizedState;o!==d||f!==p||Ba||e!==null&&e.dependencies!==null&&$i(e.dependencies)?(typeof s==`function`&&(Gs(t,n,s,r),p=t.memoizedState),(u=Ba||qs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&$i(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,_c(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Ra(t,e.child,null,i),t.child=Ra(t,null,n,i)):sc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Mc(e,t,i),e}function xc(e,t,n,r){return Hi(),t.flags|=256,sc(e,t,n,r),t.child}var Sc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Cc(e){return{baseLanes:e,cachePool:xa()}}function wc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=iu),e}function Tc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(uo.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Pi){if(a?ao(t):co(t),(e=Ni)?(e=pf(e,Ii),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wi===null?null:{id:Ti,overflow:Ei},retryLane:536870912,hydrationErrors:null},n=mi(e),n.return=t,t.child=n,Mi=t,Ni=null)):e=null,e===null)throw Ri(t);return hf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(co(t),a=t.mode,c=Dc({mode:`hidden`,children:c},a),r=fi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=Cc(n),r.childLanes=wc(e,s,n),t.memoizedState=Sc,fc(null,r)):(ao(t),Ec(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(ao(t),t.flags&=-257,t=Oc(e,t,n)):t.memoizedState===null?(co(t),c=r.fallback,a=t.mode,r=Dc({mode:`visible`,children:r.children},a),c=fi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ra(t,e.child,null,n),r=t.child,r.memoizedState=Cc(n),r.childLanes=wc(e,s,n),t.memoizedState=Sc,t=fc(null,r)):(co(t),t.child=e.child,t.flags|=128,t=null);else if(ao(t),hf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Wi({value:r,source:null,stack:null}),t=Oc(e,t,n)}else if(oc||Qi(e,t,n,!1),s=(n&e.childLanes)!==0,oc||s){if(s=Gl,s!==null&&(r=$e(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ni(e,r),Tu(s,e,r),ac;mf(c)||Lu(),t=Oc(e,t,n)}else mf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ni=_f(c.nextSibling),Mi=t,Pi=!0,Fi=null,Ii=!1,e!==null&&ji(t,e),t=Ec(t,r.children),t.flags|=4096);return t}return a?(co(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=li(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=fi(c,a,n,null),c.flags|=2):c=li(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,fc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Cc(n):(a=c.cachePool,a===null?a=xa():(l=sa._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=wc(e,s,n),t.memoizedState=Sc,fc(e.child,r)):(ao(t),n=e.child,e=n.sibling,n=li(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function Ec(e,t){return t=Dc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Dc(e,t){return e=si(22,e,null,t),e.lanes=0,e}function Oc(e,t,n){return Ra(t,e.child,null,n),e=Ec(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function kc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Xi(e.return,t,n)}function Ac(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function jc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=uo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,L(uo,o),sc(e,t,r,n),r=Pi?xi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&kc(e,n,t);else if(e.tag===19)kc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&fo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Ac(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&fo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Ac(t,!0,n,null,a,r);break;case`together`:Ac(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Mc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),tu|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Qi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=li(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=li(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Nc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&$i(e))):!0}function Pc(e,t,n){switch(t.tag){case 3:ue(t,t.stateNode.containerInfo),Ji(t,sa,e.memoizedState.cache),Hi();break;case 27:case 5:fe(t);break;case 4:ue(t,t.stateNode.containerInfo);break;case 10:Ji(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,oo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(ao(t),e=Mc(e,t,n),e===null?null:e.sibling):Tc(e,t,n):(ao(t),t.flags|=128,null);ao(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Qi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return jc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),L(uo,uo.current),r)break;return null;case 22:return t.lanes=0,dc(e,t,n,t.pendingProps);case 24:Ji(t,sa,e.memoizedState.cache)}return Mc(e,t,n)}function Fc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)oc=!0;else{if(!Nc(e,n)&&!(t.flags&128))return oc=!1,Pc(e,t,n);oc=!!(e.flags&131072)}else oc=!1,Pi&&t.flags&1048576&&Oi(t,xi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Oa(t.elementType),t.type=e,typeof e==`function`)ci(e)?(r=Ys(e,r),t.tag=1,t=bc(null,t,e,r,n)):(t.tag=0,t=vc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=cc(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=lc(null,t,e,r,n);break a}}throw t=M(e)||e,Error(i(306,t,``))}}return t;case 0:return vc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Ys(r,t.pendingProps),bc(e,t,r,a,n);case 3:a:{if(ue(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ha(e,t),Ya(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ji(t,sa,r),r!==o.cache&&Zi(t,[sa],n,!0),Ja(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=xc(e,t,r,n);break a}else if(r!==a){a=_i(Error(i(424)),t),Wi(a),t=xc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ni=_f(e.firstChild),Mi=t,Pi=!0,Fi=null,Ii=!0,n=za(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Hi(),r===a){t=Mc(e,t,n);break a}sc(e,t,r,n)}t=t.child}return t;case 26:return _c(e,t),e===null?(n=Rf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Pi||(n=t.type,e=t.pendingProps,r=Xd(ce.current).createElement(n),r[at]=t,r[ot]=e,Wd(r,n,e),vt(r),t.stateNode=r):t.memoizedState=Rf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return fe(t),e===null&&Pi&&(r=t.stateNode=xf(t.type,t.pendingProps,ce.current),Mi=t,Ii=!0,a=Ni,sf(t.type)?(vf=a,Ni=_f(r.firstChild)):Ni=a),sc(e,t,t.pendingProps.children,n),_c(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Pi&&((a=r=Ni)&&(r=df(r,t.type,t.pendingProps,Ii),r===null?a=!1:(t.stateNode=r,Mi=t,Ni=_f(r.firstChild),Ii=!1,a=!0)),a||Ri(t)),fe(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,$d(a,o)?r=null:s!==null&&$d(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=To(e,t,Oo,null,null,n),sp._currentValue=a),_c(e,t),sc(e,t,r,n),t.child;case 6:return e===null&&Pi&&((e=n=Ni)&&(n=ff(n,t.pendingProps,Ii),n===null?e=!1:(t.stateNode=n,Mi=t,Ni=null,e=!0)),e||Ri(t)),null;case 13:return Tc(e,t,n);case 4:return ue(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ra(t,null,r,n):sc(e,t,r,n),t.child;case 11:return cc(e,t,t.type,t.pendingProps,n);case 7:return sc(e,t,t.pendingProps,n),t.child;case 8:return sc(e,t,t.pendingProps.children,n),t.child;case 12:return sc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ji(t,t.type,r.value),sc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,ea(t),a=ta(a),r=r(a),t.flags|=1,sc(e,t,r,n),t.child;case 14:return lc(e,t,t.type,t.pendingProps,n);case 15:return uc(e,t,t.type,t.pendingProps,n);case 19:return jc(e,t,n);case 31:return gc(e,t,n);case 22:return dc(e,t,n,t.pendingProps);case 24:return ea(t),r=ta(sa),e===null?(a=ya(),a===null&&(a=Gl,o=ca(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Va(t),Ji(t,sa,a)):((e.lanes&n)!==0&&(Ha(e,t),Ya(t,null,null,n),Ja()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ji(t,sa,r),r!==a.cache&&Zi(t,[sa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ji(t,sa,r))),sc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Ic(e){e.flags|=4}function Lc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Pu())e.flags|=8192;else throw ka=Ta,Ca}else e.flags&=-16777217}function Rc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!$f(t))if(Pu())e.flags|=8192;else throw ka=Ta,Ca}function zc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:z(),e.lanes|=t,au|=t)}function Bc(e,t){if(!Pi)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Vc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Hc(e,t,n){var r=t.pendingProps;switch(Ai(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vc(t),null;case 1:return Vc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Yi(sa),de(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Vi(t)?Ic(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ui())),Vc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Ic(t),o===null?(Vc(t),Lc(t,a,null,r,n)):(Vc(t),Rc(t,o))):o?o===e.memoizedState?(Vc(t),t.flags&=-16777217):(Ic(t),Vc(t),Rc(t,o)):(e=e.memoizedProps,e!==r&&Ic(t),Vc(t),Lc(t,a,e,r,n)),null;case 27:if(pe(t),n=ce.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ic(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Vc(t),null}e=oe.current,Vi(t)?zi(t,e):(e=xf(a,r,n),t.stateNode=e,Ic(t))}return Vc(t),null;case 5:if(pe(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ic(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Vc(t),null}if(o=oe.current,Vi(t))zi(t,o);else{var s=Xd(ce.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[at]=t,o[ot]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Wd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ic(t)}}return Vc(t),Lc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ic(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ce.current,Vi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Mi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[at]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Vd(e.nodeValue,n)),e||Ri(t,!0)}else e=Xd(e).createTextNode(r),e[at]=t,t.stateNode=e}return Vc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Vi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[at]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Vc(t),e=!1}else n=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(lo(t),t):(lo(t),null);if(t.flags&128)throw Error(i(558))}return Vc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Vi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[at]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Vc(t),a=!1}else a=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(lo(t),t):(lo(t),null)}return lo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),zc(t,t.updateQueue),Vc(t),null);case 4:return de(),e===null&&Md(t.stateNode.containerInfo),Vc(t),null;case 10:return Yi(t.type),Vc(t),null;case 19:if(I(uo),r=t.memoizedState,r===null)return Vc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Bc(r,!1);else{if(eu!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=fo(e),o!==null){for(t.flags|=128,Bc(r,!1),e=o.updateQueue,t.updateQueue=e,zc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ui(n,e),n=n.sibling;return L(uo,uo.current&1|2),Pi&&Di(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ee()>du&&(t.flags|=128,a=!0,Bc(r,!1),t.lanes=4194304)}else{if(!a)if(e=fo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,zc(t,e),Bc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Pi)return Vc(t),null}else 2*Ee()-r.renderingStartTime>du&&n!==536870912&&(t.flags|=128,a=!0,Bc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Vc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ee(),e.sibling=null,n=uo.current,L(uo,a?n&1|2:n&1),Pi&&Di(t,r.treeForkCount),e);case 22:case 23:return lo(t),no(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Vc(t),t.subtreeFlags&6&&(t.flags|=8192)):Vc(t),n=t.updateQueue,n!==null&&zc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&I(va),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Yi(sa),Vc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Uc(e,t){switch(Ai(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Yi(sa),de(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pe(t),null;case 31:if(t.memoizedState!==null){if(lo(t),t.alternate===null)throw Error(i(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(lo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return I(uo),null;case 4:return de(),null;case 10:return Yi(t.type),null;case 22:case 23:return lo(t),no(),e!==null&&I(va),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Yi(sa),null;case 25:return null;default:return null}}function Wc(e,t){switch(Ai(t),t.tag){case 3:Yi(sa),de();break;case 26:case 27:case 5:pe(t);break;case 4:de();break;case 31:t.memoizedState!==null&&lo(t);break;case 13:lo(t);break;case 19:I(uo);break;case 10:Yi(t.type);break;case 22:case 23:lo(t),no(),e!==null&&I(va);break;case 24:Yi(sa)}}function Gc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){td(t,t.return,e)}}function Kc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){td(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){td(t,t.return,e)}}function qc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Za(t,n)}catch(t){td(e,e.return,t)}}}function Jc(e,t,n){n.props=Ys(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){td(e,t,n)}}function Yc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){td(e,t,n)}}function Xc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){td(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){td(e,t,n)}else n.current=null}function Zc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){td(e,e.return,t)}}function Qc(e,t,n){try{var r=e.stateNode;Gd(r,e.type,n,t),r[ot]=t}catch(t){td(e,e.return,t)}}function $c(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&sf(e.type)||e.tag===4}function el(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||$c(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&sf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function tl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Qt));else if(r!==4&&(r===27&&sf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(tl(e,t,n),e=e.sibling;e!==null;)tl(e,t,n),e=e.sibling}function nl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&sf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(nl(e,t,n),e=e.sibling;e!==null;)nl(e,t,n),e=e.sibling}function rl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Wd(t,r,n),t[at]=e,t[ot]=n}catch(t){td(e,e.return,t)}}var il=!1,al=!1,ol=!1,sl=typeof WeakSet==`function`?WeakSet:Set,cl=null;function ll(e,t){if(e=e.containerInfo,Jd=gp,e=Er(e),Dr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Yd={focusedElem:e,selectionRange:n},gp=!1,cl=t;cl!==null;)if(t=cl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,cl=e;else for(;cl!==null;){switch(t=cl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Ys(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){td(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)uf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:uf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,cl=e;break}cl=t.return}}function ul(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Tl(e,n),r&4&&Gc(5,n);break;case 1:if(Tl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){td(n,n.return,e)}else{var i=Ys(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){td(n,n.return,e)}}r&64&&qc(n),r&512&&Yc(n,n.return);break;case 3:if(Tl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Za(e,t)}catch(e){td(n,n.return,e)}}break;case 27:t===null&&r&4&&rl(n);case 26:case 5:Tl(e,n),t===null&&r&4&&Zc(n),r&512&&Yc(n,n.return);break;case 12:Tl(e,n);break;case 31:Tl(e,n),r&4&&gl(e,n);break;case 13:Tl(e,n),r&4&&_l(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=ad.bind(null,n),gf(e,n))));break;case 22:if(r=n.memoizedState!==null||il,!r){t=t!==null&&t.memoizedState!==null||al,i=il;var a=al;il=r,(al=t)&&!a?Dl(e,n,(n.subtreeFlags&8772)!=0):Tl(e,n),il=i,al=a}break;case 30:break;default:Tl(e,n)}}function dl(e){var t=e.alternate;t!==null&&(e.alternate=null,dl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&pt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var fl=null,pl=!1;function ml(e,t,n){for(n=n.child;n!==null;)hl(e,t,n),n=n.sibling}function hl(e,t,n){if(Ie&&typeof Ie.onCommitFiberUnmount==`function`)try{Ie.onCommitFiberUnmount(Fe,n)}catch{}switch(n.tag){case 26:al||Xc(n,t),ml(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:al||Xc(n,t);var r=fl,i=pl;sf(n.type)&&(fl=n.stateNode,pl=!1),ml(e,t,n),Sf(n.stateNode),fl=r,pl=i;break;case 5:al||Xc(n,t);case 6:if(r=fl,i=pl,fl=null,ml(e,t,n),fl=r,pl=i,fl!==null)if(pl)try{(fl.nodeType===9?fl.body:fl.nodeName===`HTML`?fl.ownerDocument.body:fl).removeChild(n.stateNode)}catch(e){td(n,t,e)}else try{fl.removeChild(n.stateNode)}catch(e){td(n,t,e)}break;case 18:fl!==null&&(pl?(e=fl,cf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Vp(e)):cf(fl,n.stateNode));break;case 4:r=fl,i=pl,fl=n.stateNode.containerInfo,pl=!0,ml(e,t,n),fl=r,pl=i;break;case 0:case 11:case 14:case 15:Kc(2,n,t),al||Kc(4,n,t),ml(e,t,n);break;case 1:al||(Xc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Jc(n,t,r)),ml(e,t,n);break;case 21:ml(e,t,n);break;case 22:al=(r=al)||n.memoizedState!==null,ml(e,t,n),al=r;break;default:ml(e,t,n)}}function gl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Vp(e)}catch(e){td(t,t.return,e)}}}function _l(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Vp(e)}catch(e){td(t,t.return,e)}}function vl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new sl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new sl),t;default:throw Error(i(435,e.tag))}}function yl(e,t){var n=vl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=od.bind(null,e,t);t.then(r,r)}})}function bl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(sf(c.type)){fl=c.stateNode,pl=!1;break a}break;case 5:fl=c.stateNode,pl=!1;break a;case 3:case 4:fl=c.stateNode.containerInfo,pl=!0;break a}c=c.return}if(fl===null)throw Error(i(160));hl(o,s,a),fl=null,pl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Sl(t,e),t=t.sibling}var xl=null;function Sl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:bl(t,e),Cl(e),r&4&&(Kc(3,e,e.return),Gc(3,e),Kc(5,e,e.return));break;case 1:bl(t,e),Cl(e),r&512&&(al||n===null||Xc(n,n.return)),r&64&&il&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=xl;if(bl(t,e),Cl(e),r&512&&(al||n===null||Xc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[ft]||o[at]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Wd(o,r,n),o[at]=e,vt(o),r=o;break a;case`link`:var s=Xf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Wd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Xf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Wd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[at]=e,vt(o),r=o}e.stateNode=r}else Zf(a,e.type,e.stateNode);else e.stateNode=Gf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Qc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Zf(a,e.type,e.stateNode):Gf(a,r,e.memoizedProps))}break;case 27:bl(t,e),Cl(e),r&512&&(al||n===null||Xc(n,n.return)),n!==null&&r&4&&Qc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(bl(t,e),Cl(e),r&512&&(al||n===null||Xc(n,n.return)),e.flags&32){a=e.stateNode;try{Wt(a,``)}catch(t){td(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Qc(e,a,n===null?a:n.memoizedProps)),r&1024&&(ol=!0);break;case 6:if(bl(t,e),Cl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){td(e,e.return,t)}}break;case 3:if(Yf=null,a=xl,xl=Tf(t.containerInfo),bl(t,e),xl=a,Cl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Vp(t.containerInfo)}catch(t){td(e,e.return,t)}ol&&(ol=!1,wl(e));break;case 4:r=xl,xl=Tf(e.stateNode.containerInfo),bl(t,e),Cl(e),xl=r;break;case 12:bl(t,e),Cl(e);break;case 31:bl(t,e),Cl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,yl(e,r)));break;case 13:bl(t,e),Cl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(lu=Ee()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,yl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=il,d=al;if(il=u||a,al=d||l,bl(t,e),al=d,il=u,Cl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||il||al||El(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){td(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){td(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?lf(m,!0):lf(l.stateNode,!1)}catch(e){td(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,yl(e,n))));break;case 19:bl(t,e),Cl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,yl(e,r)));break;case 30:break;case 21:break;default:bl(t,e),Cl(e)}}function Cl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if($c(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;nl(e,el(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Wt(o,``),n.flags&=-33),nl(e,el(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;tl(e,el(e),s);break;default:throw Error(i(161))}}catch(t){td(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function wl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;wl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Tl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ul(e,t.alternate,t),t=t.sibling}function El(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Kc(4,t,t.return),El(t);break;case 1:Xc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Jc(t,t.return,n),El(t);break;case 27:Sf(t.stateNode);case 26:case 5:Xc(t,t.return),El(t);break;case 22:t.memoizedState===null&&El(t);break;case 30:El(t);break;default:El(t)}e=e.sibling}}function Dl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Dl(i,a,n),Gc(4,a);break;case 1:if(Dl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){td(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Xa(c[i],s)}catch(e){td(r,r.return,e)}}n&&o&64&&qc(a),Yc(a,a.return);break;case 27:rl(a);case 26:case 5:Dl(i,a,n),n&&r===null&&o&4&&Zc(a),Yc(a,a.return);break;case 12:Dl(i,a,n);break;case 31:Dl(i,a,n),n&&o&4&&gl(i,a);break;case 13:Dl(i,a,n),n&&o&4&&_l(i,a);break;case 22:a.memoizedState===null&&Dl(i,a,n),Yc(a,a.return);break;case 30:break;default:Dl(i,a,n)}t=t.sibling}}function Ol(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&la(n))}function kl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&la(e))}function Al(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)jl(e,t,n,r),t=t.sibling}function jl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Al(e,t,n,r),i&2048&&Gc(9,t);break;case 1:Al(e,t,n,r);break;case 3:Al(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&la(e)));break;case 12:if(i&2048){Al(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){td(t,t.return,e)}}else Al(e,t,n,r);break;case 31:Al(e,t,n,r);break;case 13:Al(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Al(e,t,n,r):(a._visibility|=2,Ml(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Al(e,t,n,r):Nl(e,t),i&2048&&Ol(o,t);break;case 24:Al(e,t,n,r),i&2048&&kl(t.alternate,t);break;default:Al(e,t,n,r)}}function Ml(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Ml(a,o,s,c,i),Gc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Ml(a,o,s,c,i)):u._visibility&2?Ml(a,o,s,c,i):Nl(a,o),i&&l&2048&&Ol(o.alternate,o);break;case 24:Ml(a,o,s,c,i),i&&l&2048&&kl(o.alternate,o);break;default:Ml(a,o,s,c,i)}t=t.sibling}}function Nl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Nl(n,r),i&2048&&Ol(r.alternate,r);break;case 24:Nl(n,r),i&2048&&kl(r.alternate,r);break;default:Nl(n,r)}t=t.sibling}}var Pl=8192;function Fl(e,t,n){if(e.subtreeFlags&Pl)for(e=e.child;e!==null;)Il(e,t,n),e=e.sibling}function Il(e,t,n){switch(e.tag){case 26:Fl(e,t,n),e.flags&Pl&&e.memoizedState!==null&&ep(n,xl,e.memoizedState,e.memoizedProps);break;case 5:Fl(e,t,n);break;case 3:case 4:var r=xl;xl=Tf(e.stateNode.containerInfo),Fl(e,t,n),xl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Pl,Pl=16777216,Fl(e,t,n),Pl=r):Fl(e,t,n));break;default:Fl(e,t,n)}}function Ll(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Rl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];cl=r,Vl(r,e)}Ll(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)zl(e),e=e.sibling}function zl(e){switch(e.tag){case 0:case 11:case 15:Rl(e),e.flags&2048&&Kc(9,e,e.return);break;case 3:Rl(e);break;case 12:Rl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Bl(e)):Rl(e);break;default:Rl(e)}}function Bl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];cl=r,Vl(r,e)}Ll(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Kc(8,t,t.return),Bl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Bl(t));break;default:Bl(t)}e=e.sibling}}function Vl(e,t){for(;cl!==null;){var n=cl;switch(n.tag){case 0:case 11:case 15:Kc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:la(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,cl=r;else a:for(n=e;cl!==null;){r=cl;var i=r.sibling,a=r.return;if(dl(r),r===n){cl=null;break a}if(i!==null){i.return=a,cl=i;break a}cl=a}}}var Hl={getCacheForType:function(e){var t=ta(sa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ta(sa).controller.signal}},Ul=typeof WeakMap==`function`?WeakMap:Map,Wl=0,Gl=null,Kl=null,ql=0,Jl=0,Yl=null,Xl=!1,Zl=!1,Ql=!1,$l=0,eu=0,tu=0,nu=0,ru=0,iu=0,au=0,ou=null,su=null,cu=!1,lu=0,uu=0,du=1/0,fu=null,pu=null,mu=0,hu=null,gu=null,_u=0,vu=0,yu=null,bu=null,xu=0,Su=null;function Cu(){return Wl&2&&ql!==0?ql&-ql:N.T===null?nt():Sd()}function wu(){if(iu===0)if(!(ql&536870912)||Pi){var e=Ue;Ue<<=1,!(Ue&3932160)&&(Ue=262144),iu=e}else iu=536870912;return e=ro.current,e!==null&&(e.flags|=32),iu}function Tu(e,t,n){(e===Gl&&(Jl===2||Jl===9)||e.cancelPendingCommit!==null)&&(Mu(e,0),ku(e,ql,iu,!1)),Ye(e,n),(!(Wl&2)||e!==Gl)&&(e===Gl&&(!(Wl&2)&&(nu|=n),eu===4&&ku(e,ql,iu,!1)),md(e))}function Eu(e,t,n){if(Wl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||qe(e,t),a=r?Bu(e,t):Ru(e,t,!0),o=r;do{if(a===0){Zl&&!r&&ku(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!Ou(n)){a=Ru(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=ou;var l=c.current.memoizedState.isDehydrated;if(l&&(Mu(c,s).flags|=256),s=Ru(c,s,!1),s!==2){if(Ql&&!l){c.errorRecoveryDisabledLanes|=o,nu|=o,a=4;break a}o=su,su=a,o!==null&&(su===null?su=o:su.push.apply(su,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Mu(e,0),ku(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:ku(r,t,iu,!Xl);break a;case 2:su=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=lu+300-Ee(),10<a)){if(ku(r,t,iu,!Xl),Ke(r,0,!0)!==0)break a;_u=t,r.timeoutHandle=tf(Du.bind(null,r,n,su,fu,cu,t,iu,nu,au,Xl,o,`Throttled`,-0,0),a);break a}Du(r,n,su,fu,cu,t,iu,nu,au,Xl,o,null,-0,0)}}break}while(1);md(e)}function Du(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qt},Il(t,a,d);var m=(a&62914560)===a?lu-Ee():(a&4194048)===a?uu-Ee():0;if(m=np(d,m),m!==null){_u=a,e.cancelPendingCommit=m(qu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),ku(e,a,o,!l);return}}qu(e,t,a,n,r,i,o,s,c)}function Ou(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!xr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ku(e,t,n,r){t&=~ru,t&=~nu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Re(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ze(e,n,t)}function Au(){return Wl&6?!0:(hd(0,!1),!1)}function ju(){if(Kl!==null){if(Jl===0)var e=Kl.return;else e=Kl,qi=Ki=null,jo(e),Ma=null,Na=0,e=Kl;for(;e!==null;)Wc(e.alternate,e),e=e.return;Kl=null}}function Mu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,nf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),_u=0,ju(),Gl=e,Kl=n=li(e.current,null),ql=t,Jl=0,Yl=null,Xl=!1,Zl=qe(e,t),Ql=!1,au=iu=ru=nu=tu=eu=0,su=ou=null,cu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Re(r),a=1<<i;t|=e[i],r&=~a}return $l=t,$r(),n}function Nu(e,t){B=null,N.H=Vs,t===Sa||t===wa?(t=Aa(),Jl=3):t===Ca?(t=Aa(),Jl=4):Jl=t===ac?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Yl=t,Kl===null&&(eu=1,$s(e,_i(t,e.current)))}function Pu(){var e=ro.current;return e===null?!0:(ql&4194048)===ql?io===null:(ql&62914560)===ql||ql&536870912?e===io:!1}function Fu(){var e=N.H;return N.H=Vs,e===null?Vs:e}function Iu(){var e=N.A;return N.A=Hl,e}function Lu(){eu=4,Xl||(ql&4194048)!==ql&&ro.current!==null||(Zl=!0),!(tu&134217727)&&!(nu&134217727)||Gl===null||ku(Gl,ql,iu,!1)}function Ru(e,t,n){var r=Wl;Wl|=2;var i=Fu(),a=Iu();(Gl!==e||ql!==t)&&(fu=null,Mu(e,t)),t=!1;var o=eu;a:do try{if(Jl!==0&&Kl!==null){var s=Kl,c=Yl;switch(Jl){case 8:ju(),o=6;break a;case 3:case 2:case 9:case 6:ro.current===null&&(t=!0);var l=Jl;if(Jl=0,Yl=null,Wu(e,s,c,l),n&&Zl){o=0;break a}break;default:l=Jl,Jl=0,Yl=null,Wu(e,s,c,l)}}zu(),o=eu;break}catch(t){Nu(e,t)}while(1);return t&&e.shellSuspendCounter++,qi=Ki=null,Wl=r,N.H=i,N.A=a,Kl===null&&(Gl=null,ql=0,$r()),o}function zu(){for(;Kl!==null;)Hu(Kl)}function Bu(e,t){var n=Wl;Wl|=2;var r=Fu(),a=Iu();Gl!==e||ql!==t?(fu=null,du=Ee()+500,Mu(e,t)):Zl=qe(e,t);a:do try{if(Jl!==0&&Kl!==null){t=Kl;var o=Yl;b:switch(Jl){case 1:Jl=0,Yl=null,Wu(e,t,o,1);break;case 2:case 9:if(Ea(o)){Jl=0,Yl=null,Uu(t);break}t=function(){Jl!==2&&Jl!==9||Gl!==e||(Jl=7),md(e)},o.then(t,t);break a;case 3:Jl=7;break a;case 4:Jl=5;break a;case 7:Ea(o)?(Jl=0,Yl=null,Uu(t)):(Jl=0,Yl=null,Wu(e,t,o,7));break;case 5:var s=null;switch(Kl.tag){case 26:s=Kl.memoizedState;case 5:case 27:var c=Kl;if(s?$f(s):c.stateNode.complete){Jl=0,Yl=null;var l=c.sibling;if(l!==null)Kl=l;else{var u=c.return;u===null?Kl=null:(Kl=u,Gu(u))}break b}}Jl=0,Yl=null,Wu(e,t,o,5);break;case 6:Jl=0,Yl=null,Wu(e,t,o,6);break;case 8:ju(),eu=6;break a;default:throw Error(i(462))}}Vu();break}catch(t){Nu(e,t)}while(1);return qi=Ki=null,N.H=r,N.A=a,Wl=n,Kl===null?(Gl=null,ql=0,$r(),eu):0}function Vu(){for(;Kl!==null&&!we();)Hu(Kl)}function Hu(e){var t=Fc(e.alternate,e,$l);e.memoizedProps=e.pendingProps,t===null?Gu(e):Kl=t}function Uu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=yc(n,t,t.pendingProps,t.type,void 0,ql);break;case 11:t=yc(n,t,t.pendingProps,t.type.render,t.ref,ql);break;case 5:jo(t);default:Wc(n,t),t=Kl=ui(t,$l),t=Fc(n,t,$l)}e.memoizedProps=e.pendingProps,t===null?Gu(e):Kl=t}function Wu(e,t,n,r){qi=Ki=null,jo(t),Ma=null,Na=0;var i=t.return;try{if(ic(e,i,t,n,ql)){eu=1,$s(e,_i(n,e.current)),Kl=null;return}}catch(t){if(i!==null)throw Kl=i,t;eu=1,$s(e,_i(n,e.current)),Kl=null;return}t.flags&32768?(Pi||r===1?e=!0:Zl||ql&536870912?e=!1:(Xl=e=!0,(r===2||r===9||r===3||r===6)&&(r=ro.current,r!==null&&r.tag===13&&(r.flags|=16384))),Ku(t,e)):Gu(t)}function Gu(e){var t=e;do{if(t.flags&32768){Ku(t,Xl);return}e=t.return;var n=Hc(t.alternate,t,$l);if(n!==null){Kl=n;return}if(t=t.sibling,t!==null){Kl=t;return}Kl=t=e}while(t!==null);eu===0&&(eu=5)}function Ku(e,t){do{var n=Uc(e.alternate,e);if(n!==null){n.flags&=32767,Kl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Kl=e;return}Kl=e=n}while(e!==null);eu=6,Kl=null}function qu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Qu();while(mu!==0);if(Wl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Qr,Xe(e,n,o,s,c,l),e===Gl&&(Kl=Gl=null,ql=0),gu=t,hu=e,_u=n,vu=o,yu=a,bu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,sd(Ae,function(){return $u(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=N.T,N.T=null,a=P.p,P.p=2,s=Wl,Wl|=4;try{ll(e,t,n)}finally{Wl=s,P.p=a,N.T=r}}mu=1,Ju(),Yu(),Xu()}}function Ju(){if(mu===1){mu=0;var e=hu,t=gu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Wl;Wl|=4;try{Sl(t,e);var a=Yd,o=Er(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Tr(s.ownerDocument.documentElement,s)){if(c!==null&&Dr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=wr(s,h),v=wr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}gp=!!Jd,Yd=Jd=null}finally{Wl=i,P.p=r,N.T=n}}e.current=t,mu=2}}function Yu(){if(mu===2){mu=0;var e=hu,t=gu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Wl;Wl|=4;try{ul(e,t.alternate,t)}finally{Wl=i,P.p=r,N.T=n}}mu=3}}function Xu(){if(mu===4||mu===3){mu=0,Te();var e=hu,t=gu,n=_u,r=bu;t.subtreeFlags&10256||t.flags&10256?mu=5:(mu=0,gu=hu=null,Zu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(pu=null),tt(n),t=t.stateNode,Ie&&typeof Ie.onCommitFiberRoot==`function`)try{Ie.onCommitFiberRoot(Fe,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=N.T,i=P.p,P.p=2,N.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{N.T=t,P.p=i}}_u&3&&Qu(),md(e),i=e.pendingLanes,n&261930&&i&42?e===Su?xu++:(xu=0,Su=e):xu=0,hd(0,!1)}}function Zu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,la(t)))}function Qu(){return Ju(),Yu(),Xu(),$u()}function $u(){if(mu!==5)return!1;var e=hu,t=vu;vu=0;var n=tt(_u),r=N.T,a=P.p;try{P.p=32>n?32:n,N.T=null,n=yu,yu=null;var o=hu,s=_u;if(mu=0,gu=hu=null,_u=0,Wl&6)throw Error(i(331));var c=Wl;if(Wl|=4,zl(o.current),jl(o,o.current,s,n),Wl=c,hd(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot==`function`)try{Ie.onPostCommitFiberRoot(Fe,o)}catch{}return!0}finally{P.p=a,N.T=r,Zu(e,t)}}function ed(e,t,n){t=_i(n,t),t=tc(e.stateNode,t,2),e=Wa(e,t,2),e!==null&&(Ye(e,2),md(e))}function td(e,t,n){if(e.tag===3)ed(e,e,n);else for(;t!==null;){if(t.tag===3){ed(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(pu===null||!pu.has(r))){e=_i(n,e),n=nc(2),r=Wa(t,n,2),r!==null&&(rc(n,r,t,e),Ye(r,2),md(r));break}}t=t.return}}function nd(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ul;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ql=!0,i.add(n),e=rd.bind(null,e,t,n),t.then(e,e))}function rd(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Gl===e&&(ql&n)===n&&(eu===4||eu===3&&(ql&62914560)===ql&&300>Ee()-lu?!(Wl&2)&&Mu(e,0):ru|=n,au===ql&&(au=0)),md(e)}function id(e,t){t===0&&(t=z()),e=ni(e,t),e!==null&&(Ye(e,t),md(e))}function ad(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),id(e,n)}function od(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),id(e,n)}function sd(e,t){return Se(e,t)}var cd=null,ld=null,ud=!1,dd=!1,fd=!1,pd=0;function md(e){e!==ld&&e.next===null&&(ld===null?cd=ld=e:ld=ld.next=e),dd=!0,ud||(ud=!0,xd())}function hd(e,t){if(!fd&&dd){fd=!0;do for(var n=!1,r=cd;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Re(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,bd(r,a))}else a=ql,a=Ke(r,r===Gl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||qe(r,a)||(n=!0,bd(r,a));r=r.next}while(n);fd=!1}}function gd(){_d()}function _d(){dd=ud=!1;var e=0;pd!==0&&ef()&&(e=pd);for(var t=Ee(),n=null,r=cd;r!==null;){var i=r.next,a=vd(r,t);a===0?(r.next=null,n===null?cd=i:n.next=i,i===null&&(ld=n)):(n=r,(e!==0||a&3)&&(dd=!0)),r=i}mu!==0&&mu!==5||hd(e,!1),pd!==0&&(pd=0)}function vd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Re(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=R(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Gl,n=ql,n=Ke(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Jl===2||Jl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ce(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||qe(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ce(r),tt(n)){case 2:case 8:n=ke;break;case 32:n=Ae;break;case 268435456:n=Me;break;default:n=Ae}return r=yd.bind(null,e),n=Se(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ce(r),e.callbackPriority=2,e.callbackNode=null,2}function yd(e,t){if(mu!==0&&mu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Qu()&&e.callbackNode!==n)return null;var r=ql;return r=Ke(e,e===Gl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Eu(e,r,t),vd(e,Ee()),e.callbackNode!=null&&e.callbackNode===n?yd.bind(null,e):null)}function bd(e,t){if(Qu())return null;Eu(e,t,!0)}function xd(){af(function(){Wl&6?Se(Oe,gd):_d()})}function Sd(){if(pd===0){var e=fa;e===0&&(e=He,He<<=1,!(He&261888)&&(He=256)),pd=e}return pd}function Cd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Zt(``+e)}function wd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Td(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Cd((i[ot]||null).action),o=r.submitter;o&&(t=(t=o[ot]||null)?Cd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new bn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(pd!==0){var e=o?wd(i,o):new FormData(i);Ds(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?wd(i,o):new FormData(i),Ds(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Ed=0;Ed<qr.length;Ed++){var Dd=qr[Ed];Jr(Dd.toLowerCase(),`on`+(Dd[0].toUpperCase()+Dd.slice(1)))}Jr(zr,`onAnimationEnd`),Jr(Br,`onAnimationIteration`),Jr(Vr,`onAnimationStart`),Jr(`dblclick`,`onDoubleClick`),Jr(`focusin`,`onFocus`),Jr(`focusout`,`onBlur`),Jr(Hr,`onTransitionRun`),Jr(Ur,`onTransitionStart`),Jr(Wr,`onTransitionCancel`),Jr(Gr,`onTransitionEnd`),St(`onMouseEnter`,[`mouseout`,`mouseover`]),St(`onMouseLeave`,[`mouseout`,`mouseover`]),St(`onPointerEnter`,[`pointerout`,`pointerover`]),St(`onPointerLeave`,[`pointerout`,`pointerover`]),xt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),xt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),xt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),xt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),xt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),xt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Od=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),kd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Od));function V(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Yr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Yr(e)}i.currentTarget=null,a=c}}}}function H(e,t){var n=t[ct];n===void 0&&(n=t[ct]=new Set);var r=e+`__bubble`;n.has(r)||(Nd(t,e,2,!1),n.add(r))}function Ad(e,t,n){var r=0;t&&(r|=4),Nd(n,e,r,t)}var jd=`_reactListening`+Math.random().toString(36).slice(2);function Md(e){if(!e[jd]){e[jd]=!0,yt.forEach(function(t){t!==`selectionchange`&&(kd.has(t)||Ad(t,!1,e),Ad(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[jd]||(t[jd]=!0,Ad(`selectionchange`,!1,t))}}function Nd(e,t,n,r){switch(Cp(t)){case 2:var i=_p;break;case 8:i=vp;break;default:i=yp}n=i.bind(null,t,n,e),i=void 0,!ln||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Pd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=mt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}on(function(){var r=a,i=en(n),s=[];a:{var c=Kr.get(e);if(c!==void 0){var l=bn,u=e;switch(e){case`keypress`:if(hn(n)===0)break a;case`keydown`:case`keyup`:l=Rn;break;case`focusin`:u=`focus`,l=kn;break;case`focusout`:u=`blur`,l=kn;break;case`beforeblur`:case`afterblur`:l=kn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Dn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=On;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Bn;break;case zr:case Br:case Vr:l=An;break;case Gr:l=Vn;break;case`scroll`:case`scrollend`:l=Sn;break;case`wheel`:l=Hn;break;case`copy`:case`cut`:case`paste`:l=jn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=zn;break;case`toggle`:case`beforetoggle`:l=Un}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=sn(m,p),g!=null&&d.push(Fd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==$t&&(u=n.relatedTarget||n.fromElement)&&(mt(u)||u[st]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?mt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Dn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=zn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:gt(l),h=u==null?c:gt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,mt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Id,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Ld(s,c,l,d,!1),u!==null&&f!==null&&Ld(s,f,u,d,!0)}}a:{if(c=r?gt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=lr;else if(rr(c))if(ur)v=yr;else{v=_r;var y=gr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Jt(r.elementType)&&(v=lr):v=vr;if(v&&=v(e,r)){ir(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Bt(c,`number`,c.value)}switch(y=r?gt(r):window,e){case`focusin`:(rr(y)||y.contentEditable===`true`)&&(kr=y,Ar=r,jr=null);break;case`focusout`:jr=Ar=kr=null;break;case`mousedown`:Mr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Mr=!1,Nr(s,n,i);break;case`selectionchange`:if(Or)break;case`keydown`:case`keyup`:Nr(s,n,i)}var b;if(Gn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else $n?Zn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Jn&&n.locale!==`ko`&&($n||x!==`onCompositionStart`?x===`onCompositionEnd`&&$n&&(b=mn()):(dn=i,fn=`value`in dn?dn.value:dn.textContent,$n=!0)),y=U(r,x),0<y.length&&(x=new Mn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Qn(n),b!==null&&(x.data=b)))),(b=qn?er(e,n):tr(e,n))&&(x=U(r,`onBeforeInput`),0<x.length&&(y=new Mn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),Td(s,e,r,n,i)}V(s,t)})}function Fd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function U(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=sn(e,n),i!=null&&r.unshift(Fd(e,i,a)),i=sn(e,t),i!=null&&r.push(Fd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Id(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ld(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=sn(n,a),l!=null&&o.unshift(Fd(n,l,c))):i||(l=sn(n,a),l!=null&&o.push(Fd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Rd=/\r\n?/g,zd=/\u0000|\uFFFD/g;function Bd(e){return(typeof e==`string`?e:``+e).replace(Rd,`
9
+ `).replace(zd,``)}function Vd(e,t){return t=Bd(t),Bd(e)===t}function Hd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Wt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Wt(e,``+r);break;case`className`:Ot(e,`class`,r);break;case`tabIndex`:Ot(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ot(e,n,r);break;case`style`:qt(e,r,o);break;case`data`:if(t!==`object`){Ot(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Zt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Hd(e,t,`name`,a.name,a,null),Hd(e,t,`formEncType`,a.formEncType,a,null),Hd(e,t,`formMethod`,a.formMethod,a,null),Hd(e,t,`formTarget`,a.formTarget,a,null)):(Hd(e,t,`encType`,a.encType,a,null),Hd(e,t,`method`,a.method,a,null),Hd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Zt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Qt);break;case`onScroll`:r!=null&&H(`scroll`,e);break;case`onScrollEnd`:r!=null&&H(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Zt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:H(`beforetoggle`,e),H(`toggle`,e),Dt(e,`popover`,r);break;case`xlinkActuate`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Dt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Yt.get(n)||n,Dt(e,n,r))}}function Ud(e,t,n,r,a,o){switch(n){case`style`:qt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Wt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Wt(e,``+r);break;case`onScroll`:r!=null&&H(`scroll`,e);break;case`onScrollEnd`:r!=null&&H(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Qt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!bt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[ot]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Dt(e,n,r)}}}function Wd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:H(`error`,e),H(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Hd(e,t,o,s,n,null)}}a&&Hd(e,t,`srcSet`,n.srcSet,n,null),r&&Hd(e,t,`src`,n.src,n,null);return;case`input`:H(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Hd(e,t,r,d,n,null)}}zt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in H(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Hd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Vt(e,!!r,n,!0):Vt(e,!!r,t,!1);return;case`textarea`:for(s in H(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Hd(e,t,s,c,n,null)}Ut(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Hd(e,t,l,r,n,null)}return;case`dialog`:H(`beforetoggle`,e),H(`toggle`,e),H(`cancel`,e),H(`close`,e);break;case`iframe`:case`object`:H(`load`,e);break;case`video`:case`audio`:for(r=0;r<Od.length;r++)H(Od[r],e);break;case`image`:H(`error`,e),H(`load`,e);break;case`details`:H(`toggle`,e);break;case`embed`:case`source`:case`link`:H(`error`,e),H(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Hd(e,t,u,r,n,null)}return;default:if(Jt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Ud(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Hd(e,t,c,r,n,null))}function Gd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Hd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Hd(e,t,p,m,r,f)}}Rt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Hd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Hd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Vt(e,!!n,n?[]:``,!1):Vt(e,!!n,t,!0)):Vt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Hd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Hd(e,t,s,a,r,o)}Ht(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Hd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Hd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Hd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Hd(e,t,u,p,r,m)}return;default:if(Jt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Ud(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Ud(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Hd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Hd(e,t,f,p,r,m)}function Kd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function qd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Kd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Kd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Jd=null,Yd=null;function Xd(e){return e.nodeType===9?e:e.ownerDocument}function Zd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Qd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function $d(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var W=null;function ef(){var e=window.event;return e&&e.type===`popstate`?e===W?!1:(W=e,!0):(W=null,!1)}var tf=typeof setTimeout==`function`?setTimeout:void 0,nf=typeof clearTimeout==`function`?clearTimeout:void 0,rf=typeof Promise==`function`?Promise:void 0,af=typeof queueMicrotask==`function`?queueMicrotask:rf===void 0?tf:function(e){return rf.resolve(null).then(e).catch(of)};function of(e){setTimeout(function(){throw e})}function sf(e){return e===`head`}function cf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Vp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Sf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Sf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ft]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Sf(e.ownerDocument.body);n=i}while(n);Vp(t)}function lf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function uf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:uf(n),pt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function df(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[ft])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=_f(e.nextSibling),e===null)break}return null}function ff(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=_f(e.nextSibling),e===null))return null;return e}function pf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=_f(e.nextSibling),e===null))return null;return e}function mf(e){return e.data===`$?`||e.data===`$~`}function hf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function gf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function _f(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var vf=null;function yf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return _f(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function bf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function xf(e,t,n){switch(t=Xd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Sf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);pt(e)}var Cf=new Map,wf=new Set;function Tf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ef=P.d;P.d={f:Df,r:Of,D:jf,C:Mf,L:Nf,m:Pf,X:If,S:Ff,M:Lf};function Df(){var e=Ef.f(),t=Au();return e||t}function Of(e){var t=ht(e);t!==null&&t.tag===5&&t.type===`form`?ks(t):Ef.r(e)}var kf=typeof document>`u`?null:document;function Af(e,t,n){var r=kf;if(r&&typeof t==`string`&&t){var i=Lt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),wf.has(i)||(wf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Wd(t,`link`,e),vt(t),r.head.appendChild(t)))}}function jf(e){Ef.D(e),Af(`dns-prefetch`,e,null)}function Mf(e,t){Ef.C(e,t),Af(`preconnect`,e,t)}function Nf(e,t,n){Ef.L(e,t,n);var r=kf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Lt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Lt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Lt(n.imageSizes)+`"]`)):i+=`[href="`+Lt(e)+`"]`;var a=i;switch(t){case`style`:a=zf(e);break;case`script`:a=Uf(e)}Cf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Cf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Bf(a))||t===`script`&&r.querySelector(Wf(a))||(t=r.createElement(`link`),Wd(t,`link`,e),vt(t),r.head.appendChild(t)))}}function Pf(e,t){Ef.m(e,t);var n=kf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Lt(r)+`"][href="`+Lt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Uf(e)}if(!Cf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),Cf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Wf(a)))return}r=n.createElement(`link`),Wd(r,`link`,e),vt(r),n.head.appendChild(r)}}}function Ff(e,t,n){Ef.S(e,t,n);var r=kf;if(r&&e){var i=_t(r).hoistableStyles,a=zf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Bf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Cf.get(a))&&qf(e,n);var c=o=r.createElement(`link`);vt(c),Wd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Kf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function If(e,t){Ef.X(e,t);var n=kf;if(n&&e){var r=_t(n).hoistableScripts,i=Uf(e),a=r.get(i);a||(a=n.querySelector(Wf(i)),a||(e=m({src:e,async:!0},t),(t=Cf.get(i))&&Jf(e,t),a=n.createElement(`script`),vt(a),Wd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Lf(e,t){Ef.M(e,t);var n=kf;if(n&&e){var r=_t(n).hoistableScripts,i=Uf(e),a=r.get(i);a||(a=n.querySelector(Wf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=Cf.get(i))&&Jf(e,t),a=n.createElement(`script`),vt(a),Wd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Rf(e,t,n,r){var a=(a=ce.current)?Tf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=zf(n.href),n=_t(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=zf(n.href);var o=_t(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Bf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Cf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Cf.set(e,n),o||Hf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Uf(n),n=_t(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function zf(e){return`href="`+Lt(e)+`"`}function Bf(e){return`link[rel="stylesheet"][`+e+`]`}function Vf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Hf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Wd(t,`link`,n),vt(t),e.head.appendChild(t))}function Uf(e){return`[src="`+Lt(e)+`"]`}function Wf(e){return`script[async]`+e}function Gf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Lt(n.href)+`"]`);if(r)return t.instance=r,vt(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),vt(r),Wd(r,`style`,a),Kf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=zf(n.href);var o=e.querySelector(Bf(a));if(o)return t.state.loading|=4,t.instance=o,vt(o),o;r=Vf(n),(a=Cf.get(a))&&qf(r,a),o=(e.ownerDocument||e).createElement(`link`),vt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Wd(o,`link`,r),t.state.loading|=4,Kf(o,n.precedence,e),t.instance=o;case`script`:return o=Uf(n.src),(a=e.querySelector(Wf(o)))?(t.instance=a,vt(a),a):(r=n,(a=Cf.get(o))&&(r=m({},n),Jf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),vt(a),Wd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Kf(r,n.precedence,e));return t.instance}function Kf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function qf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Jf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Yf=null;function Xf(e,t,n){if(Yf===null){var r=new Map,i=Yf=new Map;i.set(n,r)}else i=Yf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ft]||a[at]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Zf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Qf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function $f(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function ep(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=zf(r.href),a=t.querySelector(Bf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=rp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,vt(a);return}a=t.ownerDocument||t,r=Vf(r),(i=Cf.get(i))&&qf(r,i),a=a.createElement(`link`),vt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Wd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=rp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var tp=0;function np(e,t){return e.stylesheets&&e.count===0&&ap(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ap(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&tp===0&&(tp=62500*qd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ap(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>tp?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function rp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ap(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ip=null;function ap(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ip=new Map,t.forEach(op,e),ip=null,rp.call(e))}function op(e,t){if(!(t.state.loading&4)){var n=ip.get(e);if(n)var r=n.get(null);else{n=new Map,ip.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=rp.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var sp={$$typeof:C,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function cp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Je(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Je(0),this.hiddenUpdates=Je(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function lp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new cp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=si(3,null,null,t),e.current=a,a.stateNode=e,t=ca(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Va(a),e}function up(e){return e?(e=ai,e):ai}function dp(e,t,n,r,i,a){i=up(i),r.context===null?r.context=i:r.pendingContext=i,r=Ua(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Wa(e,r,t),n!==null&&(Tu(n,e,t),Ga(n,e,t))}function fp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function pp(e,t){fp(e,t),(e=e.alternate)&&fp(e,t)}function mp(e){if(e.tag===13||e.tag===31){var t=ni(e,67108864);t!==null&&Tu(t,e,67108864),pp(e,67108864)}}function hp(e){if(e.tag===13||e.tag===31){var t=Cu();t=et(t);var n=ni(e,t);n!==null&&Tu(n,e,t),pp(e,t)}}var gp=!0;function _p(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=2,yp(e,t,n,r)}finally{P.p=a,N.T=i}}function vp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=8,yp(e,t,n,r)}finally{P.p=a,N.T=i}}function yp(e,t,n,r){if(gp){var i=bp(r);if(i===null)Pd(e,t,r,xp,n),jp(e,r);else if(Np(i,e,t,n,r))r.stopPropagation();else if(jp(e,r),t&4&&-1<Ap.indexOf(e)){for(;i!==null;){var a=ht(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ge(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Re(o);s.entanglements[1]|=c,o&=~c}md(a),!(Wl&6)&&(du=Ee()+500,hd(0,!1))}}break;case 31:case 13:s=ni(a,2),s!==null&&Tu(s,a,2),Au(),pp(a,2)}if(a=bp(r),a===null&&Pd(e,t,r,xp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Pd(e,t,r,null,n)}}function bp(e){return e=en(e),Sp(e)}var xp=null;function Sp(e){if(xp=null,e=mt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xp=e,null}function Cp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(De()){case Oe:return 2;case ke:return 8;case Ae:case je:return 32;case Me:return 268435456;default:return 32}default:return 32}}var G=!1,wp=null,Tp=null,Ep=null,Dp=new Map,Op=new Map,kp=[],Ap=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function jp(e,t){switch(e){case`focusin`:case`focusout`:wp=null;break;case`dragenter`:case`dragleave`:Tp=null;break;case`mouseover`:case`mouseout`:Ep=null;break;case`pointerover`:case`pointerout`:Dp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Op.delete(t.pointerId)}}function Mp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ht(t),t!==null&&mp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Np(e,t,n,r,i){switch(t){case`focusin`:return wp=Mp(wp,e,t,n,r,i),!0;case`dragenter`:return Tp=Mp(Tp,e,t,n,r,i),!0;case`mouseover`:return Ep=Mp(Ep,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Dp.set(a,Mp(Dp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Op.set(a,Mp(Op.get(a)||null,e,t,n,r,i)),!0}return!1}function Pp(e){var t=mt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,rt(e.priority,function(){hp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,rt(e.priority,function(){hp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Fp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);$t=r,n.target.dispatchEvent(r),$t=null}else return t=ht(n),t!==null&&mp(t),e.blockedOn=n,!1;t.shift()}return!0}function Ip(e,t,n){Fp(e)&&n.delete(t)}function Lp(){G=!1,wp!==null&&Fp(wp)&&(wp=null),Tp!==null&&Fp(Tp)&&(Tp=null),Ep!==null&&Fp(Ep)&&(Ep=null),Dp.forEach(Ip),Op.forEach(Ip)}function Rp(e,n){e.blockedOn===n&&(e.blockedOn=null,G||(G=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Lp)))}var zp=null;function Bp(e){zp!==e&&(zp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){zp===e&&(zp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sp(r||n)===null)continue;break}var a=ht(n);a!==null&&(e.splice(t,3),t-=3,Ds(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Vp(e){function t(t){return Rp(t,e)}wp!==null&&Rp(wp,e),Tp!==null&&Rp(Tp,e),Ep!==null&&Rp(Ep,e),Dp.forEach(t),Op.forEach(t);for(var n=0;n<kp.length;n++){var r=kp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<kp.length&&(n=kp[0],n.blockedOn===null);)Pp(n),n.blockedOn===null&&kp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[ot]||null;if(typeof a==`function`)o||Bp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[ot]||null)s=o.formAction;else if(Sp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Bp(n)}}}function Hp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Up(e){this._internalRoot=e}Wp.prototype.render=Up.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;dp(n,Cu(),e,t,null,null)},Wp.prototype.unmount=Up.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dp(e.current,2,null,e,null,null),Au(),t[st]=null}};function Wp(e){this._internalRoot=e}Wp.prototype.unstable_scheduleHydration=function(e){if(e){var t=nt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<kp.length&&t!==0&&t<kp[n].priority;n++);kp.splice(n,0,e),n===0&&Pp(e)}};var Gp=n.version;if(Gp!==`19.2.7`)throw Error(i(527,Gp,`19.2.7`));P.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Kp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:N,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var qp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qp.isDisabled&&qp.supportsFiber)try{Fe=qp.inject(Kp),Ie=qp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Xs,s=Zs,c=Qs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=lp(e,1,!1,null,null,n,r,null,o,s,c,Hp),e[st]=t.current,Md(e),new Up(t)}})),_=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},y=new class extends v{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},b={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},x=new class{#e=b;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function S(e){setTimeout(e,0)}var C=typeof window>`u`||`Deno`in globalThis;function w(){}function T(e,t){return typeof e==`function`?e(t):e}function E(e){return typeof e==`number`&&e>=0&&e!==1/0}function D(e,t){return Math.max(e+(t||0)-Date.now(),0)}function O(e,t){return typeof e==`function`?e(t):e}function k(e,t){return typeof e==`function`?e(t):e}function ee(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==A(o,t.options))return!1}else if(!M(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function te(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(j(t.options.mutationKey)!==j(a))return!1}else if(!M(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function A(e,t){return(t?.queryKeyHashFn||j)(e)}function j(e){return JSON.stringify(e,(e,t)=>ie(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function M(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>M(e[n],t[n])):!1}var ne=Object.prototype.hasOwnProperty;function N(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=re(e)&&re(t);if(!r&&!(ie(e)&&ie(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ne.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=N(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function P(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function re(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ie(e){if(!ae(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ae(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ae(e){return Object.prototype.toString.call(e)===`[object Object]`}function F(e){return new Promise(t=>{x.setTimeout(t,e)})}function I(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:N(e,t)}function L(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function oe(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var se=Symbol();function ce(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===se?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function le(e,t){return typeof e==`function`?e(...t):!!e}function ue(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var de=(()=>{let e=()=>C;return{isServer(){return e()},setIsServer(t){e=t}}})();function fe(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var pe=S;function me(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=pe,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var he=me(),ge=new class extends v{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function _e(e){return Math.min(1e3*2**e,3e4)}function ve(e){return(e??`online`)!==`online`||ge.isOnline()}var ye=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function be(e){let t=!1,n=0,r,i=fe(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new ye(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>y.isFocused()&&(e.networkMode===`always`||ge.isOnline())&&e.canRun(),u=()=>ve(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(de.isServer()?0:3),o=e.retryDelay??_e,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),F(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var xe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),E(this.gcTime)&&(this.#e=x.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(de.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(x.clearTimeout(this.#e),this.#e=void 0)}};function Se(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ue(e,()=>t.signal,()=>n=!0)},u=ce(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?oe:L;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?we:Ce,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ce(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Ce(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function we(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Te=class extends xe{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Oe(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Oe(this.options);e.data!==void 0&&(this.setState(De(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=I(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(w).catch(w):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>k(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===se||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>O(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!D(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ce(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Se(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=be({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ye&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof ye){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ee(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...De(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),he.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ee(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ve(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function De(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Oe(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var ke=class extends v{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=fe(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),je(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Me(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Me(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof k(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!P(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Ne(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||O(this.options.staleTime,this.#t)!==O(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Fe(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(w)),t}#g(){this.#b();let e=O(this.options.staleTime,this.#t);if(de.isServer()||this.#r.isStale||!E(e))return;let t=D(this.#r.dataUpdatedAt,e)+1;this.#d=x.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(de.isServer()||k(this.options.enabled,this.#t)===!1||!E(this.#p)||this.#p===0)&&(this.#f=x.setInterval(()=>{(this.options.refetchIntervalInBackground||y.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(x.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(x.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&je(e,t),o=i&&Ne(e,n,t,r);(a||o)&&(l={...l,...Ee(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=I(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=I(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Pe(e,t),refetch:this.refetch,promise:this.#o,isEnabled:k(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=fe();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!P(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){he.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Ae(e,t){return k(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&k(t.retryOnMount,e)===!1)}function je(e,t){return Ae(e,t)||e.state.data!==void 0&&Me(e,t,t.refetchOnMount)}function Me(e,t,n){if(k(t.enabled,e)!==!1&&O(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Pe(e,t)}return!1}function Ne(e,t,n,r){return(e!==t||k(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Pe(e,n)}function Pe(e,t){return k(t.enabled,e)!==!1&&e.isStaleByTime(O(t.staleTime,e))}function Fe(e,t){return!P(e.getCurrentResult(),t)}var Ie=class extends xe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Le(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=be({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),he.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Le(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Re=class extends v{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Ie({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ze(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ze(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ze(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=ze(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){he.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>te(t,e))}findAll(e={}){return this.getAll().filter(t=>te(e,t))}notify(e){he.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return he.batch(()=>Promise.all(e.map(e=>e.continue().catch(w))))}};function ze(e){return e.options.scope?.id}var Be=class extends v{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),P(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&j(t.mutationKey)!==j(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Le();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){he.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Ve(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function He(e,t,n){let r=e.slice(0);return r[t]=n,r}var Ue=class extends v{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,he.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!P(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Ve(e,n).forEach(e=>{e.destroy()}),Ve(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=N(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new ke(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=He(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&he.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},We=class extends v{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??A(r,t),a=this.get(i);return a||(a=new Te({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){he.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ee(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ee(e,t)):t}notify(e){he.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){he.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){he.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ge=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new We,this.#t=e.mutationCache||new Re,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=y.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ge.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(O(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=T(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return he.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;he.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return he.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=he.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(w).catch(w)}invalidateQueries(e,t={}){return he.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=he.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(w)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(w)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(O(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(w).catch(w)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(w).catch(w)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ge.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(j(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{M(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(j(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{M(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=A(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===se&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ke=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),qe=o(((e,t)=>{t.exports=Ke()})),R=l(d(),1),z=qe(),Je=R.createContext(void 0),Ye=e=>{let t=R.useContext(Je);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Xe=({client:e,children:t})=>(R.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,z.jsx)(Je.Provider,{value:e,children:t})),Ze=R.createContext(!1),Qe=()=>R.useContext(Ze);Ze.Provider;function $e(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var et=R.createContext($e()),tt=()=>R.useContext(et),nt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?le(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},rt=e=>{R.useEffect(()=>{e.clearReset()},[e])},it=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||le(n,[e.error,r])),at=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},ot=(e,t)=>e.isLoading&&e.isFetching&&!t,st=(e,t)=>e?.suspense&&t.isPending,ct=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function lt({queries:e,...t},n){let r=Ye(n),i=Qe(),a=tt(),o=R.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{at(e);let t=r.getQueryCache().get(e.queryHash);nt(e,a,t)}),rt(a);let[s]=R.useState(()=>new Ue(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;R.useSyncExternalStore(R.useCallback(e=>d?s.subscribe(he.batchCalls(e)):w,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),R.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>st(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&st(n,e)?ct(n,new ke(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&it({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function ut(e,t,n){let r=Qe(),i=tt(),a=Ye(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,at(o),nt(o,i,s),rt(i);let l=!a.getQueryCache().get(o.queryHash),[u]=R.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(R.useSyncExternalStore(R.useCallback(e=>{let t=f?u.subscribe(he.batchCalls(e)):w;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),R.useEffect(()=>{u.setOptions(o)},[o,u]),st(o,d))throw ct(o,u,i);if(it({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!de.isServer()&&ot(d,r)&&(l?ct(o,u,i):s?.promise)?.catch(w).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function dt(e,t){return ut(e,ke,t)}function ft(e){return e}function pt(e,t){let n=Ye(t),[r]=R.useState(()=>new Be(n,e));R.useEffect(()=>{r.setOptions(e)},[r,e]);let i=R.useSyncExternalStore(R.useCallback(e=>r.subscribe(he.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=R.useCallback((e,t)=>{r.mutate(e,t).catch(w)},[r]);if(i.error&&le(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var mt=typeof window<`u`?R.useLayoutEffect:R.useEffect;function ht(e){let t=R.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function gt(e,t,n={},r={}){R.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function _t(e){let t=R.useRef(null);return R.useImperativeHandle(e,()=>t.current,[]),t}function vt(e){return e[e.length-1]}function yt(e){return typeof e==`function`}function bt(e,t){return yt(e)?e(t):e}var xt=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable;function Ct(e){for(let t in e)if(xt.call(e,t))return!0;return!1}var wt=()=>Object.create(null),Tt=(e,t)=>Et(e,t,wt);function Et(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=At(e)&&At(i);if(!a&&!(Ot(e)&&Ot(i)))return i;let o=a?e:Dt(e);if(!o)return i;let s=a?i:Dt(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:xt.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=Et(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function Dt(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!St.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!St.call(e,t))return!1;r.push(t)}return r}function Ot(e){if(!kt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!kt(n)||!n.hasOwnProperty(`isPrototypeOf`))}function kt(e){return Object.prototype.toString.call(e)===`[object Object]`}function At(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function jt(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!jt(e[r],t[r],n))return!1;return!0}if(Ot(e)&&Ot(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!jt(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!jt(e[o],t[o],n)))return!1;return i===a}return!1}function Mt(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function Nt(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}var Pt=/[\x00-\x1f\x7f"<>`{}]/g;function Ft(e){return e.replace(Pt,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function It(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Ft(t)}var Lt=[`http:`,`https:`,`mailto:`,`tel:`];function Rt(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function zt(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=It(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=It(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Bt(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Vt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ht(){throw Error(`Invariant failed`)}function Ut(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var Wt=4,Gt=5;function Kt(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function qt(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=Kt(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function Jt(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=qt(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=Zt(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=Zt(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Qt(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Qt(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=Qt(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=Zt(n.fullPath??n.from);e.kind=Gt,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=Zt(n.fullPath??n.from);e.kind=Wt,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)Jt(e,t,r,s,i,a,o)}function Yt(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Xt(e){if(e.pathless)for(let t of e.pathless)Xt(t);if(e.static)for(let t of e.static.values())Xt(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())Xt(t);if(e.dynamic?.length){e.dynamic.sort(Yt);for(let t of e.dynamic)Xt(t)}if(e.optional?.length){e.optional.sort(Yt);for(let t of e.optional)Xt(t)}if(e.wildcard?.length){e.wildcard.sort(Yt);for(let t of e.wildcard)Xt(t)}}function Zt(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Qt(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function $t(e,t){let n=Zt(`/`),r=new Uint16Array(6);for(let t of e)Jt(!1,r,t,1,n,0);Xt(n),t.masksTree=n,t.flatCache=Ut(1e3)}function en(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=on(e,t.masksTree);return t.flatCache.set(e,r),r}function tn(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Zt(`/`),Jt(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),on(r,o,n)}function nn(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=on(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=cn(a.route)),t.matchCache.set(r,a),a}function rn(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function an(e,t=!1,n){let r=Zt(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return Jt(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&Ht(),a[e.id]=e,s!==0&&e.path){let t=rn(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),Xt(r),{processedTree:{segmentTree:r,singleCache:Ut(1e3),matchCache:Ut(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function on(e,t,n=!1){let r=e.split(`/`),i=un(e,r,t,n);if(!i)return null;let[a]=sn(e,r,i);return{route:i.node.route,rawParams:a}}function sn(e,t,n){let r=ln(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===Wt)break;if(u.kind===Gt){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function cn(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function ln(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function un(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!vt(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!mn(l,n))continue;if(i.parse){if(!pn(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==Wt&&mn(c,n)&&(c=n);let v=u===o;if(v&&(i.route&&(!a||i.kind===Wt||i.kind===2)&&mn(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[u],b;if(v&&i.index){let n={node:i.index,index:u,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(pn(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&fn(p,o))return n;mn(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:u,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:u+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+dn(o,u),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,depth:f+1,statics:p,dynamics:m+dn(o,u),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+dn(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+dn(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:u,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function dn(e,t){return 2**(e-t-1)}function fn(e,t){return e===2**(t-1)-1}function pn(e,t,n){let r,i;try{[r,i]=sn(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function mn(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Wt)>(e.node.kind===Wt)||t.node.kind===Wt==(e.node.kind===Wt)&&t.depth>e.depth)))}function hn(e){return gn(e.filter(e=>e!==void 0).join(`/`))}function gn(e){return e.replace(/\/{2,}/g,`/`)}function _n(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function vn(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function yn(e){return vn(_n(e))}function bn(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function xn(e,t,n){return bn(e,n)===bn(t,n)}function Sn({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&vt(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(vt(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=gn(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function Cn(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function wn(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>En(e,n)).join(`/`):En(r,n):r}function Tn({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=qt(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=wn(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=wn(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=wn(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function En(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function Dn(e){return e?.isNotFound===!0}function On(){try{return sessionStorage}catch{return}}var kn=`tsr-scroll-restoration-v1_3`,An=On();function jn(){try{return JSON.parse(An?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Mn(){try{An?.setItem(kn,JSON.stringify(Nn))}catch{}}var Nn=jn(),Pn=`data-scroll-restoration-id`,Fn=e=>e.state.__TSR_key||e.href;function In(e){let t=e.getAttribute(Pn);if(t)return`[${Pn}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var Ln=!1,Rn=`window`;function zn(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Bn(e){let t=new Set;for(let n of e){if(n===Rn)continue;let e=zn(n);e&&t.add(e)}return t}function Vn(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||Fn,a=new Set,o=e=>{let t=Nn[e]||={};for(let e of a)e===document?t[Rn]={scrollX,scrollY}:e.isConnected&&(t[In(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,Ln=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{Ln||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),Mn()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=Nn[d];if(e){let t=Nn[u];for(let n in e){if(n===Rn){if(s)continue}else{let e=zn(n);if(!e||s&&o&&(l??=Bn(o),l.has(e)))continue}t||=Nn[u]={},t[n]??=e[n]}}}Ln=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Bn(o));let t=e&&i&&c,s=r.restoring?Nn[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Rn){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=zn(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{Ln=!1}}))}function Hn(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function Un(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Wn(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=Un(r):Array.isArray(t)?t.push(Un(r)):n[e]=[t,Un(r)]}return n}var Gn=qn(JSON.parse),Kn=Jn(JSON.stringify,JSON.parse);function qn(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=Wn(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function Jn(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=Hn(e,r);return t?`?${t}`:``}}var Yn=`__root__`;function Xn(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Zn(e){return e instanceof Response&&!!e.options}function Qn(e){return{input:({url:t})=>{for(let n of e)t=er(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=tr(e[n],t);return t}}}function $n(e){let t=yn(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=hn([`/`,t,e.pathname]),e)}}function er(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function tr(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function nr(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i,init:a}=t,o=new Map,s=new Map,c=new Map,l=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),f=n(e.isTransitioning),p=n(e.location),m=n(e.resolvedLocation),h=n(e.statusCode),g=n(e.redirect),_=n([]),v=n([]),y=n([]),b=r(()=>rr(o,_.get())),x=r(()=>rr(s,v.get())),S=r(()=>rr(c,y.get())),C=r(()=>_.get()[0]),w=r(()=>_.get().some(e=>o.get(e)?.get().status===`pending`)),T=r(()=>({locationHref:p.get().href,resolvedLocationHref:m.get()?.href,status:l.get()})),E=r(()=>({status:l.get(),loadedAt:u.get(),isLoading:d.get(),isTransitioning:f.get(),matches:b.get(),location:p.get(),resolvedLocation:m.get(),statusCode:h.get(),redirect:g.get()})),D=Ut(64);function O(e){let t=D.get(e);return t||(t=r(()=>{let t=_.get();for(let n of t){let t=o.get(n);if(t&&t.routeId===e)return t.get()}}),D.set(e,t)),t}let k={status:l,loadedAt:u,isLoading:d,isTransitioning:f,location:p,resolvedLocation:m,statusCode:h,redirect:g,matchesId:_,pendingIds:v,cachedIds:y,matches:b,pendingMatches:x,cachedMatches:S,firstId:C,hasPending:w,matchRouteDeps:T,matchStores:o,pendingMatchStores:s,cachedMatchStores:c,__store:E,getRouteMatchStore:O,setMatches:ee,setPending:te,setCached:A};ee(e.matches),a?.(k);function ee(e){ir(e,o,_,n,i)}function te(e){ir(e,s,v,n,i)}function A(e){ir(e,c,y,n,i)}return k}function rr(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.get())}return n}function ir(e,t,n,r,i){let a=e.map(e=>e.id),o=new Set(a);i(()=>{for(let e of t.keys())o.has(e)||t.delete(e);for(let n of e){let e=t.get(n.id);if(!e){let e=r(n);e.routeId=n.routeId,t.set(n.id,e);continue}e.routeId=n.routeId,e.get()!==n&&e.set(n)}Vt(n.get(),a)||n.set(a)})}var ar=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},or=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),sr=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),cr=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},lr=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},ur=(e,t,n)=>{if(!(!Zn(n)&&!Dn(n)))throw Zn(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:Zn(n)?`redirected`:Dn(n)?`notFound`:r.status===`pending`?`success`:r.status,context:cr(e,t.index),isFetching:!1,error:n})),Dn(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Zn(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},dr=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},fr=(e,t,n)=>{let r=cr(e,n);e.updateMatch(t,e=>({...e,context:r}))},pr=(e,t,n)=>{let{id:r,routeId:i}=e.matches[t],a=e.router.looseRoutesById[i];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,ur(e,e.router.getMatch(r),n);try{a.options.onError?.(n)}catch(t){n=t,ur(e,e.router.getMatch(r),n)}e.updateMatch(r,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Zn(n)&&!Dn(n)&&(e.serialError??=n)},mr=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!sr(e,t)&&(n.options.loader||n.options.beforeLoad||Tr(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{ar(e)},i);r._nonReactive.pendingTimeout=t}},hr=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;mr(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&ur(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},gr=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=Mt(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&pr(e,n,o),s&&pr(e,n,s),mr(e,t,r,i);let c=new AbortController,l=!1,u=()=>{l||(l=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=Mt();let f={...cr(e,n,!1),...i.__routeContext},{search:p,params:m,cause:h}=i,g=sr(e,t),_={search:p,abortController:c,params:m,preload:g,context:f,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:g?`preload`:h,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},v=r=>{if(r===void 0){e.router.batch(()=>{u(),d()});return}(Zn(r)||Dn(r))&&(u(),pr(e,n,r)),e.router.batch(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},y;try{if(y=r.options.beforeLoad(_),Nt(y))return u(),y.catch(t=>{pr(e,n,t)}).then(v)}catch(t){u(),pr(e,n,t)}v(y)},_r=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>gr(e,n,t,i),s=()=>{if(dr(e,n))return;let t=hr(e,n,i);return Nt(t)?t.then(o):o()};return a()},vr=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},yr=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=cr(e,r),d=sr(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},br=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{wr(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(yr(e,t,n,r,i)),l=!!s&&Nt(c);if((l||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;ur(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}i._lazyPromise&&await i._lazyPromise;let u=a._nonReactive.minPendingPromise;u&&await u,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:cr(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let o=t;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:cr(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,Dn(t)&&await i.options.notFoundComponent?.preload?.(),ur(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,ur(e,e.router.getMatch(n),t)}!Zn(o)&&!Dn(o)&&await wr(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:cr(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),ur(e,r,t)}},xr=async(e,t,n)=>{async function r(r,a,c,l,d){let f=Date.now()-a.updatedAt,p=r?d.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:d.options.staleTime??e.router.options.defaultStaleTime??0,m=d.options.shouldReload,h=typeof m==`function`?m(yr(e,t,i,n,d)):m,{status:g,invalid:_}=l,v=f>=p&&(!!e.forceStaleReload||l.cause===`enter`||c!==void 0&&c!==l.id);o=g===`success`&&(_||(h??v)),r&&d.options.preload===!1||(o&&!e.sync&&u?(s=!0,(async()=>{try{await br(e,t,i,n,d);let r=e.router.getMatch(i);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){Zn(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await br(e,t,i,n,d):fr(e,i,n))}let{id:i,routeId:a}=e.matches[n],o=!1,s=!1,c=e.router.looseRoutesById[a],l=c.options.loader,u=((typeof l==`function`?void 0:l?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(dr(e,i)){if(!e.router.getMatch(i))return e.matches[n];fr(e,i,n)}else{let t=e.router.getMatch(i),o=e.router.stores.matchesId.get()[n],s=(o&&e.router.stores.matchStores.get(o)||null)?.routeId===a?o:e.router.stores.matches.get().find(e=>e.routeId===a)?.id,l=sr(e,i);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&u)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(i),a=n._nonReactive.error||n.error;a&&ur(e,n,a),n.status===`pending`&&await r(l,t,s,n,c)}else{let n=l&&!e.router.stores.matchStores.has(i),a=e.router.getMatch(i);a._nonReactive.loaderPromise=Mt(),n!==a.preload&&e.updateMatch(i,e=>({...e,preload:n})),await r(l,t,s,a,c)}}let d=e.router.getMatch(i);s||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,s||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;let f=s?d.isFetching:!1;return f!==d.isFetching||d.invalid!==!1?(e.updateMatch(i,e=>({...e,isFetching:f,invalid:!1})),e.router.getMatch(i)):d};async function Sr(e){let t=e,n=[];or(t.router)&&ar(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=_r(t,e);Nt(n)&&await n}catch(e){if(Zn(e))throw e;if(Dn(e))r=e;else if(!t.preload)throw e;break}if(t.serialError||t.firstBadMatchIndex!=null)break}let i=t.firstBadMatchIndex??t.matches.length,a=r&&!t.preload?lr(t,r):void 0,o=r&&t.preload?0:a===void 0?i:Math.min(a+1,i),s,c;for(let e=0;e<o;e++)n.push(xr(t,n,e));try{await Promise.all(n)}catch{let e=await Promise.allSettled(n);for(let t of e){if(t.status!==`rejected`)continue;let e=t.reason;if(Zn(e))throw e;Dn(e)?s??=e:c??=e}if(c!==void 0)throw c}let l=s??(r&&!t.preload?r:void 0),u=t.firstBadMatchIndex===void 0?t.matches.length-1:t.firstBadMatchIndex;if(!l&&r&&t.preload)return t.matches;if(l){let e=lr(t,l);e===void 0&&Ht();let n=t.matches[e],r=t.router.looseRoutesById[n.routeId],i=t.router.options?.defaultNotFoundComponent;!r.options.notFoundComponent&&i&&(r.options.notFoundComponent=i),l.routeId=n.routeId;let a=n.routeId===t.router.routeTree.id;t.updateMatch(n.id,e=>({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:l},isFetching:!1})),u=e,await wr(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await wr(e,[`errorComponent`])}for(let e=0;e<=u;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=vr(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let d=ar(t);if(Nt(d)&&await d,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Cr(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function wr(e,t=Er){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===Er?(()=>{if(e._componentsPromise===void 0){let t=Cr(e,Er);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Cr(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function Tr(e){for(let t of Er)if(e.options[t]?.preload)return!0;return!1}var Er=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`],Dr=`__TSR_index`,Or=`popstate`,kr=`beforeunload`;function Ar(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=Pr(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[Dr];i=jr(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[Dr];i=jr(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[Dr]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function jr(e,t){t||={};let n=Fr();return{...t,key:n,__TSR_key:n,[Dr]:e}}function Mr(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>Pr(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Fr();t.history.replaceState({[Dr]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=Pr(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[Dr]-l.state[Dr],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=Ar({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(kr,S,{capture:!0}),t.removeEventListener(Or,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(kr,S,{capture:!0}),t.addEventListener(Or,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function Nr(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function Pr(e,t){let n=Nr(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=Fr();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[Dr]:0,key:a,__TSR_key:a}}}function Fr(){return(Math.random()+1).toString(36).substring(7)}function Ir(e,t){let n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}var Lr=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=e=>e(),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Cn(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=Mr()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!==`null`?this.origin=window.origin:this.origin=`http://localhost`),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=Ut(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=nr(Br(this.latestLocation),e),Vn(this)}let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=yn(o);t&&t!==`/`&&e.push($n({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Qn(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a))`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=an(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&$t(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:zt(e).path,external:!1,searchStr:o,search:Tt(t?.search,i),hash:zt(r.slice(1)).path,state:Et(t?.state,a)}}let o=new URL(i,this.origin),s=er(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:zt(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:Tt(t?.search,c),hash:zt(s.hash.slice(1)).path,state:Et(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>Sn({base:e,to:t.includes(`//`)?gn(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>Hr({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.get().forEach(e=>{if(this.stores.pendingMatchStores.has(e))return;let t=this.stores.matchStores.get(e)?.get();t&&(t.status===`pending`||t.isFetching===`loader`)&&this.cancelMatch(e)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=t.to?`${t.to}`:void 0,o=r.search,s=Object.assign(Object.create(null),r.params),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?s:Object.assign(s,bt(t.params,s)),d=this.routesByPath[vn(l)],f;if(d)f=this.getRouteBranch(d);else if(l.includes(`$`))f=[];else{let e=this.getMatchedRoutes(l);f=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(f=[...f,this.options.notFoundRoute])}if(f.length&&Ct(u))for(let e of f){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let p=e.leaveParams?l:zt(Tn({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,m=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};f.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Vr(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=Ur({search:m,dest:t,destRoutes:f,_includeValidateSearch:e._includeValidateSearch}),m=Tt(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?bt(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?bt(t.state,n.state):{};v=Et(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=tr(this.rewrite,e);b=e.href.replace(e.origin,``),t.origin===this.origin?x=t.pathname+t.search+t.hash:(x=t.href,S=!0)}else b=Bt(y),x=b;return{publicHref:x,href:b,pathname:p,search:m,searchStr:h,state:v,hash:g??``,external:S,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=en(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,bt(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=jt(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},a=vn(this.latestLocation.href)===vn(n.href),o=this.commitLocationPromise;if(this.commitLocationPromise=Mt(()=>{o?.resolve(),o=void 0}),a&&i())this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t})}return this._scroll.next=n.resetScroll??!0,this.history.subscribers.size||this.load(r?{action:{type:r}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=Pr(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=er(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(Rt(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation),t=this.stores.cachedMatches.get().filter(t=>!e.some(e=>e.id===t.id));this.batch(()=>{this.stores.status.set(`pending`),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(e),this.stores.setCached(t)})},this.load=async e=>{let t=e?.action?.type,n,r,i,a=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(o=>{this.startTransition(async()=>{try{this.beforeLoad(),t&&(this._scroll.hash=t===`PUSH`||t===`REPLACE`);let n=this.latestLocation,r=Ir(n,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:`onBeforeNavigate`,...r}),this.emit({type:`onBeforeLoad`,...r}),await Sr({router:this,sync:e?.sync,forceStaleReload:a.href===n.href,matches:this.stores.pendingMatches.get(),location:n,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=null,t=null,n=null,r=null;this.batch(()=>{let i=this.stores.pendingMatches.get(),a=i.length,o=this.stores.matches.get();e=a?o.filter(e=>!this.stores.pendingMatchStores.has(e.id)):null;let s=new Set;for(let e of this.stores.pendingMatchStores.values())e.routeId&&s.add(e.routeId);let c=new Set;for(let e of this.stores.matchStores.values())e.routeId&&c.add(e.routeId);t=a?o.filter(e=>!s.has(e.routeId)):null,n=a?i.filter(e=>!c.has(e.routeId)):null,r=a?i.filter(e=>c.has(e.routeId)):o,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),a&&(this.stores.setMatches(i),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]),this.clearExpiredCache())});for(let[e,i]of[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]])if(e)for(let t of e)this.looseRoutesById[t.routeId].options[i]?.(t)})})}})}catch(e){Zn(e)?(n=e,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):Dn(e)&&(r=e);let t=n?n.status:r?404:this.stores.matches.get().some(e=>e.status===`error`)?500:200;this.batch(()=>{this.stores.statusCode.set(t),this.stores.redirect.set(n)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),o()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let o;this.hasNotFoundMatch()?o=404:this.stores.matches.get().some(e=>e.status===`error`)&&(o=500),o!==void 0&&this.stores.statusCode.set(o)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(Ir(r,i)):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.stores.pendingMatchStores.get(e);if(n){n.set(t);return}let r=this.stores.matchStores.get(e);if(r){r.set(t);return}let i=this.stores.cachedMatchStores.get(e);if(i){let n=t(i.get());n.status===`redirected`?this.stores.cachedMatchStores.delete(e)&&this.stores.cachedIds.set(t=>t.filter(t=>t!==e)):i.set(n)}})},this.getMatch=e=>this.stores.cachedMatchStores.get(e)?.get()??this.stores.pendingMatchStores.get(e)?.get()??this.stores.matchStores.get(e)?.get(),this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(t)),this.stores.setCached(this.stores.cachedMatches.get().map(t)),this.stores.setPending(this.stores.pendingMatches.get().map(t))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&Rt(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.stores.setCached([]):this.stores.setCached(this.stores.cachedMatches.get().filter(e=>!t(e)))},this.clearExpiredCache=()=>{let e=Date.now();this.clearCache({filter:t=>{let n=this.looseRoutesById[t.routeId];if(!n.options.loader)return!0;let r=(t.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??300*1e3;return t.status===`error`||e-t.updatedAt>=r}})},this.loadRouteChunk=wr,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...r,...this.stores.cachedIds.get()]),a=n.filter(e=>!i.has(e.id));if(a.length){let e=this.stores.cachedMatches.get();this.stores.setCached([...e,...a])}try{return n=await Sr({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(Zn(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});Dn(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.stores.status.get()!==`pending`)return!1;let i=(t?.pending===void 0?!this.stores.isLoading.get():t.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),a=tn(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!jt(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?jt(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(e=>e.status===`notFound`||e.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Kn,parseSearch:e.parseSearch??Gn,protocolAllowlist:e.protocolAllowlist??Lt}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=cn(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i}=n,{matchedRoutes:a}=n,o=!1;(r?r.path!==`/`&&i[`**`]:vn(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?Gr(this.options.notFoundMode,a):void 0,c=Array(a.length),l=new Map;for(let e of this.stores.matchStores.values())e.routeId&&l.set(e.routeId,e.get());for(let n=0;n<a.length;n++){let r=a[n],o=c[n-1],u,d,f;{let n=o?.search??e.search,i=o?._strictSearch??void 0;try{let e=Vr(r.options.validateSearch,{...n})??void 0;u={...n,...e},d={...i,...e},f=void 0}catch(e){let r=e;if(e instanceof Rr||(r=new Rr(e.message,{cause:e})),t?.throwOnError)throw r;u=n,d={},f=r}}let p=r.options.loaderDeps?.({search:u})??``,m=p?JSON.stringify(p):``,{interpolatedPath:h,usedParams:g}=Tn({path:r.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),_=r.id+h+m,v=this.getMatch(_),y=l.get(r.id),b=v?._strictParams??g,x;if(!v)try{Kr(r,b)}catch(e){if(x=Dn(e)||Zn(e)?e:new zr(e.message,{cause:e}),t?.throwOnError)throw x}Object.assign(i,b);let S=y?`stay`:`enter`,C;if(v)C={...v,cause:S,params:y?.params??i,_strictParams:b,search:Tt(y?y.search:v.search,u),_strictSearch:d};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||Tr(r)?`pending`:`success`;C={id:_,ssr:r.options.ssr,index:n,routeId:r.id,params:y?.params??i,_strictParams:b,pathname:h,updatedAt:Date.now(),search:y?Tt(y.search,u):u,_strictSearch:d,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:x,__routeContext:void 0,_nonReactive:{loadPromise:Mt()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:S,loaderDeps:y?Et(y.loaderDeps,p):p,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(C.globalNotFound=s===r.id),C.searchError=f;let w=this.getParentContext(o);C.context={...w,...C.__routeContext,...C.__beforeLoadContext},c[n]=C}for(let t=0;t<c.length;t++){let n=c[t],r=this.looseRoutesById[n.routeId],a=this.getMatch(n.id),o=l.get(n.routeId);if(n.params=o?Tt(o.params,i):i,!a){let i=c[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:c,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return c}matchRoutesLightweight(e){let t=vt(this.stores.matchesId.get()),n=this.lightweightCache.get(e);if(n&&n[0]===t)return n[1];let{matchedRoutes:r,routeParams:i}=this.getMatchedRoutes(e.pathname),a=vt(r),o={...e.search};for(let e of r)try{Object.assign(o,Vr(e.options.validateSearch,o))}catch{}let s=t&&this.stores.matchStores.get(t)?.get(),c=s&&s.routeId===a.id&&s.pathname===e.pathname,l;if(c)l=s.params;else{let e=Object.assign(Object.create(null),i);for(let t of r)try{Kr(t,e)}catch{}l=e}let u={matchedRoutes:r,fullPath:a.fullPath,search:o,params:l};return this.lightweightCache.set(e,[t,u]),u}},Rr=class extends Error{},zr=class extends Error{};function Br(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Vr(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Rr(`Async validation not supported`);if(n.issues)throw new Rr(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Hr({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=vn(e),a,o=nn(i,n,!0);return o&&(a=o.route,Object.assign(r,o.rawParams)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function Ur({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return Wr(n)(e,t,r??!1)}function Wr(e){let t,n,r=[];for(let t of e){let e=t.options;`search`in e?e.search?.middlewares&&r.push(...e.search.middlewares):(e.preSearchFilters||e.postSearchFilters)&&r.push(({search:t,next:n})=>{let r=n(e.preSearchFilters?e.preSearchFilters.reduce((e,t)=>t(e),t):t);return e.postSearchFilters?e.postSearchFilters.reduce((e,t)=>t(e),r):r});let i=e.validateSearch;i&&r.push(({search:e,next:t,meta:r})=>{let a=t(e);if(n)try{let e=Vr(i,a);if(r&&e)for(let t in e)t in a||(r.defaulted||=new Map).set(t,e[t]);return{...a,...e}}catch{}return a})}let i=(e,n,a)=>{if(e>=r.length){if(!t.search)return{};if(t.search===!0)return n;let e=bt(t.search,n);return a&&(a.explicit=e),e}return r[e]({search:n,next:(t,n)=>{if(n){let n=a||{};return{search:i(e+1,t,n),meta:n}}return i(e+1,t,a)},meta:a})};return function(e,r,a){return t=r,n=a,i(0,e)}}function Gr(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return Yn}function Kr(e,t){let n=e.options.params?.parse??e.options.parseParams;if(n){let e=n(t);if(e===!1)throw Error(`Route params.parse returned false for a matched route`);Object.assign(t,e)}}var qr=`Error preloading route! ☝️`,Jr=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Yn:this.parentRoute||Ht();let r=n?Yn:t?.path;r&&r!==`/`&&(r=_n(r));let i=t?.id||r,a=n?Yn:hn([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=hn([`/`,a]));let o=a===`__root__`?`/`:hn([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=vn(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>Xn({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Yr=class extends Jr{constructor(e){super(e)}};function Xr(e){let t=e.errorComponent??Qr;return(0,z.jsx)(Zr,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?R.createElement(t,{error:n,reset:r}):e.children})}var Zr=class extends R.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function Qr({error:e}){let[t,n]=R.useState(!1);return(0,z.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,z.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,z.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,z.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,z.jsx)(`div`,{children:(0,z.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,z.jsx)(`code`,{children:e.message}):null})}):null]})}function $r({children:e,fallback:t=null}){return ei()?(0,z.jsx)(R.Fragment,{children:e}):(0,z.jsx)(R.Fragment,{children:t})}function ei(){return R.useSyncExternalStore(ti,()=>!0,()=>!1)}function ti(){return()=>{}}var ni=R.createContext(null);function ri(e){return R.useContext(ni)}var ii=R.createContext(void 0),ai=R.createContext(void 0),oi=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(oi||{});function si({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function ci(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var li=[],ui=0,{link:di,unlink:fi,propagate:pi,checkDirty:mi,shallowPropagate:hi}=si({update(e){return e._update()},notify(e){li[_i++]=e,e.flags&=~oi.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=oi.Mutable|oi.Dirty,xi(e))}}),gi=0,_i=0,vi,yi=0;function bi(e){try{++yi,e()}finally{--yi||Si()}}function xi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=fi(n,e)}function Si(){if(!(yi>0)){for(;gi<_i;){let e=li[gi];li[gi++]=void 0,e.notify()}gi=0,_i=0}}function Ci(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?oi.None:oi.Mutable,get(){return vi!==void 0&&di(i,vi,ui),i._snapshot},subscribe(e){let t=ci(e),n={current:!1},r=wi(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=vi,o=t?.compare??Object.is;if(n)vi=i,++ui,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=oi.Mutable|oi.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{vi=a,n&&(i.flags&=~oi.RecursedCheck),xi(i)}}};return n?(i.flags=oi.Mutable|oi.Dirty,i.get=function(){let e=i.flags;if(e&oi.Dirty||e&oi.Pending&&mi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&hi(e)}}else e&oi.Pending&&(i.flags=e&~oi.Pending);return vi!==void 0&&di(i,vi,ui),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(pi(e),hi(e),Si())}},i}function wi(e){let t=()=>{let t=vi;vi=n,++ui,n.depsTail=void 0,n.flags=oi.Watching|oi.RecursedCheck;try{return e()}finally{vi=t,n.flags&=~oi.RecursedCheck,xi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:oi.Watching|oi.RecursedCheck,notify(){let e=this.flags;e&oi.Dirty||e&oi.Pending&&mi(this.deps,this)?t():this.flags=oi.Watching},stop(){this.flags=oi.None,this.depsTail=void 0,xi(this)}};return t(),n}var Ti=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Ei=o(((e,t)=>{t.exports=Ti()})),Di=o((e=>{var t=d(),n=Ei();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Oi=o(((e,t)=>{t.exports=Di()}))();function ki(e,t){return e===t}function Ai(e,t,n=ki){let r=(0,R.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,R.useCallback)(()=>e?.get(),[e]);return(0,Oi.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var ji={get(){},subscribe(){return{unsubscribe(){}}}};function Mi(e,t){let n=R.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=Et(n.current,i):i}}function Ni(e){let t=ri(),n=R.useContext(e.from?ai:ii),r=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),i=Mi(e,t),a=Ai(r??ji,e=>e?i(e):ji);if(a!==ji)return a;(e.shouldThrow??!0)&&Ht()}function Pi(e){return Ni({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Fi(e){let{select:t,...n}=e;return Ni({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Ii(e){return Ni({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Li(e){return Ni({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ri(e){let t=ri();return R.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function zi(e){return Ni({...e,select:t=>e.select?e.select(t.context):t.context})}var Bi=l(h(),1);function Vi(e,t){let n=ri(),r=_t(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:ee,state:te,mask:A,reloadDocument:j,unsafeRelative:M,from:ne,_fromLocation:N,...P}=e,re=ei(),ie=R.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),ae=Ai(n.stores.location,e=>e,(e,t)=>e.href===t.href),F=R.useMemo(()=>{let e={_fromLocation:ae,...ie};return n.buildLocation(e)},[n,ae,ie]),I=F.maskedLocation?F.maskedLocation.publicHref:F.publicHref,L=F.maskedLocation?F.maskedLocation.external:F.external,oe=R.useMemo(()=>Xi(I,L,n.history,v),[v,L,I,n.history]),se=R.useMemo(()=>{if(oe?.external)return Rt(oe.href,n.protocolAllowlist)?void 0:oe.href;if(!Zi(s)&&!(typeof s!=`string`||s.indexOf(`:`)===-1))try{return new URL(s),Rt(s,n.protocolAllowlist)?void 0:s}catch{}},[s,oe,n.protocolAllowlist]),ce=R.useMemo(()=>{if(se)return!1;if(o?.exact){if(!xn(ae.pathname,F.pathname,n.basepath))return!1}else{let e=bn(ae.pathname,n.basepath),t=bn(F.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!jt(ae.search,F.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:!o?.includeHash||re&&ae.hash===F.hash},[o?.exact,o?.explicitUndefined,o?.includeHash,o?.includeSearch,ae,se,re,F.hash,F.pathname,F.search,n.basepath]),le=ce?bt(i,{})??Ui:Hi,ue=ce?Hi:bt(a,{})??Hi,de=[b,le.className,ue.className].filter(Boolean).join(` `),fe=(y||le.style||ue.style)&&{...y,...le.style,...ue.style},[pe,me]=R.useState(!1),he=R.useRef(!1),ge=e.reloadDocument||se?!1:c??n.options.defaultPreload,_e=l??n.options.defaultPreloadDelay??0,ve=R.useCallback(()=>{n.preloadRoute({...ie,_builtLocation:F}).catch(e=>{console.warn(e),console.warn(qr)})},[n,ie,F]);gt(r,R.useCallback(e=>{e?.isIntersecting&&ve()},[ve]),Ji,{disabled:!!v||ge!==`viewport`}),R.useEffect(()=>{he.current||!v&&ge===`render`&&(ve(),he.current=!0)},[v,ve,ge]);let ye=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;if(!v&&!$i(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,Bi.flushSync)(()=>{me(!0)});let t=n.subscribe(`onResolved`,()=>{t(),me(!1)});n.navigate({...ie,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D})}};if(se)return{...P,ref:r,href:se,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let be=e=>{if(v||ge!==`intent`)return;if(!_e){ve();return}let t=e.currentTarget;if(qi.has(t))return;let n=setTimeout(()=>{qi.delete(t),ve()},_e);qi.set(t,n)},xe=e=>{v||ge!==`intent`||ve()},Se=e=>{if(v||!ge||!_e)return;let t=e.currentTarget,n=qi.get(t);n&&(clearTimeout(n),qi.delete(t))};return{...P,...le,...ue,href:oe?.href,ref:r,onClick:Yi([x,ye]),onBlur:Yi([S,Se]),onFocus:Yi([C,be]),onMouseEnter:Yi([w,be]),onMouseLeave:Yi([T,Se]),onTouchStart:Yi([E,xe]),disabled:!!v,target:_,...fe&&{style:fe},...de&&{className:de},...v&&Wi,...ce&&Gi,...re&&pe&&Ki}}var Hi={},Ui={className:`active`},Wi={role:`link`,"aria-disabled":!0},Gi={"data-status":`active`,"aria-current":`page`},Ki={"data-transitioning":`transitioning`},qi=new WeakMap,Ji={rootMargin:`100px`},Yi=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Xi(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function Zi(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Qi=R.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Vi(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return R.createElement(`a`,t,o)}return R.createElement(n,a,o)});function $i(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var ea=class extends Jr{constructor(e){super(e),this.useMatch=e=>Ni({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>zi({...e,from:this.id}),this.useSearch=e=>Li({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Ii({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Fi({...e,from:this.id}),this.useLoaderData=e=>Pi({...e,from:this.id}),this.useNavigate=()=>Ri({from:this.fullPath}),this.Link=R.forwardRef((e,t)=>(0,z.jsx)(Qi,{ref:t,from:this.fullPath,...e}))}};function ta(e){return new ea(e)}var na=class extends Yr{constructor(e){super(e),this.useMatch=e=>Ni({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>zi({...e,from:this.id}),this.useSearch=e=>Li({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Ii({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Fi({...e,from:this.id}),this.useLoaderData=e=>Pi({...e,from:this.id}),this.useNavigate=()=>Ri({from:this.fullPath}),this.Link=R.forwardRef((e,t)=>(0,z.jsx)(Qi,{ref:t,from:this.fullPath,...e}))}};function ra(e){return new na(e)}function ia(e){let t=ri(),n=`not-found-${Ai(t.stores.location,e=>e.pathname)}-${Ai(t.stores.status,e=>e)}`;return(0,z.jsx)(Xr,{getResetKey:()=>n,onCatch:(t,n)=>{if(Dn(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Dn(t))return e.fallback?.(t);throw t},children:e.children})}function aa(){return(0,z.jsx)(`p`,{children:`Not Found`})}function oa(e){return(0,z.jsx)(z.Fragment,{children:e.children})}function sa(e,t,n){return t.options.notFoundComponent?(0,z.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,z.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,z.jsx)(aa,{})}var ca=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,la=(e,t)=>e[0]===t[0]&&e[1]===t[1],ua=R.memo(function({matchId:e}){let t=ri(),n=t.stores.matchStores.get(e);n||Ht();let r=Ai(t.stores.loadedAt,e=>e),i=Ai(n,e=>e,ca);return(0,z.jsx)(da,{router:t,matchId:e,resetKey:r,matchState:R.useMemo(()=>{let e=i.routeId,n=t.routesById[e].parentRoute?.id;return{routeId:e,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:n}},[i._displayPending,i.routeId,i.ssr,t.routesById])})});function da({router:e,matchId:t,resetKey:n,matchState:r}){let i=e.routesById[r.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,o=a?(0,z.jsx)(a,{}):null,s=i.options.errorComponent??e.options.defaultErrorComponent,c=i.options.onCatch??e.options.defaultOnCatch,l=i.isRoot?i.options.notFoundComponent??e.options.notFoundRoute?.options.component:i.options.notFoundComponent,u=r.ssr===!1||r.ssr===`data-only`,d=(!i.isRoot||i.options.wrapInSuspense||u)&&(i.options.wrapInSuspense??a??(i.options.errorComponent?.preload||u))?R.Suspense:oa,f=s?Xr:oa,p=l?ia:oa;return(0,z.jsxs)(i.isRoot?i.options.shellComponent??oa:oa,{children:[(0,z.jsx)(ii.Provider,{value:t,children:(0,z.jsx)(d,{fallback:o,children:(0,z.jsx)(f,{getResetKey:()=>n,errorComponent:s||Qr,onCatch:(e,t)=>{if(Dn(e))throw e.routeId??=r.routeId,e;c?.(e,t)},children:(0,z.jsx)(p,{fallback:e=>{if(e.routeId??=r.routeId,!l||e.routeId&&e.routeId!==r.routeId||!e.routeId&&!i.isRoot)throw e;return R.createElement(l,e)},children:u||r._displayPending?(0,z.jsx)($r,{fallback:o,children:(0,z.jsx)(pa,{matchId:t})}):(0,z.jsx)(pa,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(fa,{}),(e.options.scrollRestoration,null)]}):null]})}function fa(){let e=ri(),t=R.useRef();return mt(()=>{let n=e.stores.resolvedLocation.get(),r=t.current;n&&(!r||r.href!==n.href)&&e.emit({type:`onRendered`,...Ir(e.stores.location.get(),r??n)}),t.current=n},[Ai(e.stores.resolvedLocation,e=>e?.state.__TSR_key),e]),null}var pa=R.memo(function({matchId:e}){let t=ri(),n=(e,n)=>t.getMatch(e.id)?._nonReactive[n]??e._nonReactive[n],r=t.stores.matchStores.get(e);r||Ht();let i=Ai(r,e=>e),a=i.routeId,o=t.routesById[a],s=R.useMemo(()=>{let e=(t.routesById[a].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:a,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return e?JSON.stringify(e):void 0},[a,i.loaderDeps,i._strictParams,i._strictSearch,t.options.defaultRemountDeps,t.routesById]),c=R.useMemo(()=>{let e=o.options.component??t.options.defaultComponent;return e?(0,z.jsx)(e,{},s):(0,z.jsx)(ma,{})},[s,o.options.component,t.options.defaultComponent]);if(i._displayPending)throw n(i,`displayPendingPromise`);if(i._forcePending)throw n(i,`minPendingPromise`);if(i.status===`pending`){let e=o.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let n=t.getMatch(i.id);if(n&&!n._nonReactive.minPendingPromise){let t=Mt();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw n(i,`loadPromise`)}if(i.status===`notFound`)return Dn(i.error)||Ht(),sa(t,o,i.error);if(i.status===`redirected`)throw Zn(i.error)||Ht(),n(i,`loadPromise`);if(i.status===`error`)throw i.error;return c}),ma=R.memo(function(){let e=ri(),t=R.useContext(ii),n,r=!1,i;{let a=t?e.stores.matchStores.get(t):void 0;[n,r]=Ai(a,e=>[e?.routeId,e?.globalNotFound??!1],la),i=Ai(e.stores.matchesId,e=>e[e.findIndex(e=>e===t)+1])}let a=n?e.routesById[n]:void 0,o=e.options.defaultPendingComponent?(0,z.jsx)(e.options.defaultPendingComponent,{}):null;if(r)return a||Ht(),sa(e,a,void 0);if(!i)return null;let s=(0,z.jsx)(ua,{matchId:i});return n===`__root__`?(0,z.jsx)(R.Suspense,{fallback:o,children:s}):s});function ha(){let e=ri(),t=R.useRef({router:e,mounted:!1}),[n,r]=R.useState(!1),i=Ai(e.stores.isLoading,e=>e),a=Ai(e.stores.hasPending,e=>e),o=ht(i),s=i||n||a,c=ht(s),l=i||a,u=ht(l);return e.startTransition=e=>{r(!0),R.startTransition(()=>{e(),r(!1)})},R.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return vn(e.latestLocation.publicHref)!==vn(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),mt(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),mt(()=>{o&&!i&&e.emit({type:`onLoad`,...Ir(e.stores.location.get(),e.stores.resolvedLocation.get())})},[o,e,i]),mt(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...Ir(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,u,e]),mt(()=>{if(c&&!s){let t=Ir(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:`onResolved`,...t}),bi(()=>{e.stores.status.set(`idle`),e.stores.resolvedLocation.set(e.stores.location.get())})}},[s,c,e]),null}function ga(){let e=ri(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,z.jsx)(t,{}):null,r=(0,z.jsxs)(typeof document<`u`&&e.ssr?oa:R.Suspense,{fallback:n,children:[(0,z.jsx)(ha,{}),(0,z.jsx)(_a,{})]});return e.options.InnerWrap?(0,z.jsx)(e.options.InnerWrap,{children:r}):r}function _a(){let e=ri(),t=Ai(e.stores.firstId,e=>e),n=Ai(e.stores.loadedAt,e=>e),r=t?(0,z.jsx)(ua,{matchId:t}):null;return(0,z.jsx)(ii.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,z.jsx)(Xr,{getResetKey:()=>n,errorComponent:Qr,onCatch:void 0,children:r})})}var va=e=>({createMutableStore:Ci,createReadonlyStore:Ci,batch:bi}),ya=e=>new ba(e),ba=class extends Lr{constructor(e){super(e,va)}};function xa({router:e,children:t,...n}){Ct(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,z.jsx)(ni.Provider,{value:e,children:t});return e.options.Wrap?(0,z.jsx)(e.options.Wrap,{children:r}):r}function Sa({router:e,...t}){return(0,z.jsx)(xa,{router:e,...t,children:(0,z.jsx)(ga,{})})}function Ca(e){let t=ri();return Ai(t.stores.location,Mi(e,t))}var wa=_();function Ta(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var Ea=e=>{switch(e){case`success`:return ka;case`info`:return ja;case`warning`:return Aa;case`error`:return Ma;default:return null}},Da=Array(12).fill(0),Oa=({visible:e,className:t})=>R.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},R.createElement(`div`,{className:`sonner-spinner`},Da.map((e,t)=>R.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),ka=R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},R.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),Aa=R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},R.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),ja=R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},R.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),Ma=R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},R.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),Na=R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},R.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),R.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),Pa=()=>{let[e,t]=R.useState(document.hidden);return R.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},Fa=1,Ia=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:Fa++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0||e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],R.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Ra(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!R.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!R.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!R.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!R.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||Fa++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},La=(e,t)=>{let n=t?.id||Fa++;return Ia.addToast({title:e,...t,id:n}),n},Ra=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,za=Object.assign(La,{success:Ia.success,info:Ia.info,warning:Ia.warning,error:Ia.error,custom:Ia.custom,message:Ia.message,promise:Ia.promise,dismiss:Ia.dismiss,loading:Ia.loading},{getHistory:()=>Ia.toasts,getToasts:()=>Ia.getActiveToasts()});Ta(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function Ba(e){return e.label!==void 0}var Va=3,Ha=`24px`,Ua=`16px`,Wa=4e3,Ga=356,Ka=14,qa=45,Ja=200;function Ya(...e){return e.filter(Boolean).join(` `)}function Xa(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Za=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[E,D]=R.useState(null),[O,k]=R.useState(null),[ee,te]=R.useState(!1),[A,j]=R.useState(!1),[M,ne]=R.useState(!1),[N,P]=R.useState(!1),[re,ie]=R.useState(!1),[ae,F]=R.useState(0),[I,L]=R.useState(0),oe=R.useRef(n.duration||y||Wa),se=R.useRef(null),ce=R.useRef(null),le=c===0,ue=c+1<=o,de=n.type,fe=n.dismissible!==!1,pe=n.className||``,me=n.descriptionClassName||``,he=R.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ge=R.useMemo(()=>n.closeButton??p,[n.closeButton,p]),_e=R.useMemo(()=>n.duration||y||Wa,[n.duration,y]),ve=R.useRef(0),ye=R.useRef(0),be=R.useRef(0),xe=R.useRef(null),[Se,Ce]=b.split(`-`),we=R.useMemo(()=>s.reduce((e,t,n)=>n>=he?e:e+t.height,0),[s,he]),Te=Pa(),Ee=n.invert||t,De=de===`loading`;ye.current=R.useMemo(()=>he*x+we,[he,we]),R.useEffect(()=>{oe.current=_e},[_e]),R.useEffect(()=>{te(!0)},[]),R.useEffect(()=>{let e=ce.current;if(e){let t=e.getBoundingClientRect().height;return L(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),R.useLayoutEffect(()=>{if(!ee)return;let e=ce.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,L(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[ee,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Oe=R.useCallback(()=>{j(!0),F(ye.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Ja)},[n,d,a,ye]);R.useEffect(()=>{if(n.promise&&de===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||Te?(()=>{if(be.current<ve.current){let e=new Date().getTime()-ve.current;oe.current-=e}be.current=new Date().getTime()})():oe.current!==1/0&&(ve.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Oe()},oe.current)),()=>clearTimeout(e)},[u,i,n,de,Te,Oe]),R.useEffect(()=>{n.delete&&(Oe(),n.onDismiss==null||n.onDismiss.call(n,n))},[Oe,n.delete]);function ke(){return w?.loading?R.createElement(`div`,{className:Ya(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":de===`loading`},w.loading):R.createElement(Oa,{className:Ya(C?.loader,n?.classNames?.loader),visible:de===`loading`})}let Ae=n.icon||w?.[de]||Ea(de);return R.createElement(`li`,{tabIndex:0,ref:ce,className:Ya(_,pe,C?.toast,n?.classNames?.toast,C?.default,C?.[de],n?.classNames?.[de]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":ee,"data-promise":!!n.promise,"data-swiped":re,"data-removed":A,"data-visible":ue,"data-y-position":Se,"data-x-position":Ce,"data-index":c,"data-front":le,"data-swiping":M,"data-dismissible":fe,"data-type":de,"data-invert":Ee,"data-swipe-out":N,"data-swipe-direction":O,"data-expanded":!!(u||S&&ee),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${A?ae:ye.current}px`,"--initial-height":S?`auto`:`${I}px`,...m,...n.style},onDragEnd:()=>{ne(!1),D(null),xe.current=null},onPointerDown:e=>{e.button!==2&&(De||!fe||(se.current=new Date,F(ye.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(ne(!0),xe.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(N||!fe)return;xe.current=null;let e=Number(ce.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(ce.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-se.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=qa||a>.11){F(ye.current),n.onDismiss==null||n.onDismiss.call(n,n),k(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Oe(),P(!0);return}else{var o,s;(o=ce.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=ce.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}ie(!1),ne(!1),D(null)},onPointerMove:t=>{var n,r;if(!xe.current||!fe||window.getSelection()?.toString().length>0)return;let i=t.clientY-xe.current.y,a=t.clientX-xe.current.x,o=e.swipeDirections??Xa(b);!E&&(Math.abs(a)>1||Math.abs(i)>1)&&D(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(E===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(E===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&ie(!0),(n=ce.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=ce.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},ge&&!n.jsx&&de!==`loading`?R.createElement(`button`,{"aria-label":T,"data-disabled":De,"data-close-button":!0,onClick:De||!fe?()=>{}:()=>{Oe(),n.onDismiss==null||n.onDismiss.call(n,n)},className:Ya(C?.closeButton,n?.classNames?.closeButton)},w?.close??Na):null,(de||n.icon||n.promise)&&n.icon!==null&&(w?.[de]!==null||n.icon)?R.createElement(`div`,{"data-icon":``,className:Ya(C?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||ke():null,n.type===`loading`?null:Ae):null,R.createElement(`div`,{"data-content":``,className:Ya(C?.content,n?.classNames?.content)},R.createElement(`div`,{"data-title":``,className:Ya(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?R.createElement(`div`,{"data-description":``,className:Ya(v,me,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),R.isValidElement(n.cancel)?n.cancel:n.cancel&&Ba(n.cancel)?R.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{Ba(n.cancel)&&fe&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Oe())},className:Ya(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,R.isValidElement(n.action)?n.action:n.action&&Ba(n.action)?R.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{Ba(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Oe())},className:Ya(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Qa(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function $a(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Ua:Ha;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var eo=R.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=Va,toastOptions:g,dir:_=Qa(),gap:v=Ka,icons:y,containerAriaLabel:b=`Notifications`}=e,[x,S]=R.useState([]),C=R.useMemo(()=>n?x.filter(e=>e.toasterId===n):x.filter(e=>!e.toasterId),[x,n]),w=R.useMemo(()=>Array.from(new Set([i].concat(C.filter(e=>e.position).map(e=>e.position)))),[C,i]),[T,E]=R.useState([]),[D,O]=R.useState(!1),[k,ee]=R.useState(!1),[te,A]=R.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),j=R.useRef(null),M=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),ne=R.useRef(null),N=R.useRef(!1),P=R.useCallback(e=>{S(t=>(t.find(t=>t.id===e.id)?.delete||Ia.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return R.useEffect(()=>Ia.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{S(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{Bi.flushSync(()=>{S(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[x]),R.useEffect(()=>{if(d!==`system`){A(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?A(`dark`):A(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{A(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{A(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),R.useEffect(()=>{x.length<=1&&O(!1)},[x]),R.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;O(!0),(t=j.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===j.current||j.current?.contains(document.activeElement))&&O(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),R.useEffect(()=>{if(j.current)return()=>{ne.current&&(ne.current.focus({preventScroll:!0}),ne.current=null,N.current=!1)}},[j.current]),R.createElement(`section`,{ref:t,"aria-label":`${b} ${M}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},w.map((t,n)=>{let[i,a]=t.split(`-`);return C.length?R.createElement(`ol`,{key:t,dir:_===`auto`?Qa():_,tabIndex:-1,ref:j,className:c,"data-sonner-toaster":!0,"data-sonner-theme":te,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${T[0]?.height||0}px`,"--width":`${Ga}px`,"--gap":`${v}px`,...m,...$a(l,u)},onBlur:e=>{N.current&&!e.currentTarget.contains(e.relatedTarget)&&(N.current=!1,ne.current&&=(ne.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||N.current||(N.current=!0,ne.current=e.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{k||O(!1)},onDragEnd:()=>O(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||ee(!0)},onPointerUp:()=>ee(!1)},C.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>R.createElement(Za,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:k,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:P,toasts:C.filter(e=>e.position==n.position),heights:T.filter(e=>e.position==n.position),setHeights:E,expandByDefault:o,gap:v,expanded:D,swipeDirections:e.swipeDirections}))):null}))});function to(e){return(0,z.jsx)(eo,{theme:`dark`,position:`top-right`,visibleToasts:3,expand:!0,containerAriaLabel:`Notifications`,toastOptions:{classNames:{toast:`group border-zinc-700! bg-zinc-900! text-zinc-100! shadow-2xl!`,title:`text-zinc-100!`,description:`text-zinc-400!`,actionButton:`bg-cyan-600! text-white! hover:bg-cyan-500!`,cancelButton:`bg-zinc-800! text-zinc-200! hover:bg-zinc-700!`}},...e})}typeof window<`u`&&window.document&&window.document.createElement;function no(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}function ro(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function io(...e){return t=>{let n=!1,r=e.map(e=>{let r=ro(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():ro(e[t],null)}}}}function ao(...e){return R.useCallback(io(...e),e)}function oo(e,t=[]){let n=[];function r(t,r){let i=R.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=R.useMemo(()=>o,Object.values(o));return(0,z.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=R.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>R.createContext(e));return function(n){let r=n?.[e]||t;return R.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,so(i,...t)]}function so(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return R.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function co(e){let t=R.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];go(r)&&typeof bo==`function`&&(r=bo(r._payload)),R.Children.forEach(r,e=>{if(mo(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;go(n)&&typeof bo==`function`&&(n=bo(n._payload)),a=fo(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=R.cloneElement(a,void 0,s):!o&&R.Children.count(r)===1&&R.isValidElement(r)&&(a=r);let c=a?B(a):void 0,l=ao(n,c);if(!a){if(r||r===0)throw Error(o?yo(e):vo(e));return r}let u=po(i,a.props??{});return a.type!==R.Fragment&&(u.ref=n?l:c),R.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var lo=Symbol.for(`radix.slottable`);function uo(e){let t=e=>`child`in e?e.children(e.child):e.children;return t.displayName=`${e}.Slottable`,t.__radixId=lo,t}var fo=(e,t)=>{if(`child`in e.props){let t=e.props.child;return R.isValidElement(t)?R.cloneElement(t,void 0,e.props.children(t.props.children)):null}return R.isValidElement(t)?t:null};function po(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function B(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function mo(e){return R.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===lo}var ho=Symbol.for(`react.lazy`);function go(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===ho&&`_payload`in e&&_o(e._payload)}function _o(e){return typeof e==`object`&&!!e&&`then`in e}var vo=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,yo=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,bo=R.use,xo=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=co(`Primitive.${t}`),r=R.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,z.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function So(e,t){e&&Bi.flushSync(()=>e.dispatchEvent(t))}function Co(e){let t=R.useRef(e);return R.useEffect(()=>{t.current=e}),R.useMemo(()=>((...e)=>t.current?.(...e)),[])}var wo=`DismissableLayer`,To=`dismissableLayer.update`,Eo=`dismissableLayer.pointerDownOutside`,Do=`dismissableLayer.focusOutside`,Oo,ko=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Ao=R.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=R.useContext(ko),[d,f]=R.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=R.useState({}),h=ao(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=R.useRef(!1),C=Po(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:R.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=Fo(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=Co(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return R.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),R.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Oo=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Io(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Oo))}},[d,p,n,u]),R.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Io())},[d,u]),R.useEffect(()=>{let e=()=>m({});return document.addEventListener(To,e),()=>document.removeEventListener(To,e)},[]),(0,z.jsx)(xo.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:no(e.onFocusCapture,w.onFocusCapture),onBlurCapture:no(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:no(e.onPointerDownCapture,C.onPointerDownCapture)})});Ao.displayName=wo;var jo=`DismissableLayerBranch`,Mo=R.forwardRef((e,t)=>{let n=R.useContext(ko),r=R.useRef(null),i=ao(t,r);return R.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,z.jsx)(xo.div,{...e,ref:i})});Mo.displayName=jo;var No=()=>!0;function Po(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=No}=t,s=Co(e),c=R.useRef(!1),l=R.useRef(!1),u=R.useRef(new Map),d=R.useRef(()=>{});return R.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}function p(e){l.current&&u.current.set(e.type,!1)}let m=a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||Lo(Eo,s,p,{discrete:!0})};if(!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:()=>c.current=!0}}function Fo(e,t=globalThis?.document){let n=Co(e),r=R.useRef(!1);return R.useEffect(()=>{let e=e=>{e.target&&!r.current&&Lo(Do,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Io(){let e=new CustomEvent(To);document.dispatchEvent(e)}function Lo(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?So(i,a):i.dispatchEvent(a)}var Ro=globalThis?.document?R.useLayoutEffect:()=>{},zo=R.useId||(()=>void 0),Bo=0;function Vo(e){let[t,n]=R.useState(zo());return Ro(()=>{e||n(e=>e??String(Bo++))},[e]),e||(t?`radix-${t}`:``)}var Ho=[`top`,`right`,`bottom`,`left`],Uo=Math.min,Wo=Math.max,Go=Math.round,Ko=Math.floor,qo=e=>({x:e,y:e}),Jo={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Yo(e,t,n){return Wo(e,Uo(t,n))}function Xo(e,t){return typeof e==`function`?e(t):e}function Zo(e){return e.split(`-`)[0]}function Qo(e){return e.split(`-`)[1]}function $o(e){return e===`x`?`y`:`x`}function es(e){return e===`y`?`height`:`width`}function ts(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ns(e){return $o(ts(e))}function rs(e,t,n){n===void 0&&(n=!1);let r=Qo(e),i=ns(e),a=es(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=fs(o)),[o,fs(o)]}function is(e){let t=fs(e);return[as(e),t,as(t)]}function as(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var os=[`left`,`right`],ss=[`right`,`left`],cs=[`top`,`bottom`],ls=[`bottom`,`top`];function us(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ss:os:t?os:ss;case`left`:case`right`:return t?cs:ls;default:return[]}}function ds(e,t,n,r){let i=Qo(e),a=us(Zo(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(as)))),a}function fs(e){let t=Zo(e);return Jo[t]+e.slice(t.length)}function ps(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ms(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ps(e)}function hs(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function gs(e,t,n){let{reference:r,floating:i}=e,a=ts(t),o=ns(t),s=es(o),c=Zo(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Qo(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function _s(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Xo(t,e),p=ms(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=hs(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=hs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var vs=50,ys=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:_s},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=gs(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<vs&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=gs(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},bs=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Xo(e,t)||{};if(l==null)return{};let d=ms(u),f={x:n,y:r},p=ns(i),m=es(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Uo(d[_],T),D=Uo(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,ee=Yo(E,k,O),te=!c.arrow&&Qo(i)!=null&&k!==ee&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,A=te?k<E?k-E:k-O:0;return{[p]:f[p]+A,data:{[p]:ee,centerOffset:k-ee-A,...te&&{alignmentOffset:A}},reset:te}}}),xs=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Xo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Zo(r),_=ts(o),v=Zo(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[fs(o)]:is(o)),x=p!==`none`;!d&&x&&b.push(...ds(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=rs(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==ts(t))||T.every(e=>ts(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=ts(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ss(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Cs(e){return Ho.some(t=>e[t]>=0)}var ws=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Xo(e,t);switch(i){case`referenceHidden`:{let e=Ss(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Cs(e)}}}case`escaped`:{let e=Ss(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Cs(e)}}}default:return{}}}}},Ts=new Set([`left`,`top`]);async function Es(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Zo(n),s=Qo(n),c=ts(n)===`y`,l=Ts.has(o)?-1:1,u=a&&c?-1:1,d=Xo(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Ds=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Es(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Os=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Xo(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=ts(i),p=$o(f),m=u[p],h=u[f],g=(e,t)=>Yo(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},ks=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Xo(e,t),u={x:n,y:r},d=ts(i),f=$o(d),p=u[f],m=u[d],h=Xo(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ts.has(Zo(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},As=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Xo(e,t),c=await i.detectOverflow(t,s),l=Zo(n),u=Qo(n),d=ts(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Uo(p-c[m],g),y=Uo(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Wo(c.left,c.right):S=p-2*Wo(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function js(){return typeof window<`u`}function Ms(e){return Fs(e)?(e.nodeName||``).toLowerCase():`#document`}function Ns(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ps(e){return((Fs(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Fs(e){return js()?e instanceof Node||e instanceof Ns(e).Node:!1}function Is(e){return js()?e instanceof Element||e instanceof Ns(e).Element:!1}function Ls(e){return js()?e instanceof HTMLElement||e instanceof Ns(e).HTMLElement:!1}function Rs(e){return!js()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ns(e).ShadowRoot}function zs(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Xs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Bs(e){return/^(table|td|th)$/.test(Ms(e))}function Vs(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Hs=/transform|translate|scale|rotate|perspective|filter/,Us=/paint|layout|strict|content/,Ws=e=>!!e&&e!==`none`,Gs;function Ks(e){let t=Is(e)?Xs(e):e;return Ws(t.transform)||Ws(t.translate)||Ws(t.scale)||Ws(t.rotate)||Ws(t.perspective)||!Js()&&(Ws(t.backdropFilter)||Ws(t.filter))||Hs.test(t.willChange||``)||Us.test(t.contain||``)}function qs(e){let t=Qs(e);for(;Ls(t)&&!Ys(t);){if(Ks(t))return t;if(Vs(t))return null;t=Qs(t)}return null}function Js(){return Gs??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Gs}function Ys(e){return/^(html|body|#document)$/.test(Ms(e))}function Xs(e){return Ns(e).getComputedStyle(e)}function Zs(e){return Is(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qs(e){if(Ms(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Rs(e)&&e.host||Ps(e);return Rs(t)?t.host:t}function $s(e){let t=Qs(e);return Ys(t)?(e.ownerDocument||e).body:Ls(t)&&zs(t)?t:$s(t)}function ec(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=$s(e),i=r===e.ownerDocument?.body,a=Ns(r);if(i){let e=tc(a);return t.concat(a,a.visualViewport||[],zs(r)?r:[],e&&n?ec(e):[])}else return t.concat(r,ec(r,[],n))}function tc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function nc(e){let t=Xs(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ls(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Go(n)!==a||Go(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function rc(e){return Is(e)?e:e.contextElement}function ic(e){let t=rc(e);if(!Ls(t))return qo(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=nc(t),o=(a?Go(n.width):n.width)/r,s=(a?Go(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ac=qo(0);function oc(e){let t=Ns(e);return!Js()||!t.visualViewport?ac:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function sc(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ns(e)}function cc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=rc(e),o=qo(1);t&&(r?Is(r)&&(o=ic(r)):o=ic(e));let s=sc(a,n,r)?oc(a):qo(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Ns(a),t=Is(r)?Ns(r):r,n=e,i=tc(n);for(;i&&t!==n;){let e=ic(i),t=i.getBoundingClientRect(),r=Xs(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Ns(i),i=tc(n)}}return hs({width:u,height:d,x:c,y:l})}function lc(e,t){let n=Zs(e).scrollLeft;return t?t.left+n:cc(Ps(e)).left+n}function uc(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-lc(e,n),y:n.top+t.scrollTop}}function dc(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Ps(r),s=t?Vs(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=qo(1),u=qo(0),d=Ls(r);if((d||!a)&&((Ms(r)!==`body`||zs(o))&&(c=Zs(r)),d)){let e=cc(r);l=ic(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?uc(o,c):qo(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function fc(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function pc(e){let t=Zs(e),n=e.ownerDocument.body,r=Wo(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Wo(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+lc(e),o=-t.scrollTop;return Xs(n).direction===`rtl`&&(a+=Wo(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var mc=25;function hc(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Ns(e),a=Ps(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Js()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(lc(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=mc&&(s-=o)}return{width:s,height:c,x:l,y:u}}function gc(e,t){let n=cc(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=ic(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function _c(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=hc(e,n,t);else if(t===`document`)r=pc(Ps(e));else if(Is(t))r=gc(t,n);else{let n=oc(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return hs(r)}function vc(e,t){let n=t.get(e);if(n)return n;let r=ec(e,[],!1).filter(e=>Is(e)&&Ms(e)!==`body`),i=null,a=Xs(e).position===`fixed`,o=a?Qs(e):e;for(;Is(o)&&!Ys(o);){let e=Xs(o),t=Ks(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Qs(o)}return t.set(e,r),r}function yc(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Vs(t)?[]:vc(t,this._c):[].concat(n),r],o=_c(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=_c(t,a[e],i);s=Wo(n.top,s),c=Uo(n.right,c),l=Uo(n.bottom,l),u=Wo(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function bc(e){let{width:t,height:n}=nc(e);return{width:t,height:n}}function xc(e,t,n){let r=Ls(t),i=Ps(t),a=n===`fixed`,o=cc(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=qo(0);if((r||!a)&&((Ms(t)!==`body`||zs(i))&&(s=Zs(t)),r)){let e=cc(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=lc(i));let l=i&&!r&&!a?uc(i,s):qo(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Sc(e){return Xs(e).position===`static`}function Cc(e,t){if(!Ls(e)||Xs(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Ps(e)===n&&(n=n.ownerDocument.body),n}function wc(e,t){let n=Ns(e);if(Vs(e))return n;if(!Ls(e)){let t=Qs(e);for(;t&&!Ys(t);){if(Is(t)&&!Sc(t))return t;t=Qs(t)}return n}let r=Cc(e,t);for(;r&&Bs(r)&&Sc(r);)r=Cc(r,t);return r&&Ys(r)&&Sc(r)&&!Ks(r)?n:r||qs(e)||n}var Tc=async function(e){let t=this.getOffsetParent||wc,n=this.getDimensions,r=await n(e.floating);return{reference:xc(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ec(e){return Xs(e).direction===`rtl`}var Dc={convertOffsetParentRelativeRectToViewportRelativeRect:dc,getDocumentElement:Ps,getClippingRect:yc,getOffsetParent:wc,getElementRects:Tc,getClientRects:fc,getDimensions:bc,getScale:ic,isElement:Is,isRTL:Ec};function Oc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function kc(e,t,n){let r=null,i,a=Ps(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Ko(d),h=Ko(a.clientWidth-(u+f)),g=Ko(a.clientHeight-(d+p)),_=Ko(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Wo(0,Uo(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Oc(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Ns(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Ac(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=rc(e),u=i||a?[...l?ec(l):[],...t?ec(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?kc(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?cc(e):null;c&&g();function g(){let t=cc(e);h&&!Oc(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var jc=Ds,Mc=Os,Nc=xs,Pc=As,Fc=ws,Ic=bs,Lc=ks,Rc=(e,t,n)=>{let r=new Map,i=n??{},a={...Dc,...i.platform,_c:r};return ys(e,t,{...i,platform:a})},zc=typeof document<`u`?R.useLayoutEffect:function(){};function Bc(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Bc(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Bc(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Vc(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Hc(e,t){let n=Vc(e);return Math.round(t*n)/n}function Uc(e){let t=R.useRef(e);return zc(()=>{t.current=e}),t}function Wc(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=R.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=R.useState(r);Bc(f,r)||p(r);let[m,h]=R.useState(null),[g,_]=R.useState(null),v=R.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=R.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=R.useRef(null),C=R.useRef(null),w=R.useRef(u),T=c!=null,E=Uc(c),D=Uc(i),O=Uc(l),k=R.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Rc(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};ee.current&&!Bc(w.current,t)&&(w.current=t,Bi.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);zc(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let ee=R.useRef(!1);zc(()=>(ee.current=!0,()=>{ee.current=!1}),[]),zc(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let te=R.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),A=R.useMemo(()=>({reference:b,floating:x}),[b,x]),j=R.useMemo(()=>{let e={position:n,left:0,top:0};if(!A.floating)return e;let t=Hc(A.floating,u.x),r=Hc(A.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Vc(A.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,A.floating,u.x,u.y]);return R.useMemo(()=>({...u,update:k,refs:te,elements:A,floatingStyles:j}),[u,k,te,A,j])}var Gc=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Ic({element:r.current,padding:i}).fn(n):r?Ic({element:r,padding:i}).fn(n):{}}}},Kc=(e,t)=>{let n=jc(e);return{name:n.name,fn:n.fn,options:[e,t]}},qc=(e,t)=>{let n=Mc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jc=(e,t)=>({fn:Lc(e).fn,options:[e,t]}),Yc=(e,t)=>{let n=Nc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xc=(e,t)=>{let n=Pc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zc=(e,t)=>{let n=Fc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qc=(e,t)=>{let n=Gc(e);return{name:n.name,fn:n.fn,options:[e,t]}},$c=`Arrow`,el=R.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,z.jsx)(xo.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,z.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});el.displayName=$c;var tl=el;function nl(e){let[t,n]=R.useState(void 0);return Ro(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var rl=`Popper`,[il,al]=oo(rl),[ol,sl]=il(rl),cl=e=>{let{__scopePopper:t,children:n}=e,[r,i]=R.useState(null),[a,o]=R.useState(void 0);return(0,z.jsx)(ol,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};cl.displayName=rl;var ll=`PopperAnchor`,ul=R.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=sl(ll,n),o=R.useRef(null),s=a.onAnchorChange,c=ao(t,R.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=R.useRef(null);R.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&bl(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,z.jsx)(xo.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});ul.displayName=ll;var dl=`PopperContent`,[fl,pl]=il(dl),ml=R.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=sl(dl,n),[_,v]=R.useState(null),y=ao(t,v),[b,x]=R.useState(null),S=nl(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(vl),altBoundary:O},{refs:ee,floatingStyles:te,placement:A,isPositioned:j,middlewareData:M}=Wc({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>Ac(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Kc({mainAxis:i+w,alignmentAxis:o}),c&&qc({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Jc():void 0,...k}),c&&Yc({...k}),Xc({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&Qc({element:b,padding:s}),yl({arrowWidth:C,arrowHeight:w}),f&&Zc({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),ne=g.setPlacementState;Ro(()=>(ne(A),()=>{ne(void 0)}),[A,ne]);let[N,P]=bl(A),re=Co(m);Ro(()=>{j&&re?.()},[j,re]);let ie=M.arrow?.x,ae=M.arrow?.y,F=M.arrow?.centerOffset!==0,[I,L]=R.useState();return Ro(()=>{_&&L(window.getComputedStyle(_).zIndex)},[_]),(0,z.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:j?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:I,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(` `),...M.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,z.jsx)(fl,{scope:n,placedSide:N,placedAlign:P,onArrowChange:x,arrowX:ie,arrowY:ae,shouldHideArrow:F,children:(0,z.jsx)(xo.div,{"data-side":N,"data-align":P,...h,ref:y,style:{...h.style,animation:j?void 0:`none`}})})})});ml.displayName=dl;var hl=`PopperArrow`,gl={top:`bottom`,right:`left`,bottom:`top`,left:`right`},_l=R.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=pl(hl,n),a=gl[i.placedSide];return(0,z.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,z.jsx)(tl,{...r,ref:t,style:{...r.style,display:`block`}})})});_l.displayName=hl;function vl(e){return e!==null}var yl=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=bl(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function bl(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var xl=cl,Sl=ul,Cl=ml,wl=_l,Tl=`Portal`,El=R.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=R.useState(!1);Ro(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Bi.createPortal((0,z.jsx)(xo.div,{...r,ref:t}),o):null});El.displayName=Tl;function Dl(e,t){return R.useReducer((e,n)=>t[e][n]??e,e)}var Ol=e=>{let{present:t,children:n}=e,r=kl(t),i=typeof n==`function`?n({present:r.isPresent}):R.Children.only(n),a=jl(r.ref,Nl(i));return typeof n==`function`||r.isPresent?R.cloneElement(i,{ref:a}):null};Ol.displayName=`Presence`;function kl(e){let[t,n]=R.useState(),r=R.useRef(null),i=R.useRef(e),a=R.useRef(`none`),o=R.useRef(void 0),[s,c]=Dl(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return R.useEffect(()=>{s===`mounted`?(a.current=o.current??Ml(r.current),o.current=void 0):a.current=`none`},[s]),Ro(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=Ml(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),Ro(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Ml(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=Ml(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:R.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=Ml(t)}else r.current=null;n(e)},[])}}function Al(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function jl(...e){let t=R.useRef(e);return t.current=e,R.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Al(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Al(n[e],null)}}},[])}function Ml(e){return e?.animationName||`none`}function Nl(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Pl=R.useInsertionEffect||Ro;function Fl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Il({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=R.useRef(e!==void 0);R.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,R.useCallback(t=>{if(s){let n=Ll(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Il({defaultProp:e,onChange:t}){let[n,r]=R.useState(e),i=R.useRef(n),a=R.useRef(t);return Pl(()=>{a.current=t},[t]),R.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Ll(e){return typeof e==`function`}var Rl=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),zl=`VisuallyHidden`,Bl=R.forwardRef((e,t)=>(0,z.jsx)(xo.span,{...e,ref:t,style:{...Rl,...e.style}}));Bl.displayName=zl;var Vl=Bl,[Hl,Ul]=oo(`Tooltip`,[al]),Wl=al(),Gl=`TooltipProvider`,Kl=700,ql=`tooltip.open`,[Jl,Yl]=Hl(Gl),Xl=e=>{let{__scopeTooltip:t,delayDuration:n=Kl,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=R.useRef(!0),s=R.useRef(!1),c=R.useRef(0);return R.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,z.jsx)(Jl,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:R.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:R.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:R.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Xl.displayName=Gl;var Zl=`Tooltip`,[Ql,$l]=Hl(Zl),eu=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Yl(Zl,e.__scopeTooltip),l=Wl(t),[u,d]=R.useState(null),f=Vo(),p=R.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=R.useRef(!1),[_,v]=Fl({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(ql))):c.onClose(),a?.(e)},caller:Zl}),y=R.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=R.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=R.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=R.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return R.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,z.jsx)(xl,{...l,children:(0,z.jsx)(Ql,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:R.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:R.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};eu.displayName=Zl;var tu=`TooltipTrigger`,nu=R.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=$l(tu,n),a=Yl(tu,n),o=Wl(n),s=ao(t,R.useRef(null),i.onTriggerChange),c=R.useRef(!1),l=R.useRef(!1),u=R.useCallback(()=>c.current=!1,[]);return R.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,z.jsx)(Sl,{asChild:!0,...o,children:(0,z.jsx)(xo.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:no(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:no(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:no(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:no(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:no(e.onBlur,i.onClose),onClick:no(e.onClick,i.onClose)})})});nu.displayName=tu;var ru=`TooltipPortal`,[iu,au]=Hl(ru,{forceMount:void 0}),ou=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=$l(ru,t);return(0,z.jsx)(iu,{scope:t,forceMount:n,children:(0,z.jsx)(Ol,{present:n||a.open,children:(0,z.jsx)(El,{asChild:!0,container:i,children:r})})})};ou.displayName=ru;var su=`TooltipContent`,cu=R.forwardRef((e,t)=>{let n=au(su,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=$l(su,e.__scopeTooltip);return(0,z.jsx)(Ol,{present:r||o.open,children:o.disableHoverableContent?(0,z.jsx)(pu,{side:i,...a,ref:t}):(0,z.jsx)(lu,{side:i,...a,ref:t})})}),lu=R.forwardRef((e,t)=>{let n=$l(su,e.__scopeTooltip),r=Yl(su,e.__scopeTooltip),i=R.useRef(null),a=ao(t,i),[o,s]=R.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=R.useCallback(()=>{s(null),d(!1)},[d]),p=R.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=_u(r,gu(r,n.getBoundingClientRect())),a=vu(t.getBoundingClientRect()),o=bu([...i,...a]);s(o),d(!0)},[d]);return R.useEffect(()=>()=>f(),[f]),R.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),R.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!yu(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,z.jsx)(pu,{...e,ref:a})}),[uu,du]=Hl(Zl,{isInside:!1}),fu=uo(`TooltipContent`),pu=R.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=$l(su,n),l=Wl(n),{onClose:u}=c;return R.useEffect(()=>(document.addEventListener(ql,u),()=>document.removeEventListener(ql,u)),[u]),R.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,z.jsx)(Ao,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,z.jsxs)(Cl,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,z.jsx)(fu,{children:r}),(0,z.jsx)(uu,{scope:n,isInside:!0,children:(0,z.jsx)(Vl,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});cu.displayName=su;var mu=`TooltipArrow`,hu=R.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Wl(n);return du(mu,n).isInside?null:(0,z.jsx)(wl,{...i,...r,ref:t})});hu.displayName=mu;function gu(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function _u(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function vu(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function yu(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function bu(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),xu(t)}function xu(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Su=Xl,Cu=eu,wu=nu,Tu=ou,Eu=cu;function Du(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Du(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Ou(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Du(e))&&(r&&(r+=` `),r+=t);return r}var ku=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Au=(e,t)=>({classGroupId:e,validator:t}),ju=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Mu=`-`,Nu=[],Pu=`arbitrary..`,Fu=e=>{let t=Ru(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Lu(e);let n=e.split(Mu);return Iu(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?ku(i,t):t:i||Nu}return n[e]||Nu}}},Iu=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Iu(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Mu):e.slice(t).join(Mu),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Lu=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Pu+r:void 0})(),Ru=e=>{let{theme:t,classGroups:n}=e;return zu(n,t)},zu=(e,t)=>{let n=ju();for(let r in e){let i=e[r];Bu(i,n,r,t)}return n},Bu=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Vu(i,t,n,r)}},Vu=(e,t,n,r)=>{if(typeof e==`string`){Hu(e,t,n);return}if(typeof e==`function`){Uu(e,t,n,r);return}Wu(e,t,n,r)},Hu=(e,t,n)=>{let r=e===``?t:Gu(t,e);r.classGroupId=n},Uu=(e,t,n,r)=>{if(Ku(e)){Bu(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Au(n,e))},Wu=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Bu(o,Gu(t,a),n,r)}},Gu=(e,t)=>{let n=e,r=t.split(Mu),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=ju(),n.nextPart.set(t,i)),n=i}return n},Ku=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,qu=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ju=`!`,Yu=`:`,Xu=[],Zu=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Qu=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===Yu){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Ju)?(c=s.slice(0,-1),l=!0):s.startsWith(Ju)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Zu(t,l,c,u)};if(t){let e=t+Yu,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Zu(Xu,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},$u=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},ed=e=>({cache:qu(e.cacheSize),parseClassName:Qu(e),sortModifiers:$u(e),postfixLookupClassGroupIds:td(e),...Fu(e)}),td=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},nd=/\s+/,rd=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(nd),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Ju:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},id=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=ad(n))&&(i&&(i+=` `),i+=r);return i},ad=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=ad(e[r]))&&(n&&(n+=` `),n+=t);return n},od=(e,...t)=>{let n,r,i,a,o=o=>(n=ed(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=rd(e,n);return i(e,a),a};return a=o,(...e)=>a(id(...e))},sd=[],cd=e=>{let t=t=>t[e]||sd;return t.isThemeGetter=!0,t},ld=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ud=/^\((?:(\w[\w-]*):)?(.+)\)$/i,dd=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,fd=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,pd=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,md=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,hd=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,gd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_d=e=>dd.test(e),vd=e=>!!e&&!Number.isNaN(Number(e)),yd=e=>!!e&&Number.isInteger(Number(e)),bd=e=>e.endsWith(`%`)&&vd(e.slice(0,-1)),xd=e=>fd.test(e),Sd=()=>!0,Cd=e=>pd.test(e)&&!md.test(e),wd=()=>!1,Td=e=>hd.test(e),Ed=e=>gd.test(e),Dd=e=>!V(e)&&!U(e),Od=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),kd=e=>Ud(e,qd,wd),V=e=>ld.test(e),H=e=>Ud(e,Jd,Cd),Ad=e=>Ud(e,Yd,vd),jd=e=>Ud(e,Zd,Sd),Md=e=>Ud(e,Xd,wd),Nd=e=>Ud(e,Gd,wd),Pd=e=>Ud(e,Kd,Ed),Fd=e=>Ud(e,Qd,Td),U=e=>ud.test(e),Id=e=>Wd(e,Jd),Ld=e=>Wd(e,Xd),Rd=e=>Wd(e,Gd),zd=e=>Wd(e,qd),Bd=e=>Wd(e,Kd),Vd=e=>Wd(e,Qd,!0),Hd=e=>Wd(e,Zd,!0),Ud=(e,t,n)=>{let r=ld.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Wd=(e,t,n=!1)=>{let r=ud.exec(e);return r?r[1]?t(r[1]):n:!1},Gd=e=>e===`position`||e===`percentage`,Kd=e=>e===`image`||e===`url`,qd=e=>e===`length`||e===`size`||e===`bg-size`,Jd=e=>e===`length`,Yd=e=>e===`number`,Xd=e=>e===`family-name`,Zd=e=>e===`number`||e===`weight`,Qd=e=>e===`shadow`,$d=od(()=>{let e=cd(`color`),t=cd(`font`),n=cd(`text`),r=cd(`font-weight`),i=cd(`tracking`),a=cd(`leading`),o=cd(`breakpoint`),s=cd(`container`),c=cd(`spacing`),l=cd(`radius`),u=cd(`shadow`),d=cd(`inset-shadow`),f=cd(`text-shadow`),p=cd(`drop-shadow`),m=cd(`blur`),h=cd(`perspective`),g=cd(`aspect`),_=cd(`ease`),v=cd(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),U,V],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[U,V,c],T=()=>[_d,`full`,`auto`,...w()],E=()=>[yd,`none`,`subgrid`,U,V],D=()=>[`auto`,{span:[`full`,yd,U,V]},yd,U,V],O=()=>[yd,`auto`,U,V],k=()=>[`auto`,`min`,`max`,`fr`,U,V],ee=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],te=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],A=()=>[`auto`,...w()],j=()=>[_d,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],M=()=>[_d,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ne=()=>[_d,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],N=()=>[e,U,V],P=()=>[...b(),Rd,Nd,{position:[U,V]}],re=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ie=()=>[`auto`,`cover`,`contain`,zd,kd,{size:[U,V]}],ae=()=>[bd,Id,H],F=()=>[``,`none`,`full`,l,U,V],I=()=>[``,vd,Id,H],L=()=>[`solid`,`dashed`,`dotted`,`double`],oe=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],se=()=>[vd,bd,Rd,Nd],ce=()=>[``,`none`,m,U,V],le=()=>[`none`,vd,U,V],ue=()=>[`none`,vd,U,V],de=()=>[vd,U,V],fe=()=>[_d,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[xd],breakpoint:[xd],color:[Sd],container:[xd],"drop-shadow":[xd],ease:[`in`,`out`,`in-out`],font:[Dd],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[xd],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[xd],shadow:[xd],spacing:[`px`,vd],text:[xd],"text-shadow":[xd],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,_d,V,U,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,U,V]}],"container-named":[Od],columns:[{columns:[vd,V,U,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[yd,`auto`,U,V]}],basis:[{basis:[_d,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[vd,_d,`auto`,`initial`,`none`,V]}],grow:[{grow:[``,vd,U,V]}],shrink:[{shrink:[``,vd,U,V]}],order:[{order:[yd,`first`,`last`,`none`,U,V]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ee(),`normal`]}],"justify-items":[{"justify-items":[...te(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...te()]}],"align-content":[{content:[`normal`,...ee()]}],"align-items":[{items:[...te(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...te(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...te(),`baseline`]}],"place-self":[{"place-self":[`auto`,...te()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:j()}],"inline-size":[{inline:[`auto`,...M()]}],"min-inline-size":[{"min-inline":[`auto`,...M()]}],"max-inline-size":[{"max-inline":[`none`,...M()]}],"block-size":[{block:[`auto`,...ne()]}],"min-block-size":[{"min-block":[`auto`,...ne()]}],"max-block-size":[{"max-block":[`none`,...ne()]}],w:[{w:[s,`screen`,...j()]}],"min-w":[{"min-w":[s,`screen`,`none`,...j()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...j()]}],h:[{h:[`screen`,`lh`,...j()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...j()]}],"max-h":[{"max-h":[`screen`,`lh`,...j()]}],"font-size":[{text:[`base`,n,Id,H]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Hd,jd]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,bd,V]}],"font-family":[{font:[Ld,Md,t]}],"font-features":[{"font-features":[V]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,U,V]}],"line-clamp":[{"line-clamp":[vd,`none`,U,Ad]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,U,V]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,U,V]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...L(),`wavy`]}],"text-decoration-thickness":[{decoration:[vd,`from-font`,`auto`,U,H]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[vd,`auto`,U,V]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[yd,U,V]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,U,V]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,U,V]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:re()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},yd,U,V],radial:[``,U,V],conic:[yd,U,V]},Bd,Pd]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:ae()}],"gradient-via-pos":[{via:ae()}],"gradient-to-pos":[{to:ae()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-bs":[{"border-bs":I()}],"border-w-be":[{"border-be":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":I()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...L(),`hidden`,`none`]}],"divide-style":[{divide:[...L(),`hidden`,`none`]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-bs":[{"border-bs":N()}],"border-color-be":[{"border-be":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...L(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[vd,U,V]}],"outline-w":[{outline:[``,vd,Id,H]}],"outline-color":[{outline:N()}],shadow:[{shadow:[``,`none`,u,Vd,Fd]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":[`none`,d,Vd,Fd]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:I()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[vd,H]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":[`none`,f,Vd,Fd]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[vd,U,V]}],"mix-blend":[{"mix-blend":[...oe(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":oe()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[vd]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[U,V]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[vd]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:re()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,U,V]}],filter:[{filter:[``,`none`,U,V]}],blur:[{blur:ce()}],brightness:[{brightness:[vd,U,V]}],contrast:[{contrast:[vd,U,V]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Vd,Fd]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:[``,vd,U,V]}],"hue-rotate":[{"hue-rotate":[vd,U,V]}],invert:[{invert:[``,vd,U,V]}],saturate:[{saturate:[vd,U,V]}],sepia:[{sepia:[``,vd,U,V]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,U,V]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[vd,U,V]}],"backdrop-contrast":[{"backdrop-contrast":[vd,U,V]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,vd,U,V]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[vd,U,V]}],"backdrop-invert":[{"backdrop-invert":[``,vd,U,V]}],"backdrop-opacity":[{"backdrop-opacity":[vd,U,V]}],"backdrop-saturate":[{"backdrop-saturate":[vd,U,V]}],"backdrop-sepia":[{"backdrop-sepia":[``,vd,U,V]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,U,V]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[vd,`initial`,U,V]}],ease:[{ease:[`linear`,`initial`,_,U,V]}],delay:[{delay:[vd,U,V]}],animate:[{animate:[`none`,v,U,V]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,U,V]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":[`scale-3d`],skew:[{skew:de()}],"skew-x":[{"skew-x":de()}],"skew-y":[{"skew-y":de()}],transform:[{transform:[U,V,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:fe()}],"translate-x":[{"translate-x":fe()}],"translate-y":[{"translate-y":fe()}],"translate-z":[{"translate-z":fe()}],"translate-none":[`translate-none`],zoom:[{zoom:[yd,U,V]}],accent:[{accent:N()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,U,V]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":N()}],"scrollbar-track-color":[{"scrollbar-track":N()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,U,V]}],fill:[{fill:[`none`,...N()]}],"stroke-w":[{stroke:[vd,Id,H,Ad]}],stroke:[{stroke:[`none`,...N()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function W(...e){return $d(Ou(e))}function ef({delayDuration:e=250,...t}){return(0,z.jsx)(Su,{delayDuration:e,...t})}function tf(e){return(0,z.jsx)(Cu,{...e})}function nf(e){return(0,z.jsx)(wu,{...e})}function rf({className:e,sideOffset:t=6,...n}){return(0,z.jsx)(Tu,{children:(0,z.jsx)(Eu,{sideOffset:t,className:W(`z-100 rounded-md bg-zinc-800 px-2 py-1 text-xs font-medium text-zinc-100 shadow-lg ring-1 ring-white/10`,e),...n})})}var af=(0,R.createContext)(null),of=(0,R.createContext)(null);function sf({children:e}){let[t,n]=(0,R.useState)(null),r=(0,R.useCallback)((e,t)=>{n(n=>({terminalId:e,focus:t,sequence:(n?.sequence??0)+1}))},[]);return(0,z.jsx)(af,{value:r,children:(0,z.jsx)(of,{value:t,children:e})})}function cf(){let e=(0,R.useContext)(af);if(!e)throw Error(`useSetTerminalFocusIntent must be used within TerminalFocusProvider`);return e}function lf({terminalId:e,session:t,blocked:n}){let r=(0,R.useContext)(of),i=(0,R.useRef)(null),a=(0,R.useRef)(0),o=(0,R.useRef)(null),s=(0,R.useRef)(null),c=(0,R.useRef)(e),l=(0,R.useRef)(t),u=(0,R.useRef)(n);(0,R.useLayoutEffect)(()=>{c.current=e,l.current=t,u.current=n},[n,t,e]),(0,R.useEffect)(()=>{if(r&&a.current!==r.sequence&&(a.current=r.sequence,o.current=r.focus?r.terminalId:null,s.current=r.focus||i.current===r.terminalId?null:r.terminalId),i.current!==e&&(i.current=e,o.current=s.current===e?null:e,s.current===e&&(s.current=null)),!e||!t||t.terminalId!==e||n||o.current!==e)return;let d=window.requestAnimationFrame(()=>{u.current||c.current!==e||l.current!==t||o.current!==e||(t.focus(),o.current=null)});return()=>window.cancelAnimationFrame(d)},[n,r,t,e])}var uf=/^[\w!#$%&'*.^`|~+-]+$/,df=(e,t,n={})=>{if(!uf.test(e))throw Error(`Invalid cookie name`);let r=`${e}=${t}`;if(e.startsWith(`__Secure-`)&&!n.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!n.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(n.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(n.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`,`sameSite`,`priority`])if(n[e]&&/[;\r\n]/.test(n[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==`number`&&n.maxAge>=0){if(n.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!==`host`&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw Error(`Partitioned Cookie must have Secure attributes`);r+=`; Partitioned`}return r},ff=(e,t,n)=>(t=encodeURIComponent(t),df(e,t,n)),pf=new Set([101,204,205,304]);async function mf(e){let t=await e;if((t.body||t._bodyInit)&&!pf.has(t.status)&&(t._data=await t[_f(t)]()),!t.ok)throw new hf(`${t.status} ${t.statusText}`,{statusCode:t?.status,detail:{data:t?._data,statusText:t?.statusText}});return t._data}var hf=class extends Error{detail;code;log;statusCode;constructor(e,t={}){super(e),this.name=`DetailedError`,this.log=t.log,this.detail=t.detail,this.code=t.code,this.statusCode=t.statusCode}},gf=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(?:;.+)?$/i;function _f(e){let t=e.headers.get(`content-type`);if(!t)return`text`;let n=t.split(`;`).shift();return gf.test(n)?`json`:`text`}var vf=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),yf=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??(?=/|$)`);e=e.replace(t,r?`/${r}`:``)}return e},bf=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.set(n,r);return t},xf=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},Sf=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function Cf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function wf(e,t){if(!Cf(e)&&!Cf(t))return t;let n={...e};for(let e in t){let r=t[e];Cf(n[e])&&Cf(r)?n[e]=wf(n[e],r):n[e]=r}return n}async function Tf(e){return mf(e)}var Ef=(e,t)=>new Proxy(()=>{},{get(n,r){if(!(typeof r!=`string`||r===`then`))return Ef(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),Df=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.append(n,r);this.rBody=t}e.json&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),r={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,r]of Object.entries(e.cookie))t.push(ff(n,r,{path:`/`}));r.Cookie=t.join(`,`)}this.cType&&(r[`Content-Type`]=this.cType);let i=new Headers(r??void 0),a=this.url;a=Sf(a),a=yf(a,this.pathParams),this.queryParams&&(a=a+`?`+this.queryParams.toString()),n=this.method.toUpperCase();let o=!(n===`GET`||n===`HEAD`);return(t?.fetch||fetch)(a,{body:o?this.rBody:void 0,method:n,headers:i,...t?.init})}},Of=(e,t)=>Ef(function n(r){let i=t?.buildSearchParams??bf,a=[...r.path],o=a.slice(-3).reverse();if(o[0]===`toString`)return o[1]===`name`?o[2]||``:n.toString();if(o[0]===`valueOf`)return o[1]===`name`?o[2]||``:n;let s=``;if(/^\$/.test(o[0])){let e=a.pop();e&&(s=e.replace(/^\$/,``))}let c=vf(e,a.join(`/`));if(s===`url`||s===`path`){let t=c;return r.args[0]&&(r.args[0].param&&(t=yf(c,r.args[0].param)),r.args[0].query&&(t=t+`?`+i(r.args[0].query).toString())),t=Sf(t),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=xf(r.args[0]&&r.args[0].param?yf(c,r.args[0].param):c,`ws`),n=new URL(e),i=r.args[0]?.query;return i&&Object.entries(i).forEach(([e,t])=>{Array.isArray(t)?t.forEach(t=>n.searchParams.append(e,t)):n.searchParams.set(e,t)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(n.toString())}let l=new Df(c,s,{buildSearchParams:i});if(s){t??={};let e={...r.args[1]},n=t.headers,i=e.headers;n&&i&&(e.headers=async()=>({...typeof n==`function`?await n():n,...typeof i==`function`?await i():i}));let a=wf(t,e);return l.fetch(r.args[0],a)}return l},[]),kf=3e4,Af=75,jf=3e3;function Mf(e,t){if(e>=2)return!1;if(!(t instanceof hf))return!0;let n=t.statusCode??500;return n===408||n===429||n>=500}function Nf(e){return Math.min(2e3,500*2**Math.max(0,e))}function Pf(e,t=Af){let n=null,r=!1,i=!1,a=!1,o=async()=>{if(n=null,!a){if(r){i=!0;return}r=!0;try{await e()}catch{}finally{r=!1,i&&!a&&(i=!1,n=setTimeout(()=>void o(),t))}}};return{schedule(){if(!a){if(r){i=!0;return}n===null&&(n=setTimeout(()=>void o(),t))}},dispose(){a=!0,i=!1,n!==null&&clearTimeout(n),n=null}}}var Ff=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),If=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Lf=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Rf=e=>{let t=Lf(e);return t.charAt(0).toUpperCase()+t.slice(1)},zf={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`},Bf=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Vf=(0,R.createContext)({}),Hf=()=>(0,R.useContext)(Vf),Uf=(0,R.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Hf()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,R.createElement)(`svg`,{ref:c,...zf,width:t??l??zf.width,height:t??l??zf.height,stroke:e??f,strokeWidth:m,className:Ff(`lucide`,p,i),...!a&&!Bf(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,R.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Wf=(e,t)=>{let n=(0,R.forwardRef)(({className:n,...r},i)=>(0,R.createElement)(Uf,{ref:i,iconNode:t,className:Ff(`lucide-${If(Rf(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Rf(e),n},Gf=Wf(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Kf=Wf(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),qf=Wf(`crown`,[[`path`,{d:`M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z`,key:`1vdc57`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),Jf=Wf(`git-branch`,[[`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`}]]),Yf=Wf(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Xf=Wf(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Zf=Object.defineProperty,Qf=(e,t)=>Zf(e,`name`,{value:t,configurable:!0});function $f(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Qf($f,`setRef`);function ep(...e){return t=>{let n=!1,r=e.map(e=>{let r=$f(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():$f(e[t],null)}}}}Qf(ep,`composeRefs`);function tp(...e){return R.useCallback(ep(...e),e)}Qf(tp,`useComposedRefs`);var np=Object.defineProperty,rp=(e,t)=>np(e,`name`,{value:t,configurable:!0});function ip(e){let t=R.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];pp(r)&&typeof _p==`function`&&(r=_p(r._payload)),R.Children.forEach(r,e=>{if(dp(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;pp(n)&&typeof _p==`function`&&(n=_p(n._payload)),a=cp(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=R.cloneElement(a,void 0,s):!o&&R.Children.count(r)===1&&R.isValidElement(r)&&(a=r);let c=a?up(a):void 0,l=tp(n,c);if(!a){if(r||r===0)throw Error(o?gp(e):hp(e));return r}let u=lp(i,a.props??{});return a.type!==R.Fragment&&(u.ref=n?l:c),R.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}rp(ip,`createSlot`);var ap=ip(`Slot`),op=Symbol.for(`radix.slottable`);function sp(e){let t=rp(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=op,t}rp(sp,`createSlottable`);var cp=rp((e,t)=>{if(`child`in e.props){let t=e.props.child;return R.isValidElement(t)?R.cloneElement(t,void 0,e.props.children(t.props.children)):null}return R.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function lp(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}rp(lp,`mergeProps`);function up(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}rp(up,`getElementRef`);function dp(e){return R.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===op}rp(dp,`isSlottable`);var fp=Symbol.for(`react.lazy`);function pp(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===fp&&`_payload`in e&&mp(e._payload)}rp(pp,`isLazyComponent`);function mp(e){return typeof e==`object`&&!!e&&`then`in e}rp(mp,`isPromiseLike`);var hp=rp(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),gp=rp(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),_p=R.use,vp=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,yp=Ou,bp=(e,t)=>n=>{if(t?.variants==null)return yp(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=vp(t)||vp(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return yp(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},xp=bp(`inline-flex shrink-0 items-center justify-center rounded-full font-medium whitespace-nowrap`,{variants:{variant:{default:`bg-cyan-600 text-white`,secondary:`bg-zinc-800 text-zinc-200`,outline:`text-zinc-200 ring-1 ring-white/12`},size:{default:`px-1.5 py-0.5 text-xs`,counter:`h-4 min-w-4 px-1 text-[0.625rem] font-semibold tabular-nums`}},defaultVariants:{variant:`default`,size:`default`}});function Sp({className:e,variant:t,size:n,asChild:r=!1,...i}){return(0,z.jsx)(r?ap:`span`,{"data-slot":`badge`,className:W(xp({variant:t,size:n,className:e})),...i})}var Cp=bp(`relative inline-flex shrink-0 items-center justify-center gap-1.5 rounded-md text-sm font-medium whitespace-nowrap outline-none disabled:pointer-events-none disabled:opacity-45 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-cyan-400`,{variants:{variant:{default:`bg-cyan-600 text-white ring-1 ring-cyan-600 hover:bg-cyan-500 hover:ring-cyan-500`,secondary:`bg-zinc-800 text-zinc-100 ring-1 ring-white/8 hover:bg-zinc-700`,destructive:`bg-rose-700 text-white ring-1 ring-rose-700 hover:bg-rose-600`,outline:`bg-transparent text-zinc-200 ring-1 ring-white/12 hover:bg-white/6`,ghost:`bg-transparent text-zinc-400 hover:bg-white/6 hover:text-zinc-100`,link:`h-auto rounded-none p-0 text-zinc-400 hover:text-zinc-100`},size:{default:`h-9 px-3 py-2 has-[>svg:first-child]:pl-2 has-[>svg:last-child]:pr-2`,sm:`h-7 px-2.5 text-sm has-[>svg:first-child]:pl-1.5 has-[>svg:last-child]:pr-1.5`,icon:`size-9 p-0`,"icon-sm":`size-7 p-0`}},defaultVariants:{variant:`default`,size:`default`}});function G({className:e,variant:t,size:n,asChild:r=!1,...i}){return(0,z.jsx)(r?ap:`button`,{"data-slot":`button`,className:W(Cp({variant:t,size:n,className:e})),...i})}function wp({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`empty`,className:W(`flex min-w-0 flex-1 flex-col items-center justify-center gap-2 p-6 text-center`,e),...t})}function Tp({className:e,...t}){return(0,z.jsx)(`h3`,{"data-slot":`empty-title`,className:W(`text-sm font-medium text-zinc-200`,e),...t})}function Ep({className:e,...t}){return(0,z.jsx)(`p`,{"data-slot":`empty-description`,className:W(`text-sm text-zinc-400`,e),...t})}var Dp=0,Op=null;function kp(){R.useEffect(()=>{Op||={start:Ap(),end:Ap()};let{start:e,end:t}=Op;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Dp++,()=>{Dp===1&&(Op?.start.remove(),Op?.end.remove(),Op=null),Dp=Math.max(0,Dp-1)}},[])}function Ap(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var jp=`focusScope.autoFocusOnMount`,Mp=`focusScope.autoFocusOnUnmount`,Np={bubbles:!1,cancelable:!0},Pp=`FocusScope`,Fp=R.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=R.useState(null),l=Co(i),u=Co(a),d=R.useRef(null),f=ao(t,c),p=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Hp(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Hp(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Hp(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),R.useEffect(()=>{if(s){Up.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(jp,Np);s.addEventListener(jp,l),s.dispatchEvent(t),t.defaultPrevented||(Ip(Kp(Rp(s)),{select:!0}),document.activeElement===e&&Hp(s))}return()=>{s.removeEventListener(jp,l),setTimeout(()=>{let t=new CustomEvent(Mp,Np);s.addEventListener(Mp,u),s.dispatchEvent(t),t.defaultPrevented||Hp(e??document.body,{select:!0}),s.removeEventListener(Mp,u),Up.remove(p)},0)}}},[s,l,u,p]);let m=R.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Lp(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Hp(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Hp(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,z.jsx)(xo.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Fp.displayName=Pp;function Ip(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Hp(r,{select:t}),document.activeElement!==n)return}function Lp(e){let t=Rp(e);return[zp(t,e),zp(t.reverse(),e)]}function Rp(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function zp(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Bp(r,{upTo:t})))return r}function Bp(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Vp(e){return e instanceof HTMLInputElement&&`select`in e}function Hp(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Vp(e)&&t&&e.select()}}var Up=Wp();function Wp(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Gp(e,t),e.unshift(t)},remove(t){e=Gp(e,t),e[0]?.resume()}}}function Gp(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Kp(e){return e.filter(e=>e.tagName!==`A`)}var qp=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Jp=new WeakMap,Yp=new WeakMap,Xp={},Zp=0,Qp=function(e){return e&&(e.host||Qp(e.parentNode))},$p=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Qp(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},em=function(e,t,n,r){var i=$p(t,Array.isArray(e)?e:[e]);Xp[n]||(Xp[n]=new WeakMap);var a=Xp[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Jp.get(e)||0)+1,l=(a.get(e)||0)+1;Jp.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Yp.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Zp++,function(){o.forEach(function(e){var t=Jp.get(e)-1,i=a.get(e)-1;Jp.set(e,t),a.set(e,i),t||(Yp.has(e)||e.removeAttribute(r),Yp.delete(e)),i||e.removeAttribute(n)}),Zp--,Zp||(Jp=new WeakMap,Jp=new WeakMap,Yp=new WeakMap,Xp={})}},tm=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||qp(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),em(r,i,n,`aria-hidden`)):function(){return null}},nm=function(){return nm=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},nm.apply(this,arguments)};function rm(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function im(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var am=`right-scroll-bar-position`,om=`width-before-scroll-bar`,sm=`with-scroll-bars-hidden`,cm=`--removed-body-scroll-bar-size`;function lm(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function um(e,t){var n=(0,R.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var dm=typeof window<`u`?R.useLayoutEffect:R.useEffect,fm=new WeakMap;function pm(e,t){var n=um(t||null,function(t){return e.forEach(function(e){return lm(e,t)})});return dm(function(){var t=fm.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||lm(e,null)}),i.forEach(function(e){r.has(e)||lm(e,a)})}fm.set(n,e)},[e]),n}function mm(e){return e}function hm(e,t){t===void 0&&(t=mm);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function gm(e){e===void 0&&(e={});var t=hm(null);return t.options=nm({async:!0,ssr:!1},e),t}var _m=function(e){var t=e.sideCar,n=rm(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return R.createElement(r,nm({},n))};_m.isSideCarExport=!0;function vm(e,t){return e.useMedium(t),_m}var ym=gm(),bm=function(){},xm=R.forwardRef(function(e,t){var n=R.useRef(null),r=R.useState({onScrollCapture:bm,onWheelCapture:bm,onTouchMoveCapture:bm}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=rm(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=pm([n,t]),C=nm(nm({},b),i);return R.createElement(R.Fragment,null,u&&R.createElement(x,{sideCar:ym,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?R.cloneElement(R.Children.only(s),nm(nm({},C),{ref:S})):R.createElement(v,nm({},C,{className:c,ref:S}),s))});xm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},xm.classNames={fullWidth:om,zeroRight:am};var Sm,Cm=function(){if(Sm)return Sm;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function wm(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Cm();return t&&e.setAttribute(`nonce`,t),e}function Tm(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Em(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Dm=function(){var e=0,t=null;return{add:function(n){e==0&&(t=wm())&&(Tm(t,n),Em(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Om=function(){var e=Dm();return function(t,n){R.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},km=function(){var e=Om();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Am={left:0,top:0,right:0,gap:0},jm=function(e){return parseInt(e||``,10)||0},Mm=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[jm(n),jm(r),jm(i)]},Nm=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Am;var t=Mm(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Pm=km(),Fm=`data-scroll-locked`,Im=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
10
+ .${sm} {
11
+ overflow: hidden ${r};
12
+ padding-right: ${s}px ${r};
13
+ }
14
+ body[${Fm}] {
15
+ overflow: hidden ${r};
16
+ overscroll-behavior: contain;
17
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
18
+ padding-left: ${i}px;
19
+ padding-top: ${a}px;
20
+ padding-right: ${o}px;
21
+ margin-left:0;
22
+ margin-top:0;
23
+ margin-right: ${s}px ${r};
24
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
25
+ }
26
+
27
+ .${am} {
28
+ right: ${s}px ${r};
29
+ }
30
+
31
+ .${om} {
32
+ margin-right: ${s}px ${r};
33
+ }
34
+
35
+ .${am} .${am} {
36
+ right: 0 ${r};
37
+ }
38
+
39
+ .${om} .${om} {
40
+ margin-right: 0 ${r};
41
+ }
42
+
43
+ body[${Fm}] {
44
+ ${cm}: ${s}px;
45
+ }
46
+ `},Lm=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Rm=function(){R.useEffect(function(){return document.body.setAttribute(Fm,(Lm()+1).toString()),function(){var e=Lm()-1;e<=0?document.body.removeAttribute(Fm):document.body.setAttribute(Fm,e.toString())}},[])},zm=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Rm();var a=R.useMemo(function(){return Nm(i)},[i]);return R.createElement(Pm,{styles:Im(a,!t,i,n?``:`!important`)})},Bm=!1;if(typeof window<`u`)try{var Vm=Object.defineProperty({},"passive",{get:function(){return Bm=!0,!0}});window.addEventListener(`test`,Vm,Vm),window.removeEventListener(`test`,Vm,Vm)}catch{Bm=!1}var Hm=Bm?{passive:!1}:!1,Um=function(e){return e.tagName===`TEXTAREA`},Wm=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Um(e)&&n[t]===`visible`)},Gm=function(e){return Wm(e,`overflowY`)},Km=function(e){return Wm(e,`overflowX`)},qm=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Xm(e,r)){var i=Zm(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Jm=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Ym=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Xm=function(e,t){return e===`v`?Gm(t):Km(t)},Zm=function(e,t){return e===`v`?Jm(t):Ym(t)},Qm=function(e,t){return e===`h`&&t===`rtl`?-1:1},$m=function(e,t,n,r,i){var a=Qm(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Zm(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Xm(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},eh=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},th=function(e){return[e.deltaX,e.deltaY]},nh=function(e){return e&&`current`in e?e.current:e},rh=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ih=function(e){return`
47
+ .block-interactivity-${e} {pointer-events: none;}
48
+ .allow-interactivity-${e} {pointer-events: all;}
49
+ `},ah=0,oh=[];function sh(e){var t=R.useRef([]),n=R.useRef([0,0]),r=R.useRef(),i=R.useState(ah++)[0],a=R.useState(km)[0],o=R.useRef(e);R.useEffect(function(){o.current=e},[e]),R.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=im([e.lockRef.current],(e.shards||[]).map(nh),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=R.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=eh(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=qm(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=qm(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return $m(h,t,e,h===`h`?s:c,!0)},[]),c=R.useCallback(function(e){var n=e;if(!(!oh.length||oh[oh.length-1]!==a)){var r=`deltaY`in n?th(n):eh(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&rh(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(nh).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=R.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:ch(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=R.useCallback(function(e){n.current=eh(e),r.current=void 0},[]),d=R.useCallback(function(t){l(t.type,th(t),t.target,s(t,e.lockRef.current))},[]),f=R.useCallback(function(t){l(t.type,eh(t),t.target,s(t,e.lockRef.current))},[]);R.useEffect(function(){return oh.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Hm),document.addEventListener(`touchmove`,c,Hm),document.addEventListener(`touchstart`,u,Hm),function(){oh=oh.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Hm),document.removeEventListener(`touchmove`,c,Hm),document.removeEventListener(`touchstart`,u,Hm)}},[]);var p=e.removeScrollBar,m=e.inert;return R.createElement(R.Fragment,null,m?R.createElement(a,{styles:ih(i)}):null,p?R.createElement(zm,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ch(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var lh=vm(ym,sh),uh=R.forwardRef(function(e,t){return R.createElement(xm,nm({},e,{ref:t,sideCar:lh}))});uh.classNames=xm.classNames;var dh=`Popover`,[fh,ph]=oo(dh,[al]),mh=al(),[hh,gh]=fh(dh),_h=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=mh(t),c=R.useRef(null),[l,u]=R.useState(!1),[d,f]=Fl({prop:r,defaultProp:i??!1,onChange:a,caller:dh});return(0,z.jsx)(xl,{...s,children:(0,z.jsx)(hh,{scope:t,contentId:Vo(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:R.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:R.useCallback(()=>u(!0),[]),onCustomAnchorRemove:R.useCallback(()=>u(!1),[]),modal:o,children:n})})};_h.displayName=dh;var vh=`PopoverAnchor`,yh=R.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=gh(vh,n),a=mh(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return R.useEffect(()=>(o(),()=>s()),[o,s]),(0,z.jsx)(Sl,{...a,...r,ref:t})});yh.displayName=vh;var bh=`PopoverTrigger`,xh=R.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=gh(bh,n),a=mh(n),o=ao(t,i.triggerRef),s=(0,z.jsx)(xo.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Ih(i.open),...r,ref:o,onClick:no(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,z.jsx)(Sl,{asChild:!0,...a,children:s})});xh.displayName=bh;var Sh=`PopoverPortal`,[Ch,wh]=fh(Sh,{forceMount:void 0}),Th=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=gh(Sh,t);return(0,z.jsx)(Ch,{scope:t,forceMount:n,children:(0,z.jsx)(Ol,{present:n||a.open,children:(0,z.jsx)(El,{asChild:!0,container:i,children:r})})})};Th.displayName=Sh;var Eh=`PopoverContent`,Dh=R.forwardRef((e,t)=>{let n=wh(Eh,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=gh(Eh,e.__scopePopover);return(0,z.jsx)(Ol,{present:r||a.open,children:a.modal?(0,z.jsx)(kh,{...i,ref:t}):(0,z.jsx)(Ah,{...i,ref:t})})});Dh.displayName=Eh;var Oh=co(`PopoverContent.RemoveScroll`),kh=R.forwardRef((e,t)=>{let n=gh(Eh,e.__scopePopover),r=R.useRef(null),i=ao(t,r),a=R.useRef(!1);return R.useEffect(()=>{let e=r.current;if(e)return tm(e)},[]),(0,z.jsx)(uh,{as:Oh,allowPinchZoom:!0,children:(0,z.jsx)(jh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:no(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:no(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:no(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Ah=R.forwardRef((e,t)=>{let n=gh(Eh,e.__scopePopover),r=R.useRef(!1),i=R.useRef(!1);return(0,z.jsx)(jh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),jh=R.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=gh(Eh,n),p=mh(n);return kp(),(0,z.jsx)(Fp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,z.jsx)(Ao,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,z.jsx)(Cl,{"data-state":Ih(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),Mh=`PopoverClose`,Nh=R.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=gh(Mh,n);return(0,z.jsx)(xo.button,{type:`button`,...r,ref:t,onClick:no(e.onClick,()=>i.onOpenChange(!1))})});Nh.displayName=Mh;var Ph=`PopoverArrow`,Fh=R.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=mh(n);return(0,z.jsx)(wl,{...i,...r,ref:t})});Fh.displayName=Ph;function Ih(e){return e?`open`:`closed`}var Lh=_h,Rh=xh,zh=Th,Bh=Dh;function Vh(e){return(0,z.jsx)(Lh,{...e})}function Hh(e){return(0,z.jsx)(Rh,{...e})}function Uh({className:e,align:t=`start`,sideOffset:n=6,portalled:r=!0,...i}){let a=(0,z.jsx)(Bh,{align:t,sideOffset:n,className:W(`z-100 w-52 rounded-lg bg-zinc-900 p-3 text-zinc-200 shadow-xl ring-1 ring-white/10 outline-none`,e),...i});return r?(0,z.jsx)(zh,{children:a}):a}var Wh=(0,R.createRef)();function Gh(e){if(!Wh.current)throw Error(`ForceSpecificCursor is not mounted`);Wh.current.style.cursor=e,Wh.current.style.pointerEvents=`auto`}function Kh(){if(!Wh.current)throw Error(`ForceSpecificCursor is not mounted`);Wh.current.style.cursor=``,Wh.current.style.pointerEvents=`none`}function qh(){return(0,z.jsx)(`div`,{ref:Wh,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0`,style:{zIndex:2147483647}})}var Jh=3,Yh=450,Xh=550,Zh=10;function Qh(e){let t=e.value===null?``:`, ${e.value}% complete`;return e.state===`error`?`progress error${t}`:e.state===`paused`?`progress paused${t}`:e.value===null?`working`:`${e.value}% complete`}function $h(e,t=!1){if(e.type!==`keydown`||e.isComposing||e.ctrlKey)return null;if(e.key===`Enter`&&e.shiftKey&&!e.altKey&&!e.metaKey)return`\x1B[13;2u`;if(e.altKey&&!e.metaKey&&!e.shiftKey){if(eg()){if(e.key===`ArrowLeft`)return`\x1Bb`;if(e.key===`ArrowRight`)return`\x1Bf`}else{let t={ArrowUp:`A`,ArrowDown:`B`,ArrowRight:`C`,ArrowLeft:`D`}[e.key];if(t)return`\u001b[1;5${t}`}return null}if(!e.metaKey||e.altKey||e.shiftKey)return null;let n=t?`\x1BO`:`\x1B[`;return e.key===`ArrowLeft`?`${n}H`:e.key===`ArrowRight`?`${n}F`:null}function eg(){return typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)}function tg(e,t){if(eg()?!e.metaKey:!e.ctrlKey)return;let n;try{n=new URL(t)}catch{return}if(n.protocol===`file:`){window.treeportDesktop?.openFileUrl(t).catch(()=>void 0);return}(n.protocol===`http:`||n.protocol===`https:`)&&window.open(t,`_blank`,`noopener,noreferrer`)}function ng(e,t){!t.element?.classList.contains(`enable-mouse-events`)||e.button!==0||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||Object.defineProperty(e,eg()?`altKey`:`shiftKey`,{configurable:!0,value:!0})}var rg=50,ig=3;function ag(e,t,n){let r=null,i=null,a=null,o,s=(e,n)=>{let r=(t.element?.querySelector(`.xterm-screen`))?.getBoundingClientRect();return!r?.width||!r.height?null:{column:Math.max(1,Math.min(t.cols,Math.floor((e-r.left)/r.width*t.cols)+1)),row:Math.max(1,Math.min(t.rows,Math.floor((n-r.top)/r.height*t.rows)+1)),bounds:r}},c=()=>{a!==null&&(window.clearInterval(a),a=null)};function l(){if(!i)return;let u=s(i.clientX,i.clientY);if(!u)return;let f=i.clientY<u.bounds.top||i.clientY>u.bounds.bottom,p=i.clientX<u.bounds.left||i.clientX>u.bounds.right,m=f&&!p;if(m||c(),i.tmux)n.canInput()&&n.sendInput(`\u001b[<32;${u.column};${u.row}M`);else{if(Math.hypot(i.clientX-i.startClientX,i.clientY-i.startClientY)<ig||!n.canInput())return;n.sendInput(`${n.selectionStartSequence}\u001b[<0;${i.startColumn};${i.startRow}M\u001b[<32;${i.startColumn};${i.startRow}M\u001b[<32;${u.column};${u.row}M`),t.clearSelection(),r!==null&&e.setPointerCapture(r),i.tmux=!0,o??=window.treeportDesktop?.onTerminalSelectionRelease(d),window.treeportDesktop?.setTerminalSelectionActive(!0),n.onTmuxSelectionStart()}m&&a===null&&(a=window.setInterval(l,rg))}let u=()=>{let t=r;r=null,t!==null&&e.hasPointerCapture(t)&&e.releasePointerCapture(t)},d=()=>{if(!i){u();return}let e=i.tmux;if(e&&n.canInput()){let e=s(i.clientX,i.clientY);if(e){let r=e.row===1?Math.min(2,t.rows):e.row===t.rows?Math.max(1,t.rows-1):e.row;n.onTmuxSelectionFinish(),n.sendInput(`${n.selectionStopSequence}\u001b[<32;${e.column};${r}M\u001b[<0;${e.column};${r}m`)}}c(),i=null,Kh(),e&&window.treeportDesktop?.setTerminalSelectionActive(!1),u(),document.removeEventListener(`mousemove`,f,!0),document.removeEventListener(`mouseup`,p,!0),window.removeEventListener(`blur`,_)},f=e=>{if(i){if(!(e.buttons&1)){d();return}i.clientX=e.clientX,i.clientY=e.clientY,l()}},p=()=>d(),m=e=>{e.isPrimary&&e.button===0&&(d(),r=e.pointerId)},h=()=>d(),g=()=>d(),_=()=>d();return e.addEventListener(`pointerdown`,m,!0),e.addEventListener(`pointerup`,h,!0),e.addEventListener(`pointercancel`,h,!0),e.addEventListener(`lostpointercapture`,g,!0),e.addEventListener(`mousedown`,e=>{n.requestControl(),ng(e,t);let r=s(e.clientX,e.clientY);e.button!==0||e.ctrlKey||e.metaKey||!r||e.clientX<r.bounds.left||e.clientX>r.bounds.right||e.clientY<r.bounds.top||e.clientY>r.bounds.bottom||(n.onSelectionStart(),Gh(`text`),i={startColumn:r.column,startRow:r.row,startClientX:e.clientX,startClientY:e.clientY,clientX:e.clientX,clientY:e.clientY,tmux:!1},document.addEventListener(`mousemove`,f,!0),document.addEventListener(`mouseup`,p,!0),window.addEventListener(`blur`,_))},!0),()=>{i?.tmux&&n.canInput()&&n.onTmuxSelectionCancel(),i?.tmux&&window.treeportDesktop?.setTerminalSelectionActive(!1),o?.(),c(),i&&=(Kh(),null),u(),e.removeEventListener(`pointerdown`,m,!0),e.removeEventListener(`pointerup`,h,!0),e.removeEventListener(`pointercancel`,h,!0),e.removeEventListener(`lostpointercapture`,g,!0),document.removeEventListener(`mousemove`,f,!0),document.removeEventListener(`mouseup`,p,!0),window.removeEventListener(`blur`,_)}}function og(e,t,n,r,i){let a=null,o=0,s=null,c=null,l=null,u=null,d=[],f=(e,n)=>{let r=t.element;if(!r)return null;let i=r.getBoundingClientRect();return{column:Math.min(t.cols-1,Math.max(0,Math.floor((e-i.left)/i.width*t.cols))),row:t.buffer.active.viewportY+Math.min(t.rows-1,Math.max(0,Math.floor((n-i.top)/i.height*t.rows)))}},p=()=>{c!==null&&(window.clearTimeout(c),c=null)},m=()=>{u!==null&&(window.clearTimeout(u),u=null),d=[]};e.addEventListener(`wheel`,n,{capture:!0,passive:!0}),e.addEventListener(`touchstart`,e=>{if(e.touches.length===2){p(),m(),a=null,o=0,s=null,l=null,d=Array.from(e.touches,e=>({identifier:e.identifier,x:e.clientX,y:e.clientY})),u=window.setTimeout(()=>{u=null,d=[],navigator.vibrate?.(10),i()},Xh);return}if(e.touches.length!==1){p(),m(),a=null,o=0,s=null,l=null;return}m();let n=e.touches[0];a=n.clientY,o=0,s={x:n.clientX,y:n.clientY},l=null,p(),c=window.setTimeout(()=>{c=null,s&&(l=f(s.x,s.y),l&&(t.select(l.column,l.row,1),navigator.vibrate?.(10)))},Yh)},{capture:!0,passive:!0}),e.addEventListener(`touchmove`,e=>{if(e.touches.length===2&&d.length===2){d.some(t=>{let n=Array.from(e.touches).find(e=>e.identifier===t.identifier);return!n||Math.hypot(n.clientX-t.x,n.clientY-t.y)>Zh})?m():e.preventDefault();return}if(e.touches.length!==1||a===null){p(),m(),a=null,o=0,s=null,l=null;return}let n=t.element;if(!n)return;let r=e.touches[0];if(l){e.preventDefault();let n=f(r.clientX,r.clientY);if(!n)return;let i=l.row*t.cols+l.column,a=n.row*t.cols+n.column,o=Math.min(i,a);t.select(o%t.cols,Math.floor(o/t.cols),Math.abs(a-i)+1);return}s&&Math.hypot(r.clientX-s.x,r.clientY-s.y)>Zh&&(p(),s=null),o+=a-r.clientY,a=r.clientY,e.preventDefault();let i=n.getBoundingClientRect(),c=(i.height/t.rows||16)*(n.classList.contains(`enable-mouse-events`)?Jh:1),u=Math.trunc(o/c);if(u===0)return;o-=u*c;let h=Math.min(Math.max(r.clientX,i.left),i.right-1),g=Math.min(Math.max(r.clientY,i.top),i.bottom-1);for(let e=0;e<Math.abs(u);e+=1)n.dispatchEvent(new WheelEvent(`wheel`,{bubbles:!0,cancelable:!0,composed:!0,clientX:h,clientY:g,deltaMode:WheelEvent.DOM_DELTA_LINE,deltaY:Math.sign(u)}))},{capture:!0,passive:!1});let h=e=>{l&&e.preventDefault(),p(),m(),a=null,o=0,s=null,l=null};e.addEventListener(`touchend`,h,{capture:!0,passive:!1}),e.addEventListener(`touchcancel`,h,{capture:!0,passive:!1}),e.addEventListener(`paste`,r,!0)}function sg(){return{cursorBlink:!0,convertEol:!1,fontFamily:`"SFMono-Regular", "Cascadia Code", "Liberation Mono", monospace`,fontSize:14,lineHeight:1.15,scrollback:0,allowProposedApi:!1,macOptionClickForcesSelection:!0,linkHandler:{activate:tg,allowNonHttpProtocols:!0},theme:{background:`#09090b`,foreground:`#e4e4e7`,cursor:`#67e8f9`,selectionBackground:`#3f3f4666`,scrollbarSliderBackground:`#3f3f46`,scrollbarSliderHoverBackground:`#52525b`,scrollbarSliderActiveBackground:`#71717a`,black:`#18181b`,red:`#fb7185`,green:`#86efac`,yellow:`#fde047`,blue:`#7dd3fc`,magenta:`#d8b4fe`,cyan:`#67e8f9`,white:`#f4f4f5`}}}var cg=2,lg=1,ug=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(cg,Math.floor(u/e.css.cell.width)),rows:Math.max(lg,Math.floor(l/e.css.cell.height))}}},dg=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=pg.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function fg(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var pg=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!fg(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},mg=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function hg(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var gg=class{constructor(e=hg,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||mg;this._linkProvider=this._terminal.registerLinkProvider(new dg(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},_g=Object.defineProperty,vg=Object.getOwnPropertyDescriptor,yg=(e,t)=>{for(var n in t)_g(e,n,{get:t[n],enumerable:!0})},bg=(e,t,n,r)=>{for(var i=r>1?void 0:r?vg(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&_g(t,n,i),i},K=(e,t)=>(n,r)=>t(n,r,e),xg=`Terminal input`,Sg={get:()=>xg,set:e=>xg=e},Cg=`Too much output to announce, navigate to rows manually to read`,wg={get:()=>Cg,set:e=>Cg=e};function Tg(e){return e.replace(/\r?\n/g,`\r`)}function Eg(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function Dg(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function Og(e,t,n,r){e.stopPropagation(),e.clipboardData&&kg(e.clipboardData.getData(`text/plain`),t,n,r)}function kg(e,t,n,r){e=Tg(e),e=Eg(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function Ag(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function jg(e,t,n,r,i){Ag(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Mg(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Ng(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var Pg=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},Fg=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},Ig=``,Lg=` `,Rg=class e{constructor(){this.fg=0,this.bg=0,this.extended=new zg}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},zg=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Bg=class e extends Rg{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new zg,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Mg(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Vg=`di$target`,Hg=`di$dependencies`,Ug=new Map;function Wg(e){return e[Hg]||[]}function Gg(e){if(Ug.has(e))return Ug.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Kg(t,e,r)};return t._id=e,Ug.set(e,t),t}function Kg(e,t,n){t[Vg]===t?t[Hg].push({id:e,index:n}):(t[Hg]=[{id:e,index:n}],t[Vg]=t)}var qg=Gg(`BufferService`),Jg=Gg(`CoreMouseService`),Yg=Gg(`CoreService`),Xg=Gg(`CharsetService`),Zg=Gg(`InstantiationService`),Qg=Gg(`LogService`),$g=Gg(`OptionsService`),e_=Gg(`OscLinkService`),t_=Gg(`UnicodeService`),n_=Gg(`DecorationService`),r_=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new Bg,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):i_(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};r_=bg([K(0,qg),K(1,$g),K(2,e_)],r_);function i_(e,t){if(confirm(`Do you want to navigate to ${t}?
50
+
51
+ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var a_=Gg(`CharSizeService`),o_=Gg(`CoreBrowserService`),s_=Gg(`MouseService`),c_=Gg(`RenderService`),l_=Gg(`SelectionService`),u_=Gg(`CharacterJoinerService`),d_=Gg(`ThemeService`),f_=Gg(`LinkProviderService`),p_=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?y_.isErrorNoTelemetry(e)?new y_(e.message+`
52
+
53
+ `+e.stack):Error(e.message+`
54
+
55
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function m_(e){g_(e)||p_.onUnexpectedError(e)}var h_=`Canceled`;function g_(e){return e instanceof __||e instanceof Error&&e.name===h_&&e.message===h_}var __=class extends Error{constructor(){super(h_),this.name=this.message}};function v_(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var y_=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},b_=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function x_(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}var S_=class e{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=x_(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}};S_.assertInvariants=!1;function C_(e,t=0){return e[e.length-(1+t)]}var w_;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(w_||={});function T_(e,t){return(n,r)=>t(e(n),e(r))}var E_=(e,t)=>e-t,D_=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||w_.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};D_.empty=new D_(e=>{});function O_(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var k_=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function A_(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var j_;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(j_||={});var M_=null,N_=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let n=this.livingDisposables.get(t);return n||(n={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,n)),n}trackDisposable(e){let t=this.getDisposableData(e);t.source||=Error().stack}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let r=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,r),r}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(`
56
+ `).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new k_;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
57
+ `),e)}n.sort(T_(e=>e.idx,E_));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;t<e.length;t++){let a=e[t];a=`(shared with ${i.get(e.slice(0,t+1).join(`
58
+ `)).size}/${n.length} leaks) at ${a}`;let o=O_([...i.get(e.slice(0,t).join(`
59
+ `))].map(e=>r(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=`
60
+
61
+
62
+ ==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ====================
63
+ ${s.join(`
64
+ `)}
65
+ ============================================================
66
+
67
+ `}return n.length>e&&(a+=`
68
+
69
+
70
+ ... and ${n.length-e} more leaking disposables
71
+
72
+ `),{leaks:n,details:a}}};N_.idx=0;function P_(e){return M_?.trackDisposable(e),e}function F_(e){M_?.markAsDisposed(e)}function I_(e,t){M_?.setParent(e,t)}function L_(e){return M_?.markAsSingleton(e),e}function R_(e){if(j_.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function z_(...e){return B_(()=>R_(e))}function B_(e){let t=P_({dispose:A_(()=>{F_(t),e()})});return t}var V_=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,P_(this)}dispose(){this._isDisposed||(F_(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{R_(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return I_(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),I_(e,null))}};V_.DISABLE_DISPOSED_WARNING=!1;var H_=V_,U_=class{constructor(){this._store=new H_,P_(this),I_(this._store,this)}dispose(){F_(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};U_.None=Object.freeze({dispose(){}});var W_=class{constructor(){this._isDisposed=!1,P_(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&I_(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,F_(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&I_(e,null),e}},G_=typeof window==`object`?window:globalThis,K_=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};K_.Undefined=new K_(void 0);var q_=K_,J_=class{constructor(){this._first=q_.Undefined,this._last=q_.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===q_.Undefined}clear(){let e=this._first;for(;e!==q_.Undefined;){let t=e.next;e.prev=q_.Undefined,e.next=q_.Undefined,e=t}this._first=q_.Undefined,this._last=q_.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new q_(e);if(this._first===q_.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==q_.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==q_.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==q_.Undefined&&e.next!==q_.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===q_.Undefined&&e.next===q_.Undefined?(this._first=q_.Undefined,this._last=q_.Undefined):e.next===q_.Undefined?(this._last=this._last.prev,this._last.next=q_.Undefined):e.prev===q_.Undefined&&(this._first=this._first.next,this._first.prev=q_.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==q_.Undefined;)yield e.element,e=e.next}},Y_=globalThis.performance&&typeof globalThis.performance.now==`function`,X_=class e{static create(t){return new e(t)}constructor(e){this._now=Y_&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},Z_;(e=>{e.None=()=>U_.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(z_(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new q({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new q({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new q({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new q({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new q({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new q;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new q(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof H_?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(Z_||={});var Q_=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new X_,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Q_.all=new Set,Q_._idPool=0;var $_=Q_,ev=-1,tv=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new iv(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};tv._idPool=1;var nv=tv,rv=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
73
+ `).slice(2).join(`
74
+ `))}},iv=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},av=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},ov=0,sv=class{constructor(e){this.value=e,this.id=ov++}},cv=2,lv,q=class{constructor(e){this._size=0,this._options=e,this._leakageMon=ev>0||this._options?.leakWarningThreshold?new nv(e?.onListenerError??m_,this._options?.leakWarningThreshold??ev):void 0,this._perfMon=this._options?._profName?new $_(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new av(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||m_)(n),U_.None}if(this._disposed)return U_.None;t&&(e=e.bind(t));let r=new sv(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=rv.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof sv?(this._deliveryQueue??=new uv,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=B_(()=>{lv?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof H_?n.add(a):Array.isArray(n)&&n.push(a),lv){let e=Error().stack.split(`
75
+ `).slice(2,3).join(`
76
+ `).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);lv.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*cv<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||m_;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof sv)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},uv=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},dv=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new q,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new q,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};dv.INSTANCE=new dv;var fv=dv;function pv(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}fv.INSTANCE.onDidChangeZoomLevel;function mv(e){return fv.INSTANCE.getZoomFactor(e)}fv.INSTANCE.onDidChangeFullscreen;var hv=typeof navigator==`object`?navigator.userAgent:``,gv=hv.indexOf(`Firefox`)>=0,_v=hv.indexOf(`AppleWebKit`)>=0,vv=hv.indexOf(`Chrome`)>=0,yv=!vv&&hv.indexOf(`Safari`)>=0;hv.indexOf(`Electron/`),hv.indexOf(`Android`);var bv=!1;if(typeof G_.matchMedia==`function`){let e=G_.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=G_.matchMedia(`(display-mode: fullscreen)`);bv=e.matches,pv(G_,e,({matches:e})=>{bv&&t.matches||(bv=e)})}function xv(){return bv}var Sv=`en`,Cv=!1,wv=!1,Tv=!1,Ev=!1,Dv=!1,Ov=Sv,kv,Av=globalThis,jv;typeof Av.vscode<`u`&&typeof Av.vscode.process<`u`?jv=Av.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(jv=process);var Mv=typeof jv?.versions?.electron==`string`&&jv?.type===`renderer`;if(typeof jv==`object`){Cv=jv.platform===`win32`,wv=jv.platform===`darwin`,Tv=jv.platform===`linux`,Tv&&jv.env.SNAP&&jv.env.SNAP_REVISION,jv.env.CI||jv.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ov=Sv;let e=jv.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,Ov=t.resolvedLanguage||Sv,t.languagePack?.translationsConfigFile}catch{}Ev=!0}else typeof navigator==`object`&&!Mv?(kv=navigator.userAgent,Cv=kv.indexOf(`Windows`)>=0,wv=kv.indexOf(`Macintosh`)>=0,(kv.indexOf(`Macintosh`)>=0||kv.indexOf(`iPad`)>=0||kv.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,Tv=kv.indexOf(`Linux`)>=0,kv?.indexOf(`Mobi`),Dv=!0,Ov=globalThis._VSCODE_NLS_LANGUAGE||Sv,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var Nv=Cv,Pv=wv,Fv=Tv,Iv=Ev;Dv&&typeof Av.importScripts==`function`&&Av.origin;var Lv=kv,Rv=Ov,zv;(e=>{function t(){return Rv}e.value=t;function n(){return Rv.length===2?Rv===`en`:Rv.length>=3&&Rv[0]===`e`&&Rv[1]===`n`&&Rv[2]===`-`}e.isDefaultVariant=n;function r(){return Rv===`en`}e.isDefault=r})(zv||={});var Bv=typeof Av.postMessage==`function`&&!Av.importScripts;(()=>{if(Bv){let e=[];Av.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Av.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var Vv=!!(Lv&&Lv.indexOf(`Chrome`)>=0);Lv&&Lv.indexOf(`Firefox`),!Vv&&Lv&&Lv.indexOf(`Safari`),Lv&&Lv.indexOf(`Edg/`),Lv&&Lv.indexOf(`Android`);var Hv=typeof navigator==`object`?navigator:{};Iv||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||Hv&&Hv.clipboard&&Hv.clipboard.writeText,Iv||Hv&&Hv.clipboard&&Hv.clipboard.readText,Iv||xv()||Hv.keyboard,`ontouchstart`in G_||Hv.maxTouchPoints,G_.PointerEvent&&(`ontouchstart`in G_||navigator.maxTouchPoints);var Uv=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Wv=new Uv,Gv=new Uv,Kv=new Uv,qv=Array(230),Jv;(e=>{function t(e){return Wv.keyCodeToStr(e)}e.toString=t;function n(e){return Wv.strToKeyCode(e)}e.fromString=n;function r(e){return Gv.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Kv.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return Gv.strToKeyCode(e)||Kv.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return Wv.keyCodeToStr(e)}e.toElectronAccelerator=o})(Jv||={});var Yv=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Xv([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Xv=class{constructor(e){if(e.length===0)throw v_(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function Zv(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return Jv.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(gv)switch(t){case 59:return 85;case 60:if(Fv)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Pv)return 57;break}else if(_v&&(Pv&&t===93||!Pv&&t===92))return 57;return qv[t]||0}var Qv=Pv?256:2048,$v=512,ey=1024,ty=Pv?2048:256,ny=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=Zv(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=Qv),this.altKey&&(t|=$v),this.shiftKey&&(t|=ey),this.metaKey&&(t|=ty),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Yv(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},ry=new WeakMap;function iy(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var ay=class{static getSameOriginWindowChain(e){let t=ry.get(e);if(!t){t=[],ry.set(e,t);let n=e,r;do r=iy(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},oy=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=ay.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},sy=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(vv){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)r?this.deltaY=t.wheelDeltaY/(120*i):this.deltaY=t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?gv&&!Pv?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)yv&&Nv?this.deltaX=-(t.wheelDeltaX/120):r?this.deltaX=t.wheelDeltaX/(120*i):this.deltaX=t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?gv&&!Pv?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*i):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},cy=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),ly;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof uy?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Z_.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:cy})})(ly||={});var uy=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?cy:(this._emitter||=new q,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},dy=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new b_(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new b_(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},fy=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new b_(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=B_(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var py;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(py||={});var my=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new q,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Z_.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};my.EMPTY=my.fromArray([]);function hy(e){return 55296<=e&&e<=56319}function gy(e){return 56320<=e&&e<=57343}function _y(e,t){return(e-55296<<10)+(t-56320)+65536}function vy(e){return yy(e,0)}function yy(e,t){switch(typeof e){case`object`:return e===null?by(349,t):Array.isArray(e)?Cy(e,t):wy(e,t);case`string`:return Sy(e,t);case`boolean`:return xy(e,t);case`number`:return by(e,t);case`undefined`:return by(937,t);default:return by(617,t)}}function by(e,t){return(t<<5)-t+e|0}function xy(e,t){return by(e?433:863,t)}function Sy(e,t){t=by(149417,t);for(let n=0,r=e.length;n<r;n++)t=by(e.charCodeAt(n),t);return t}function Cy(e,t){return t=by(104579,t),e.reduce((e,t)=>yy(t,e),t)}function wy(e,t){return t=by(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Sy(n,t),yy(e[n],t)),t)}function Ty(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function Ey(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function Dy(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function Oy(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):Dy((e>>>0).toString(16),t/4)}var ky=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(hy(a))if(o+1<t){let t=e.charCodeAt(o+1);gy(t)?(o++,s=_y(a,t)):s=65533}else{i=a;break}else gy(a)&&(s=65533);if(r=this._push(n,r,s),o++,o<t)a=e.charCodeAt(o);else break}this._buffLen=r,this._leftoverHighSurrogate=i}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Oy(this._h0)+Oy(this._h1)+Oy(this._h2)+Oy(this._h3)+Oy(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Ey(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Ey(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,Ty(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=Ty(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=Ty(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};ky._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:Ay,getWindow:jy,getDocument:My,getWindows:Ny,getWindowsCount:Py,getWindowId:Fy,getWindowById:Iy,hasWindow:Ly,onDidRegisterWindow:Ry,onWillUnregisterWindow:zy,onDidUnregisterWindow:By}=function(){let e=new Map,t={window:G_,disposables:new H_};e.set(G_.vscodeWindowId,t);let n=new q,r=new q,i=new q;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return U_.None;let a=new H_,o={window:t,disposables:a.add(new H_)};return e.set(t.vscodeWindowId,o),a.add(B_(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(J(t,Xy.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:G_},getDocument(e){return jy(e).document}}}(),Vy=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function J(e,t,n,r){return new Vy(e,t,n,r)}function Hy(e,t){return function(n){return t(new oy(e,n))}}function Uy(e){return function(t){return e(new ny(t))}}var Wy=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=Hy(jy(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=Uy(n)),J(e,t,i,r)},Gy,Ky=class extends fy{constructor(e){super(),this.defaultTarget=e&&jy(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},qy=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){m_(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(qy.sort),a.shift().execute();r.set(i,!1)};Gy=(t,r,a=0)=>{let o=Fy(t),s=new qy(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var Jy=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};Jy.None=new Jy(0,0);function Yy(e){let t=e.getBoundingClientRect(),n=jy(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=vy(n),a=r.get(i);if(a)a.users+=1;else{let o=new q,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(B_(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var Xy={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:_v?`webkitAnimationStart`:`animationstart`,ANIMATION_END:_v?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:_v?`webkitAnimationIteration`:`animationiteration`},Zy=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Qy(e,t,n,...r){let i=Zy.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function $y(e,t,...n){return Qy(`http://www.w3.org/1999/xhtml`,e,t,...n)}$y.SVG=function(e,t,...n){return Qy(`http://www.w3.org/2000/svg`,e,t,...n)};var eb=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=tb(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=tb(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=tb(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=tb(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=tb(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=tb(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=tb(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=tb(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=tb(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=tb(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=tb(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=tb(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=tb(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=tb(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function tb(e){return typeof e==`number`?`${e}px`:e}function nb(e){return new eb(e)}var rb=class{constructor(){this._hooks=new H_,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(B_(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=jy(e)}this._hooks.add(J(a,Xy.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(J(a,Xy.POINTER_UP,e=>this.stopMonitoring(!0)))}};function ib(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var ab;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(ab||={});var ob=class e extends U_{constructor(){super(),this.dispatched=!1,this.targets=new J_,this.ignoreTargets=new J_,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Z_.runAndSubscribe(Ry,({window:e,disposables:t})=>{t.add(J(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(J(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(J(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:G_,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=L_(new e),B_(e.INSTANCE.targets.push(t))):U_.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=L_(new e),B_(e.INSTANCE.ignoreTargets.push(t))):U_.None}static isTouchDevice(){return`ontouchstart`in G_||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(ab.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-C_(s.rollingPageX))<30&&Math.abs(s.initialPageY-C_(s.rollingPageY))<30){let e=this.newGestureEvent(ab.Tap,s.initialTarget);e.pageX=C_(s.rollingPageX),e.pageY=C_(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-C_(s.rollingPageX))<30&&Math.abs(s.initialPageY-C_(s.rollingPageY))<30){let e=this.newGestureEvent(ab.Contextmenu,s.initialTarget);e.pageX=C_(s.rollingPageX),e.pageY=C_(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=C_(s.rollingPageX),n=C_(s.rollingPageY),i=C_(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(ab.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===ab.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===ab.Change||t.type===ab.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=Gy(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(ab.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(ab.Change,i.initialTarget);a.translationX=r.pageX-C_(i.rollingPageX),a.translationY=r.pageY-C_(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};ob.SCROLL_FRICTION=-.005,ob.HOLD_DELAY=700,ob.CLEAR_TAP_COUNT_TIME=400,bg([ib],ob,`isTouchDevice`,1);var sb=ob,cb=class extends U_{onclick(e,t){this._register(J(e,Xy.CLICK,n=>t(new oy(jy(e),n))))}onmousedown(e,t){this._register(J(e,Xy.MOUSE_DOWN,n=>t(new oy(jy(e),n))))}onmouseover(e,t){this._register(J(e,Xy.MOUSE_OVER,n=>t(new oy(jy(e),n))))}onmouseleave(e,t){this._register(J(e,Xy.MOUSE_LEAVE,n=>t(new oy(jy(e),n))))}onkeydown(e,t){this._register(J(e,Xy.KEY_DOWN,e=>t(new ny(e))))}onkeyup(e,t){this._register(J(e,Xy.KEY_UP,e=>t(new ny(e))))}oninput(e,t){this._register(J(e,Xy.INPUT,t))}onblur(e,t){this._register(J(e,Xy.BLUR,t))}onfocus(e,t){this._register(J(e,Xy.FOCUS,t))}onchange(e,t){this._register(J(e,Xy.CHANGE,t))}ignoreGesture(e){return sb.ignoreTarget(e)}},lb=11,ub=class extends cb{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=lb+`px`,this.domNode.style.height=lb+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new rb),this._register(Wy(this.bgDomNode,Xy.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(Wy(this.domNode,Xy.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new Ky),this._pointerdownScheduleRepeatTimer=this._register(new dy)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,jy(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},db=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},fb=class extends U_{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new q),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new db(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new gb(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=gb.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},pb=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function mb(e,t){let n=t-e;return function(t){return e+n*vb(t)}}function hb(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var gb=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),hb(mb(e,r),mb(i,t),.33)}return mb(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new pb(this.scrollLeft(t),this.scrollTop(t),!1):new pb(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function _b(e){return e**3}function vb(e){return 1-_b(1-e)}var yb=class extends U_{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new dy)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3||this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},bb=140,xb=class extends cb{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new yb(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new rb),this._shouldRender=!0,this.domNode=nb(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(J(this.domNode.domNode,Xy.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new ub(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=nb(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(J(this.slider.domNode,Xy.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=Yy(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(Nv&&a>bb){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Sb=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize===t?!1:(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize===t?!1:(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition===t?!1:(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},Cb=class extends xb{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Sb(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},wb=class extends xb{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Sb(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Tb=500,Eb=50,Db=!0,Ob=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},kb=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(vv){let t=mv(jy(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new Ob(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};kb.INSTANCE=new kb;var Ab=kb,jb=class extends cb{constructor(e,t,n){super(),this._onScroll=this._register(new q),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new q),this.onWillScroll=this._onWillScroll.event,this._options=Nb(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new wb(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new Cb(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=nb(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=nb(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=nb(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new dy),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=R_(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Pv&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new sy(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=R_(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(J(this._listenOnDomNode,Xy.MOUSE_WHEEL,e=>{this._onMouseWheel(new sy(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Ab.INSTANCE;Db&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!Pv&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=Eb*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=Eb*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(Db&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Tb)}},Mb=class extends jb{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Nb(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,Pv&&(t.className+=` mac`),t}var Pb=class extends U_{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new fb({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>Gy(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Mb(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Z_.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(B_(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(B_(()=>this._styleElement.remove())),this._register(Z_.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
77
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Pb=bg([K(2,qg),K(3,o_),K(4,Jg),K(5,d_),K(6,$g),K(7,c_)],Pb);var Fb=class extends U_{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,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(B_(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Fb=bg([K(1,qg),K(2,o_),K(3,n_),K(4,c_)],Fb);var Ib=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Lb={full:0,left:0,center:0,right:0},Rb={full:0,left:0,center:0,right:0},zb={full:0,left:0,center:0,right:0},Bb=class extends U_{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new Ib,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(B_(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Rb.full=this._canvas.width,Rb.left=e,Rb.center=t,Rb.right=e,this._refreshDrawHeightConstants(),zb.full=1,zb.left=1,zb.center=1+Rb.left,zb.right=1+Rb.left+Rb.center}_refreshDrawHeightConstants(){Lb.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Lb.left=t,Lb.center=t,Lb.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Lb.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Lb.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Lb.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Lb.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(zb[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Lb[e.position||`full`]/2),Rb[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Lb[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Bb=bg([K(2,qg),K(3,n_),K(4,c_),K(5,$g),K(6,d_),K(7,o_)],Bb);var Y;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
78
+ `,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(Y||={});var Vb;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))(Vb||={});var Hb;(e=>e.ST=`${Y.ESC}\\`)(Hb||={});var Ub=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Y.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Ub=bg([K(2,qg),K(3,$g),K(4,Yg),K(5,c_)],Ub);var Wb=0,Gb=0,Kb=0,qb=0,Jb={css:`#00000000`,rgba:0},Yb;(e=>{function t(e,t,n,r){return r===void 0?`#${ex(e)}${ex(t)}${ex(n)}`:`#${ex(e)}${ex(t)}${ex(n)}${ex(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(Yb||={});var Xb;(e=>{function t(e,t){if(qb=(t.rgba&255)/255,qb===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return Wb=a+Math.round((n-a)*qb),Gb=o+Math.round((r-o)*qb),Kb=s+Math.round((i-s)*qb),{css:Yb.toCss(Wb,Gb,Kb),rgba:Yb.toRgba(Wb,Gb,Kb)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=$b.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return Yb.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[Wb,Gb,Kb]=$b.toChannels(t),{css:Yb.toCss(Wb,Gb,Kb),rgba:t}}e.opaque=i;function a(e,t){return qb=Math.round(t*255),[Wb,Gb,Kb]=$b.toChannels(e.rgba),{css:Yb.toCss(Wb,Gb,Kb,qb),rgba:Yb.toRgba(Wb,Gb,Kb,qb)}}e.opacity=a;function o(e,t){return qb=e.rgba&255,a(e,qb*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(Xb||={});var Zb;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return Wb=parseInt(e.slice(1,2).repeat(2),16),Gb=parseInt(e.slice(2,3).repeat(2),16),Kb=parseInt(e.slice(3,4).repeat(2),16),Yb.toColor(Wb,Gb,Kb);case 5:return Wb=parseInt(e.slice(1,2).repeat(2),16),Gb=parseInt(e.slice(2,3).repeat(2),16),Kb=parseInt(e.slice(3,4).repeat(2),16),qb=parseInt(e.slice(4,5).repeat(2),16),Yb.toColor(Wb,Gb,Kb,qb);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return Wb=parseInt(r[1]),Gb=parseInt(r[2]),Kb=parseInt(r[3]),qb=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),Yb.toColor(Wb,Gb,Kb,qb);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[Wb,Gb,Kb,qb]=t.getImageData(0,0,1,1).data,qb!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:Yb.toRgba(Wb,Gb,Kb,qb),css:e}}e.toColor=r})(Zb||={});var Qb;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(Qb||={});var $b;(e=>{function t(e,t){if(qb=(t&255)/255,qb===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return Wb=a+Math.round((n-a)*qb),Gb=o+Math.round((r-o)*qb),Kb=s+Math.round((i-s)*qb),Yb.toRgba(Wb,Gb,Kb)}e.blend=t;function n(e,t,n){let a=Qb.relativeLuminance(e>>8),o=Qb.relativeLuminance(t>>8);if(tx(a,o)<n){if(o<a){let o=r(e,t,n),s=tx(a,Qb.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>tx(a,Qb.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=tx(a,Qb.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>tx(a,Qb.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=tx(Qb.relativeLuminance2(o,s,c),Qb.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=tx(Qb.relativeLuminance2(o,s,c),Qb.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=tx(Qb.relativeLuminance2(o,s,c),Qb.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=tx(Qb.relativeLuminance2(o,s,c),Qb.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})($b||={});function ex(e){let t=e.toString(16);return t.length<2?`0`+t:t}function tx(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var nx=class extends Rg{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},rx=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Bg}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||Lg.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)rx._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||Lg.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};rx=bg([K(0,qg)],rx);function ix(e){return 57508<=e&&e<=57558}function ax(e){return 9472<=e&&e<=9631}function ox(e){return ix(e)||ax(e)}function sx(){return{css:{canvas:cx(),cell:cx()},device:{canvas:cx(),cell:cx(),char:{width:0,height:0,left:0,top:0}}}}function cx(){return{width:0,height:0}}var lx=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new Bg,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,w=!1,T=0,E=0,D=[],O=l!==-1&&u!==-1;for(let k=0;k<m;k++){e.loadCell(k,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let ee=!1,te=k>=E,A=k,j=this._workCell;if(f.length>0&&k===f[0][0]&&te){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)te&&=i===this._isCellInSelection(v,t);te&&=!n||a<r[0]||a>=r[1],te?(ee=!0,j=new nx(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),A=r[1]-1,m=j.getWidth()):E=r[1]}let M=this._isCellInSelection(k,t),ne=n&&k===a,N=O&&k>=l&&k<=u,P=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{P=!0});let re=j.getChars()||Lg;if(re===` `&&(j.isUnderline()||j.isOverline())&&(re=`\xA0`),T=m*s-c.get(re,j.isBold(),j.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(M&&w||!M&&!w&&j.bg===y)&&(M&&w&&p.selectionForeground||j.fg===b)&&j.extended.ext===x&&N===S&&T===C&&!ne&&!ee&&!P&&te){j.isInvisible()?_+=Lg:_+=re,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=j.bg,b=j.fg,x=j.extended.ext,S=N,C=T,w=M,ee&&a>=k&&a<=A&&(a=k),!this._coreService.isCursorHidden&&ne&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`);break;default:break}}if(j.isBold()&&D.push(`xterm-bold`),j.isItalic()&&D.push(`xterm-italic`),j.isDim()&&D.push(`xterm-dim`),_=j.isInvisible()?Lg:j.getChars()||Lg,j.isUnderline()&&(D.push(`xterm-underline-${j.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!j.isUnderlineColorDefault()))if(j.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${Rg.toColorRGB(j.getUnderlineColor()).join(`,`)})`;else{let e=j.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&j.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}j.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),j.isStrikethrough()&&D.push(`xterm-strikethrough`),N&&(h.style.textDecoration=`underline`);let ie=j.getFgColor(),ae=j.getFgColorMode(),F=j.getBgColor(),I=j.getBgColorMode(),L=!!j.isInverse();if(L){let e=ie;ie=F,F=e;let t=ae;ae=I,I=t}let oe,se,ce=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{e.options.layer!==`top`&&ce||(e.backgroundColorRGB&&(I=50331648,F=e.backgroundColorRGB.rgba>>8&16777215,oe=e.backgroundColorRGB),e.foregroundColorRGB&&(ae=50331648,ie=e.foregroundColorRGB.rgba>>8&16777215,se=e.foregroundColorRGB),ce=e.options.layer===`top`)}),!ce&&M&&(oe=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,F=oe.rgba>>8&16777215,I=50331648,ce=!0,p.selectionForeground&&(ae=50331648,ie=p.selectionForeground.rgba>>8&16777215,se=p.selectionForeground)),ce&&D.push(`xterm-decoration-top`);let le;switch(I){case 16777216:case 33554432:le=p.ansi[F],D.push(`xterm-bg-${F}`);break;case 50331648:le=Yb.toColor(F>>16,F>>8&255,F&255),this._addStyle(h,`background-color:#${ux((F>>>0).toString(16),`0`,6)}`);break;default:L?(le=p.foreground,D.push(`xterm-bg-257`)):le=p.background}switch(oe||j.isDim()&&(oe=Xb.multiplyOpacity(le,.5)),ae){case 16777216:case 33554432:j.isBold()&&ie<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ie+=8),this._applyMinimumContrast(h,le,p.ansi[ie],j,oe,void 0)||D.push(`xterm-fg-${ie}`);break;case 50331648:let e=Yb.toColor(ie>>16&255,ie>>8&255,ie&255);this._applyMinimumContrast(h,le,e,j,oe,se)||this._addStyle(h,`color:#${ux(ie.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,le,p.foreground,j,oe,se)||L&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!ne&&!ee&&!P&&te?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),k=A}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||ox(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=Xb.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};lx=bg([K(1,u_),K(2,$g),K(3,o_),K(4,Yg),K(5,n_),K(6,d_)],lx);function ux(e,t,n){for(;e.length<n;)e=t+e;return e}var dx=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},fx=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function px(){return new fx}var mx=`xterm-dom-renderer-owner-`,hx=`xterm-rows`,gx=`xterm-fg-`,_x=`xterm-bg-`,vx=`xterm-focus`,yx=`xterm-selection`,bx=1,xx=class extends U_{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=bx++,this._rowElements=[],this._selectionRenderModel=px(),this.onRequestRedraw=this._register(new q).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(hx),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(yx),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=sx(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(lx,document),this._element.classList.add(mx+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(B_(()=>{this._element.classList.remove(mx+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new dx(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${hx} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${hx} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${hx} .xterm-dim { color: ${Xb.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${hx}.${vx} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${hx}.${vx} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${hx}.${vx} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${hx} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${hx} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${hx} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${hx} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${hx} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${yx} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${yx} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${yx} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${gx}${n} { color: ${r.css}; }${this._terminalSelector} .${gx}${n}.xterm-dim { color: ${Xb.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${_x}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${gx}257 { color: ${Xb.opaque(e.background).css}; }${this._terminalSelector} .${gx}257.xterm-dim { color: ${Xb.multiplyOpacity(Xb.opaque(e.background),.5).css}; }${this._terminalSelector} .${_x}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(vx),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(vx),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${mx}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};xx=bg([K(7,Zg),K(8,a_),K(9,$g),K(10,qg),K(11,Yg),K(12,o_),K(13,d_)],xx);var Sx=class extends U_{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new q),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Tx(this._optionsService))}catch{this._measureStrategy=this._register(new wx(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Sx=bg([K(2,$g)],Sx);var Cx=class extends U_{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},wx=class extends Cx{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,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}},Tx=class extends Cx{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},Ex=class extends U_{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Dx(this._window)),this._onDprChange=this._register(new q),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new q),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(Z_.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(J(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(J(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Dx=class extends U_{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new W_),this._onDprChange=this._register(new q),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(B_(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=J(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},Ox=class extends U_{constructor(){super(),this.linkProviders=[],this._register(B_(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function kx(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function Ax(e,t,n,r,i,a,o,s,c){if(!a)return;let l=kx(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var jx=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return Ax(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=kx(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};jx=bg([K(0,c_),K(1,a_)],jx);var Mx=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Nx={};yg(Nx,{getSafariVersion:()=>Bx,isChromeOS:()=>Kx,isFirefox:()=>Lx,isIpad:()=>Hx,isIphone:()=>Ux,isLegacyEdge:()=>Rx,isLinux:()=>Gx,isMac:()=>Vx,isNode:()=>Px,isSafari:()=>zx,isWindows:()=>Wx});var Px=typeof process<`u`&&`title`in process,Fx=Px?`node`:navigator.userAgent,Ix=Px?`node`:navigator.platform,Lx=Fx.includes(`Firefox`),Rx=Fx.includes(`Edge`),zx=/^((?!chrome|android).)*safari/i.test(Fx);function Bx(){if(!zx)return 0;let e=Fx.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Vx=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(Ix),Hx=Ix===`iPad`,Ux=Ix===`iPhone`,Wx=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(Ix),Gx=Ix.indexOf(`Linux`)>=0,Kx=/\bCrOS\b/.test(Fx),qx=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},Jx=class extends qx{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Yx=class extends qx{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Xx=!Px&&`requestIdleCallback`in window?Yx:Jx,Zx=class{constructor(){this._queue=new Xx}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Qx=class extends U_{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new W_),this._pausedResizeTask=new Zx,this._observerDisposable=this._register(new W_),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 q),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new q),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new q),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new q),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Mx((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new $x(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(B_(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=B_(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Qx=bg([K(2,$g),K(3,a_),K(4,Yg),K(5,n_),K(6,qg),K(7,o_),K(8,d_)],Qx);var $x=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function eS(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return rS(i,a,e,t,n,r)+iS(a,t,n,r)+aS(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,fS(Math.abs(i-e),dS(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return fS(nS(a>t?e:i,n)+(s-1)*n.cols+1+tS(a>t?i:e,n),dS(o,r))}function tS(e,t){return e-1}function nS(e,t){return t.cols-e}function rS(e,t,n,r,i,a){return iS(t,r,i,a).length===0?``:fS(uS(e,t,e,t-sS(t,i),!1,i).length,dS(`D`,a))}function iS(e,t,n,r){let i=e-sS(e,n),a=t-sS(t,n);return fS(Math.abs(i-a)-oS(e,t,n),dS(lS(e,t),r))}function aS(e,t,n,r,i,a){let o;o=iS(t,r,i,a).length>0?r-sS(r,i):t;let s=r,c=cS(e,t,n,r,i,a);return fS(uS(e,o,n,s,c===`C`,i).length,dS(c,a))}function oS(e,t,n){let r=0,i=e-sS(e,n),a=t-sS(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=lS(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function sS(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function cS(e,t,n,r,i,a){let o;return o=iS(n,r,i,a).length>0?r-sS(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function lS(e,t){return e>t?`A`:`B`}function uS(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function dS(e,t){let n=t?`O`:`[`;return Y.ESC+n+e}function fS(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var pS=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function mS(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var hS=50,gS=15,_S=50,vS=500,yS=RegExp(`\xA0`,`g`),bS=class extends U_{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Bg,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new q),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new q),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new q),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new pS(this._bufferService),this._activeSelectionMode=0,this._register(B_(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(yS,` `)).join(Wx?`\r
79
+ `:`
80
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),Gx&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=mS(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=kx(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-hS),hS),t/=hS,t/Math.abs(t)+Math.round(t*(gS-1)))}shouldForceSelection(e){return Vx?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),_S)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Vx&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<vS&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=eS(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=mS(n,this._bufferService.cols)}};bS=bg([K(3,qg),K(4,Yg),K(5,s_),K(6,$g),K(7,c_),K(8,o_)],bS);var xS=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},SS=class{constructor(){this._color=new xS,this._css=new xS}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},CS=Object.freeze((()=>{let e=[Zb.toColor(`#2e3436`),Zb.toColor(`#cc0000`),Zb.toColor(`#4e9a06`),Zb.toColor(`#c4a000`),Zb.toColor(`#3465a4`),Zb.toColor(`#75507b`),Zb.toColor(`#06989a`),Zb.toColor(`#d3d7cf`),Zb.toColor(`#555753`),Zb.toColor(`#ef2929`),Zb.toColor(`#8ae234`),Zb.toColor(`#fce94f`),Zb.toColor(`#729fcf`),Zb.toColor(`#ad7fa8`),Zb.toColor(`#34e2e2`),Zb.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:Yb.toCss(r,i,a),rgba:Yb.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:Yb.toCss(n,n,n),rgba:Yb.toRgba(n,n,n)})}return e})()),wS=Zb.toColor(`#ffffff`),TS=Zb.toColor(`#000000`),ES=Zb.toColor(`#ffffff`),DS=TS,OS={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},kS=wS,AS=class extends U_{constructor(e){super(),this._optionsService=e,this._contrastCache=new SS,this._halfContrastCache=new SS,this._onChangeColors=this._register(new q),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:wS,background:TS,cursor:ES,cursorAccent:DS,selectionForeground:void 0,selectionBackgroundTransparent:OS,selectionBackgroundOpaque:Xb.blend(TS,OS),selectionInactiveBackgroundTransparent:OS,selectionInactiveBackgroundOpaque:Xb.blend(TS,OS),scrollbarSliderBackground:Xb.opacity(wS,.2),scrollbarSliderHoverBackground:Xb.opacity(wS,.4),scrollbarSliderActiveBackground:Xb.opacity(wS,.5),overviewRulerBorder:wS,ansi:CS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=jS(e.foreground,wS),t.background=jS(e.background,TS),t.cursor=Xb.blend(t.background,jS(e.cursor,ES)),t.cursorAccent=Xb.blend(t.background,jS(e.cursorAccent,DS)),t.selectionBackgroundTransparent=jS(e.selectionBackground,OS),t.selectionBackgroundOpaque=Xb.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=jS(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Xb.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?jS(e.selectionForeground,Jb):void 0,t.selectionForeground===Jb&&(t.selectionForeground=void 0),Xb.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Xb.opacity(t.selectionBackgroundTransparent,.3)),Xb.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Xb.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=jS(e.scrollbarSliderBackground,Xb.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=jS(e.scrollbarSliderHoverBackground,Xb.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=jS(e.scrollbarSliderActiveBackground,Xb.opacity(t.foreground,.5)),t.overviewRulerBorder=jS(e.overviewRulerBorder,kS),t.ansi=CS.slice(),t.ansi[0]=jS(e.black,CS[0]),t.ansi[1]=jS(e.red,CS[1]),t.ansi[2]=jS(e.green,CS[2]),t.ansi[3]=jS(e.yellow,CS[3]),t.ansi[4]=jS(e.blue,CS[4]),t.ansi[5]=jS(e.magenta,CS[5]),t.ansi[6]=jS(e.cyan,CS[6]),t.ansi[7]=jS(e.white,CS[7]),t.ansi[8]=jS(e.brightBlack,CS[8]),t.ansi[9]=jS(e.brightRed,CS[9]),t.ansi[10]=jS(e.brightGreen,CS[10]),t.ansi[11]=jS(e.brightYellow,CS[11]),t.ansi[12]=jS(e.brightBlue,CS[12]),t.ansi[13]=jS(e.brightMagenta,CS[13]),t.ansi[14]=jS(e.brightCyan,CS[14]),t.ansi[15]=jS(e.brightWhite,CS[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=jS(e.extendedAnsi[r],CS[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};AS=bg([K(0,$g)],AS);function jS(e,t){if(e!==void 0)try{return Zb.toColor(e)}catch{}return t}var MS=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},NS=class{constructor(){this._services=new MS,this._services.set(Zg,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Wg(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},PS={trace:0,debug:1,info:2,warn:3,error:4,off:5},FS=`xterm.js: `,IS=class extends U_{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),LS=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=PS[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:FS)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};IS=bg([K(0,$g)],IS);var LS,RS=class extends U_{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new q),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new q),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new q),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},zS=3,BS=Object.freeze(new Rg),VS=0,HS=2,US=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*zS);let r=t||Bg.fromCharData([0,Ig,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*zS+0],n=t&2097151;return[this._data[e*zS+1],t&2097152?this._combined[e]:n?Mg(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*zS+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*zS+0]=e|2097152|t[2]<<22):this._data[e*zS+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*zS+0]>>22}hasWidth(e){return this._data[e*zS+0]&12582912}getFg(e){return this._data[e*zS+1]}getBg(e){return this._data[e*zS+2]}hasContent(e){return this._data[e*zS+0]&4194303}getCodePoint(e){let t=this._data[e*zS+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*zS+0]&2097152}getString(e){let t=this._data[e*zS+0];return t&2097152?this._combined[e]:t&2097151?Mg(t&2097151):``}isProtected(e){return this._data[e*zS+2]&536870912}loadCell(e,t){return VS=e*zS,t.content=this._data[VS+0],t.fg=this._data[VS+1],t.bg=this._data[VS+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*zS+0]=t.content,this._data[e*zS+1]=t.fg,this._data[e*zS+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*zS+0]=t|n<<22,this._data[e*zS+1]=r.fg,this._data[e*zS+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*zS+0];r&2097152?this._combined[e]+=Mg(t):r&2097151?(this._combined[e]=Mg(r&2097151)+Mg(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*zS+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new Bg;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new Bg;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*HS<this._data.buffer.byteLength;let n=e*zS;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*HS<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*HS<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*zS+0]&4194303)return e+(this._data[e*zS+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*zS+0]&4194303||this._data[e*zS+2]&50331648)return e+(this._data[e*zS+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<zS;e++)this._data[(n+i)*zS+e]=a[(t+i)*zS+e];a[(t+i)*zS+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<zS;e++)this._data[(n+i)*zS+e]=a[(t+i)*zS+e];a[(t+i)*zS+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*zS+0],n=e&2097151,a=e&2097152?this._combined[t]:n?Mg(n):Lg;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function WS(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=JS(u,d,t),p=1,m=0;for(;p<u.length;){let e=JS(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function GS(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function KS(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function qS(e,t,n){let r=[],i=e.map((n,r)=>JS(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=JS(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function JS(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var YS=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new q),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),R_(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};YS._nextId=1;var XS=YS,ZS={},QS=ZS.B;ZS[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},ZS.A={"#":`£`},ZS.B=void 0,ZS[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},ZS.C=ZS[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},ZS.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},ZS.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},ZS.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},ZS.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},ZS.E=ZS[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},ZS.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},ZS.H=ZS[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},ZS[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var $S=4294967295,eC=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=BS.clone(),this.savedCharset=QS,this.markers=[],this._nullCell=Bg.fromCharData([0,Ig,1,0]),this._whitespaceCell=Bg.fromCharData([0,Lg,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Xx,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new RS(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new zg),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new zg),this._whitespaceCell}getBlankLine(e,t){return new US(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>$S?$S:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=BS);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new RS(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(BS),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new US(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new US(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=WS(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(BS),n);if(r.length>0){let n=GS(this.lines,r);KS(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(BS),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new US(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(BS),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=qS(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(BS,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=JS(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new XS(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},tC=class extends U_{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new q),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 eC(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new eC(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},nC=2,rC=1,iC=class extends U_{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new q),this.onResize=this._onResize.event,this._onScroll=this._register(new q),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,nC),this.rows=Math.max(e.rawOptions.rows||0,rC),this.buffers=this._register(new tC(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};iC=bg([K(0,$g)],iC);var aC={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Vx,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},oC=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],sC=class extends U_{constructor(e){super(),this._onOptionChange=this._register(new q),this.onOptionChange=this._onOptionChange.event;let t={...aC};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(B_(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in aC))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in aC))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=aC[e],!cC(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=aC[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=oC.includes(t)?t:aC[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={};break}return t}};function cC(e){return e===`block`||e===`underline`||e===`bar`}function lC(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&lC(e[r],t-1);return n}var uC=Object.freeze({insertMode:!1}),dC=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),fC=class extends U_{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new q),this.onData=this._onData.event,this._onUserInput=this._register(new q),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new q),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new q),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=lC(uC),this.decPrivateModes=lC(dC)}reset(){this.modes=lC(uC),this.decPrivateModes=lC(dC)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};fC=bg([K(0,qg),K(1,Qg),K(2,$g)],fC);var pC={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function mC(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var hC=String.fromCharCode,gC={DEFAULT:e=>{let t=[mC(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${hC(t[0])}${hC(t[1])}${hC(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${mC(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${mC(e,!0)};${e.x};${e.y}${t}`}},_C=class extends U_{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new q),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(pC))this.addProtocol(e,pC[e]);for(let e of Object.keys(gC))this.addEncoding(e,gC[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};_C=bg([K(0,qg),K(1,Yg),K(2,$g)],_C);var vC=[[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]],yC=[[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]],bC;function xC(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var SC=class{constructor(){if(this.version=`6`,!bC){bC=new Uint8Array(65536),bC.fill(1),bC[0]=0,bC.fill(0,1,32),bC.fill(0,127,160),bC.fill(2,4352,4448),bC[9001]=2,bC[9002]=2,bC.fill(2,11904,42192),bC[12351]=1,bC.fill(2,44032,55204),bC.fill(2,63744,64256),bC.fill(2,65040,65050),bC.fill(2,65072,65136),bC.fill(2,65280,65377),bC.fill(2,65504,65511);for(let e=0;e<vC.length;++e)bC.fill(0,vC[e][0],vC[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?bC[e]:xC(e,yC)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=CC.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return CC.createPropertyValue(0,n,r)}},CC=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new q,this.onChange=this._onChange.event;let e=new SC;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},wC=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function TC(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var EC=2147483647,DC=256,OC=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>DC)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>EC?EC:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>EC?EC:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,EC):e}},kC=[],AC=class{constructor(){this._state=0,this._active=kC,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=kC}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=kC,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||kC,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,Ng(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=kC,this._id=-1,this._state=0}}},jC=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Ng(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},MC=[],NC=class{constructor(){this._handlers=Object.create(null),this._active=MC,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=MC}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=MC,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||MC,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,Ng(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=MC,this._ident=0}},PC=new OC;PC.addParam(0);var FC=class{constructor(e){this._handler=e,this._data=``,this._params=PC,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():PC,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Ng(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=PC,this._data=``,this._hitLimit=!1,e));return this._params=PC,this._data=``,this._hitLimit=!1,t}},IC=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},LC=160,RC=function(){let e=new IC(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(LC,0,2,0),e.add(LC,8,5,8),e.add(LC,6,0,6),e.add(LC,11,0,11),e.add(LC,13,13,13),e}(),zC=class extends U_{constructor(e=RC){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new OC,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(B_(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new AC),this._dcsParser=this._register(new NC),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:LC)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<LC){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<LC){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<LC){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<LC){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<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(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<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 i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<LC){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<LC){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},BC=/^([\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})$/,VC=/^[\da-f]+$/;function HC(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=BC.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),VC.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function UC(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function WC(e,t=16){let[n,r,i]=e;return`rgb:${UC(n,t)}/${UC(r,t)}/${UC(i,t)}`}var GC={"(":0,")":1,"*":2,"+":3,"-":1,".":2},KC=131072,qC=10;function JC(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var YC=5e3,XC=0,ZC=class extends U_{constructor(e,t,n,r,i,a,o,s,c=new zC){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Pg,this._utf8Decoder=new Fg,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=BS.clone(),this._eraseAttrDataInternal=BS.clone(),this._onRequestBell=this._register(new q),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new q),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new q),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new q),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new q),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new q),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new q),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new q),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new q),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new q),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new q),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new q),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new q),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 QC(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(Y.BEL,()=>this.bell()),this._parser.setExecuteHandler(Y.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Y.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Y.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Y.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Y.BS,()=>this.backspace()),this._parser.setExecuteHandler(Y.HT,()=>this.tab()),this._parser.setExecuteHandler(Y.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Y.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Vb.IND,()=>this.index()),this._parser.setExecuteHandler(Vb.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Vb.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new jC(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new jC(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new jC(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new jC(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new jC(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new jC(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new jC(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new jC(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new jC(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new jC(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new jC(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new jC(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in ZS)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new FC((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),YC))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${YC} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>KC&&(a=this._parseStack.position+KC)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<KC&&(this._parseBuffer=new Uint32Array(Math.min(e.length,KC))),o||this._dirtyRowTracker.clearRange(),e.length>KC)for(let t=a;t<e.length;t+=KC){let a=t+KC<e.length?t+KC:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=CC.extractWidth(t);let n=CC.extractShouldJoin(t),m=n?CC.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(Mg(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof US&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!JC(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new FC(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new jC(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(BS));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=CC.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(Y.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(Y.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(Y.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(Y.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(Y.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,QS),this._charsetService.setgCharset(1,QS),this._charsetService.setgCharset(2,QS),this._charsetService.setgCharset(3,QS);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${Y.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Rg.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=BS.fg,e.bg=BS.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=BS.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=BS.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=BS.fg&16777215,r.bg&=-67108864,r.bg|=BS.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Y.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Y.ESC}[${e};${t}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Y.ESC}[?${e};${t}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=BS.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`;break}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!JC(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Y.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>qC&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>qC&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if($C(n))if(r===`?`)t.push({type:0,index:n});else{let e=HC(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=HC(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);$C(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,QS),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(GC[e[0]],ZS[e[1]]||QS),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=BS.clone(),this._eraseAttrDataInternal=BS.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Bg;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${Y.ESC}${e}${Y.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},QC=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(XC=e,e=t,t=XC),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};QC=bg([K(0,qg)],QC);function $C(e){return 0<=e&&e<256}var ew=5e7,tw=12,nw=50,rw=class extends U_{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new q),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>ew)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=tw?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=tw)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>nw&&(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()}},iw=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};iw=bg([K(0,qg)],iw);var aw=!1,ow=class extends U_{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new W_),this._onBinary=this._register(new q),this.onBinary=this._onBinary.event,this._onData=this._register(new q),this.onData=this._onData.event,this._onLineFeed=this._register(new q),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new q),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new q),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new q),this._instantiationService=new NS,this.optionsService=this._register(new sC(e)),this._instantiationService.setService($g,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(iC)),this._instantiationService.setService(qg,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(IS)),this._instantiationService.setService(Qg,this._logService),this.coreService=this._register(this._instantiationService.createInstance(fC)),this._instantiationService.setService(Yg,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(_C)),this._instantiationService.setService(Jg,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(CC)),this._instantiationService.setService(t_,this.unicodeService),this._charsetService=this._instantiationService.createInstance(wC),this._instantiationService.setService(Xg,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(iw),this._instantiationService.setService(e_,this._oscLinkService),this._inputHandler=this._register(new ZC(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Z_.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Z_.forward(this._bufferService.onResize,this._onResize)),this._register(Z_.forward(this.coreService.onData,this._onData)),this._register(Z_.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new rw((e,t)=>this._inputHandler.parse(e,t))),this._register(Z_.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new q),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!aw&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),aw=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,nC),t=Math.max(t,rC),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(TC.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(TC(this._bufferService),!1))),this._windowsWrappingHeuristics.value=B_(()=>{for(let t of e)t.dispose()})}}},sw={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function cw(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?t?i.key=Y.ESC+`OA`:i.key=Y.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?t?i.key=Y.ESC+`OD`:i.key=Y.ESC+`[D`:e.key===`UIKeyInputRightArrow`?t?i.key=Y.ESC+`OC`:i.key=Y.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(t?i.key=Y.ESC+`OB`:i.key=Y.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:Y.DEL,e.altKey&&(i.key=Y.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Y.ESC+`[Z`;break}i.key=Y.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Y.ESC+Y.CR:Y.CR,i.cancel=!0;break;case 27:i.key=Y.ESC,e.altKey&&(i.key=Y.ESC+Y.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;a?i.key=Y.ESC+`[1;`+(a+1)+`D`:t?i.key=Y.ESC+`OD`:i.key=Y.ESC+`[D`;break;case 39:if(e.metaKey)break;a?i.key=Y.ESC+`[1;`+(a+1)+`C`:t?i.key=Y.ESC+`OC`:i.key=Y.ESC+`[C`;break;case 38:if(e.metaKey)break;a?i.key=Y.ESC+`[1;`+(a+1)+`A`:t?i.key=Y.ESC+`OA`:i.key=Y.ESC+`[A`;break;case 40:if(e.metaKey)break;a?i.key=Y.ESC+`[1;`+(a+1)+`B`:t?i.key=Y.ESC+`OB`:i.key=Y.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Y.ESC+`[2~`);break;case 46:a?i.key=Y.ESC+`[3;`+(a+1)+`~`:i.key=Y.ESC+`[3~`;break;case 36:a?i.key=Y.ESC+`[1;`+(a+1)+`H`:t?i.key=Y.ESC+`OH`:i.key=Y.ESC+`[H`;break;case 35:a?i.key=Y.ESC+`[1;`+(a+1)+`F`:t?i.key=Y.ESC+`OF`:i.key=Y.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=Y.ESC+`[5;`+(a+1)+`~`:i.key=Y.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=Y.ESC+`[6;`+(a+1)+`~`:i.key=Y.ESC+`[6~`;break;case 112:a?i.key=Y.ESC+`[1;`+(a+1)+`P`:i.key=Y.ESC+`OP`;break;case 113:a?i.key=Y.ESC+`[1;`+(a+1)+`Q`:i.key=Y.ESC+`OQ`;break;case 114:a?i.key=Y.ESC+`[1;`+(a+1)+`R`:i.key=Y.ESC+`OR`;break;case 115:a?i.key=Y.ESC+`[1;`+(a+1)+`S`:i.key=Y.ESC+`OS`;break;case 116:a?i.key=Y.ESC+`[15;`+(a+1)+`~`:i.key=Y.ESC+`[15~`;break;case 117:a?i.key=Y.ESC+`[17;`+(a+1)+`~`:i.key=Y.ESC+`[17~`;break;case 118:a?i.key=Y.ESC+`[18;`+(a+1)+`~`:i.key=Y.ESC+`[18~`;break;case 119:a?i.key=Y.ESC+`[19;`+(a+1)+`~`:i.key=Y.ESC+`[19~`;break;case 120:a?i.key=Y.ESC+`[20;`+(a+1)+`~`:i.key=Y.ESC+`[20~`;break;case 121:a?i.key=Y.ESC+`[21;`+(a+1)+`~`:i.key=Y.ESC+`[21~`;break;case 122:a?i.key=Y.ESC+`[23;`+(a+1)+`~`:i.key=Y.ESC+`[23~`;break;case 123:a?i.key=Y.ESC+`[24;`+(a+1)+`~`:i.key=Y.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Y.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Y.DEL:e.keyCode===219?i.key=Y.ESC:e.keyCode===220?i.key=Y.FS:e.keyCode===221&&(i.key=Y.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=sw[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=Y.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=Y.ESC+n}else if(e.keyCode===32)i.key=Y.ESC+(e.ctrlKey?Y.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=Y.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=Y.US),e.key===`@`&&(i.key=Y.NUL));break}return i}var lw=0,uw=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Xx,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Xx,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(lw=this._search(t),lw===-1)||this._getKey(this._array[lw])!==t)return!1;do if(this._array[lw]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(lw),!0;while(++lw<this._array.length&&this._getKey(this._array[lw])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(lw=this._search(e),!(lw<0||lw>=this._array.length)&&this._getKey(this._array[lw])===e))do yield this._array[lw];while(++lw<this._array.length&&this._getKey(this._array[lw])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(lw=this._search(e),!(lw<0||lw>=this._array.length)&&this._getKey(this._array[lw])===e))do t(this._array[lw]);while(++lw<this._array.length&&this._getKey(this._array[lw])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},dw=0,fw=0,pw=class extends U_{constructor(){super(),this._decorations=new uw(e=>e?.marker.line),this._onDecorationRegistered=this._register(new q),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new q),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(B_(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new mw(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{dw=t.options.x??0,fw=dw+(t.options.width??1),e>=dw&&e<fw&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},mw=class extends H_{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new q),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new q),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Zb.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Zb.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},hw=1e3,gw=class{constructor(e,t=hw){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},_w=20,vw=class extends U_{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new gw(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
81
+ `))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(J(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(B_(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<_w+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
82
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===_w+1&&(this._liveRegion.textContent+=wg.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};vw=bg([K(1,Zg),K(2,o_),K(3,c_)],vw);var yw=class extends U_{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new q),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new q),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(B_(()=>{R_(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(J(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(J(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(J(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(J(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&bw(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,R_(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};yw=bg([K(1,s_),K(2,c_),K(3,qg),K(4,f_)],yw);function bw(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var xw=class extends ow{constructor(e={}){super(e),this._linkifier=this._register(new W_),this.browser=Nx,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new W_),this._onCursorMove=this._register(new q),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new q),this.onKey=this._onKey.event,this._onRender=this._register(new q),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new q),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new q),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new q),this.onBell=this._onBell.event,this._onFocus=this._register(new q),this._onBlur=this._register(new q),this._onA11yCharEmitter=this._register(new q),this._onA11yTabEmitter=this._register(new q),this._onWillOpen=this._register(new q),this._setup(),this._decorationService=this._instantiationService.createInstance(pw),this._instantiationService.setService(n_,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Ox),this._instantiationService.setService(f_,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(r_)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(Z_.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Z_.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Z_.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Z_.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(B_(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=Xb.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${Y.ESC}]${n};${WC(r)}${Hb.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=Yb.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=Yb.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(vw,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(J(this.element,`copy`,e=>{this.hasSelection()&&Dg(e,this._selectionService)}));let e=e=>Og(e,this.textarea,this.coreService,this.optionsService);this._register(J(this.textarea,`paste`,e)),this._register(J(this.element,`paste`,e)),Lx?this._register(J(this.element,`mousedown`,e=>{e.button===2&&jg(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(J(this.element,`contextmenu`,e=>{jg(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Gx&&this._register(J(this.element,`auxclick`,e=>{e.button===1&&Ag(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(J(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(J(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(J(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(J(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(J(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(J(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(J(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(J(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,Sg.get()),Kx||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Ex,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(o_,this._coreBrowserService),this._register(J(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(J(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Sx,this._document,this._helperContainer),this._instantiationService.setService(a_,this._charSizeService),this._themeService=this._instantiationService.createInstance(AS),this._instantiationService.setService(d_,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(rx),this._instantiationService.setService(u_,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Qx,this.rows,this.screenElement)),this._instantiationService.setService(c_,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(Ub,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(jx),this._instantiationService.setService(s_,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(yw,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Pb,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(bS,this.element,this.screenElement,r)),this._instantiationService.setService(l_,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(Z_.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Fb,this.screenElement)),this._register(J(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),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(vw,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Bb,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Bb,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(xx,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),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()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(J(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(J(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=Y.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){kg(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=cw(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Y.ETX||n.key===Y.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Sw(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(BS));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(Y.ESC+`[I`):this.coreService.triggerDataEvent(Y.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.ESC}[6;${r};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Sw(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Cw=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},ww=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Bg)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Tw=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new ww(t)}getNullCell(){return new Bg}},Ew=class extends U_{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new q),this.onBufferChange=this._onBufferChange.event,this._normal=new Tw(this._core.buffers.normal,`normal`),this._alternate=new Tw(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 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)}},Dw=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},Ow=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},kw=[`cols`,`rows`],Aw=0,jw=class extends U_{constructor(e){super(),this._core=this._register(new xw(e)),this._addonManager=this._register(new Cw),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(kw.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw 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||=new Dw(this._core),this._parser}get unicode(){return this._checkProposedApi(),new Ow(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._register(new Ew(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`;break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
83
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Sg.get()},set promptLabel(e){Sg.set(e)},get tooMuchOutput(){return wg.get()},set tooMuchOutput(e){wg.set(e)}}}_verifyIntegers(...e){for(Aw of e)if(Aw===1/0||isNaN(Aw)||Aw%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Aw of e)if(Aw&&(Aw===1/0||isNaN(Aw)||Aw%1!=0||Aw<0))throw Error(`This API only accepts positive integers`)}},Mw=Object.create(null);Mw.open=`0`,Mw.close=`1`,Mw.ping=`2`,Mw.pong=`3`,Mw.message=`4`,Mw.upgrade=`5`,Mw.noop=`6`;var Nw=Object.create(null);Object.keys(Mw).forEach(e=>{Nw[Mw[e]]=e});var Pw={type:`error`,data:`parser error`},Fw=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,Iw=typeof ArrayBuffer==`function`,Lw=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Rw=({type:e,data:t},n,r)=>Fw&&t instanceof Blob?n?r(t):zw(t,r):Iw&&(t instanceof ArrayBuffer||Lw(t))?n?r(t):zw(new Blob([t]),r):r(Mw[e]+(t||``)),zw=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function Bw(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var Vw;function Hw(e,t){if(Fw&&e.data instanceof Blob)return e.data.arrayBuffer().then(Bw).then(t);if(Iw&&(e.data instanceof ArrayBuffer||Lw(e.data)))return t(Bw(e.data));Rw(e,!1,e=>{Vw||=new TextEncoder,t(Vw.encode(e))})}var Uw=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ww=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)Ww[Uw.charCodeAt(e)]=e;var Gw=e=>{let t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);let l=new ArrayBuffer(t),u=new Uint8Array(l);for(r=0;r<n;r+=4)a=Ww[e.charCodeAt(r)],o=Ww[e.charCodeAt(r+1)],s=Ww[e.charCodeAt(r+2)],c=Ww[e.charCodeAt(r+3)],u[i++]=a<<2|o>>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},Kw=typeof ArrayBuffer==`function`,qw=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:Yw(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:Jw(e.substring(1),t)}:Nw[n]?e.length>1?{type:Nw[n],data:e.substring(1)}:{type:Nw[n]}:Pw},Jw=(e,t)=>Kw?Yw(Gw(e),t):{base64:!0,data:e},Yw=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},Xw=``,Zw=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{Rw(e,!1,e=>{r[a]=e,++i===n&&t(r.join(Xw))})})},Qw=(e,t)=>{let n=e.split(Xw),r=[];for(let e=0;e<n.length;e++){let i=qw(n[e],t);if(r.push(i),i.type===`error`)break}return r};function $w(){return new TransformStream({transform(e,t){Hw(e,n=>{let r=n.length,i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);let e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);let e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!=`string`&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}var eT;function tT(e){return e.reduce((e,t)=>e+t.length,0)}function nT(e,t){if(e[0].length===t)return e.shift();let n=new Uint8Array(t),r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function rT(e,t){eT||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(tT(n)<1)break;let e=nT(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(tT(n)<2)break;let e=nT(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(tT(n)<8)break;let e=nT(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(Pw);break}i=a*2**32+t.getUint32(4),r=3}else{if(tT(n)<i)break;let e=nT(n,i);s.enqueue(qw(a?e:eT.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(Pw);break}}}})}function iT(e){if(e)return aT(e)}function aT(e){for(var t in iT.prototype)e[t]=iT.prototype[t];return e}iT.prototype.on=iT.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},iT.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},iT.prototype.off=iT.prototype.removeListener=iT.prototype.removeAllListeners=iT.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks[`$`+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks[`$`+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks[`$`+e],this},iT.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),n=this._callbacks[`$`+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},iT.prototype.emitReserved=iT.prototype.emit,iT.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},iT.prototype.hasListeners=function(e){return!!this.listeners(e).length};var oT=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),sT=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),cT=`arraybuffer`;function lT(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var uT=sT.setTimeout,dT=sT.clearTimeout;function fT(e,t){t.useNativeTimers?(e.setTimeoutFn=uT.bind(sT),e.clearTimeoutFn=dT.bind(sT)):(e.setTimeoutFn=sT.setTimeout.bind(sT),e.clearTimeoutFn=sT.clearTimeout.bind(sT))}var pT=1.33;function mT(e){return typeof e==`string`?hT(e):Math.ceil((e.byteLength||e.size)*pT)}function hT(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function gT(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function _T(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function vT(e){let t={},n=e.split(`&`);for(let e=0,r=n.length;e<r;e++){let r=n[e].split(`=`);t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}var yT=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},bT=class extends iT{constructor(e){super(),this.writable=!1,fT(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved(`error`,new yT(e,t,n)),this}open(){return this.readyState=`opening`,this.doOpen(),this}close(){return(this.readyState===`opening`||this.readyState===`open`)&&(this.doClose(),this.onClose()),this}send(e){this.readyState===`open`&&this.write(e)}onOpen(){this.readyState=`open`,this.writable=!0,super.emitReserved(`open`)}onData(e){let t=qw(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved(`packet`,e)}onClose(e){this.readyState=`closed`,super.emitReserved(`close`,e)}pause(e){}createUri(e,t={}){return e+`://`+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(`:`)===-1?e:`[`+e+`]`}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?`:`+this.opts.port:``}_query(e){let t=_T(e);return t.length?`?`+t:``}},xT=class extends bT{constructor(){super(...arguments),this._polling=!1}get name(){return`polling`}doOpen(){this._poll()}pause(e){this.readyState=`pausing`;let t=()=>{this.readyState=`paused`,e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once(`pollComplete`,function(){--e||t()})),this.writable||(e++,this.once(`drain`,function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved(`poll`)}onData(e){Qw(e,this.socket.binaryType).forEach(e=>{if(this.readyState===`opening`&&e.type===`open`&&this.onOpen(),e.type===`close`)return this.onClose({description:`transport closed by the server`}),!1;this.onPacket(e)}),this.readyState!==`closed`&&(this._polling=!1,this.emitReserved(`pollComplete`),this.readyState===`open`&&this._poll())}doClose(){let e=()=>{this.write([{type:`close`}])};this.readyState===`open`?e():this.once(`open`,e)}write(e){this.writable=!1,Zw(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved(`drain`)})})}uri(){let e=this.opts.secure?`https`:`http`,t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=gT()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},ST=!1;try{ST=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var CT=ST;function wT(){}var TT=class extends xT{constructor(e){if(super(e),typeof location<`u`){let t=location.protocol===`https:`,n=location.port;n||=t?`443`:`80`,this.xd=typeof location<`u`&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){let n=this.request({method:`POST`,data:e});n.on(`success`,t),n.on(`error`,(e,t)=>{this.onError(`xhr post error`,e,t)})}doPoll(){let e=this.request();e.on(`data`,this.onData.bind(this)),e.on(`error`,(e,t)=>{this.onError(`xhr poll error`,e,t)}),this.pollXhr=e}},ET=class e extends iT{constructor(e,t,n){super(),this.createRequest=e,fT(this,n),this._opts=n,this._method=n.method||`GET`,this._uri=t,this._data=n.data===void 0?null:n.data,this._create()}_create(){var t;let n=lT(this._opts,`agent`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`autoUnref`);n.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch{}if(this._method===`POST`)try{r.setRequestHeader(`Content-type`,`text/plain;charset=UTF-8`)}catch{}try{r.setRequestHeader(`Accept`,`*/*`)}catch{}(t=this._opts.cookieJar)==null||t.addCookies(r),`withCredentials`in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;r.readyState===3&&((e=this._opts.cookieJar)==null||e.parseCookies(r.getResponseHeader(`set-cookie`))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status==`number`?r.status:0)},0))},r.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}typeof document<`u`&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved(`error`,e,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(this._xhr===void 0||this._xhr===null)){if(this._xhr.onreadystatechange=wT,t)try{this._xhr.abort()}catch{}typeof document<`u`&&delete e.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved(`data`,e),this.emitReserved(`success`),this._cleanup())}abort(){this._cleanup()}};if(ET.requestsCount=0,ET.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,DT);else if(typeof addEventListener==`function`){let e=`onpagehide`in sT?`pagehide`:`unload`;addEventListener(e,DT,!1)}}function DT(){for(let e in ET.requests)ET.requests.hasOwnProperty(e)&&ET.requests[e].abort()}var OT=(function(){let e=AT({xdomain:!1});return e&&e.responseType!==null})(),kT=class extends TT{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=OT&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new ET(AT,this.uri(),e)}};function AT(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||CT))return new XMLHttpRequest}catch{}if(!t)try{return new sT[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var jT=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,MT=class extends bT{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=jT?{}:lT(this.opts,`agent`,`perMessageDeflate`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`localAddress`,`protocolVersion`,`origin`,`maxPayload`,`family`,`checkServerIdentity`);this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved(`error`,e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:`websocket connection closed`,context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError(`websocket error`,e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;Rw(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&oT(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){this.ws!==void 0&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?`wss`:`ws`,t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=gT()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},NT=sT.WebSocket||sT.MozWebSocket,PT={websocket:class extends MT{createSocket(e,t,n){return jT?new NT(e,t,n):t?new NT(e,t):new NT(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends bT{get name(){return`webtransport`}doOpen(){try{this._transport=new WebTransport(this.createUri(`https`),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved(`error`,e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError(`webtransport error`,e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=rT(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=$w();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();let i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();let a={type:`open`};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&oT(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:kT},FT=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,IT=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function LT(e){if(e.length>8e3)throw`URI too long`;let t=e,n=e.indexOf(`[`),r=e.indexOf(`]`);n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,`;`)+e.substring(r,e.length));let i=FT.exec(e||``),a={},o=14;for(;o--;)a[IT[o]]=i[o]||``;return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,`:`),a.authority=a.authority.replace(`[`,``).replace(`]`,``).replace(/;/g,`:`),a.ipv6uri=!0),a.pathNames=RT(a,a.path),a.queryKey=zT(a,a.query),a}function RT(e,t){let n=t.replace(/\/{2,9}/g,`/`).split(`/`);return(t.slice(0,1)==`/`||t.length===0)&&n.splice(0,1),t.slice(-1)==`/`&&n.splice(n.length-1,1),n}function zT(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var BT=typeof addEventListener==`function`&&typeof removeEventListener==`function`,VT=[];BT&&addEventListener(`offline`,()=>{VT.forEach(e=>e())},!1);var HT=class e extends iT{constructor(e,t){if(super(),this.binaryType=cT,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e==`object`&&(t=e,e=null),e){let n=LT(e);t.hostname=n.host,t.secure=n.protocol===`https`||n.protocol===`wss`,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=LT(t.host).host);fT(this,t),this.secure=t.secure==null?typeof location<`u`&&location.protocol===`https:`:t.secure,t.hostname&&!t.port&&(t.port=this.secure?`443`:`80`),this.hostname=t.hostname||(typeof location<`u`?location.hostname:`localhost`),this.port=t.port||(typeof location<`u`&&location.port?location.port:this.secure?`443`:`80`),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{let t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:`/engine.io`,agent:!1,withCredentials:!1,upgrade:!0,timestampParam:`t`,rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,``)+(this.opts.addTrailingSlash?`/`:``),typeof this.opts.query==`string`&&(this.opts.query=vT(this.opts.query)),BT&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener(`beforeunload`,this._beforeunloadEventListener,!1)),this.hostname!==`localhost`&&(this._offlineEventListener=()=>{this._onClose(`transport close`,{description:`network connection lost`})},VT.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved(`error`,`No transports available`)},0);return}let t=this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&this.transports.indexOf(`websocket`)!==-1?`websocket`:this.transports[0];this.readyState=`opening`;let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on(`drain`,this._onDrain.bind(this)).on(`packet`,this._onPacket.bind(this)).on(`error`,this._onError.bind(this)).on(`close`,e=>this._onClose(`transport close`,e))}onOpen(){this.readyState=`open`,e.priorWebsocketSuccess=this.transport.name===`websocket`,this.emitReserved(`open`),this.flush()}_onPacket(e){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`)switch(this.emitReserved(`packet`,e),this.emitReserved(`heartbeat`),e.type){case`open`:this.onHandshake(JSON.parse(e.data));break;case`ping`:this._sendPacket(`pong`),this.emitReserved(`ping`),this.emitReserved(`pong`),this._resetPingTimeout();break;case`error`:let t=Error(`server error`);t.code=e.data,this._onError(t);break;case`message`:this.emitReserved(`data`,e.data),this.emitReserved(`message`,e.data);break}}onHandshake(e){this.emitReserved(`handshake`,e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!==`closed`&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose(`ping timeout`)},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved(`drain`):this.flush()}flush(){if(this.readyState!==`closed`&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved(`flush`)}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name===`polling`&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let n=this.writeBuffer[t].data;if(n&&(e+=mT(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,oT(()=>{this._onClose(`ping timeout`)},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket(`message`,e,t,n),this}send(e,t,n){return this._sendPacket(`message`,e,t,n),this}_sendPacket(e,t,n,r){if(typeof t==`function`&&(r=t,t=void 0),typeof n==`function`&&(r=n,n=null),this.readyState===`closing`||this.readyState===`closed`)return;n||={},n.compress=!1!==n.compress;let i={type:e,data:t,options:n};this.emitReserved(`packetCreate`,i),this.writeBuffer.push(i),r&&this.once(`flush`,r),this.flush()}close(){let e=()=>{this._onClose(`forced close`),this.transport.close()},t=()=>{this.off(`upgrade`,t),this.off(`upgradeError`,t),e()},n=()=>{this.once(`upgrade`,t),this.once(`upgradeError`,t)};return(this.readyState===`opening`||this.readyState===`open`)&&(this.readyState=`closing`,this.writeBuffer.length?this.once(`drain`,()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(t){if(e.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState===`opening`)return this.transports.shift(),this._open();this.emitReserved(`error`,t),this._onClose(`transport error`,t)}_onClose(e,t){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners(`close`),this.transport.close(),this.transport.removeAllListeners(),BT&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=VT.indexOf(this._offlineEventListener);e!==-1&&VT.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};HT.protocol=4;var UT=class extends HT{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState===`open`&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;HT.priorWebsocketSuccess=!1;let r=()=>{n||(t.send([{type:`ping`,data:`probe`}]),t.once(`packet`,e=>{if(!n)if(e.type===`pong`&&e.data===`probe`){if(this.upgrading=!0,this.emitReserved(`upgrading`,t),!t)return;HT.priorWebsocketSuccess=t.name===`websocket`,this.transport.pause(()=>{n||this.readyState!==`closed`&&(l(),this.setTransport(t),t.send([{type:`upgrade`}]),this.emitReserved(`upgrade`,t),t=null,this.upgrading=!1,this.flush())})}else{let e=Error(`probe error`);e.transport=t.name,this.emitReserved(`upgradeError`,e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}let a=e=>{let n=Error(`probe error: `+e);n.transport=t.name,i(),this.emitReserved(`upgradeError`,n)};function o(){a(`transport closed`)}function s(){a(`socket closed`)}function c(e){t&&e.name!==t.name&&i()}let l=()=>{t.removeListener(`open`,r),t.removeListener(`error`,a),t.removeListener(`close`,o),this.off(`close`,s),this.off(`upgrading`,c)};t.once(`open`,r),t.once(`error`,a),t.once(`close`,o),this.once(`close`,s),this.once(`upgrading`,c),this._upgrades.indexOf(`webtransport`)!==-1&&e!==`webtransport`?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}},WT=class extends UT{constructor(e,t={}){let n=typeof e==`object`,r=n?{...e}:{...t};(!r.transports||r.transports&&typeof r.transports[0]==`string`)&&(r.transports=(r.transports||[`polling`,`websocket`,`webtransport`]).map(e=>PT[e]).filter(e=>!!e)),super(n?r:e,r)}};WT.protocol;function GT(e,t=``,n){let r=e;n||=typeof location<`u`&&location,e??=n.protocol+`//`+n.host,typeof e==`string`&&(e.charAt(0)===`/`&&(e=e.charAt(1)===`/`?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=n===void 0?`https://`+e:n.protocol+`//`+e),r=LT(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port=`80`:/^(http|ws)s$/.test(r.protocol)&&(r.port=`443`)),r.path=r.path||`/`;let i=r.host.indexOf(`:`)===-1?r.host:`[`+r.host+`]`;return r.id=r.protocol+`://`+i+`:`+r.port+t,r.href=r.protocol+`://`+i+(n&&n.port===r.port?``:`:`+r.port),r}var KT=typeof ArrayBuffer==`function`,qT=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,JT=Object.prototype.toString,YT=typeof Blob==`function`||typeof Blob<`u`&&JT.call(Blob)===`[object BlobConstructor]`,XT=typeof File==`function`||typeof File<`u`&&JT.call(File)===`[object FileConstructor]`;function ZT(e){return KT&&(e instanceof ArrayBuffer||qT(e))||YT&&e instanceof Blob||XT&&e instanceof File}function QT(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(QT(e[t]))return!0;return!1}if(ZT(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return QT(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&QT(e[t]))return!0;return!1}function $T(e){let t=[],n=e.data,r=e;return r.data=eE(n,t),r.attachments=t.length,{packet:r,buffers:t}}function eE(e,t,n){if(!e)return e;if(ZT(e)){let n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=eE(e[r],t);return n}else if(typeof e==`object`&&!(e instanceof Date)){if(e.toJSON&&typeof e.toJSON==`function`&&!n)return eE(e.toJSON(),t,!0);let r={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=eE(e[n],t));return r}return e}function tE(e,t){return e.data=nE(e.data,t),delete e.attachments,e}function nE(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num==`number`&&e.num>=0&&e.num<t.length)return t[e.num];throw Error(`illegal attachments`)}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=nE(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=nE(e[n],t));return e}var rE=s({Decoder:()=>sE,Encoder:()=>oE,PacketType:()=>aE,isPacketValid:()=>mE,protocol:()=>5}),iE=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],aE;(function(e){e[e.CONNECT=0]=`CONNECT`,e[e.DISCONNECT=1]=`DISCONNECT`,e[e.EVENT=2]=`EVENT`,e[e.ACK=3]=`ACK`,e[e.CONNECT_ERROR=4]=`CONNECT_ERROR`,e[e.BINARY_EVENT=5]=`BINARY_EVENT`,e[e.BINARY_ACK=6]=`BINARY_ACK`})(aE||={});var oE=class{constructor(e){this.replacer=e}encode(e){return(e.type===aE.EVENT||e.type===aE.ACK)&&QT(e)?this.encodeAsBinary({type:e.type===aE.EVENT?aE.BINARY_EVENT:aE.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===aE.BINARY_EVENT||e.type===aE.BINARY_ACK)&&(t+=e.attachments+`-`),e.nsp&&e.nsp!==`/`&&(t+=e.nsp+`,`),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=$T(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},sE=class e extends iT{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e==`function`?{reviver:e}:e)}add(e){let t;if(typeof e==`string`){if(this.reconstructor)throw Error(`got plaintext data when reconstructing a packet`);t=this.decodeString(e);let n=t.type===aE.BINARY_EVENT;n||t.type===aE.BINARY_ACK?(t.type=n?aE.EVENT:aE.ACK,this.reconstructor=new cE(t)):super.emitReserved(`decoded`,t)}else if(ZT(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved(`decoded`,t));else throw Error(`got binary data when not reconstructing a packet`);else throw Error(`Unknown type: `+e)}decodeString(t){let n=0,r={type:Number(t.charAt(0))};if(aE[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===aE.BINARY_EVENT||r.type===aE.BINARY_ACK){let e=n+1;for(;t.charAt(++n)!==`-`&&n!=t.length;);let i=t.substring(e,n);if(i!=Number(i)||t.charAt(n)!==`-`)throw Error(`Illegal attachments`);let a=Number(i);if(!uE(a)||a<1)throw Error(`Illegal attachments`);if(a>this.opts.maxAttachments)throw Error(`too many attachments`);r.attachments=a}if(t.charAt(n+1)===`/`){let e=n+1;for(;++n&&!(t.charAt(n)===`,`||n===t.length););r.nsp=t.substring(e,n)}else r.nsp=`/`;let i=t.charAt(n+1);if(i!==``&&Number(i)==i){let e=n+1;for(;++n;){let e=t.charAt(n);if(e==null||Number(e)!=e){--n;break}if(n===t.length)break}r.id=Number(t.substring(e,n+1))}if(t.charAt(++n)){let i=this.tryParse(t.substr(n));if(e.isPayloadValid(r.type,i))r.data=i;else throw Error(`invalid payload`)}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case aE.CONNECT:return fE(t);case aE.DISCONNECT:return t===void 0;case aE.CONNECT_ERROR:return typeof t==`string`||fE(t);case aE.EVENT:case aE.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&iE.indexOf(t[0])===-1);case aE.ACK:case aE.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},cE=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let e=tE(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function lE(e){return typeof e==`string`}var uE=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function dE(e){return e===void 0||uE(e)}function fE(e){return Object.prototype.toString.call(e)===`[object Object]`}function pE(e,t){switch(e){case aE.CONNECT:return t===void 0||fE(t);case aE.DISCONNECT:return t===void 0;case aE.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&iE.indexOf(t[0])===-1);case aE.ACK:return Array.isArray(t);case aE.CONNECT_ERROR:return typeof t==`string`||fE(t);default:return!1}}function mE(e){return lE(e.nsp)&&dE(e.id)&&pE(e.type,e.data)}function hE(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var gE=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),_E=class extends iT{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[hE(e,`open`,this.onopen.bind(this)),hE(e,`packet`,this.onpacket.bind(this)),hE(e,`error`,this.onerror.bind(this)),hE(e,`close`,this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState===`open`&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift(`message`),this.emit.apply(this,e),this}emit(e,...t){if(gE.hasOwnProperty(e))throw Error(`"`+e.toString()+`" is a reserved event name`);if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let n={type:aE.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]==`function`){let e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}let r=this.io.engine?.transport?.writable,i=this.connected&&!this.io.engine?._hasPingExpired();return this.flags.volatile&&!r||(i?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){let n=this.flags.timeout??this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error(`operation has timed out`))},n),i=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{let i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]==`function`&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>(this._queue[0],e===null?(this._queue.shift(),t&&t(null,...r)):n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth==`function`?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:aE.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved(`connect_error`,e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved(`disconnect`,e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){let t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error(`socket has been disconnected`))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case aE.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved(`connect_error`,Error(`It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)`));break;case aE.EVENT:case aE.BINARY_EVENT:this.onevent(e);break;case aE.ACK:case aE.BINARY_ACK:this.onack(e);break;case aE.DISCONNECT:this.ondisconnect();break;case aE.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved(`connect_error`,t);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]==`string`&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,n=!1;return function(...r){n||(n=!0,t.packet({type:aE.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];typeof t==`function`&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved(`connect`)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose(`io server disconnect`)}destroy(){this.subs&&=(this.subs.forEach(e=>e()),void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:aE.DISCONNECT}),this.destroy(),this.connected&&this.onclose(`io client disconnect`),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let n of t)n.apply(this,e.data)}}};function vE(e){e||={},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}vE.prototype.duration=function(){var e=this.ms*this.factor**+this.attempts++;if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0},vE.prototype.reset=function(){this.attempts=0},vE.prototype.setMin=function(e){this.ms=e},vE.prototype.setMax=function(e){this.max=e},vE.prototype.setJitter=function(e){this.jitter=e};var yE=class extends iT{constructor(e,t){super(),this.nsps={},this.subs=[],e&&typeof e==`object`&&(t=e,e=void 0),t||={},t.path=t.path||`/socket.io`,this.opts=t,fT(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor??.5),this.backoff=new vE({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState=`closed`,this.uri=e;let n=t.parser||rE;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)==null||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)==null||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)==null||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf(`open`))return this;this.engine=new WT(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=hE(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=hE(t,`error`,i);if(!1!==this._timeout){let e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(Error(`timeout`)),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState=`open`,this.emitReserved(`open`);let e=this.engine;this.subs.push(hE(e,`ping`,this.onping.bind(this)),hE(e,`data`,this.ondata.bind(this)),hE(e,`error`,this.onerror.bind(this)),hE(e,`close`,this.onclose.bind(this)),hE(this.decoder,`decoded`,this.ondecoded.bind(this)))}onping(){this.emitReserved(`ping`)}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose(`parse error`,e)}}ondecoded(e){oT(()=>{this.emitReserved(`packet`,e)},this.setTimeoutFn)}onerror(e){this.emitReserved(`error`,e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new _E(this,e,t),this.nsps[e]=n),n}_destroy(e){let t=Object.keys(this.nsps);for(let e of t)if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose(`forced close`)}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),(n=this.engine)==null||n.close(),this.backoff.reset(),this._readyState=`closed`,this.emitReserved(`close`,e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved(`reconnect_failed`),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved(`reconnect_attempt`,e.backoff.attempts),!e.skipReconnect&&e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved(`reconnect_error`,t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved(`reconnect`,e)}},bE={};function xE(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=GT(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=bE[i]&&a in bE[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new yE(r,t):(bE[i]||(bE[i]=new yE(r,t)),c=bE[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(xE,{Manager:yE,Socket:_E,io:xE,connect:xE});var SE=class extends Error{method;path;constructor(e,t,n){super(`Treeport could not be reached`,{cause:n}),this.method=e,this.path=t,this.name=`RpcNetworkError`}},CE=Of(`/`,{fetch:async(e,t)=>{try{return await fetch(e,t)}catch(n){if(n instanceof Error&&n.name===`AbortError`)throw n;let r=e instanceof Request?e:null,i=new URL(r?.url??String(e),globalThis.location?.href??`http://localhost`);throw new SE(String(t?.method??r?.method??`GET`).toUpperCase().slice(0,16),i.pathname.slice(0,2048),n)}}}),wE=500,TE=80,EE=128;function DE(e,t){if(typeof e!=`string`)return null;let n=``;for(let t of e){let e=t.charCodeAt(0);n+=e<32||e===127?` `:t}let r=n.replace(/\s+/g,` `).trim();return r?r.length<=t?r:`${r.slice(0,t-1)}…`:null}function OE(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.requestId;return typeof t==`string`&&t.length<=EE&&/^[A-Za-z0-9_=-]+$/.test(t)?t:null}function kE(e){if(e instanceof SE)return{message:`Treeport could not be reached.`,code:null,details:null,status:null,statusText:null,requestId:null,method:e.method,path:e.path,networkFailure:!0,recoveryHint:`Check that it is running and reachable, then retry.`};if(e instanceof hf){let t=e.detail,n=t?.data,r=n&&typeof n==`object`&&!Array.isArray(n)?n.error:null,i=r&&typeof r==`object`&&!Array.isArray(r)?r:null,a=DE(i?.message,wE),o=DE(i?.code,100),s=i?.details??null,c=typeof e.statusCode==`number`&&e.statusCode>=100&&e.statusCode<=599?e.statusCode:null,l=DE(t?.statusText,TE),u=OE(s);if(a)return{message:a,code:o,details:s,status:c,statusText:l,requestId:u,method:null,path:null,networkFailure:!1,recoveryHint:o===`INTERNAL_ERROR`?`Retry. If the problem continues, use the reference when checking Treeport logs.`:null};let d=c?`${c}${l?` ${l}`:``}`:DE(e.message,TE);return{message:c&&[502,503,504].includes(c)?`The server or proxy returned ${d}.`:d?`The Treeport server returned ${d}.`:`The Treeport server returned an unexpected response.`,code:o,details:s,status:c,statusText:l,requestId:u,method:null,path:null,networkFailure:!1,recoveryHint:c&&[502,503,504].includes(c)?`Check that Treeport is running, then retry.`:null}}return{message:DE(e instanceof Error?e.message:String(e),wE)??`Unexpected error.`,code:null,details:null,status:null,statusText:null,requestId:null,method:null,path:null,networkFailure:!1,recoveryHint:null}}function AE(e){return kE(e).message}var jE;function X(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var ME=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},NE=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(jE=globalThis).__zod_globalConfig??(jE.__zod_globalConfig={});var PE=globalThis.__zod_globalConfig;function FE(e){return e&&Object.assign(PE,e),PE}function IE(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function LE(e,t){return typeof t==`bigint`?t.toString():t}function RE(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function zE(e){return e==null}function BE(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function VE(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var HE=Symbol(`evaluating`);function UE(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==HE)return r===void 0&&(r=HE,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function WE(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function GE(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function KE(e){return JSON.stringify(e)}function qE(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var JE=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function YE(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var XE=RE(()=>{if(PE.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ZE(e){if(YE(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(YE(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function QE(e){return ZE(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var $E=new Set([`string`,`number`,`symbol`]);function eD(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function tD(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Z(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function nD(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var rD={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function iD(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return tD(e,GE(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return WE(this,`shape`,e),e},checks:[]}))}function aD(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return tD(e,GE(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return WE(this,`shape`,r),r},checks:[]}))}function oD(e,t){if(!ZE(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return tD(e,GE(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return WE(this,`shape`,n),n}}))}function sD(e,t){if(!ZE(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return tD(e,GE(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return WE(this,`shape`,n),n}}))}function cD(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return tD(e,GE(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return WE(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function lD(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return tD(t,GE(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return WE(this,`shape`,i),i},checks:[]}))}function uD(e,t,n){return tD(t,GE(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return WE(this,`shape`,i),i}}))}function dD(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function fD(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function pD(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function mD(e){return typeof e==`string`?e:e?.message}function hD(e,t,n){let r=e.message?e.message:mD(e.inst?._zod.def?.error?.(e))??mD(t?.error?.(e))??mD(n.customError?.(e))??mD(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function gD(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function _D(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var vD=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,LE,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},yD=X(`$ZodError`,vD),bD=X(`$ZodError`,vD,{Parent:Error});function xD(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function SD(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var CD=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new ME;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>hD(e,a,FE())));throw JE(t,i?.callee),t}return o.value},wD=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>hD(e,a,FE())));throw JE(t,i?.callee),t}return o.value},TD=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new ME;return a.issues.length?{success:!1,error:new(e??yD)(a.issues.map(e=>hD(e,i,FE())))}:{success:!0,data:a.value}},ED=TD(bD),DD=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>hD(e,i,FE())))}:{success:!0,data:a.value}},OD=DD(bD),kD=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return CD(e)(t,n,i)},AD=e=>(t,n,r)=>CD(e)(t,n,r),jD=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return wD(e)(t,n,i)},MD=e=>async(t,n,r)=>wD(e)(t,n,r),ND=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return TD(e)(t,n,i)},PD=e=>(t,n,r)=>TD(e)(t,n,r),FD=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return DD(e)(t,n,i)},ID=e=>async(t,n,r)=>DD(e)(t,n,r),LD=/^[cC][0-9a-z]{6,}$/,RD=/^[0-9a-z]+$/,zD=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,BD=/^[0-9a-vA-V]{20}$/,VD=/^[A-Za-z0-9]{27}$/,HD=/^[a-zA-Z0-9_-]{21}$/,UD=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,WD=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,GD=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,KD=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,qD=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function JD(){return new RegExp(qD,`u`)}var YD=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,XD=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ZD=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,QD=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$D=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,eO=/^[A-Za-z0-9_-]*$/,tO=/^https?$/,nO=/^\+[1-9]\d{6,14}$/,rO=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,iO=RegExp(`^${rO}$`);function aO(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function oO(e){return RegExp(`^${aO(e)}$`)}function sO(e){let t=aO({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${rO}T(?:${r})$`)}var cO=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},lO=/^-?\d+$/,uO=/^-?\d+(?:\.\d+)?$/,dO=/^(?:true|false)$/i,fO=/^null$/i,pO=/^[^A-Z]*$/,mO=/^[^a-z]*$/,hO=X(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),gO={number:`number`,bigint:`bigint`,object:`date`},_O=X(`$ZodCheckLessThan`,(e,t)=>{hO.init(e,t);let n=gO[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vO=X(`$ZodCheckGreaterThan`,(e,t)=>{hO.init(e,t);let n=gO[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yO=X(`$ZodCheckMultipleOf`,(e,t)=>{hO.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):VE(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),bO=X(`$ZodCheckNumberFormat`,(e,t)=>{hO.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=rD[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=lO)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),xO=X(`$ZodCheckMaxLength`,(e,t)=>{var n;hO.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!zE(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=gD(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),SO=X(`$ZodCheckMinLength`,(e,t)=>{var n;hO.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!zE(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=gD(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),CO=X(`$ZodCheckLengthEquals`,(e,t)=>{var n;hO.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!zE(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=gD(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),wO=X(`$ZodCheckStringFormat`,(e,t)=>{var n,r;hO.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),TO=X(`$ZodCheckRegex`,(e,t)=>{wO.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),EO=X(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=pO,wO.init(e,t)}),DO=X(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=mO,wO.init(e,t)}),OO=X(`$ZodCheckIncludes`,(e,t)=>{hO.init(e,t);let n=eD(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),kO=X(`$ZodCheckStartsWith`,(e,t)=>{hO.init(e,t);let n=RegExp(`^${eD(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),AO=X(`$ZodCheckEndsWith`,(e,t)=>{hO.init(e,t);let n=RegExp(`.*${eD(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),jO=X(`$ZodCheckOverwrite`,(e,t)=>{hO.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),MO=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
84
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
85
+ `))}},NO={major:4,minor:4,patch:3},PO=X(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=NO;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=dD(e),i;for(let a of t){if(a._zod.def.when){if(fD(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new ME;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=dD(e,t))});else{if(e.issues.length===t)continue;r||=dD(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(dD(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new ME;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new ME;return o.then(e=>t(e,r,a))}return t(o,r,a)}}UE(e,`~standard`,()=>({validate:t=>{try{let n=ED(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return OD(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),FO=X(`$ZodString`,(e,t)=>{PO.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??cO(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),IO=X(`$ZodStringFormat`,(e,t)=>{wO.init(e,t),FO.init(e,t)}),LO=X(`$ZodGUID`,(e,t)=>{t.pattern??=WD,IO.init(e,t)}),RO=X(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=GD(e)}else t.pattern??=GD();IO.init(e,t)}),zO=X(`$ZodEmail`,(e,t)=>{t.pattern??=KD,IO.init(e,t)}),BO=X(`$ZodURL`,(e,t)=>{IO.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===tO.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),VO=X(`$ZodEmoji`,(e,t)=>{t.pattern??=JD(),IO.init(e,t)}),HO=X(`$ZodNanoID`,(e,t)=>{t.pattern??=HD,IO.init(e,t)}),UO=X(`$ZodCUID`,(e,t)=>{t.pattern??=LD,IO.init(e,t)}),WO=X(`$ZodCUID2`,(e,t)=>{t.pattern??=RD,IO.init(e,t)}),GO=X(`$ZodULID`,(e,t)=>{t.pattern??=zD,IO.init(e,t)}),KO=X(`$ZodXID`,(e,t)=>{t.pattern??=BD,IO.init(e,t)}),qO=X(`$ZodKSUID`,(e,t)=>{t.pattern??=VD,IO.init(e,t)}),JO=X(`$ZodISODateTime`,(e,t)=>{t.pattern??=sO(t),IO.init(e,t)}),YO=X(`$ZodISODate`,(e,t)=>{t.pattern??=iO,IO.init(e,t)}),XO=X(`$ZodISOTime`,(e,t)=>{t.pattern??=oO(t),IO.init(e,t)}),ZO=X(`$ZodISODuration`,(e,t)=>{t.pattern??=UD,IO.init(e,t)}),QO=X(`$ZodIPv4`,(e,t)=>{t.pattern??=YD,IO.init(e,t),e._zod.bag.format=`ipv4`}),$O=X(`$ZodIPv6`,(e,t)=>{t.pattern??=XD,IO.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),ek=X(`$ZodCIDRv4`,(e,t)=>{t.pattern??=ZD,IO.init(e,t)}),tk=X(`$ZodCIDRv6`,(e,t)=>{t.pattern??=QD,IO.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function nk(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var rk=X(`$ZodBase64`,(e,t)=>{t.pattern??=$D,IO.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{nk(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function ik(e){if(!eO.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return nk(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var ak=X(`$ZodBase64URL`,(e,t)=>{t.pattern??=eO,IO.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{ik(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),ok=X(`$ZodE164`,(e,t)=>{t.pattern??=nO,IO.init(e,t)});function sk(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var ck=X(`$ZodJWT`,(e,t)=>{IO.init(e,t),e._zod.check=n=>{sk(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),lk=X(`$ZodNumber`,(e,t)=>{PO.init(e,t),e._zod.pattern=e._zod.bag.pattern??uO,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),uk=X(`$ZodNumberFormat`,(e,t)=>{bO.init(e,t),lk.init(e,t)}),dk=X(`$ZodBoolean`,(e,t)=>{PO.init(e,t),e._zod.pattern=dO,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),fk=X(`$ZodNull`,(e,t)=>{PO.init(e,t),e._zod.pattern=fO,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),pk=X(`$ZodUnknown`,(e,t)=>{PO.init(e,t),e._zod.parse=e=>e}),mk=X(`$ZodNever`,(e,t)=>{PO.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function hk(e,t,n){e.issues.length&&t.issues.push(...pD(n,e.issues)),t.value[n]=e.value}var gk=X(`$ZodArray`,(e,t)=>{PO.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>hk(t,n,e))):hk(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function _k(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...pD(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function vk(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=nD(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function yk(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>_k(e,n,i,t,u,d))):_k(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var bk=X(`$ZodObject`,(e,t)=>{if(PO.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=RE(()=>vk(t));UE(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=YE,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>_k(n,t,e,s,r,i))):_k(a,t,e,s,r,i)}return i?yk(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),xk=X(`$ZodObjectJIT`,(e,t)=>{bk.init(e,t);let n=e._zod.parse,r=RE(()=>vk(t)),i=e=>{let t=new MO([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=KE(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=KE(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
86
+ if (${n}.issues.length) {
87
+ if (${o} in input) {
88
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
89
+ ...iss,
90
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
91
+ })));
92
+ }
93
+ }
94
+
95
+ if (${n}.value === undefined) {
96
+ if (${o} in input) {
97
+ newResult[${o}] = undefined;
98
+ }
99
+ } else {
100
+ newResult[${o}] = ${n}.value;
101
+ }
102
+
103
+ `):c?t.write(`
104
+ if (${n}.issues.length) {
105
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
106
+ ...iss,
107
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
108
+ })));
109
+ }
110
+
111
+ if (${n}.value === undefined) {
112
+ if (${o} in input) {
113
+ newResult[${o}] = undefined;
114
+ }
115
+ } else {
116
+ newResult[${o}] = ${n}.value;
117
+ }
118
+
119
+ `):t.write(`
120
+ const ${n}_present = ${o} in input;
121
+ if (${n}.issues.length) {
122
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
123
+ ...iss,
124
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
125
+ })));
126
+ }
127
+ if (!${n}_present && !${n}.issues.length) {
128
+ payload.issues.push({
129
+ code: "invalid_type",
130
+ expected: "nonoptional",
131
+ input: undefined,
132
+ path: [${o}]
133
+ });
134
+ }
135
+
136
+ if (${n}_present) {
137
+ if (${n}.value === undefined) {
138
+ newResult[${o}] = undefined;
139
+ } else {
140
+ newResult[${o}] = ${n}.value;
141
+ }
142
+ }
143
+
144
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=YE,s=!PE.jitless,c=s&&XE.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?yk([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Sk(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!dD(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>hD(e,r,FE())))}),t)}var Ck=X(`$ZodUnion`,(e,t)=>{PO.init(e,t),UE(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),UE(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),UE(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),UE(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>BE(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Sk(t,r,e,i)):Sk(o,r,e,i)}}),wk=X(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Ck.init(e,t);let n=e._zod.parse;UE(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=RE(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!YE(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Tk=X(`$ZodIntersection`,(e,t)=>{PO.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Dk(e,t,n)):Dk(e,i,a)}});function Ek(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ZE(e)&&ZE(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Ek(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ek(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Dk(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),dD(e))return e;let o=Ek(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Ok=X(`$ZodRecord`,(e,t)=>{PO.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!ZE(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>hD(e,r,FE())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...pD(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...pD(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&uO.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>hD(e,r,FE())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...pD(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...pD(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),kk=X(`$ZodEnum`,(e,t)=>{PO.init(e,t);let n=IE(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>$E.has(typeof e)).map(e=>typeof e==`string`?eD(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Ak=X(`$ZodLiteral`,(e,t)=>{if(PO.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?eD(e):e?eD(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),jk=X(`$ZodTransform`,(e,t)=>{PO.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new NE(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new ME;return n.value=i,n.fallback=!0,n}});function Mk(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Nk=X(`$ZodOptional`,(e,t)=>{PO.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,UE(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),UE(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${BE(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Mk(e,r)):Mk(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Pk=X(`$ZodExactOptional`,(e,t)=>{Nk.init(e,t),UE(e._zod,`values`,()=>t.innerType._zod.values),UE(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Fk=X(`$ZodNullable`,(e,t)=>{PO.init(e,t),UE(e._zod,`optin`,()=>t.innerType._zod.optin),UE(e._zod,`optout`,()=>t.innerType._zod.optout),UE(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${BE(e.source)}|null)$`):void 0}),UE(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ik=X(`$ZodDefault`,(e,t)=>{PO.init(e,t),e._zod.optin=`optional`,UE(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Lk(e,t)):Lk(r,t)}});function Lk(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Rk=X(`$ZodPrefault`,(e,t)=>{PO.init(e,t),e._zod.optin=`optional`,UE(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),zk=X(`$ZodNonOptional`,(e,t)=>{PO.init(e,t),UE(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Bk(t,e)):Bk(i,e)}});function Bk(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Vk=X(`$ZodCatch`,(e,t)=>{PO.init(e,t),e._zod.optin=`optional`,UE(e._zod,`optout`,()=>t.innerType._zod.optout),UE(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>hD(e,n,FE()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>hD(e,n,FE()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Hk=X(`$ZodPipe`,(e,t)=>{PO.init(e,t),UE(e._zod,`values`,()=>t.in._zod.values),UE(e._zod,`optin`,()=>t.in._zod.optin),UE(e._zod,`optout`,()=>t.out._zod.optout),UE(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Uk(e,t.in,n)):Uk(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Uk(e,t.out,n)):Uk(r,t.out,n)}});function Uk(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Wk=X(`$ZodReadonly`,(e,t)=>{PO.init(e,t),UE(e._zod,`propValues`,()=>t.innerType._zod.propValues),UE(e._zod,`values`,()=>t.innerType._zod.values),UE(e._zod,`optin`,()=>t.innerType?._zod?.optin),UE(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Gk):Gk(r)}});function Gk(e){return e.value=Object.freeze(e.value),e}var Kk=X(`$ZodLazy`,(e,t)=>{PO.init(e,t),UE(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),UE(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),UE(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),UE(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),UE(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),qk=X(`$ZodCustom`,(e,t)=>{hO.init(e,t),PO.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Jk(t,n,r,e));Jk(i,n,r,e)}});function Jk(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(_D(e))}}var Yk,Xk=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Zk(){return new Xk}(Yk=globalThis).__zod_globalRegistry??(Yk.__zod_globalRegistry=Zk());var Qk=globalThis.__zod_globalRegistry;function $k(e,t){return new e({type:`string`,...Z(t)})}function eA(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...Z(t)})}function tA(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...Z(t)})}function nA(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...Z(t)})}function rA(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...Z(t)})}function iA(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...Z(t)})}function aA(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...Z(t)})}function oA(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...Z(t)})}function sA(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...Z(t)})}function cA(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...Z(t)})}function lA(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...Z(t)})}function uA(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...Z(t)})}function dA(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...Z(t)})}function fA(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...Z(t)})}function pA(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...Z(t)})}function mA(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...Z(t)})}function hA(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...Z(t)})}function gA(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...Z(t)})}function _A(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...Z(t)})}function vA(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...Z(t)})}function yA(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...Z(t)})}function bA(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...Z(t)})}function xA(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...Z(t)})}function SA(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...Z(t)})}function CA(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...Z(t)})}function wA(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...Z(t)})}function TA(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...Z(t)})}function EA(e,t){return new e({type:`number`,checks:[],...Z(t)})}function DA(e,t){return new e({type:`number`,coerce:!0,checks:[],...Z(t)})}function OA(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...Z(t)})}function kA(e,t){return new e({type:`boolean`,...Z(t)})}function AA(e,t){return new e({type:`null`,...Z(t)})}function jA(e){return new e({type:`unknown`})}function MA(e,t){return new e({type:`never`,...Z(t)})}function NA(e,t){return new _O({check:`less_than`,...Z(t),value:e,inclusive:!1})}function PA(e,t){return new _O({check:`less_than`,...Z(t),value:e,inclusive:!0})}function FA(e,t){return new vO({check:`greater_than`,...Z(t),value:e,inclusive:!1})}function IA(e,t){return new vO({check:`greater_than`,...Z(t),value:e,inclusive:!0})}function LA(e,t){return new yO({check:`multiple_of`,...Z(t),value:e})}function RA(e,t){return new xO({check:`max_length`,...Z(t),maximum:e})}function zA(e,t){return new SO({check:`min_length`,...Z(t),minimum:e})}function BA(e,t){return new CO({check:`length_equals`,...Z(t),length:e})}function VA(e,t){return new TO({check:`string_format`,format:`regex`,...Z(t),pattern:e})}function HA(e){return new EO({check:`string_format`,format:`lowercase`,...Z(e)})}function UA(e){return new DO({check:`string_format`,format:`uppercase`,...Z(e)})}function WA(e,t){return new OO({check:`string_format`,format:`includes`,...Z(t),includes:e})}function GA(e,t){return new kO({check:`string_format`,format:`starts_with`,...Z(t),prefix:e})}function KA(e,t){return new AO({check:`string_format`,format:`ends_with`,...Z(t),suffix:e})}function qA(e){return new jO({check:`overwrite`,tx:e})}function JA(e){return qA(t=>t.normalize(e))}function YA(){return qA(e=>e.trim())}function XA(){return qA(e=>e.toLowerCase())}function ZA(){return qA(e=>e.toUpperCase())}function QA(){return qA(e=>qE(e))}function $A(e,t,n){return new e({type:`array`,element:t,...Z(n)})}function ej(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...Z(n)})}function tj(e,t){let n=nj(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(_D(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(_D(r))}},e(t.value,t)),t);return n}function nj(e,t){let n=new hO({check:`custom`,...Z(t)});return n._zod.check=e,n}function rj(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Qk,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function ij(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,ij(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&sj(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function aj(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
145
+
146
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function oj(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:lj(t,`input`,e.processors),output:lj(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function sj(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return sj(r.element,n);if(r.type===`set`)return sj(r.valueType,n);if(r.type===`lazy`)return sj(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return sj(r.innerType,n);if(r.type===`intersection`)return sj(r.left,n)||sj(r.right,n);if(r.type===`record`||r.type===`map`)return sj(r.keyType,n)||sj(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:sj(r.in,n)||sj(r.out,n);if(r.type===`object`){for(let e in r.shape)if(sj(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(sj(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(sj(e,n))return!0;return!!(r.rest&&sj(r.rest,n))}return!1}var cj=(e,t={})=>n=>{let r=rj({...n,processors:t});return ij(e,r),aj(r,e),oj(r,e)},lj=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=rj({...i??{},target:a,io:t,processors:n});return ij(e,o),aj(o,e),oj(o,e)},uj={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},dj=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=uj[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},fj=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},pj=(e,t,n,r)=>{n.type=`boolean`},mj=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},hj=(e,t,n,r)=>{n.not={}},gj=(e,t,n,r)=>{let i=e._zod.def,a=IE(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},_j=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},vj=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},yj=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},bj=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=ij(a.element,t,{...r,path:[...r.path,`items`]})},xj=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=ij(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=ij(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Sj=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>ij(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Cj=(e,t,n,r)=>{let i=e._zod.def,a=ij(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=ij(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},wj=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=ij(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=ij(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=ij(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Tj=(e,t,n,r)=>{let i=e._zod.def,a=ij(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ej=(e,t,n,r)=>{let i=e._zod.def;ij(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Dj=(e,t,n,r)=>{let i=e._zod.def;ij(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Oj=(e,t,n,r)=>{let i=e._zod.def;ij(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},kj=(e,t,n,r)=>{let i=e._zod.def;ij(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Aj=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;ij(o,t,r);let s=t.seen.get(e);s.ref=o},jj=(e,t,n,r)=>{let i=e._zod.def;ij(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Mj=(e,t,n,r)=>{let i=e._zod.def;ij(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Nj=(e,t,n,r)=>{let i=e._zod.innerType;ij(i,t,r);let a=t.seen.get(e);a.ref=i},Pj=X(`ZodISODateTime`,(e,t)=>{JO.init(e,t),oM.init(e,t)});function Fj(e){return SA(Pj,e)}var Ij=X(`ZodISODate`,(e,t)=>{YO.init(e,t),oM.init(e,t)});function Lj(e){return CA(Ij,e)}var Rj=X(`ZodISOTime`,(e,t)=>{XO.init(e,t),oM.init(e,t)});function zj(e){return wA(Rj,e)}var Bj=X(`ZodISODuration`,(e,t)=>{ZO.init(e,t),oM.init(e,t)});function Vj(e){return TA(Bj,e)}var Hj=X(`ZodError`,(e,t)=>{yD.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>SD(e,t)},flatten:{value:t=>xD(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,LE,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,LE,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Uj=CD(Hj),Wj=wD(Hj),Gj=TD(Hj),Kj=DD(Hj),qj=kD(Hj),Jj=AD(Hj),Yj=jD(Hj),Xj=MD(Hj),Zj=ND(Hj),Qj=PD(Hj),$j=FD(Hj),eM=ID(Hj),tM=new WeakMap;function nM(e,t,n){let r=Object.getPrototypeOf(e),i=tM.get(r);if(i||(i=new Set,tM.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var rM=X(`ZodType`,(e,t)=>(PO.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:lj(e,`input`),output:lj(e,`output`)}}),e.toJSONSchema=cj(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Uj(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Gj(e,t,n),e.parseAsync=async(t,n)=>Wj(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Kj(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>qj(e,t,n),e.decode=(t,n)=>Jj(e,t,n),e.encodeAsync=async(t,n)=>Yj(e,t,n),e.decodeAsync=async(t,n)=>Xj(e,t,n),e.safeEncode=(t,n)=>Zj(e,t,n),e.safeDecode=(t,n)=>Qj(e,t,n),e.safeEncodeAsync=async(t,n)=>$j(e,t,n),e.safeDecodeAsync=async(t,n)=>eM(e,t,n),nM(e,`ZodType`,{check(...e){let t=this.def;return this.clone(GE(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return tD(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(CN(e,t))},superRefine(e,t){return this.check(wN(e,t))},overwrite(e){return this.check(qA(e))},optional(){return rN(this)},exactOptional(){return aN(this)},nullable(){return sN(this)},nullish(){return rN(sN(this))},nonoptional(e){return pN(this,e)},array(){return zM(this)},or(e){return UM([this,e])},and(e){return qM(this,e)},transform(e){return _N(this,tN(e))},default(e){return lN(this,e)},prefault(e){return dN(this,e)},catch(e){return hN(this,e)},pipe(e){return _N(this,e)},readonly(){return yN(this)},describe(e){let t=this.clone();return Qk.add(t,{description:e}),t},meta(...e){if(e.length===0)return Qk.get(this);let t=this.clone();return Qk.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Qk.get(e)?.description},configurable:!0}),e)),iM=X(`_ZodString`,(e,t)=>{FO.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dj(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,nM(e,`_ZodString`,{regex(...e){return this.check(VA(...e))},includes(...e){return this.check(WA(...e))},startsWith(...e){return this.check(GA(...e))},endsWith(...e){return this.check(KA(...e))},min(...e){return this.check(zA(...e))},max(...e){return this.check(RA(...e))},length(...e){return this.check(BA(...e))},nonempty(...e){return this.check(zA(1,...e))},lowercase(e){return this.check(HA(e))},uppercase(e){return this.check(UA(e))},trim(){return this.check(YA())},normalize(...e){return this.check(JA(...e))},toLowerCase(){return this.check(XA())},toUpperCase(){return this.check(ZA())},slugify(){return this.check(QA())}})}),aM=X(`ZodString`,(e,t)=>{FO.init(e,t),iM.init(e,t),e.email=t=>e.check(eA(sM,t)),e.url=t=>e.check(oA(uM,t)),e.jwt=t=>e.check(xA(TM,t)),e.emoji=t=>e.check(sA(dM,t)),e.guid=t=>e.check(tA(cM,t)),e.uuid=t=>e.check(nA(lM,t)),e.uuidv4=t=>e.check(rA(lM,t)),e.uuidv6=t=>e.check(iA(lM,t)),e.uuidv7=t=>e.check(aA(lM,t)),e.nanoid=t=>e.check(cA(fM,t)),e.guid=t=>e.check(tA(cM,t)),e.cuid=t=>e.check(lA(pM,t)),e.cuid2=t=>e.check(uA(mM,t)),e.ulid=t=>e.check(dA(hM,t)),e.base64=t=>e.check(vA(SM,t)),e.base64url=t=>e.check(yA(CM,t)),e.xid=t=>e.check(fA(gM,t)),e.ksuid=t=>e.check(pA(_M,t)),e.ipv4=t=>e.check(mA(vM,t)),e.ipv6=t=>e.check(hA(yM,t)),e.cidrv4=t=>e.check(gA(bM,t)),e.cidrv6=t=>e.check(_A(xM,t)),e.e164=t=>e.check(bA(wM,t)),e.datetime=t=>e.check(Fj(t)),e.date=t=>e.check(Lj(t)),e.time=t=>e.check(zj(t)),e.duration=t=>e.check(Vj(t))});function Q(e){return $k(aM,e)}var oM=X(`ZodStringFormat`,(e,t)=>{IO.init(e,t),iM.init(e,t)}),sM=X(`ZodEmail`,(e,t)=>{zO.init(e,t),oM.init(e,t)}),cM=X(`ZodGUID`,(e,t)=>{LO.init(e,t),oM.init(e,t)}),lM=X(`ZodUUID`,(e,t)=>{RO.init(e,t),oM.init(e,t)}),uM=X(`ZodURL`,(e,t)=>{BO.init(e,t),oM.init(e,t)}),dM=X(`ZodEmoji`,(e,t)=>{VO.init(e,t),oM.init(e,t)}),fM=X(`ZodNanoID`,(e,t)=>{HO.init(e,t),oM.init(e,t)}),pM=X(`ZodCUID`,(e,t)=>{UO.init(e,t),oM.init(e,t)}),mM=X(`ZodCUID2`,(e,t)=>{WO.init(e,t),oM.init(e,t)}),hM=X(`ZodULID`,(e,t)=>{GO.init(e,t),oM.init(e,t)}),gM=X(`ZodXID`,(e,t)=>{KO.init(e,t),oM.init(e,t)}),_M=X(`ZodKSUID`,(e,t)=>{qO.init(e,t),oM.init(e,t)}),vM=X(`ZodIPv4`,(e,t)=>{QO.init(e,t),oM.init(e,t)}),yM=X(`ZodIPv6`,(e,t)=>{$O.init(e,t),oM.init(e,t)}),bM=X(`ZodCIDRv4`,(e,t)=>{ek.init(e,t),oM.init(e,t)}),xM=X(`ZodCIDRv6`,(e,t)=>{tk.init(e,t),oM.init(e,t)}),SM=X(`ZodBase64`,(e,t)=>{rk.init(e,t),oM.init(e,t)}),CM=X(`ZodBase64URL`,(e,t)=>{ak.init(e,t),oM.init(e,t)}),wM=X(`ZodE164`,(e,t)=>{ok.init(e,t),oM.init(e,t)}),TM=X(`ZodJWT`,(e,t)=>{ck.init(e,t),oM.init(e,t)}),EM=X(`ZodNumber`,(e,t)=>{lk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fj(e,t,n,r),nM(e,`ZodNumber`,{gt(e,t){return this.check(FA(e,t))},gte(e,t){return this.check(IA(e,t))},min(e,t){return this.check(IA(e,t))},lt(e,t){return this.check(NA(e,t))},lte(e,t){return this.check(PA(e,t))},max(e,t){return this.check(PA(e,t))},int(e){return this.check(kM(e))},safe(e){return this.check(kM(e))},positive(e){return this.check(FA(0,e))},nonnegative(e){return this.check(IA(0,e))},negative(e){return this.check(NA(0,e))},nonpositive(e){return this.check(PA(0,e))},multipleOf(e,t){return this.check(LA(e,t))},step(e,t){return this.check(LA(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function DM(e){return EA(EM,e)}var OM=X(`ZodNumberFormat`,(e,t)=>{uk.init(e,t),EM.init(e,t)});function kM(e){return OA(OM,e)}var AM=X(`ZodBoolean`,(e,t)=>{dk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pj(e,t,n,r)});function jM(e){return kA(AM,e)}var MM=X(`ZodNull`,(e,t)=>{fk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mj(e,t,n,r)});function NM(e){return AA(MM,e)}var PM=X(`ZodUnknown`,(e,t)=>{pk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function FM(){return jA(PM)}var IM=X(`ZodNever`,(e,t)=>{mk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hj(e,t,n,r)});function LM(e){return MA(IM,e)}var RM=X(`ZodArray`,(e,t)=>{gk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bj(e,t,n,r),e.element=t.element,nM(e,`ZodArray`,{min(e,t){return this.check(zA(e,t))},nonempty(e){return this.check(zA(1,e))},max(e,t){return this.check(RA(e,t))},length(e,t){return this.check(BA(e,t))},unwrap(){return this.element}})});function zM(e,t){return $A(RM,e,t)}var BM=X(`ZodObject`,(e,t)=>{xk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xj(e,t,n,r),UE(e,`shape`,()=>t.shape),nM(e,`ZodObject`,{keyof(){return ZM(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:FM()})},loose(){return this.clone({...this._zod.def,catchall:FM()})},strict(){return this.clone({...this._zod.def,catchall:LM()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return oD(this,e)},safeExtend(e){return sD(this,e)},merge(e){return cD(this,e)},pick(e){return iD(this,e)},omit(e){return aD(this,e)},partial(...e){return lD(nN,this,e[0])},required(...e){return uD(fN,this,e[0])}})});function VM(e,t){return new BM({type:`object`,shape:e??{},...Z(t)})}function $(e,t){return new BM({type:`object`,shape:e,catchall:LM(),...Z(t)})}var HM=X(`ZodUnion`,(e,t)=>{Ck.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sj(e,t,n,r),e.options=t.options});function UM(e,t){return new HM({type:`union`,options:e,...Z(t)})}var WM=X(`ZodDiscriminatedUnion`,(e,t)=>{HM.init(e,t),wk.init(e,t)});function GM(e,t,n){return new WM({type:`union`,options:t,discriminator:e,...Z(n)})}var KM=X(`ZodIntersection`,(e,t)=>{Tk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cj(e,t,n,r)});function qM(e,t){return new KM({type:`intersection`,left:e,right:t})}var JM=X(`ZodRecord`,(e,t)=>{Ok.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wj(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function YM(e,t,n){return!t||!t._zod?new JM({type:`record`,keyType:Q(),valueType:e,...Z(t)}):new JM({type:`record`,keyType:e,valueType:t,...Z(n)})}var XM=X(`ZodEnum`,(e,t)=>{kk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gj(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new XM({...t,checks:[],...Z(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new XM({...t,checks:[],...Z(r),entries:i})}});function ZM(e,t){return new XM({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Z(t)})}var QM=X(`ZodLiteral`,(e,t)=>{Ak.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_j(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function $M(e,t){return new QM({type:`literal`,values:Array.isArray(e)?e:[e],...Z(t)})}var eN=X(`ZodTransform`,(e,t)=>{jk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yj(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new NE(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(_D(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(_D(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function tN(e){return new eN({type:`transform`,transform:e})}var nN=X(`ZodOptional`,(e,t)=>{Nk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mj(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rN(e){return new nN({type:`optional`,innerType:e})}var iN=X(`ZodExactOptional`,(e,t)=>{Pk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mj(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function aN(e){return new iN({type:`optional`,innerType:e})}var oN=X(`ZodNullable`,(e,t)=>{Fk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tj(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sN(e){return new oN({type:`nullable`,innerType:e})}var cN=X(`ZodDefault`,(e,t)=>{Ik.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dj(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function lN(e,t){return new cN({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():QE(t)}})}var uN=X(`ZodPrefault`,(e,t)=>{Rk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oj(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dN(e,t){return new uN({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():QE(t)}})}var fN=X(`ZodNonOptional`,(e,t)=>{zk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ej(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pN(e,t){return new fN({type:`nonoptional`,innerType:e,...Z(t)})}var mN=X(`ZodCatch`,(e,t)=>{Vk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kj(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function hN(e,t){return new mN({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var gN=X(`ZodPipe`,(e,t)=>{Hk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aj(e,t,n,r),e.in=t.in,e.out=t.out});function _N(e,t){return new gN({type:`pipe`,in:e,out:t})}var vN=X(`ZodReadonly`,(e,t)=>{Wk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jj(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yN(e){return new vN({type:`readonly`,innerType:e})}var bN=X(`ZodLazy`,(e,t)=>{Kk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nj(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function xN(e){return new bN({type:`lazy`,getter:e})}var SN=X(`ZodCustom`,(e,t)=>{qk.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vj(e,t,n,r)});function CN(e,t={}){return ej(SN,e,t)}function wN(e,t){return tj(e,t)}function TN(e){let t=xN(()=>UM([Q(e),DM(),jM(),NM(),zM(t),YM(Q(),t)]));return t}function EN(e){return DA(EM,e)}var DN=`/api/socket.io/`,ON=64*1024,kN=`\x1B[9000~`,AN=`\x1B[9001~`,jN=`\x1B[9002~`,MN=`\x1B[9003~`,NN=`\x1B[9004~`,PN=Q().min(1).max(128),FN=Q().min(1).max(128),IN=Q().min(1).max(128),LN=DM().int().nonnegative(),RN={cols:DM().int().min(2).max(1e3),rows:DM().int().min(2).max(500)},zN=$(RN),BN=$({state:ZM([`normal`,`error`,`indeterminate`,`paused`]),value:DM().int().min(0).max(100).nullable()}),VN=ZM([`pi`,`claude`,`codex`]),HN=$({terminalId:Q().min(1),title:Q().max(256).nullable(),program:VN.nullable().default(null),hasForegroundProcess:jM().nullable().optional(),progress:BN.nullable(),progressStartedAt:Q().datetime().nullable().default(null),progressClearedAt:Q().datetime().nullable().default(null),bell:$({sequence:DM().int().positive(),at:Q().datetime(),unread:jM()}).nullable().default(null)});$({sequence:DM().int().positive()}),$({terminalId:PN,clientId:FN,...RN}),$({generation:LN,data:Q().max(ON)}),$({generation:LN,data:Q().max(ON)}),$({generation:LN,...RN}),$({generation:LN,...RN}),$({generation:LN}),$({streamId:IN,sequence:DM().int().nonnegative()});var UN={connectionId:Q().min(1).max(128),streamId:IN,generation:LN,controller:jM(),reset:$M(`full`)},WN=UM([$(UN),$({...UN,...RN,revision:DM().int().positive()})]),GN=$({...RN,revision:DM().int().positive()}),KN=$({streamId:IN,sequence:DM().int().positive(),data:Q()}),qN=$({title:Q().max(256)}),JN=$({progress:BN.nullable()}),YN=$({viewing:jM()}),XN=$({generation:LN,controller:jM()}),ZN=$({exitCode:DM().int().nullable()}),QN=$({code:Q().min(1).max(80),message:Q().min(1).max(1e3),retryable:jM()});function $N(e,t){let n={ready:WN,dimensions:GN,output:KN,title:qN,progress:JN,history:YN,control:XN,exit:ZN,terminal_error:QN}[e].safeParse(t);return n.success?n.data:null}var eP=Q().min(1).max(128),tP=(e,t)=>$({id:eP,type:$M(e),at:Q().datetime(),data:t}),nP=$({projectId:eP,worktreeId:NM()}),rP=$({worktreeId:eP}),iP=$({projectId:eP,worktreeId:eP}),aP=$({operationId:eP,worktreeId:eP}),oP=GM(`type`,[tP(`project.created`,nP),tP(`project.updated`,nP),tP(`project.removed`,nP),tP(`worktree.created`,iP),tP(`worktree.updated`,rP),tP(`worktree.removed`,iP),tP(`create.started`,$({projectId:eP,operationId:eP,worktreeId:NM()})),tP(`create.completed`,$({projectId:eP,operationId:eP,worktreeId:eP})),tP(`create.failed`,$({projectId:eP,operationId:eP,worktreeId:NM()})),tP(`terminal.created`,$({projectId:eP.optional(),worktreeId:eP,terminalId:eP})),tP(`terminal.updated`,$({worktreeId:eP,terminalId:eP})),tP(`terminal.removed`,$({worktreeId:eP,terminalId:eP})),tP(`terminal.metadata`,HN.extend({worktreeId:NM()})),tP(`terminal.controller_changed`,$({terminalId:eP,controlled:jM(),worktreeId:NM()})),tP(`panel.created`,$({worktreeId:eP,panelId:eP})),tP(`panel.updated`,$({worktreeId:eP,panelId:eP})),tP(`panel.open_requested`,$({worktreeId:eP,panelId:eP,sourceTerminalId:eP.nullable()})),tP(`panel.removed`,$({worktreeId:eP,panelId:eP})),tP(`remove.started`,aP.extend({kind:$M(`remove`)})),tP(`remove.completed`,aP),tP(`remove.failed`,aP.extend({error:Q()}))]),sP=$({id:Q().min(1),kind:$M(`web`),worktreeId:Q().min(1),definitionId:Q().min(1),title:Q().min(1),launch:$({input:YM(Q(),TN()).nullable(),cwd:Q().nullable()}),sandbox:$({allowSameOrigin:jM()}),createdAt:Q(),updatedAt:Q()}),cP=$({at:Q().datetime(),terminalMetadata:zM(HN),webPanels:zM(sP)});function lP(e){let t=cP.safeParse(e);return t.success?t.data:null}function uP(e){let t=oP.safeParse(e);return t.success?t.data:null}var dP=4096,fP=4096;VM({input:Q().trim().min(1).max(4096),hidden:ZM([`true`,`false`]).optional().default(`false`).transform(e=>e===`true`)}),VM({lines:EN().int().min(1).max(5e3).optional().default(200)}),VM({path:Q().trim().min(1),name:Q().trim().min(1).max(120).optional()}),VM({color:ZM([`rose`,`orange`,`amber`,`emerald`,`cyan`,`blue`,`violet`,`pink`]).nullable()});var pP=Q().trim().min(1).max(120),mP=zM(Q()).min(1).max(128),hP=Q().max(fP),gP={name:pP,executable:Q().min(1).max(dP).refine(e=>e.trim().length>0,{message:`Executable cannot be blank`}),args:zM(hP).max(127),closeOnSuccess:jM().default(!1)};$(gP);var _P=Q().regex(/^[a-z0-9][a-z0-9._-]{0,119}$/,{message:`Preset IDs must contain only lowercase letters, numbers, dots, underscores, and hyphens`});$({version:$M(1),presets:YM(_P,FM())});var vP=Q().min(1).max(64),yP=VM({name:pP,argv:mP.optional(),returnToShell:jM().optional(),initialSize:zN.optional()});VM({name:Q().trim().min(1).max(120),base:ZM([`default`,`current`]).default(`default`),sourceWorktreeId:Q().min(1).optional(),initialTerminal:yP.optional()}).superRefine((e,t)=>{e.base===`current`&&!e.sourceWorktreeId&&t.addIssue({code:`custom`,path:[`sourceWorktreeId`],message:`A source worktree is required when starting from current`})});var bP=Q().min(1).max(4096).refine(e=>e.trim().length>0&&!e.includes(`\0`),{message:`Working directory cannot be blank or contain NUL`}),xP=YM(Q().min(1).max(256).refine(e=>!e.includes(`=`)&&!e.includes(`\0`),{message:`Environment keys cannot contain equals or NUL`}),Q().max(fP).refine(e=>!e.includes(`\0`),{message:`Environment values cannot contain NUL`})).refine(e=>Object.keys(e).length<=128,{message:`Environment cannot contain more than 128 variables`});VM({name:pP,argv:mP.optional(),cwd:bP.optional(),env:xP.optional(),returnToShell:jM().optional(),closeOnSuccess:jM().optional(),initialSize:zN.optional()}).refine(e=>!(e.returnToShell&&e.closeOnSuccess),{message:`A terminal cannot return to a shell and close on success`}),VM({name:pP});var SP=YM(Q(),TN());VM({definitionId:Q().min(1).max(256),input:SP.nullable().optional(),launchCwd:Q().max(4096).nullable().optional()}).extend({newInstance:jM().optional(),sourceTerminalId:Q().min(1).max(128).nullable().optional()});var CP=Q().min(1).max(128);VM({key:CP}),VM({key:CP,value:TN()}),VM({key:CP}),VM(gP),VM({...gP,closeOnSuccess:jM().optional(),expectedUpdatedAt:vP}),VM({expectedUpdatedAt:vP}),VM({path:Q().trim().min(1).max(4096)}),VM({source:Q().trim().min(1).max(4096),projectId:Q().min(1).optional()}),VM({source:Q().trim().min(1).max(4096),projectId:Q().min(1).optional()}),VM({source:Q().trim().min(1).max(4096).optional()}),VM({projectId:Q().min(1).optional()}),VM({confirmationToken:Q().length(64),confirmDestructive:jM()}),VM({project:Q().min(1),worktreeName:Q().trim().min(1).max(120),name:pP,argv:mP.optional(),base:ZM([`default`,`current`]).default(`default`),sourceWorktreeId:Q().min(1).optional()}).superRefine((e,t)=>{e.base===`current`&&!e.sourceWorktreeId&&t.addIssue({code:`custom`,path:[`sourceWorktreeId`],message:`A source worktree is required when starting from current`})});var wP=8,TP=8*1024*1024,EP=4,DP=2,OP=1e3,kP=2,AP=500,jP=150,MP=24,NP=44;function PP(e,t={cols:100,rows:30}){return{cols:Number.isFinite(e.cols)?Math.min(OP,Math.max(DP,Math.trunc(e.cols))):t.cols,rows:Number.isFinite(e.rows)?Math.min(AP,Math.max(kP,Math.trunc(e.rows))):t.rows}}var FP={phase:`closed`,degraded:!1,controller:!1,controlPending:!1,title:null,bellActive:!1,bellSerial:0,exitSerial:0,fileTransfer:null,hasSelection:!1,selecting:!1,viewingHistory:!1,pasteRequestSerial:0,error:null},IP=null;function LP(){if(IP)return IP;try{let e=sessionStorage.getItem(`treeport-terminal-client-id`);if(e)return sessionStorage.setItem(`treeport-terminal-client-id`,e),IP=e}catch{}let e=new Uint8Array(16);if(typeof globalThis.crypto?.getRandomValues==`function`)globalThis.crypto.getRandomValues(e);else for(let t=0;t<e.length;t+=1)e[t]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)),n=`${t.slice(0,4).join(``)}-${t.slice(4,6).join(``)}-${t.slice(6,8).join(``)}-${t.slice(8,10).join(``)}-${t.slice(10).join(``)}`;try{sessionStorage.setItem(`treeport-terminal-client-id`,n)}catch{}return IP=n}var RP=class{terminalId;listeners=new Set;snapshotValue=FP;terminal=null;fitAddon=null;wrapper=null;host=null;resizeObserver=null;keyboardViewportCleanup=null;socket=null;degradedTimer=null;bellTimer=null;fileTransferTimer=null;fileTransferQueue=Promise.resolve();resizeFrame=null;resizeSettleTimer=null;disposed=!1;opened=!1;ready=!1;reconnectAllowed=!0;streamId=null;controllerGeneration=0;controlRequestGeneration=null;canonicalCols=100;canonicalRows=30;canonicalRevision=0;appliedRevision=0;proposedDimensions=null;resizePending=!1;serverProtocolVersion=2;resizeIntentDirty=!1;resizeQuietElapsed=!1;resizeIntentGeneration=0;renderEpoch=0;renderQueue=Promise.resolve();renderFailed=!1;pendingTerminalWrites=0;expectedSequence=1;lastParsedSequence=0;parsedSequences=new Set;scrollExitPending=!1;resumeOnNextInput=!1;historyExitRequested=!1;selectionClearRequested=!1;selectionDragCancel=null;tmuxSelectionPending=!1;tmuxSelectionText=null;pendingPaste=``;inputModifiers=null;lastBellAt=0;wakeListenersAttached=!1;reconnectWhenOnline=()=>this.reconnectImmediately();reconnectWhenVisible=()=>{document.visibilityState===`visible`&&this.reconnectImmediately()};constructor(e){this.terminalId=e}getSnapshot=()=>this.snapshotValue;getInitialSize(){return!this.host||!this.terminal?null:PP(this.proposedDimensions??{cols:this.terminal.cols,rows:this.terminal.rows})}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));mount(e){if(this.disposed)return;this.host=e,this.wrapper||(this.wrapper=document.createElement(`div`),this.wrapper.className=`terminal-session-host h-full min-h-0 min-w-0`),e.appendChild(this.wrapper),this.opened||this.openTerminal(),this.keyboardViewportCleanup?.(),this.keyboardViewportCleanup=null;let t=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,n=window.visualViewport;if(t&&n){let e=null,t=null,r=()=>{t!==null&&window.cancelAnimationFrame(t),t=window.requestAnimationFrame(()=>{t=null;let r=this.wrapper?.querySelector(`.xterm-helper-textarea`);if(!(document.activeElement===r&&n.height<document.documentElement.clientHeight-100)){e?.remove(),e=null,document.querySelector(`.app-frame`)?.scrollIntoView({block:`start`,inline:`nearest`});return}let i=document.querySelector(`.accessory-row`);if(!i)return;e??=document.createElement(`div`),e.className=`ios-keyboard-viewport-spacer`,e.setAttribute(`aria-hidden`,`true`);let a=window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone?0:NP;e.style.height=`${i.getBoundingClientRect().height+MP+a}px`,document.body.appendChild(e),e.scrollIntoView({block:`end`,inline:`nearest`})})};n.addEventListener(`resize`,r),r(),this.keyboardViewportCleanup=()=>{n.removeEventListener(`resize`,r),t!==null&&window.cancelAnimationFrame(t),e?.remove()}}this.resizeObserver?.disconnect(),this.resizeObserver=new ResizeObserver(()=>this.scheduleFit()),this.resizeObserver.observe(e),this.wakeListenersAttached||=(window.addEventListener(`online`,this.reconnectWhenOnline),document.addEventListener(`visibilitychange`,this.reconnectWhenVisible),!0),this.scheduleFit(),!this.socket&&this.opened?this.connect():this.reconnectImmediately()}unmount(e){this.host===e&&(this.resizeObserver?.disconnect(),this.resizeObserver=null,this.wakeListenersAttached&&=(window.removeEventListener(`online`,this.reconnectWhenOnline),document.removeEventListener(`visibilitychange`,this.reconnectWhenVisible),!1),this.keyboardViewportCleanup?.(),this.keyboardViewportCleanup=null,this.cancelControllerResizeIntent(!1),this.selectionDragCancel?.(),this.wrapper?.remove(),this.host=null)}focus(e={}){e.requestControl&&this.requestControl(),this.terminal?.focus()}requestControl(){if(!this.ready||!this.socket?.connected||this.snapshotValue.controller||this.controlRequestGeneration===this.controllerGeneration)return;let e=PP(this.proposedDimensions??{cols:this.canonicalCols,rows:this.canonicalRows});this.controlRequestGeneration=this.controllerGeneration,this.update({controlPending:!0}),this.send(`take_control`,this.serverProtocolVersion===2?{generation:this.controllerGeneration,...e}:{generation:this.controllerGeneration})}retry(){if(!(this.disposed||this.ready)){if(this.renderFailed){window.location.reload();return}this.reconnectAllowed=!0,this.update({error:null,phase:`connecting`,degraded:!1}),this.socket?this.socket.connect():this.connect()}}setInputModifiers(e,t,n){this.inputModifiers=e||t?{ctrl:e,alt:t,onConsumed:n}:null}sendText(e){this.requestControl(),this.clearSelection(),this.prepareScrollExit(),this.canInput()&&this.send(`input`,{generation:this.controllerGeneration,data:this.withScrollExit(e)}),this.focus()}pasteText(e){e&&(this.requestControl(),this.clearSelection(),this.prepareScrollExit(),this.canInput()?this.terminal?.paste(e):this.pendingPaste+=e,this.focus())}sendArrow(e,t=!1){let n={up:`A`,down:`B`,right:`C`,left:`D`}[e],r=this.terminal?.modes.applicationCursorKeysMode?`\x1BO`:`\x1B[`;this.sendText(`${t?`\x1B`:``}${r}${n}`)}jumpToLatest(){this.ready&&(this.historyExitRequested=!0,this.requestControl(),this.canInput()&&this.sendHistoryExit(),this.focus())}copySelection(){let e=this.tmuxSelectionText??this.terminal?.getSelection()??``;if(!e)return;let t=document.createElement(`textarea`);t.value=e,t.readOnly=!0,t.style.position=`fixed`,t.style.left=`-9999px`,t.style.opacity=`0`,document.body.appendChild(t),t.focus({preventScroll:!0}),t.select(),t.setSelectionRange(0,e.length);let n=document.execCommand(`copy`);t.remove(),!n&&navigator.clipboard&&navigator.clipboard.writeText(e),this.focus()}clearSelectionAndJumpToLatest(){this.ready&&(this.historyExitRequested=!0,this.selectionClearRequested=!0,this.requestControl(),this.canInput()&&(this.send(`input`,{generation:this.controllerGeneration,data:`${kN}${MN}`}),this.historyExitRequested=!1,this.selectionClearRequested=!1,this.setViewingHistory(!1)),this.tmuxSelectionPending=!1,this.tmuxSelectionText=null,this.wrapper?.classList.remove(`terminal-tmux-selection`),this.terminal?.clearSelection(),this.update({selecting:!1,hasSelection:!1}),this.focus())}clearSelection(){let e=this.tmuxSelectionPending||this.tmuxSelectionText!==null;!e&&!this.terminal?.hasSelection?.()||(e&&(this.selectionClearRequested=!0,this.sendSelectionClear()),this.tmuxSelectionPending=!1,this.tmuxSelectionText=null,this.update({selecting:!1}),this.wrapper?.classList.remove(`terminal-tmux-selection`),this.terminal?.clearSelection(),this.updateSelectionState())}dispose(){this.disposed||(this.disposed=!0,this.reconnectAllowed=!1,this.clearTimers(),this.selectionDragCancel?.(),this.selectionDragCancel=null,this.resizeObserver?.disconnect(),this.wakeListenersAttached&&=(window.removeEventListener(`online`,this.reconnectWhenOnline),document.removeEventListener(`visibilitychange`,this.reconnectWhenVisible),!1),this.keyboardViewportCleanup?.(),this.keyboardViewportCleanup=null,this.socket?.disconnect(),this.socket=null,this.wrapper?.remove(),this.terminal?.dispose(),this.terminal=null,this.fitAddon=null,this.wrapper=null,this.listeners.clear())}openTerminal(){if(!this.wrapper||this.opened)return;let e=new jw(sg()),t=new ug;e.loadAddon(t),e.loadAddon(new gg(tg)),e.open(this.wrapper),e.onSelectionChange(()=>this.updateSelectionState()),this.selectionDragCancel=ag(this.wrapper,e,{canInput:()=>this.canInput(),sendInput:e=>{this.send(`input`,{generation:this.controllerGeneration,data:e})},requestControl:()=>this.requestControl(),onSelectionStart:()=>this.clearSelection(),onTmuxSelectionStart:()=>{this.scrollExitPending=!0,this.update({selecting:!0}),this.wrapper?.classList.add(`terminal-scrolling`,`terminal-tmux-selection`)},onTmuxSelectionFinish:()=>{this.tmuxSelectionPending=!0,this.update({selecting:!1,hasSelection:!0})},onTmuxSelectionCancel:()=>{this.update({selecting:!1}),this.sendHistoryExit()},selectionStartSequence:AN,selectionStopSequence:jN}),this.wrapper.addEventListener(`copy`,e=>{this.tmuxSelectionText===null||!e.clipboardData||(e.preventDefault(),e.stopImmediatePropagation(),e.clipboardData.setData(`text/plain`,this.tmuxSelectionText))},!0),this.wrapper.addEventListener(`click`,()=>this.requestControl(),!0),this.wrapper.addEventListener(`keydown`,t=>{let n=t.key.toLowerCase(),r=[`alt`,`altgraph`,`control`,`meta`,`shift`].includes(n),i=$h(t,e.modes.applicationCursorKeysMode),a=t.metaKey&&i===null,o=t.ctrlKey&&t.shiftKey&&(n===`c`||n===`v`);!r&&!a&&!o&&(this.clearSelection(),this.requestControl())},!0),og(this.wrapper,e,e=>{e.deltaY<0&&this.canInput()&&(!this.snapshotValue.viewingHistory&&this.tmuxSelectionText!==null&&this.send(`input`,{generation:this.controllerGeneration,data:NN}),this.scrollExitPending=!0)},()=>{this.requestControl(),this.clearSelection(),this.prepareScrollExit()},()=>{this.requestControl(),this.update({pasteRequestSerial:this.snapshotValue.pasteRequestSerial+1})});let n=this.wrapper,r=e=>!!(e&&(Array.from(e.types).includes(`Files`)||Array.from(e.items).some(e=>e.kind===`file`))),i=e=>{let t=Array.from(e?.files??[]);return t.length?t:Array.from(e?.items??[]).flatMap(e=>{let t=e.kind===`file`?e.getAsFile():null;return t?[t]:[]})};n.addEventListener(`dragover`,e=>{r(e.dataTransfer)&&(this.requestControl(),e.preventDefault(),e.dataTransfer.dropEffect=`copy`,n.classList.add(`terminal-file-drag`))}),n.addEventListener(`dragleave`,e=>{(!(e.relatedTarget instanceof Node)||!n.contains(e.relatedTarget))&&n.classList.remove(`terminal-file-drag`)}),n.addEventListener(`drop`,e=>{r(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),n.classList.remove(`terminal-file-drag`),this.requestControl(),this.queueFileUpload(i(e.dataTransfer)))}),n.addEventListener(`paste`,e=>{let t=i(e.clipboardData);t.length&&(e.preventDefault(),e.stopPropagation(),this.requestControl(),this.queueFileUpload(t))},!0),this.terminal=e,this.fitAddon=t,this.opened=!0,e.parser.registerOscHandler(52,e=>{if(!this.tmuxSelectionPending)return!1;this.tmuxSelectionPending=!1;let t=e.indexOf(`;`),n=t===-1?``:e.slice(t+1),r=n.replace(/=+$/,``);if(!n||n===`?`||n.length>TP||e.indexOf(`;`,t+1)!==-1||!/^[A-Za-z0-9+/]*={0,2}$/.test(n)||r.length%4==1)return this.updateSelectionState(),!0;let i=r.padEnd(Math.ceil(r.length/4)*4,`=`),a=atob(i);return this.tmuxSelectionText=new TextDecoder().decode(Uint8Array.from(a,e=>e.charCodeAt(0))),this.update({selecting:!1}),this.updateSelectionState(),!0}),e.attachCustomKeyEventHandler(t=>{let n=$h(t,e.modes.applicationCursorKeysMode);return n===null?!0:(t.preventDefault(),t.stopPropagation(),this.prepareScrollExit(),e.input(n,!0),!1)}),e.onKey(()=>this.prepareScrollExit()),e.onData(e=>{if(this.canInput()){let t=this.inputModifiers;t&&(this.inputModifiers=null,t.ctrl&&e.length===1&&(e=String.fromCharCode(e.toUpperCase().charCodeAt(0)&31)),t.alt&&(e=`\u001b${e}`),t.onConsumed()),this.send(`input`,{generation:this.controllerGeneration,data:this.withScrollExit(e)})}}),e.onBinary(e=>{this.canInput()&&this.send(`binary`,{generation:this.controllerGeneration,data:this.withScrollExit(e)})}),e.onTitleChange(e=>this.update({title:e.trim().slice(0,256)})),e.onBell(()=>this.handleBell())}queueFileUpload(e){this.fileTransferQueue=this.fileTransferQueue.catch(()=>void 0).then(()=>this.uploadFiles(e))}async uploadFiles(e){if(!(!e.length||this.disposed)){if(e.length>wP){this.showFileTransferError(`Choose no more than ${wP} files at a time`);return}if(!this.ready||!this.snapshotValue.controller){this.showFileTransferError(this.snapshotValue.controlPending?`taking control; try again in a moment`:`interact with the terminal to take control first`);return}if(!this.canInput()){this.showFileTransferError(`Wait for the terminal resize to finish`);return}this.fileTransferTimer!==null&&(window.clearTimeout(this.fileTransferTimer),this.fileTransferTimer=null),this.update({fileTransfer:{state:`uploading`,message:`Uploading ${e.length===1?`file`:`${e.length} files`}…`}});try{let t=[];for(let n of e){let e=/\.([a-z0-9]{1,16})$/i.exec(n.name)?.[1],r=await Tf(CE.api.terminals[`:terminalId`].files.$post({param:{terminalId:this.terminalId}},{init:{body:n,headers:{"content-type":n.type||`application/octet-stream`,...e?{"x-treeport-file-extension":e.toLowerCase()}:{}}}}));t.push(r.file.path)}if(this.disposed)return;if(!this.ready||!this.snapshotValue.controller){this.showFileTransferError(`Terminal control was lost during the upload`);return}if(!this.canInput()){this.showFileTransferError(`Wait for the terminal resize to finish`);return}let n=t.join(` `);if(new TextEncoder().encode(n).byteLength>65504){this.showFileTransferError(`The uploaded file paths are too long`);return}this.clearSelection(),this.prepareScrollExit(),this.terminal?.paste(n),this.focus(),this.update({fileTransfer:null})}catch(e){this.disposed||this.showFileTransferError(AE(e))}}}showFileTransferError(e){this.fileTransferTimer!==null&&window.clearTimeout(this.fileTransferTimer),this.update({fileTransfer:{state:`error`,message:`Couldn’t paste file: ${e}`}}),this.fileTransferTimer=window.setTimeout(()=>{this.fileTransferTimer=null,this.update({fileTransfer:null})},6e3)}prepareScrollExit(){(this.scrollExitPending||this.snapshotValue.viewingHistory)&&(this.resumeOnNextInput=!0)}withScrollExit(e){return this.resumeOnNextInput?(this.setViewingHistory(!1),`${kN}${e}`):e}sendHistoryExit(){this.canInput()&&(this.send(`input`,{generation:this.controllerGeneration,data:kN}),this.historyExitRequested=!1,this.setViewingHistory(!1))}sendSelectionClear(){this.canInput()&&(this.send(`input`,{generation:this.controllerGeneration,data:MN}),this.selectionClearRequested=!1)}setViewingHistory(e){e?(this.scrollExitPending=!0,this.wrapper?.classList.add(`terminal-scrolling`),this.tmuxSelectionText!==null&&this.wrapper?.classList.add(`terminal-tmux-selection`)):(this.scrollExitPending=!1,this.resumeOnNextInput=!1,this.historyExitRequested=!1,this.wrapper?.classList.remove(`terminal-scrolling`,`terminal-tmux-selection`)),e!==this.snapshotValue.viewingHistory&&this.update({viewingHistory:e})}reconnectImmediately(){if(!this.host||this.disposed||!this.reconnectAllowed||this.ready||this.socket?.connected)return;let e=this.socket;e&&(e.disconnect(),this.socket===e&&(this.socket=null)),this.opened&&this.connect()}connect(){if(this.disposed||!this.reconnectAllowed||this.socket)return;this.ready=!1,this.controlRequestGeneration=null,this.update({phase:`connecting`,controller:!1,controlPending:!1,error:null}),this.startDegradedTimer();let e=xE(`/terminals`,{path:DN,transports:[`websocket`],forceNew:!0,multiplex:!1,autoConnect:!1,reconnection:!0,reconnectionDelay:100,reconnectionDelayMax:1e3,randomizationFactor:.2,retries:0,query:{terminalProtocol:`2`},auth:e=>{let t=PP(this.proposedDimensions??{cols:this.terminal?.cols??100,rows:this.terminal?.rows??30});e({terminalId:this.terminalId,clientId:LP(),...t})}});this.socket=e,e.on(`connect`,()=>{this.socket===e&&this.fit()}),e.on(`ready`,e=>this.handleServerEvent(`ready`,e)),e.on(`dimensions`,e=>this.handleServerEvent(`dimensions`,e)),e.on(`output`,e=>this.handleServerEvent(`output`,e)),e.on(`title`,e=>this.handleServerEvent(`title`,e)),e.on(`progress`,e=>this.handleServerEvent(`progress`,e)),e.on(`history`,e=>this.handleServerEvent(`history`,e)),e.on(`control`,e=>this.handleServerEvent(`control`,e)),e.on(`exit`,e=>this.handleServerEvent(`exit`,e)),e.on(`terminal_error`,e=>this.handleServerEvent(`terminal_error`,e)),e.on(`connect_error`,t=>{this.socket!==e||!this.reconnectAllowed||(this.controlRequestGeneration=null,this.update({phase:`reconnecting`,controller:!1,controlPending:!1,error:`Terminal connection failed: ${t.message}`}))}),e.on(`disconnect`,t=>{if(this.socket!==e)return;let n=this.ready;this.ready=!1,this.streamId=null,this.selectionDragCancel?.(),this.tmuxSelectionPending=!1,this.tmuxSelectionText=null,this.setViewingHistory(!1),this.controllerGeneration=0,this.controlRequestGeneration=null,this.cancelControllerResizeIntent(),this.reconnectAllowed||this.clearDegraded(),this.update({phase:this.reconnectAllowed&&!this.disposed?`reconnecting`:`closed`,controller:!1,controlPending:!1,hasSelection:!1,selecting:!1,viewingHistory:!1,degraded:this.reconnectAllowed?this.snapshotValue.degraded:!1,error:!n&&!this.snapshotValue.error?`Terminal connection closed: ${t}`:this.snapshotValue.error})}),e.io.on(`reconnect_attempt`,()=>{this.socket===e&&this.reconnectAllowed&&(this.controlRequestGeneration=null,this.startDegradedTimer(),this.update({phase:`reconnecting`,controller:!1,controlPending:!1}))}),e.connect()}handleServerEvent(e,t){if(e===`ready`){let e=$N(`ready`,t);if(!e){this.failProtocol(`The terminal server sent an invalid ready event`);return}this.cancelControllerResizeIntent(),this.controlRequestGeneration=null;let n=`revision`in e;this.serverProtocolVersion=n?2:1;let r=n?{cols:e.cols,rows:e.rows}:PP(this.proposedDimensions??{cols:this.terminal?.cols??100,rows:this.terminal?.rows??30}),i=n?e.revision:1;this.streamId=e.streamId,this.controllerGeneration=e.generation,this.canonicalCols=r.cols,this.canonicalRows=r.rows,this.canonicalRevision=i,this.appliedRevision=n?0:i,this.expectedSequence=1,this.lastParsedSequence=0,this.parsedSequences.clear(),this.selectionDragCancel?.(),this.tmuxSelectionPending=!1,this.tmuxSelectionText=null,this.setViewingHistory(!1),this.ready=!0,this.renderEpoch+=1;let a=this.renderEpoch;this.enqueueRender(a,async()=>{await this.drainTerminalWrites(),!(this.disposed||a!==this.renderEpoch)&&(this.terminal?.reset(),n?this.applyCanonicalDimensions(r.cols,r.rows,i,!0):this.fit(!0))}),this.clearDegraded(),this.update({phase:`ready`,controller:e.controller,controlPending:!1,hasSelection:!1,selecting:!1,viewingHistory:!1,error:null});return}if(e===`dimensions`){if(this.serverProtocolVersion!==2){this.failProtocol(`The legacy terminal server sent dimensions`);return}let e=$N(`dimensions`,t);if(!e){this.failProtocol(`The terminal server sent invalid dimensions`);return}if(e.revision<=this.canonicalRevision)return;this.canonicalCols=e.cols,this.canonicalRows=e.rows,this.canonicalRevision=e.revision,this.resizePending=!1;let n=this.renderEpoch;this.enqueueRender(n,async()=>{await this.drainTerminalWrites(),!(this.disposed||n!==this.renderEpoch)&&(this.applyCanonicalDimensions(e.cols,e.rows,e.revision),this.flushControllerResize())});return}if(e===`output`){let e=$N(`output`,t);if(!e){this.failProtocol(`The terminal server sent invalid output`);return}this.handleOutput(e.streamId,e.sequence,e.data);return}if(e===`title`){let e=$N(`title`,t);if(!e){this.failProtocol(`The terminal server sent an invalid title`);return}this.update({title:e.title.trim().slice(0,256)});return}if(e===`progress`){$N(`progress`,t)||this.failProtocol(`The terminal server sent invalid progress`);return}if(e===`history`){let e=$N(`history`,t);if(!e){this.failProtocol(`The terminal server sent invalid history state`);return}this.setViewingHistory(e.viewing);return}if(e===`control`){let e=$N(`control`,t);if(!e){this.failProtocol(`The terminal server sent invalid controller state`);return}let n=e.controller!==this.snapshotValue.controller||e.generation!==this.controllerGeneration;if(n&&this.cancelControllerResizeIntent(),this.controllerGeneration=e.generation,this.controlRequestGeneration=null,this.update({controller:e.controller,controlPending:!1}),n&&!e.controller&&(this.selectionDragCancel?.(),this.tmuxSelectionPending=!1),e.controller&&this.selectionClearRequested&&this.sendSelectionClear(),e.controller&&this.historyExitRequested&&this.sendHistoryExit(),e.controller&&this.pendingPaste){let e=this.pendingPaste;this.pendingPaste=``,this.terminal?.paste(e)}n&&this.scheduleFit();return}if(e===`exit`){if(!$N(`exit`,t)){this.failProtocol(`The terminal server sent an invalid exit event`);return}this.update({exitSerial:this.snapshotValue.exitSerial+1});return}let n=$N(`terminal_error`,t);if(!n){this.failProtocol(`The terminal server sent an invalid error event`);return}this.reconnectAllowed=n.retryable,this.terminal?.writeln(`\r\n\x1b[31m${n.message}\x1b[0m`),n.retryable?(this.controlRequestGeneration=null,this.update({controlPending:!1,error:n.message})):(this.stopWithError(n.message),this.socket?.disconnect())}handleOutput(e,t,n){if(!this.ready||e!==this.streamId||t!==this.expectedSequence){this.failProtocol(`Terminal output arrived out of order`);return}this.expectedSequence+=1;let r=this.renderEpoch;this.enqueueRender(r,()=>{let i=this.terminal;i&&(this.pendingTerminalWrites+=1,i.write(n,()=>{if(this.pendingTerminalWrites=Math.max(0,this.pendingTerminalWrites-1),this.ready&&r===this.renderEpoch&&e===this.streamId){for(this.parsedSequences.add(t);this.parsedSequences.delete(this.lastParsedSequence+1);)this.lastParsedSequence+=1;this.send(`output_ack`,{streamId:e,sequence:this.lastParsedSequence})}}))})}async drainTerminalWrites(){let e=this.terminal;!e||this.pendingTerminalWrites===0||await new Promise(t=>e.write(``,t))}enqueueRender(e,t){let n=this.renderQueue.then(async()=>{this.disposed||this.renderFailed||e!==this.renderEpoch||await t()});this.renderQueue=n,n.catch(e=>this.failRendering(e))}applyCanonicalDimensions(e,t,n,r=!1){!this.terminal||n<=this.appliedRevision||(this.terminal.resize(e,t),this.appliedRevision=n,this.wrapper&&(this.wrapper.dataset.terminalCols=String(e),this.wrapper.dataset.terminalRows=String(t),this.wrapper.dataset.terminalRevision=String(n)),n===this.canonicalRevision&&this.fit(r))}canInput(){return this.ready&&this.snapshotValue.controller&&!this.resizePending&&this.appliedRevision===this.canonicalRevision}send(e,t){if(!(!this.socket?.connected||!this.ready)){if(e===`output_ack`||e===`resize`||e===`take_control`){this.socket.emit(e,t);return}this.socket.volatile.emit(e,t)}}scheduleFit(){this.resizeFrame!==null&&cancelAnimationFrame(this.resizeFrame),this.resizeFrame=requestAnimationFrame(()=>{this.resizeFrame=null,this.fit(!0)})}queueControllerResizeIntent(){this.resizeSettleTimer!==null&&window.clearTimeout(this.resizeSettleTimer),this.resizeIntentDirty=!0,this.resizeQuietElapsed=!1,this.resizeIntentGeneration=this.controllerGeneration,this.resizeSettleTimer=window.setTimeout(()=>{this.resizeSettleTimer=null,this.resizeQuietElapsed=!0,this.flushControllerResize()},jP)}flushControllerResize(){let e=this.proposedDimensions;if(!(!this.resizeIntentDirty||!this.resizeQuietElapsed||!e||!this.host||!this.ready||!this.socket?.connected||!this.snapshotValue.controller||this.resizeIntentGeneration!==this.controllerGeneration||this.appliedRevision!==this.canonicalRevision||this.resizePending)){if(e.cols===this.canonicalCols&&e.rows===this.canonicalRows){this.resizeIntentDirty=!1,this.resizeQuietElapsed=!1;return}this.resizeIntentDirty=!1,this.resizeQuietElapsed=!1,this.serverProtocolVersion===2?this.resizePending=!0:(this.canonicalCols=e.cols,this.canonicalRows=e.rows,this.appliedRevision=this.canonicalRevision),this.send(`resize`,{generation:this.controllerGeneration,cols:e.cols,rows:e.rows})}}cancelControllerResizeIntent(e=!0){this.resizeSettleTimer!==null&&window.clearTimeout(this.resizeSettleTimer),this.resizeSettleTimer=null,e&&(this.resizePending=!1),this.resizeIntentDirty=!1,this.resizeQuietElapsed=!1,this.resizeIntentGeneration=0,this.proposedDimensions=null}fit(e=!1){if(!(!this.host||!this.fitAddon||!this.terminal))try{if(!this.ready){this.terminal.options.fontSize=14,this.fitAddon.fit(),this.terminal.cols>=DP&&this.terminal.rows>=kP&&(this.proposedDimensions=PP({cols:this.terminal.cols,rows:this.terminal.rows}));return}if(this.serverProtocolVersion===1){if(this.terminal.options.fontSize=14,this.fitAddon.fit(),this.terminal.cols<DP||this.terminal.rows<kP){this.cancelControllerResizeIntent(!1);return}let t=PP({cols:this.terminal.cols,rows:this.terminal.rows});this.proposedDimensions=t,this.snapshotValue.controller&&e&&this.queueControllerResizeIntent();return}if(this.appliedRevision!==this.canonicalRevision)return;this.terminal.options.fontSize=14;let t=this.fitAddon.proposeDimensions();if(!t||!Number.isFinite(t.cols)||!Number.isFinite(t.rows)||t.cols<DP||t.rows<kP){this.snapshotValue.controller&&this.cancelControllerResizeIntent(!1);return}let n=PP(t);if(this.proposedDimensions=n,this.snapshotValue.controller){if(!e)return;if(!this.resizePending&&n.cols===this.canonicalCols&&n.rows===this.canonicalRows){this.resizeSettleTimer!==null&&window.clearTimeout(this.resizeSettleTimer),this.resizeSettleTimer=null,this.resizeIntentDirty=!1,this.resizeQuietElapsed=!1;return}this.queueControllerResizeIntent();return}let r=Math.min(1,n.cols/this.canonicalCols,n.rows/this.canonicalRows);this.terminal.options.fontSize=Math.max(EP,Math.floor(14*r*100)/100),(this.terminal.cols!==this.canonicalCols||this.terminal.rows!==this.canonicalRows)&&this.terminal.resize(this.canonicalCols,this.canonicalRows)}catch(e){this.failRendering(e)}}startDegradedTimer(){this.degradedTimer===null&&(this.degradedTimer=window.setTimeout(()=>{this.degradedTimer=null,this.ready||this.update({degraded:!0})},500))}clearDegraded(){this.degradedTimer!==null&&window.clearTimeout(this.degradedTimer),this.degradedTimer=null,this.update({degraded:!1})}handleBell(){let e=Date.now();e-this.lastBellAt<1e3||(this.lastBellAt=e,this.bellTimer!==null&&window.clearTimeout(this.bellTimer),this.update({bellActive:!0,bellSerial:this.snapshotValue.bellSerial+1}),this.bellTimer=window.setTimeout(()=>{this.bellTimer=null,this.update({bellActive:!1})},180))}failRendering(e){if(this.renderFailed||this.disposed)return;this.renderFailed=!0;let t=(e instanceof Error?e.message:String(e)).trim();this.reconnectAllowed=!1,this.stopWithError(t?`Terminal rendering failed: ${t.slice(0,500)}`:`Terminal rendering failed`),this.socket?.disconnect()}failProtocol(e){this.reconnectAllowed=!1,this.stopWithError(e),this.socket?.disconnect()}stopWithError(e){this.ready=!1,this.clearDegraded(),this.controlRequestGeneration=null,this.update({error:e,phase:`closed`,degraded:!1,controller:!1,controlPending:!1})}updateSelectionState(){this.update({hasSelection:this.tmuxSelectionPending||this.tmuxSelectionText!==null||!!this.terminal?.hasSelection()})}update(e){this.snapshotValue={...this.snapshotValue,...e},this.listeners.forEach(e=>e())}clearTimers(){this.degradedTimer!==null&&window.clearTimeout(this.degradedTimer),this.bellTimer!==null&&window.clearTimeout(this.bellTimer),this.fileTransferTimer!==null&&window.clearTimeout(this.fileTransferTimer),this.resizeFrame!==null&&cancelAnimationFrame(this.resizeFrame),this.resizeSettleTimer!==null&&window.clearTimeout(this.resizeSettleTimer),this.degradedTimer=null,this.bellTimer=null,this.fileTransferTimer=null,this.resizeFrame=null,this.resizeSettleTimer=null,this.resizePending=!1,this.resizeIntentDirty=!1,this.resizeQuietElapsed=!1,this.resizeIntentGeneration=0,this.proposedDimensions=null}},zP=class{maxSessions;idleMs;createSession;onTitleChange;entries=new Map;constructor(e=8,t=5*6e4,n=e=>new RP(e),r=()=>void 0){this.maxSessions=e,this.idleMs=t,this.createSession=n,this.onTitleChange=r}getInitialSize(e){return this.entries.get(e)?.session.getInitialSize()??null}acquire(e){let t=this.entries.get(e);if(!t){let n=this.createSession(e);t={session:n,references:0,lastUsed:Date.now(),idleTimer:null,lastTitle:n.getSnapshot().title,unsubscribe:()=>void 0};let r=t;t.unsubscribe=n.subscribe(()=>{let t=n.getSnapshot();t.title!==r.lastTitle&&(r.lastTitle=t.title,this.onTitleChange(e,t.title))}),this.entries.set(e,t),t.lastTitle&&this.onTitleChange(e,t.lastTitle)}return t.references+=1,t.lastUsed=Date.now(),t.idleTimer!==null&&window.clearTimeout(t.idleTimer),t.idleTimer=null,this.evictOverCapacity(e),t.session}release(e){let t=this.entries.get(e);t&&(t.references=Math.max(0,t.references-1),t.lastUsed=Date.now(),t.references===0&&t.idleTimer===null&&(t.idleTimer=window.setTimeout(()=>this.disposeEntry(e),this.idleMs)))}forget(e){this.disposeEntry(e)}reconcile(e){let t=new Set(e);for(let e of this.entries.keys())t.has(e)||this.disposeEntry(e)}disposeEntry(e){let t=this.entries.get(e);t&&(t.idleTimer!==null&&window.clearTimeout(t.idleTimer),t.unsubscribe(),t.session.dispose(),this.entries.delete(e))}evictOverCapacity(e){for(;this.entries.size>this.maxSessions;){let t=[...this.entries.entries()].filter(([t,n])=>t!==e&&n.references===0).sort((e,t)=>e[1].lastUsed-t[1].lastUsed)[0];if(!t)return;this.disposeEntry(t[0])}}},BP=class{sendBellAcknowledgement;listeners=new Set;bellEventListeners=new Set;attentionSnapshot=new Set;titleSnapshot=new Map;programSnapshot=new Map;foregroundProcessSnapshot=new Set;progressSnapshot=new Map;bellMetadata=new Map;bellAcknowledgementTargets=new Map;bellAcknowledgementQueues=new Map;bellAcknowledgementEpoch=0;notificationBatchDepth=0;notificationPending=!1;constructor(e=(e,t)=>Tf(CE.api.terminals[`:terminalId`].bell.acknowledge.$post({param:{terminalId:e},json:{sequence:t}}))){this.sendBellAcknowledgement=e}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));subscribeBellEvents=e=>(this.bellEventListeners.add(e),()=>this.bellEventListeners.delete(e));getAttentionSnapshot=()=>this.attentionSnapshot;getBellSnapshot=()=>this.bellMetadata;getTitleSnapshot=()=>this.titleSnapshot;getProgramSnapshot=()=>this.programSnapshot;getForegroundProcessSnapshot=()=>this.foregroundProcessSnapshot;getProgressSnapshot=()=>this.progressSnapshot;applyRuntimeMetadata(e){this.notificationBatchDepth+=1;let t=this.bellMetadata.get(e.terminalId),n=e.bell,r=n!==null&&(!t||n.sequence>t.sequence||n.sequence===t.sequence&&(t.unread||!n.unread)),i=r&&(t?.sequence!==n.sequence||t?.at!==n.at||t?.unread!==n.unread),a=r&&n.unread&&(!t||n.sequence>t.sequence)?{terminalId:e.terminalId,sequence:n.sequence,at:n.at}:null;if(r){if(i){let t=new Map(this.bellMetadata);t.set(e.terminalId,{sequence:n.sequence,at:n.at,unread:n.unread}),this.bellMetadata=t,this.emit()}this.setAttention(e.terminalId,n.unread)}else!t&&n===null&&this.setAttention(e.terminalId,!1);this.setRuntimeTitle(e.terminalId,e.title),this.setProgram(e.terminalId,e.program??null),this.setForegroundProcess(e.terminalId,e.hasForegroundProcess===!0),this.setProgress(e.terminalId,e.progress),--this.notificationBatchDepth,this.notificationBatchDepth===0&&this.notificationPending&&(this.notificationPending=!1,this.listeners.forEach(e=>e())),a&&this.bellEventListeners.forEach(e=>e(a))}replaceRuntimeMetadata(e){let t=new Map,n=new Map,r=new Set,i=new Map,a=new Map,o=new Set;for(let s of e){let e=s.title?.trim().slice(0,256);if(e&&t.set(s.terminalId,e),s.program&&n.set(s.terminalId,s.program),s.hasForegroundProcess&&r.add(s.terminalId),s.progress){let e=this.progressSnapshot.get(s.terminalId);i.set(s.terminalId,e?.state===s.progress.state&&e.value===s.progress.value?e:s.progress)}s.bell&&(a.set(s.terminalId,{sequence:s.bell.sequence,at:s.bell.at,unread:s.bell.unread}),s.bell.unread&&o.add(s.terminalId))}let s=t.size!==this.titleSnapshot.size||[...t].some(([e,t])=>this.titleSnapshot.get(e)!==t),c=n.size!==this.programSnapshot.size||[...n].some(([e,t])=>this.programSnapshot.get(e)!==t),l=r.size!==this.foregroundProcessSnapshot.size||[...r].some(e=>!this.foregroundProcessSnapshot.has(e)),u=i.size!==this.progressSnapshot.size||[...i].some(([e,t])=>{let n=this.progressSnapshot.get(e);return n?.state!==t.state||n.value!==t.value}),d=o.size!==this.attentionSnapshot.size||[...o].some(e=>!this.attentionSnapshot.has(e)),f=a.size!==this.bellMetadata.size||[...a].some(([e,t])=>{let n=this.bellMetadata.get(e);return n?.sequence!==t.sequence||n?.at!==t.at||n?.unread!==t.unread});f&&(this.bellMetadata=a),this.bellAcknowledgementEpoch+=1,this.bellAcknowledgementTargets.clear(),s&&(this.titleSnapshot=t),c&&(this.programSnapshot=n),l&&(this.foregroundProcessSnapshot=r),u&&(this.progressSnapshot=i),d&&(this.attentionSnapshot=o),(s||c||l||u||d||f)&&this.emit()}setRuntimeTitle(e,t){let n=t?.trim().slice(0,256)||null;if(n===null){this.clearRuntimeTitle(e);return}this.titleSnapshot.get(e)!==n&&(this.titleSnapshot=new Map(this.titleSnapshot).set(e,n),this.emit())}forget(e){if(this.bellMetadata.has(e)){let t=new Map(this.bellMetadata);t.delete(e),this.bellMetadata=t,this.emit()}this.bellAcknowledgementTargets.delete(e),this.bellAcknowledgementQueues.delete(e),this.clearAttention(e),this.clearRuntimeTitle(e),this.setProgram(e,null),this.setForegroundProcess(e,!1),this.setProgress(e,null)}reconcile(e){let t=new Set(e),n=!1,r=new Set(this.attentionSnapshot),i=new Map(this.titleSnapshot),a=new Map(this.programSnapshot),o=new Set(this.foregroundProcessSnapshot),s=new Map(this.progressSnapshot);for(let e of r)t.has(e)||(r.delete(e),n=!0);for(let e of i.keys())t.has(e)||(i.delete(e),n=!0);for(let e of a.keys())t.has(e)||(a.delete(e),n=!0);for(let e of o)t.has(e)||(o.delete(e),n=!0);for(let e of s.keys())t.has(e)||(s.delete(e),n=!0);let c=new Map(this.bellMetadata);for(let e of c.keys())t.has(e)||(c.delete(e),this.bellAcknowledgementTargets.delete(e),this.bellAcknowledgementQueues.delete(e),n=!0);n&&(this.attentionSnapshot=r,this.titleSnapshot=i,this.programSnapshot=a,this.foregroundProcessSnapshot=o,this.progressSnapshot=s,this.bellMetadata=c,this.emit())}acknowledgeBell(e,t){let n=this.bellMetadata.get(e);if(!n?.unread||n.sequence!==t)return Promise.resolve();let r=this.bellAcknowledgementTargets.get(e)??0,i=this.bellAcknowledgementQueues.get(e);if(t<=r)return i??Promise.resolve();let a=this.bellAcknowledgementEpoch;this.bellAcknowledgementTargets.set(e,t);let o=(i??Promise.resolve()).catch(()=>void 0).then(async()=>{let n=this.bellMetadata.get(e);if(this.bellAcknowledgementEpoch!==a||n?.sequence!==t||!n.unread){this.bellAcknowledgementTargets.get(e)===t&&this.bellAcknowledgementTargets.delete(e);return}await this.sendBellAcknowledgement(e,t)}).catch(n=>{throw this.bellAcknowledgementTargets.get(e)===t&&this.bellAcknowledgementTargets.delete(e),n}).finally(()=>{this.bellAcknowledgementQueues.get(e)===o&&this.bellAcknowledgementQueues.delete(e)});return this.bellAcknowledgementQueues.set(e,o),o}clearAttention(e){if(!this.attentionSnapshot.has(e))return;let t=new Set(this.attentionSnapshot);t.delete(e),this.attentionSnapshot=t,this.emit()}clearRuntimeTitle(e){if(!this.titleSnapshot.has(e))return;let t=new Map(this.titleSnapshot);t.delete(e),this.titleSnapshot=t,this.emit()}setProgram(e,t){if(this.programSnapshot.get(e)===t)return;let n=new Map(this.programSnapshot);t?n.set(e,t):n.delete(e),this.programSnapshot=n,this.emit()}setForegroundProcess(e,t){if(this.foregroundProcessSnapshot.has(e)===t)return;let n=new Set(this.foregroundProcessSnapshot);t?n.add(e):n.delete(e),this.foregroundProcessSnapshot=n,this.emit()}setAttention(e,t){if(t||this.bellAcknowledgementTargets.delete(e),this.attentionSnapshot.has(e)===t)return;let n=new Set(this.attentionSnapshot);t?n.add(e):n.delete(e),this.attentionSnapshot=n,this.emit()}setProgress(e,t){let n=this.progressSnapshot.get(e);if(t&&n?.state===t.state&&n.value===t.value||!t&&!n)return;let r=new Map(this.progressSnapshot);t?r.set(e,t):r.delete(e),this.progressSnapshot=r,this.emit()}emit(){if(this.notificationBatchDepth>0){this.notificationPending=!0;return}this.listeners.forEach(e=>e())}},VP=new class{pool;runtimeMetadata;constructor(e=8,t=5*6e4,n=e=>new RP(e),r){this.runtimeMetadata=new BP(r),this.pool=new zP(e,t,n,(e,t)=>this.runtimeMetadata.setRuntimeTitle(e,t))}subscribe=e=>this.runtimeMetadata.subscribe(e);subscribeBellEvents=e=>this.runtimeMetadata.subscribeBellEvents(e);getAttentionSnapshot=()=>this.runtimeMetadata.getAttentionSnapshot();getBellSnapshot=()=>this.runtimeMetadata.getBellSnapshot();getTitleSnapshot=()=>this.runtimeMetadata.getTitleSnapshot();getProgramSnapshot=()=>this.runtimeMetadata.getProgramSnapshot();getForegroundProcessSnapshot=()=>this.runtimeMetadata.getForegroundProcessSnapshot();getProgressSnapshot=()=>this.runtimeMetadata.getProgressSnapshot();getInitialSize(e){return this.pool.getInitialSize(e)}applyRuntimeMetadata(e){this.runtimeMetadata.applyRuntimeMetadata(e)}replaceRuntimeMetadata(e){this.runtimeMetadata.replaceRuntimeMetadata(e)}acquire(e){return this.pool.acquire(e)}release(e){this.pool.release(e)}forget(e){this.pool.forget(e),this.runtimeMetadata.forget(e)}reconcile(e){let t=[...e].map(e=>e.id);this.pool.reconcile(t),this.runtimeMetadata.reconcile(t)}acknowledgeBell(e,t){return this.runtimeMetadata.acknowledgeBell(e,t)}},HP=new Set,UP=new Map,WP=new Map,GP=new Map,KP=new Map,qP={attention:HP,titles:UP,programs:WP,progress:GP},JP={bells:KP,titles:UP},YP=qP,XP=JP;function ZP(){let e=VP.getAttentionSnapshot(),t=VP.getTitleSnapshot(),n=VP.getProgramSnapshot(),r=VP.getProgressSnapshot();return(YP.attention!==e||YP.titles!==t||YP.programs!==n||YP.progress!==r)&&(YP={attention:e,titles:t,programs:n,progress:r}),YP}function QP(){let e=VP.getBellSnapshot(),t=VP.getTitleSnapshot();return(XP.bells!==e||XP.titles!==t)&&(XP={bells:e,titles:t}),XP}function $P(){return(0,R.useSyncExternalStore)(VP.subscribe,ZP,()=>qP)}function eF(){return(0,R.useSyncExternalStore)(VP.subscribe,QP,()=>JP)}var tF=`treeport-last-workspace-route`,nF=`treeport-last-project-terminal:`;function rF(e,t){return e!==null&&e===t}function iF(e){return encodeURIComponent(e)}function aF(e){return{kind:`project`,pathname:`/projects/${iF(e)}`,projectId:e}}function oF(e,t){return{kind:`worktree`,pathname:`/projects/${iF(e)}/worktrees/${iF(t)}`,projectId:e,worktreeId:t}}function sF(e,t,n){return{kind:`terminal`,pathname:`/projects/${iF(e)}/worktrees/${iF(t)}/terminals/${iF(n)}`,projectId:e,worktreeId:t,terminalId:n}}function cF(e,t,n){return{kind:`panel`,pathname:`/projects/${iF(e)}/worktrees/${iF(t)}/panels/${iF(n)}`,projectId:e,worktreeId:t,panelId:n}}function lF(e){let t=e.worktrees[0];if(!t)return aF(e.id);let n=t.terminals[0];return n?sF(e.id,t.id,n.id):oF(e.id,t.id)}function uF(e,t){if(t)for(let n of e.worktrees){let r=n.terminals.find(e=>e.id===t);if(r)return sF(e.id,n.id,r.id)}return lF(e)}function dF(e,t){let n=t.terminals[0];return n?sF(e.id,t.id,n.id):oF(e.id,t.id)}function fF(e,t){for(let n of e){let e=n.worktrees.find(e=>e.id===t.worktreeId);if(e?.panels.some(e=>e.kind===`web`&&e.id===t.id))return cF(n.id,e.id,t.id)}return null}function pF(e,t){for(let n of e){let e=n.worktrees.find(e=>e.id===t.worktreeId);if(e?.terminals.some(e=>e.id===t.id))return sF(n.id,e.id,t.id)}return null}function mF(e,t,n){let r=e.find(e=>e.id===t.projectId&&e.worktrees.some(e=>e.id===t.id));if(!r)return null;let i=t.terminals.find(e=>e.id===n)??t.terminals[0];return i?sF(r.id,t.id,i.id):oF(r.id,t.id)}function hF(e,t){if(t.kind===`root`)return{project:null,worktree:null,terminal:null,panel:null};let n=e.find(e=>e.id===t.projectId)??null;if(!n||t.kind===`project`)return{project:n,worktree:null,terminal:null,panel:null};let r=n.worktrees.find(e=>e.id===t.worktreeId)??null;return!r||t.kind===`worktree`?{project:n,worktree:r,terminal:null,panel:null}:t.kind===`panel`?{project:n,worktree:r,terminal:null,panel:r.panels.find(e=>e.kind===`web`&&e.id===t.panelId)??null}:{project:n,worktree:r,terminal:r.terminals.find(e=>e.id===t.terminalId)??null,panel:null}}function gF(e){try{return decodeURIComponent(e)}catch{return null}}function _F(e){if(e===`/`)return{kind:`root`,pathname:`/`};let t=e.split(`/`).filter(Boolean);if(t[0]!==`projects`)return null;let n=t[1]?gF(t[1]):null;if(!n)return null;if(t.length===2)return aF(n);if(t[2]!==`worktrees`)return null;let r=t[3]?gF(t[3]):null;if(!r)return null;if(t.length===4)return oF(n,r);let i=t[5]?gF(t[5]):null;return!i||t.length!==6?null:t[4]===`terminals`?sF(n,r,i):t[4]===`panels`?cF(n,r,i):null}function vF(e){return e[0]?lF(e[0]):{kind:`root`,pathname:`/`}}function yF(e,t){if(!t||t.kind===`root`)return vF(e);let n=e.find(e=>e.id===t.projectId);if(!n)return vF(e);if(t.kind===`project`)return n.worktrees.length?lF(n):aF(n.id);let r=n.worktrees.find(e=>e.id===t.worktreeId);if(!r)return n.worktrees[0]?dF(n,n.worktrees[0]):aF(n.id);if(t.kind===`worktree`)return dF(n,r);if(t.kind===`panel`){let e=r.panels.find(e=>e.kind===`web`&&e.id===t.panelId);return e?cF(n.id,r.id,e.id):dF(n,r)}let i=r.terminals.find(e=>e.id===t.terminalId);return i?sF(n.id,r.id,i.id):dF(n,r)}function bF(e,t,n){let r=_F(t),i;if(r?.kind===`root`&&e.length&&n){let t=_F(n);i=t?.kind!==`root`&&e.some(e=>e.id===t?.projectId)?yF(e,t):vF(e)}else i=yF(e,r);return{target:i,selection:hF(e,i),canonical:i.pathname===t}}function xF(e,{operation:t}){let n=kE(e),r=[n.message,n.recoveryHint,n.requestId?`Reference: ${n.requestId}.`:null].filter(e=>!!e).join(` `);za.error(`Couldn’t ${t}`,{description:r})}function SF(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=new Date,r=t.toDateString()===n.toDateString();return new Intl.DateTimeFormat(void 0,r?{hour:`numeric`,minute:`2-digit`}:{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}).format(t)}function CF({projects:e,navigateToWorkspace:t,open:n,onOpenChange:r}){let{bells:i,titles:a}=eF(),[o,s]=(0,R.useState)(()=>new Set),c=(0,R.useMemo)(()=>e.flatMap(t=>t.worktrees.flatMap(n=>n.terminals.flatMap(r=>{let o=i.get(r.id),s=pF(e,r);return o?.unread&&s?[{terminalId:r.id,sequence:o.sequence,occurredAt:o.at,title:a.get(r.id)??r.name,context:`${t.name} · ${n.name}`,target:s}]:[]}))).sort((e,t)=>t.occurredAt.localeCompare(e.occurredAt)||e.terminalId.localeCompare(t.terminalId)),[i,e,a]),l=c.length,u=l===0?`Notifications, no unread notifications`:`Notifications, ${l} unread`,d=async(e,t,n)=>{s(t=>new Set(t).add(e)),await VP.acknowledgeBell(e,t).catch(e=>{xF(e,{operation:`mark notification for terminal “${n}” as read`})}),s(t=>{let n=new Set(t);return n.delete(e),n})};return(0,z.jsxs)(Vh,{modal:!0,open:n,onOpenChange:r,children:[(0,z.jsx)(Hh,{asChild:!0,children:(0,z.jsxs)(G,{type:`button`,size:`icon`,variant:`ghost`,className:`icon-button text-zinc-400 hover:bg-white/5 hover:text-zinc-100`,"aria-label":u,children:[(0,z.jsx)(Gf,{}),l>0?(0,z.jsx)(Sp,{size:`counter`,className:`pointer-events-none absolute -top-0.5 -right-0.5`,"aria-hidden":!0,children:l>99?`99+`:l}):null]})}),(0,z.jsxs)(Uh,{align:`end`,className:`flex max-h-[min(26rem,calc(100dvh-1rem))] w-[min(22rem,calc(100vw-1rem))] touch-manipulation flex-col overflow-hidden p-0 select-none`,"aria-label":`Notifications`,children:[(0,z.jsx)(`div`,{className:`shrink-0 px-3 pt-3 pb-2`,children:(0,z.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Notifications`})}),c.length===0?(0,z.jsxs)(wp,{className:`min-h-28 p-4`,children:[(0,z.jsx)(Tp,{children:`All caught up`}),(0,z.jsx)(Ep,{children:`No unread notifications.`})]}):(0,z.jsx)(`div`,{className:`min-h-0 overflow-y-auto overscroll-contain px-1.5 pb-1.5`,children:(0,z.jsx)(`ul`,{role:`list`,className:`flex flex-col gap-0.5`,children:c.map(e=>(0,z.jsx)(`li`,{className:`min-w-0`,children:(0,z.jsxs)(`button`,{type:`button`,className:`w-full min-w-0 cursor-default rounded-md px-2 py-2 text-left outline-none hover:bg-white/5 focus-visible:bg-white/5 focus-visible:outline-2 focus-visible:outline-cyan-400 disabled:opacity-45`,disabled:o.has(e.terminalId),"aria-label":`Open ${e.title}`,onClick:()=>{r(!1),d(e.terminalId,e.sequence,e.title).then(()=>t(e.target))},children:[(0,z.jsx)(`h3`,{className:`truncate text-sm font-medium text-zinc-100`,children:e.title}),(0,z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-1.5 text-xs text-zinc-500`,children:[(0,z.jsx)(`p`,{className:`min-w-0 truncate`,children:e.context}),(0,z.jsx)(`span`,{className:`shrink-0`,"aria-hidden":!0,children:`·`}),(0,z.jsx)(`time`,{dateTime:e.occurredAt,className:`shrink-0 tabular-nums`,children:SF(e.occurredAt)})]})]})},e.terminalId))})})]})]})}function wF(e,t,n){for(let r of e)for(let e of r.worktrees){let r=e.terminals.find(e=>e.id===n);if(r)return t.get(n)??r.name}return null}function TF({projects:e,selectedTerminalId:t}){let{bells:n,titles:r}=eF(),i=(0,R.useRef)({projects:e,selectedTerminalId:t,titles:r,presence:{focused:document.hasFocus(),visible:document.visibilityState===`visible`}});i.current.projects=e,i.current.selectedTerminalId=t,i.current.titles=r;let a=()=>{let e=i.current,t=e.selectedTerminalId;if(!t||!e.presence.focused||!e.presence.visible)return;let n=VP.getBellSnapshot().get(t);if(!n?.unread)return;let r=wF(e.projects,e.titles,t);VP.acknowledgeBell(t,n.sequence).catch(e=>{xF(e,{operation:r?`acknowledge notification for terminal “${r}”`:`acknowledge terminal notification`})})};return(0,R.useEffect)(()=>{let e=()=>{i.current.presence={focused:document.hasFocus(),visible:document.visibilityState===`visible`},a()};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`focus`,e),window.addEventListener(`blur`,e),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`focus`,e),window.removeEventListener(`blur`,e)}},[]),(0,R.useEffect)(()=>{a()},[n,t]),(0,R.useEffect)(()=>VP.subscribeBellEvents(e=>{let t=i.current;if(t.selectedTerminalId===e.terminalId&&t.presence.focused&&t.presence.visible){let n=wF(t.projects,VP.getTitleSnapshot(),e.terminalId);VP.acknowledgeBell(e.terminalId,e.sequence).catch(e=>{xF(e,{operation:n?`acknowledge notification for terminal “${n}”`:`acknowledge terminal notification`})});return}window.treeportDesktop?.requestAttention()}),[]),null}var EF=Object.defineProperty,DF=(e,t)=>EF(e,`name`,{value:t,configurable:!0});function OF(e,t){let n=R.createContext(t);n.displayName=e+`Context`;let r=DF(e=>{let{children:t,...r}=e,i=R.useMemo(()=>r,Object.values(r));return(0,z.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=R.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return DF(i,`useContext`),[r,i]}DF(OF,`createContext`);function kF(e,t=[]){let n=[];function r(t,r){let i=R.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=DF(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=R.useMemo(()=>o,Object.values(o));return(0,z.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=R.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return DF(s,`useContext`),[o,s]}DF(r,`createContext`);let i=DF(()=>{let t=n.map(e=>R.createContext(e));return DF(function(n){let r=n?.[e]||t;return R.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,AF(i,...t)]}DF(kF,`createContextScope`);function AF(...e){let t=e[0];if(e.length===1)return t;let n=DF(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return DF(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return R.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}DF(AF,`composeContextScopes`);var jF=Object.defineProperty,MF=(e,t)=>jF(e,`name`,{value:t,configurable:!0}),NF=!!(typeof window<`u`&&window.document&&window.document.createElement);function PF(e,t,{checkForDefaultPrevented:n=!0}={}){return MF(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}MF(PF,`composeEventHandlers`);function FF(e){if(!NF)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}MF(FF,`getOwnerWindow`);function IF(e){if(!NF)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}MF(IF,`getOwnerDocument`);function LF(e,t=!1){let{activeElement:n}=IF(e);if(!n?.nodeName)return null;if(RF(n)&&n.contentDocument)return LF(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=IF(n).getElementById(e);if(t)return t}}return n}MF(LF,`getActiveElement`);function RF(e){return e.tagName===`IFRAME`}MF(RF,`isFrame`);var zF=globalThis?.document?R.useLayoutEffect:()=>{},BF=Object.defineProperty,VF=(e,t)=>BF(e,`name`,{value:t,configurable:!0}),HF=R.useId||(()=>void 0),UF=0;function WF(e){let[t,n]=R.useState(HF());return zF(()=>{e||n(e=>e??String(UF++))},[e]),e||(t?`radix-${t}`:``)}VF(WF,`useId`);var GF=Object.defineProperty,KF=(e,t)=>GF(e,`name`,{value:t,configurable:!0}),qF=R.useEffectEvent,JF=R.useInsertionEffect;function YF(e){if(typeof qF==`function`)return qF(e);let t=R.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof JF==`function`?JF(()=>{t.current=e}):zF(()=>{t.current=e}),R.useMemo(()=>((...e)=>t.current?.(...e)),[])}KF(YF,`useEffectEvent`);var XF=Object.defineProperty,ZF=(e,t)=>XF(e,`name`,{value:t,configurable:!0}),QF=R.useInsertionEffect||zF;function $F({prop:e,defaultProp:t,onChange:n=ZF(()=>{},`onChange`),caller:r}){let[i,a,o]=eI({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,R.useCallback(t=>{if(s){let n=tI(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}ZF($F,`useControllableState`);function eI({defaultProp:e,onChange:t}){let[n,r]=R.useState(e),i=R.useRef(n),a=R.useRef(t);return QF(()=>{a.current=t},[t]),R.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}ZF(eI,`useUncontrolledState`);function tI(e){return typeof e==`function`}ZF(tI,`isFunction`);var nI=Symbol(`RADIX:SYNC_STATE`);function rI(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=YF(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=R.useReducer((t,n)=>{if(n.type===nI)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=R.useRef(p);R.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=R.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return R.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:nI,state:i})},[i,d.state,c]),[h,f]}ZF(rI,`useControllableStateReducer`);var iI=Object.defineProperty,aI=(e,t)=>iI(e,`name`,{value:t,configurable:!0}),oI=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ip(`Primitive.${t}`),r=R.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,z.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function sI(e,t){e&&Bi.flushSync(()=>e.dispatchEvent(t))}aI(sI,`dispatchDiscreteCustomEvent`);var cI=Object.defineProperty,lI=(e,t)=>cI(e,`name`,{value:t,configurable:!0});function uI(e){let t=R.useRef(e);return R.useEffect(()=>{t.current=e}),R.useMemo(()=>((...e)=>t.current?.(...e)),[])}lI(uI,`useCallbackRef`);var dI=Object.defineProperty,fI=(e,t)=>dI(e,`name`,{value:t,configurable:!0}),pI=`dismissableLayer.update`,mI=`dismissableLayer.pointerDownOutside`,hI=`dismissableLayer.focusOutside`,gI,_I=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),vI=R.forwardRef(fI(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=R.useContext(_I),[d,f]=R.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=R.useState({}),h=tp(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=R.useRef(!1),C=xI(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:R.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=SI(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=uI(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return R.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),R.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(gI=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),CI(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=gI))}},[d,p,n,u]),R.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),CI())},[d,u]),R.useEffect(()=>{let e=fI(()=>m({}),`handleUpdate`);return document.addEventListener(pI,e),()=>document.removeEventListener(pI,e)},[]),(0,z.jsx)(oI.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:PF(e.onFocusCapture,w.onFocusCapture),onBlurCapture:PF(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:PF(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function yI(){let e=R.useContext(_I),[t,n]=R.useState(null);return R.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}fI(yI,`useDismissableLayerSurface`);var bI=fI(()=>!0,`IS_TRUE`);function xI(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=bI}=t,s=uI(e),c=R.useRef(!1),l=R.useRef(!1),u=R.useRef(new Map),d=R.useRef(()=>{});return R.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}fI(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}fI(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}fI(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}fI(p,`handleInteractionBubble`);let m=fI(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||wI(mI,s,p,{discrete:!0})};if(fI(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:fI(()=>c.current=!0,`onPointerDownCapture`)}}fI(xI,`usePointerDownOutside`);function SI(e,t=globalThis?.document){let n=uI(e),r=R.useRef(!1);return R.useEffect(()=>{let e=fI(e=>{e.target&&!r.current&&wI(hI,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:fI(()=>r.current=!0,`onFocusCapture`),onBlurCapture:fI(()=>r.current=!1,`onBlurCapture`)}}fI(SI,`useFocusOutside`);function CI(){let e=new CustomEvent(pI);document.dispatchEvent(e)}fI(CI,`dispatchUpdate`);function wI(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?sI(i,a):i.dispatchEvent(a)}fI(wI,`handleAndDispatchCustomEvent`);var TI=Object.defineProperty,EI=(e,t)=>TI(e,`name`,{value:t,configurable:!0}),DI=`focusScope.autoFocusOnMount`,OI=`focusScope.autoFocusOnUnmount`,kI={bubbles:!1,cancelable:!0},AI=R.forwardRef(EI(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=R.useState(null),l=uI(i),u=uI(a),d=R.useRef(null),f=tp(t,c),p=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:LI(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||LI(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&LI(s)};EI(e,`handleFocusIn`),EI(t,`handleFocusOut`),EI(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),R.useEffect(()=>{if(s){RI.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(DI,kI);s.addEventListener(DI,l),s.dispatchEvent(t),t.defaultPrevented||(jI(VI(NI(s)),{select:!0}),document.activeElement===e&&LI(s))}return()=>{s.removeEventListener(DI,l),setTimeout(()=>{let t=new CustomEvent(OI,kI);s.addEventListener(OI,u),s.dispatchEvent(t),t.defaultPrevented||LI(e??document.body,{select:!0}),s.removeEventListener(OI,u),RI.remove(p)},0)}}},[s,l,u,p]);let m=R.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=MI(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&LI(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&LI(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,z.jsx)(oI.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function jI(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(LI(r,{select:t}),document.activeElement!==n)return}EI(jI,`focusFirst`);function MI(e){let t=NI(e);return[PI(t,e),PI(t.reverse(),e)]}EI(MI,`getTabbableEdges`);function NI(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:EI(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}EI(NI,`getTabbableCandidates`);function PI(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):FI(r,{upTo:t})))return r}EI(PI,`findVisible`);function FI(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}EI(FI,`isHidden`);function II(e){return e instanceof HTMLInputElement&&`select`in e}EI(II,`isSelectableInput`);function LI(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&II(e)&&t&&e.select()}}EI(LI,`focus`);var RI=zI();function zI(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=BI(e,t),e.unshift(t)},remove(t){e=BI(e,t),e[0]?.resume()}}}EI(zI,`createFocusScopesStack`);function BI(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}EI(BI,`arrayRemove`);function VI(e){return e.filter(e=>e.tagName!==`A`)}EI(VI,`removeLinks`);var HI=Object.defineProperty,UI=R.forwardRef(((e,t)=>HI(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=R.useState(!1);zF(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Bi.createPortal((0,z.jsx)(oI.div,{...r,ref:t}),o):null},`Portal`)),WI=Object.defineProperty,GI=(e,t)=>WI(e,`name`,{value:t,configurable:!0});function KI(e,t){return R.useReducer((e,n)=>t[e][n]??e,e)}GI(KI,`useStateMachine`);var qI=GI(e=>{let{present:t,children:n}=e,r=JI(t),i=typeof n==`function`?n({present:r.isPresent}):R.Children.only(n),a=XI(r.ref,QI(i));return typeof n==`function`||r.isPresent?R.cloneElement(i,{ref:a}):null},`Presence`);function JI(e){let[t,n]=R.useState(),r=R.useRef(null),i=R.useRef(e),a=R.useRef(`none`),o=R.useRef(void 0),[s,c]=KI(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return R.useEffect(()=>{s===`mounted`?(a.current=o.current??ZI(r.current),o.current=void 0):a.current=`none`},[s]),zF(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=ZI(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),zF(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=GI(a=>{let o=ZI(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=GI(e=>{e.target===t&&(a.current=ZI(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:R.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=ZI(t)}else r.current=null;n(e)},[])}}GI(JI,`usePresence`);function YI(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}GI(YI,`setRef`);function XI(...e){let t=R.useRef(e);return t.current=e,R.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=YI(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():YI(n[e],null)}}},[])}GI(XI,`useStableComposedRefs`);function ZI(e){return e?.animationName||`none`}GI(ZI,`getAnimationName`);function QI(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}GI(QI,`getElementRef`);var $I=Object.defineProperty,eL=(e,t)=>$I(e,`name`,{value:t,configurable:!0}),tL=0,nL=null;function rL(e){return iL(),e.children}eL(rL,`FocusGuards`);function iL(){R.useEffect(()=>{nL||={start:aL(),end:aL()};let{start:e,end:t}=nL;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),tL++,()=>{tL===1&&(nL?.start.remove(),nL?.end.remove(),nL=null),tL=Math.max(0,tL-1)}},[])}eL(iL,`useFocusGuards`);function aL(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}eL(aL,`createFocusGuard`);var oL=Object.defineProperty,sL=(e,t)=>oL(e,`name`,{value:t,configurable:!0}),cL=`Dialog`,[lL,uL]=kF(cL),[dL,fL]=lL(cL),pL=sL(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=R.useRef(null),c=R.useRef(null),[l,u]=$F({prop:r,defaultProp:i??!1,onChange:a,caller:cL}),[d,f]=R.useState(0),[p,m]=R.useState(0);return(0,z.jsx)(dL,{scope:t,triggerRef:s,contentRef:c,contentId:WF(),titleId:WF(),descriptionId:WF(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:R.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),mL=`DialogTrigger`,hL=R.forwardRef(sL(function(e,t){let{__scopeDialog:n,...r}=e,i=fL(mL,n),a=tp(t,i.triggerRef);return(0,z.jsx)(oI.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":FL(i.open),...r,ref:a,onClick:PF(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),gL=`DialogPortal`,[_L,vL]=lL(gL,{forceMount:void 0}),yL=sL(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=fL(gL,t);return(0,z.jsx)(_L,{scope:t,forceMount:n,children:R.Children.map(r,e=>(0,z.jsx)(qI,{present:n||a.open,children:(0,z.jsx)(UI,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),bL=`DialogOverlay`,xL=R.forwardRef(sL(function(e,t){let n=vL(bL,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=fL(bL,e.__scopeDialog);return a.modal?(0,z.jsx)(qI,{present:r||a.open,children:(0,z.jsx)(CL,{...i,ref:t})}):null},`DialogOverlay`)),SL=ip(`DialogOverlay.RemoveScroll`),CL=R.forwardRef(sL(function(e,t){let{__scopeDialog:n,...r}=e,i=fL(bL,n),a=tp(t,yI());return(0,z.jsx)(uh,{as:SL,allowPinchZoom:!0,shards:[i.contentRef],children:(0,z.jsx)(oI.div,{"data-state":FL(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),wL=`DialogContent`,TL=R.forwardRef(sL(function(e,t){let n=vL(wL,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=fL(wL,e.__scopeDialog);return(0,z.jsx)(qI,{present:r||a.open,children:a.modal?(0,z.jsx)(EL,{...i,ref:t}):(0,z.jsx)(DL,{...i,ref:t})})},`DialogContent`)),EL=R.forwardRef(sL(function(e,t){let n=fL(wL,e.__scopeDialog),r=R.useRef(null),i=tp(t,n.contentRef,r);return R.useEffect(()=>{let e=r.current;if(e)return tm(e)},[]),(0,z.jsx)(OL,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:PF(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:PF(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:PF(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),DL=R.forwardRef(sL(function(e,t){let n=fL(wL,e.__scopeDialog),r=R.useRef(!1),i=R.useRef(!1);return(0,z.jsx)(OL,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),OL=R.forwardRef(sL(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=fL(wL,n);return iL(),(0,z.jsx)(z.Fragment,{children:(0,z.jsx)(AI,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,z.jsx)(vI,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":FL(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),kL=`DialogTitle`,AL=R.forwardRef(sL(function(e,t){let{__scopeDialog:n,...r}=e,i=fL(kL,n),{setTitleCount:a}=i;return zF(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,z.jsx)(oI.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),jL=`DialogDescription`,ML=R.forwardRef(sL(function(e,t){let{__scopeDialog:n,...r}=e,i=fL(jL,n),{setDescriptionCount:a}=i;return zF(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,z.jsx)(oI.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),NL=`DialogClose`,PL=R.forwardRef(sL(function(e,t){let{__scopeDialog:n,...r}=e,i=fL(NL,n);return(0,z.jsx)(oI.button,{type:`button`,...r,ref:t,onClick:PF(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function FL(e){return e?`open`:`closed`}sL(FL,`getState`);var IL=Object.defineProperty,LL=(e,t)=>IL(e,`name`,{value:t,configurable:!0}),[RL,zL]=kF(`AlertDialog`,[uL]),BL=uL(),VL=LL(e=>{let{__scopeAlertDialog:t,...n}=e,r=BL(t);return(0,z.jsx)(pL,{...r,...n,modal:!0})},`AlertDialog`);R.forwardRef(LL(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=BL(n);return(0,z.jsx)(hL,{...i,...r,ref:t})},`AlertDialogTrigger`));var HL=LL(e=>{let{__scopeAlertDialog:t,...n}=e,r=BL(t);return(0,z.jsx)(yL,{...r,...n})},`AlertDialogPortal`),UL=R.forwardRef(LL(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=BL(n);return(0,z.jsx)(xL,{...i,...r,ref:t})},`AlertDialogOverlay`)),[WL,GL]=RL(`AlertDialogContent`),KL=R.forwardRef(LL(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=BL(n),o=tp(t,R.useRef(null)),s=R.useRef(null);return(0,z.jsx)(WL,{scope:n,cancelRef:s,children:(0,z.jsx)(TL,{role:`alertdialog`,...a,...i,ref:o,onOpenAutoFocus:PF(i.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),qL=R.forwardRef(LL(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=BL(n);return(0,z.jsx)(AL,{...i,...r,ref:t})},`AlertDialogTitle`)),JL=R.forwardRef(LL(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=BL(n);return(0,z.jsx)(ML,{...i,...r,ref:t})},`AlertDialogDescription`)),YL=R.forwardRef(LL(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=BL(n);return(0,z.jsx)(PL,{...i,...r,ref:t})},`AlertDialogAction`)),XL=`AlertDialogCancel`,ZL=R.forwardRef(LL(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=GL(XL,n),a=BL(n),o=tp(t,i);return(0,z.jsx)(PL,{...a,...r,ref:o})},`AlertDialogCancel`)),QL=VL,$L=HL,eR=UL,tR=KL,nR=YL,rR=ZL,iR=qL,aR=JL,oR=QL,sR=$L,cR=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(eR,{ref:n,className:W(`fixed inset-0 z-50 bg-black/70 backdrop-blur-sm`,e),...t}));cR.displayName=eR.displayName;var lR=R.forwardRef(({className:e,restoreFocusTo:t,onCloseAutoFocus:n,...r},i)=>(0,z.jsxs)(sR,{children:[(0,z.jsx)(cR,{}),(0,z.jsx)(tR,{ref:i,className:W(`fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-xl bg-zinc-900 p-6 text-zinc-200 shadow-2xl ring-1 ring-white/10 outline-none max-[700px]:top-auto max-[700px]:bottom-0 max-[700px]:left-0 max-[700px]:max-h-[90dvh] max-[700px]:w-full max-[700px]:max-w-none max-[700px]:translate-x-0 max-[700px]:translate-y-0 max-[700px]:rounded-b-none max-[700px]:p-5 max-[700px]:pb-[calc(1.25rem+env(safe-area-inset-bottom))]`,e),onCloseAutoFocus:e=>{n?.(e),!e.defaultPrevented&&t?.isConnected&&(e.preventDefault(),t.focus())},...r})]}));lR.displayName=tR.displayName;function uR({className:e,...t}){return(0,z.jsx)(`div`,{className:W(`flex flex-col gap-1.5 text-left`,e),...t})}function dR({className:e,...t}){return(0,z.jsx)(`div`,{className:W(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}var fR=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(iR,{ref:n,className:W(`text-balance text-xl font-semibold tracking-tight text-zinc-50 sm:text-2xl`,e),...t}));fR.displayName=iR.displayName;var pR=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(aR,{ref:n,className:W(`text-base text-pretty text-zinc-400 sm:text-sm`,e),...t}));pR.displayName=aR.displayName;var mR=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(nR,{ref:n,className:W(Cp(),e),...t}));mR.displayName=nR.displayName;var hR=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(rR,{ref:n,className:W(Cp({variant:`outline`}),e),...t}));hR.displayName=rR.displayName;function gR({panel:e,busy:t,restoreFocusTo:n,onOpenChange:r,onConfirm:i}){return(0,z.jsx)(oR,{open:e!==null,onOpenChange:r,children:e?(0,z.jsxs)(lR,{restoreFocusTo:n,children:[(0,z.jsxs)(uR,{children:[(0,z.jsxs)(fR,{children:[`Close `,e.title,`?`]}),(0,z.jsx)(pR,{children:`This panel has saved data. Closing it permanently deletes that data, including any comments or drafts.`})]}),(0,z.jsxs)(dR,{children:[(0,z.jsx)(hR,{children:`Cancel`}),(0,z.jsx)(mR,{asChild:!0,children:(0,z.jsx)(G,{type:`button`,variant:`destructive`,disabled:t,onClick:t=>{t.preventDefault(),i(e)},children:t?`Closing…`:`Close and delete data`})})]})]}):null})}function _R({panel:e,active:t,title:n,reloadRevision:r,autoFocusBlocked:i,onTitleChange:a,onSelectWorkspace:o}){let s=(0,R.useRef)(null),c=(0,R.useRef)(null),l=`${e.id}:${r}`,[u,d]=(0,R.useState)(null);return(0,R.useEffect)(()=>{a(e.id,null)},[a,e.id,l]),(0,R.useEffect)(()=>{if(!t||i||u!==l)return;let e=window.requestAnimationFrame(()=>s.current?.focus());return()=>window.cancelAnimationFrame(e)},[t,i,u,l]),(0,R.useEffect)(()=>{if(!t)return;let e=e=>{e.key.toLowerCase()!==`f`||!e.metaKey&&!e.ctrlKey||e.altKey||document.querySelector(`[role="dialog"]`)||(e.preventDefault(),(s.current?.contentWindow??c.current)?.postMessage({source:`treeport-host-v1`,method:`shortcut`,shortcut:`find`},`*`))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[t]),(0,R.useEffect)(()=>{let t=t=>{let n=s.current?.contentWindow??c.current;if(t.source!==n||t.data?.source!==`treeport-panel-v1`)return;let r=t.data.method;if(r===`panel.title.set`){t.data.title===null?a(e.id,null):typeof t.data.title==`string`&&a(e.id,t.data.title.trim().slice(0,256)||null);return}if(r===`workspace.select`&&Number.isInteger(t.data.index)&&t.data.index>=0&&t.data.index<=8){o(t.data.index);return}if(typeof t.data.id!=`string`)return;let i;i=r===`context`?Tf(CE.api.panels[`:panelId`].context.$get({param:{panelId:e.id}})).then(e=>e.context):r===`diff`?Tf(CE.api.panels[`:panelId`].diff.$get({param:{panelId:e.id}})).then(e=>e.diff):r===`network.listeners`?Tf(CE.api.panels[`:panelId`].network.listeners.$get({param:{panelId:e.id}})).then(e=>e.discovery):r===`storage.get`&&typeof t.data.key==`string`?Tf(CE.api.panels[`:panelId`].storage.get.$post({param:{panelId:e.id},json:{key:t.data.key}})).then(e=>e.value):r===`storage.set`&&typeof t.data.key==`string`?Tf(CE.api.panels[`:panelId`].storage.$put({param:{panelId:e.id},json:{key:t.data.key,value:t.data.value}})).then(()=>void 0):r===`storage.delete`&&typeof t.data.key==`string`?Tf(CE.api.panels[`:panelId`].storage.$delete({param:{panelId:e.id},json:{key:t.data.key}})).then(()=>void 0):Promise.reject(Error(`Unsupported Treeport SDK method`)),i.then(e=>n?.postMessage({source:`treeport-host-v1`,id:t.data.id,ok:!0,value:e},`*`),e=>n?.postMessage({source:`treeport-host-v1`,id:t.data.id,ok:!1,error:AE(e)},`*`))};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)},[o,a,e.id]),(0,z.jsx)(R.Activity,{mode:t?`visible`:`hidden`,children:(0,z.jsx)(`main`,{className:`min-h-0 min-w-0 bg-zinc-950`,"aria-label":`${n} web panel`,children:(0,z.jsx)(`iframe`,{ref:s,title:n,src:`/api/web-panels/${encodeURIComponent(e.id)}/assets/`,sandbox:`allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads${e.sandbox.allowSameOrigin?` allow-same-origin`:``}`,allow:`clipboard-read; clipboard-write; fullscreen`,className:W(`h-full w-full border-0 bg-zinc-950`,u===l?`opacity-100`:`opacity-0`),onLoad:()=>{c.current=s.current?.contentWindow??null,d(l)}},l)})})}var vR=pL,yR=yL;function bR(e){let t=window.visualViewport;return t?(t.addEventListener(`resize`,e),t.addEventListener(`scroll`,e),()=>{t.removeEventListener(`resize`,e),t.removeEventListener(`scroll`,e)}):()=>void 0}function xR(){let e=window.visualViewport;return e?`${e.offsetTop}:${e.height}`:null}var SR=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(xL,{ref:n,className:W(`fixed inset-0 z-50 bg-black/70 backdrop-blur-sm`,e),...t}));SR.displayName=xL.displayName;var CR=R.forwardRef(({className:e,children:t,restoreFocusTo:n,mobilePresentation:r=`sheet`,overlayClassName:i,onCloseAutoFocus:a,style:o,...s},c)=>{let[l,u]=R.useSyncExternalStore(bR,xR,()=>null)?.split(`:`).map(Number)??[null,null];return(0,z.jsxs)(yR,{children:[(0,z.jsx)(SR,{className:i}),(0,z.jsxs)(TL,{ref:c,className:W(`fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-xl bg-zinc-900 p-6 text-zinc-200 shadow-2xl ring-1 ring-white/10 outline-none max-[700px]:top-auto max-[700px]:bottom-0 max-[700px]:left-0 max-[700px]:max-h-[90dvh] max-[700px]:w-full max-[700px]:max-w-none max-[700px]:translate-x-0 max-[700px]:translate-y-0 max-[700px]:rounded-b-none max-[700px]:p-5 max-[700px]:pb-[calc(1.25rem+env(safe-area-inset-bottom))]`,r===`dialog`&&`keyboard-safe-dialog`,e),style:{...o,"--dialog-visual-viewport-top":r===`dialog`&&l!==null?`${l}px`:void 0,"--dialog-visual-viewport-height":r===`dialog`&&u!==null?`${u}px`:void 0},onCloseAutoFocus:e=>{a?.(e),!e.defaultPrevented&&n?.isConnected&&(e.preventDefault(),n.focus())},...s,children:[t,(0,z.jsxs)(PL,{className:`absolute top-3 right-3 inline-flex size-9 items-center justify-center rounded-md text-zinc-500 outline-none hover:bg-white/5 hover:text-zinc-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-cyan-400 disabled:pointer-events-none [&_svg]:size-4`,children:[(0,z.jsx)(Xf,{}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})});CR.displayName=TL.displayName;function wR({className:e,...t}){return(0,z.jsx)(`div`,{className:W(`flex flex-col gap-1.5 pr-12 text-left`,e),...t})}var TR=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(AL,{ref:n,className:W(`text-balance text-xl font-semibold tracking-tight text-zinc-50 sm:text-2xl`,e),...t}));TR.displayName=AL.displayName;var ER=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(ML,{ref:n,className:W(`text-base text-pretty text-zinc-400 sm:text-sm`,e),...t}));ER.displayName=ML.displayName;function DR({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{fillRule:`evenodd`,d:`M13.836 2.477a.75.75 0 0 1 .75.75v3.182a.75.75 0 0 1-.75.75h-3.182a.75.75 0 0 1 0-1.5h1.37l-.84-.841a4.5 4.5 0 0 0-7.08.932.75.75 0 0 1-1.3-.75 6 6 0 0 1 9.44-1.242l.842.84V3.227a.75.75 0 0 1 .75-.75Zm-.911 7.5A.75.75 0 0 1 13.199 11a6 6 0 0 1-9.44 1.241l-.84-.84v1.371a.75.75 0 0 1-1.5 0V9.591a.75.75 0 0 1 .75-.75H5.35a.75.75 0 0 1 0 1.5H3.98l.841.841a4.5 4.5 0 0 0 7.08-.932.75.75 0 0 1 1.025-.273Z`,clipRule:`evenodd`}))}var OR=R.forwardRef(DR);function kR({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{fillRule:`evenodd`,d:`M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z`,clipRule:`evenodd`}))}var AR=R.forwardRef(kR);function jR({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{fillRule:`evenodd`,d:`M2 3.75A.75.75 0 0 1 2.75 3h10.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 3.75ZM2 8a.75.75 0 0 1 .75-.75h10.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 8Zm0 4.25a.75.75 0 0 1 .75-.75h10.5a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1-.75-.75Z`,clipRule:`evenodd`}))}var MR=R.forwardRef(jR);function NR({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{d:`M7.25 3.688a8.035 8.035 0 0 0-4.872-.523A.48.48 0 0 0 2 3.64v7.994c0 .345.342.588.679.512a6.02 6.02 0 0 1 4.571.81V3.688ZM8.75 12.956a6.02 6.02 0 0 1 4.571-.81c.337.075.679-.167.679-.512V3.64a.48.48 0 0 0-.378-.475 8.034 8.034 0 0 0-4.872.523v9.268Z`}))}var PR=R.forwardRef(NR);function FR({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{fillRule:`evenodd`,d:`M12.416 3.376a.75.75 0 0 1 .208 1.04l-5 7.5a.75.75 0 0 1-1.154.114l-3-3a.75.75 0 0 1 1.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 0 1 1.04-.207Z`,clipRule:`evenodd`}))}var IR=R.forwardRef(FR);function LR({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{fillRule:`evenodd`,d:`M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z`,clipRule:`evenodd`}))}var RR=R.forwardRef(LR);function zR({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{fillRule:`evenodd`,d:`M6.22 4.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1 0 1.06l-3.25 3.25a.75.75 0 0 1-1.06-1.06L8.94 8 6.22 5.28a.75.75 0 0 1 0-1.06Z`,clipRule:`evenodd`}))}var BR=R.forwardRef(zR);function VR({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{fillRule:`evenodd`,d:`M5.22 10.22a.75.75 0 0 1 1.06 0L8 11.94l1.72-1.72a.75.75 0 1 1 1.06 1.06l-2.25 2.25a.75.75 0 0 1-1.06 0l-2.25-2.25a.75.75 0 0 1 0-1.06ZM10.78 5.78a.75.75 0 0 1-1.06 0L8 4.06 6.28 5.78a.75.75 0 0 1-1.06-1.06l2.25-2.25a.75.75 0 0 1 1.06 0l2.25 2.25a.75.75 0 0 1 0 1.06Z`,clipRule:`evenodd`}))}var HR=R.forwardRef(VR);function UR({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{fillRule:`evenodd`,d:`M6.455 1.45A.5.5 0 0 1 6.952 1h2.096a.5.5 0 0 1 .497.45l.186 1.858a4.996 4.996 0 0 1 1.466.848l1.703-.769a.5.5 0 0 1 .639.206l1.047 1.814a.5.5 0 0 1-.14.656l-1.517 1.09a5.026 5.026 0 0 1 0 1.694l1.516 1.09a.5.5 0 0 1 .141.656l-1.047 1.814a.5.5 0 0 1-.639.206l-1.703-.768c-.433.36-.928.649-1.466.847l-.186 1.858a.5.5 0 0 1-.497.45H6.952a.5.5 0 0 1-.497-.45l-.186-1.858a4.993 4.993 0 0 1-1.466-.848l-1.703.769a.5.5 0 0 1-.639-.206l-1.047-1.814a.5.5 0 0 1 .14-.656l1.517-1.09a5.033 5.033 0 0 1 0-1.694l-1.516-1.09a.5.5 0 0 1-.141-.656L2.46 3.593a.5.5 0 0 1 .639-.206l1.703.769c.433-.36.928-.65 1.466-.848l.186-1.858Zm-.177 7.567-.022-.037a2 2 0 0 1 3.466-1.997l.022.037a2 2 0 0 1-3.466 1.997Z`,clipRule:`evenodd`}))}var WR=R.forwardRef(UR);function GR({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{fillRule:`evenodd`,d:`M2 4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4Zm2.22 1.97a.75.75 0 0 0 0 1.06l.97.97-.97.97a.75.75 0 1 0 1.06 1.06l1.5-1.5a.75.75 0 0 0 0-1.06l-1.5-1.5a.75.75 0 0 0-1.06 0ZM8.75 8.5a.75.75 0 0 0 0 1.5h2.5a.75.75 0 0 0 0-1.5h-2.5Z`,clipRule:`evenodd`}))}var KR=R.forwardRef(GR);function qR({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{d:`M2 3.5A1.5 1.5 0 0 1 3.5 2h2.879a1.5 1.5 0 0 1 1.06.44l1.122 1.12A1.5 1.5 0 0 0 9.62 4H12.5A1.5 1.5 0 0 1 14 5.5v1.401a2.986 2.986 0 0 0-1.5-.401h-9c-.546 0-1.059.146-1.5.401V3.5ZM2 9.5v3A1.5 1.5 0 0 0 3.5 14h9a1.5 1.5 0 0 0 1.5-1.5v-3A1.5 1.5 0 0 0 12.5 8h-9A1.5 1.5 0 0 0 2 9.5Z`}))}var JR=R.forwardRef(qR);function YR({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{d:`M8.543 2.232a.75.75 0 0 0-1.085 0l-5.25 5.5A.75.75 0 0 0 2.75 9H4v4a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-1a1 1 0 1 1 2 0v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1V9h1.25a.75.75 0 0 0 .543-1.268l-5.25-5.5Z`}))}var XR=R.forwardRef(YR);function ZR({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{fillRule:`evenodd`,d:`M9.965 11.026a5 5 0 1 1 1.06-1.06l2.755 2.754a.75.75 0 1 1-1.06 1.06l-2.755-2.754ZM10.5 7a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0Z`,clipRule:`evenodd`}))}var QR=R.forwardRef(ZR);function $R({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{d:`M8.75 3.75a.75.75 0 0 0-1.5 0v3.5h-3.5a.75.75 0 0 0 0 1.5h3.5v3.5a.75.75 0 0 0 1.5 0v-3.5h3.5a.75.75 0 0 0 0-1.5h-3.5v-3.5Z`}))}var ez=R.forwardRef($R);function tz({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{fillRule:`evenodd`,d:`M5 3.25V4H2.75a.75.75 0 0 0 0 1.5h.3l.815 8.15A1.5 1.5 0 0 0 5.357 15h5.285a1.5 1.5 0 0 0 1.493-1.35l.815-8.15h.3a.75.75 0 0 0 0-1.5H11v-.75A2.25 2.25 0 0 0 8.75 1h-1.5A2.25 2.25 0 0 0 5 3.25Zm2.25-.75a.75.75 0 0 0-.75.75V4h3v-.75a.75.75 0 0 0-.75-.75h-1.5ZM6.05 6a.75.75 0 0 1 .787.713l.275 5.5a.75.75 0 0 1-1.498.075l-.275-5.5A.75.75 0 0 1 6.05 6Zm3.9 0a.75.75 0 0 1 .712.787l-.275 5.5a.75.75 0 0 1-1.498-.075l.275-5.5a.75.75 0 0 1 .786-.711Z`,clipRule:`evenodd`}))}var nz=R.forwardRef(tz);function rz({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{fillRule:`evenodd`,d:`M2 12V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2Zm1.5-5.5V12a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5V6.5A.5.5 0 0 0 12 6H4a.5.5 0 0 0-.5.5Zm.75-1.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM7 4a.75.75 0 1 1-1.5 0A.75.75 0 0 1 7 4Zm1.25.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z`,clipRule:`evenodd`}))}var iz=R.forwardRef(rz);function az({title:e,titleId:t,...n},r){return R.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?R.createElement(`title`,{id:t},e):null,R.createElement(`path`,{d:`M5.28 4.22a.75.75 0 0 0-1.06 1.06L6.94 8l-2.72 2.72a.75.75 0 1 0 1.06 1.06L8 9.06l2.72 2.72a.75.75 0 1 0 1.06-1.06L9.06 8l2.72-2.72a.75.75 0 0 0-1.06-1.06L8 6.94 5.28 4.22Z`}))}var oz=R.forwardRef(az);function sz({children:e}){return(0,z.jsx)(`div`,{className:`grid gap-2`,children:e})}function cz({className:e,type:t,...n}){return(0,z.jsx)(`input`,{type:t,"data-slot":`input`,className:W(`h-11 w-full rounded-md bg-zinc-950/70 px-3 py-2 text-base text-zinc-100 ring-1 ring-white/12 outline-none transition-shadow placeholder:text-zinc-600 focus-visible:ring-2 focus-visible:ring-cyan-400 disabled:cursor-not-allowed disabled:opacity-50 sm:h-9 sm:text-sm`,e),...n})}function lz({className:e,...t}){return(0,z.jsx)(`label`,{"data-slot":`label`,className:W(`flex text-base font-medium text-zinc-300 sm:text-sm`,e),...t})}function uz({onOpened:e}){let t=(0,R.useRef)(null),[n,r]=(0,R.useState)(`~`),[i,a]=(0,R.useState)(`~`),[o,s]=(0,R.useState)(!1);(0,R.useEffect)(()=>{let e=window.setTimeout(()=>a(n.trim()),250);return()=>window.clearTimeout(e)},[n]);let c=dt({queryKey:[`filesystem-directories`,i,o],queryFn:()=>Tf(CE.api.filesystem.directories.$get({query:{input:i,...o?{hidden:`true`}:{}}})),enabled:!!i,retry:!1}),l=pt({mutationFn:async e=>(await Tf(CE.api.projects.$post({json:{path:e}}))).project,onSuccess:e,onError:(e,t)=>{xF(e,{operation:`open project at “${t}”`})}}),u=n.trim()===i,d=u&&!c.isError&&c.data?.input===i?c.data:void 0,f=u&&c.isSuccess&&!c.isFetching&&d?.exact&&d.repository.state===`valid`?d.repository:null,p=l.isPending,m=e=>{r(e),a(e),window.requestAnimationFrame(()=>t.current?.focus())};return(0,z.jsxs)(`form`,{className:`flex flex-col gap-3 max-[700px]:gap-4`,onSubmit:e=>{e.preventDefault(),!(!f||p)&&l.mutate(f.repositoryPath)},children:[(0,z.jsxs)(sz,{children:[(0,z.jsx)(lz,{htmlFor:`repository-path`,children:`Server folder`}),(0,z.jsx)(cz,{ref:t,id:`repository-path`,name:`repository-path`,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{if(!e.nativeEvent.isComposing){if(e.key===`Enter`&&!f){e.preventDefault(),a(n.trim());return}if(e.key===`ArrowDown`){let t=document.querySelector(`#project-directory-list button`);t&&(e.preventDefault(),t.focus());return}e.key===`Escape`&&d&&n.trim()!==d.directory.path&&(e.preventDefault(),e.stopPropagation(),m(d.directory.path))}},placeholder:`/Users/you/Projects/example`,"aria-label":`Server folder path`,"aria-describedby":`repository-path-status`,"aria-invalid":c.isError,autoFocus:!0,disabled:p})]}),(0,z.jsx)(`div`,{className:`flex min-h-8 flex-wrap items-center gap-2 min-[701px]:min-h-7`,children:d&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>m(d.directory.homePath),disabled:p,children:[(0,z.jsx)(XR,{"data-icon":`inline-start`}),`Home`]}),(0,z.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>m(d.directory.rootPath),disabled:p,children:`Root`}),(0,z.jsxs)(`label`,{className:`ml-auto flex cursor-pointer items-center gap-2 text-base text-zinc-400 min-[701px]:text-sm`,children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),disabled:p}),`Show hidden folders`]})]})}),(0,z.jsxs)(`div`,{className:`overflow-hidden rounded-lg bg-zinc-950/50 ring-1 ring-white/10`,children:[(0,z.jsx)(`div`,{className:`flex min-h-10 items-center gap-1 overflow-x-auto border-b border-white/8 px-2 py-1.5 min-[701px]:min-h-8 min-[701px]:p-1`,children:d&&(0,z.jsxs)(z.Fragment,{children:[d.directory.parentPath&&(0,z.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Parent folder`,onClick:()=>m(d.directory.parentPath),disabled:p,children:(0,z.jsx)(AR,{})}),d.directory.breadcrumbs.map((e,t)=>(0,z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t>0&&(0,z.jsx)(BR,{className:`size-3.5 shrink-0 fill-zinc-600`}),(0,z.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`max-w-48`,title:e.path,onClick:()=>m(e.path),disabled:p,children:(0,z.jsx)(`span`,{className:`truncate`,children:e.name})})]},e.path))]})}),(0,z.jsxs)(`div`,{id:`project-directory-list`,className:`grid h-64 content-start gap-0.5 overflow-y-auto p-1.5 min-[701px]:h-56 min-[701px]:p-1 [scrollbar-color:var(--color-zinc-700)_transparent]`,"aria-label":`Folders`,children:[c.isFetching&&(0,z.jsx)(`p`,{className:`form-note p-3`,role:`status`,children:`Looking for folders…`}),c.isError&&(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 p-3`,children:[(0,z.jsx)(`p`,{className:`text-base text-rose-300 min-[701px]:text-sm`,role:`alert`,children:AE(c.error)}),(0,z.jsx)(G,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>c.refetch(),children:`Retry`})]}),!c.isFetching&&d?.directory.entries.map(e=>(0,z.jsxs)(`button`,{type:`button`,className:`flex min-w-0 items-center gap-2 rounded-md px-2.5 py-2 text-left text-base text-zinc-200 outline-none hover:bg-white/6 focus-visible:bg-white/6 focus-visible:outline-2 focus-visible:outline-cyan-400 min-[701px]:px-2 min-[701px]:py-1.5 min-[701px]:text-sm`,title:e.path,onClick:()=>m(e.path),onKeyDown:e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),t.current?.focus();return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let n=[...document.querySelectorAll(`#project-directory-list button`)],r=n.indexOf(e.currentTarget),i=e.key===`ArrowDown`?Math.min(r+1,n.length-1):r-1;i>=0?n[i]?.focus():t.current?.focus()},disabled:p,children:[(0,z.jsx)(JR,{className:`size-4 shrink-0 fill-cyan-500/80`}),(0,z.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path)),!c.isFetching&&d&&d.directory.entries.length===0&&(0,z.jsx)(`p`,{className:`form-note p-3`,role:`status`,children:d.exact?`This folder has no subfolders.`:`No matching folders.`}),d?.directory.truncated&&(0,z.jsx)(`p`,{className:`form-note p-3`,role:`status`,children:`More folders are available. Type more of the path to narrow the list.`})]})]}),(0,z.jsx)(`p`,{id:`repository-path-status`,className:W(`form-note min-h-5 truncate`,d?.repository.state===`valid`?`text-emerald-300`:c.isError||d?.repository.state===`not-repository`?`text-rose-300`:void 0),title:d?.repository.state===`valid`?d.repository.repositoryPath:void 0,"aria-live":`polite`,children:i?c.isFetching||!u?`Checking folder…`:c.isError?AE(c.error):d?.repository.state===`valid`?`Will open repository: ${d.repository.repositoryPath}`:d?.repository.message:`Enter a folder path on the Treeport server.`}),(0,z.jsx)(G,{type:`submit`,className:`self-end`,disabled:!f||p,children:p?`Opening…`:`Open project`})]})}function dz({open:e,onOpenChange:t,restoreFocusTo:n,onOpened:r}){return(0,z.jsx)(vR,{open:e,onOpenChange:t,children:(0,z.jsxs)(CR,{className:`max-w-xl gap-3 p-4 max-[700px]:gap-4`,restoreFocusTo:n,children:[(0,z.jsxs)(wR,{children:[(0,z.jsx)(TR,{className:`text-lg tracking-normal sm:text-lg`,children:`Open project`}),(0,z.jsx)(ER,{children:`Browse folders on the Treeport server.`})]}),(0,z.jsx)(uz,{onOpened:r})]})})}var fz=[`projects`],pz=[`recent-projects`],mz=[`terminal-presets`],hz=ft({queryKey:fz,queryFn:async()=>(await Tf(CE.api.projects.$get())).projects,staleTime:kf,refetchInterval:5e3,refetchOnReconnect:!0,refetchOnWindowFocus:!0}),gz=ft({queryKey:pz,queryFn:async()=>(await Tf(CE.api.projects.recent.$get())).projects}),_z=ft({queryKey:mz,queryFn:async()=>(await Tf(CE.api[`terminal-presets`].$get())).presets,staleTime:0,refetchInterval:5e3,refetchOnReconnect:!0,refetchOnWindowFocus:!0}),vz=e=>ft({queryKey:[`terminal-preset-definitions`,e?.worktreeId??e?.projectId??`global`],queryFn:async()=>await Tf(CE.api[`terminal-preset-definitions`].$get({query:{...e?.projectId?{projectId:e.projectId}:{},...e?.worktreeId?{worktreeId:e.worktreeId}:{}}})),staleTime:0,refetchInterval:5e3,refetchOnReconnect:!0,refetchOnWindowFocus:!0});function yz(){let e=Ri(),t=cf();return(0,R.useCallback)((n,r=!1,i=!0)=>{switch(n.kind===`terminal`&&t(n.terminalId,i),n.kind){case`root`:return e({to:`/`,replace:r});case`project`:return e({to:`/projects/$projectId`,params:{projectId:n.projectId},replace:r});case`worktree`:return e({to:`/projects/$projectId/worktrees/$worktreeId`,params:{projectId:n.projectId,worktreeId:n.worktreeId},replace:r});case`terminal`:return e({to:`/projects/$projectId/worktrees/$worktreeId/terminals/$terminalId`,params:{projectId:n.projectId,worktreeId:n.worktreeId,terminalId:n.terminalId},replace:r});case`panel`:return e({to:`/projects/$projectId/worktrees/$worktreeId/panels/$panelId`,params:{projectId:n.projectId,worktreeId:n.worktreeId,panelId:n.panelId},replace:r})}},[e,t])}function bz({projects:e,selectedProject:t,targetForProject:n,projectSwitcherTriggerRef:r,closeProjectUi:i,openedProjectUi:a}){let o=Ye(),s=Ca(),c=yz(),l=pt({mutationFn:e=>Tf(CE.api.projects[`:projectId`].close.$post({param:{projectId:e.id}})),onSuccess:async(a,s)=>{let l=o.getQueryData(fz)??e,u=l.filter(e=>e.id!==s.id),d=l.findIndex(e=>e.id===s.id),f=u[Math.min(Math.max(d,0),u.length-1)]??null,p=t?.id===s.id;p&&(await c(f?n(f):{kind:`root`,pathname:`/`},!0),i()),o.setQueryData(fz,u);for(let e of s.worktrees.flatMap(e=>e.terminals))VP.forget(e.id);await Promise.all([o.invalidateQueries({queryKey:fz}),o.invalidateQueries({queryKey:pz})]),(p||!u.length)&&window.requestAnimationFrame(()=>r.current?.focus())},onError:(e,t)=>{xF(e,{operation:`close project “${t.name}”`}),kE(e).code===`PROJECT_CLOSE_FAILED`&&o.invalidateQueries({queryKey:fz})}});return{closingProjectId:l.isPending?l.variables?.id??null:null,requestProjectClose:e=>{let t=e.worktrees.reduce((e,t)=>e+t.terminals.length,0);t>0&&!window.confirm(`Close “${e.name}”? This will terminate ${t} Treeport terminal ${t===1?`session and its process`:`sessions and their processes`}. Git worktrees and files will remain on disk, and you can reopen the project from Recent projects.`)||l.mutate(e)},projectOpened:async(t,r=!0)=>{let i=e.length===0&&s.pathname===`/`;o.setQueryData(fz,e=>[...(e??[]).filter(e=>e.id!==t.id),t]),o.setQueryData(pz,e=>e?.filter(e=>e.id!==t.id)),await c(n(t),i,r),await Promise.all([o.invalidateQueries({queryKey:fz}),o.invalidateQueries({queryKey:pz})]),a()}}}function xz({program:e,progress:t,attention:n,exited:r,className:i,title:a}){let o=t!==null&&!n&&t.state!==`paused`&&t.state!==`error`,s=n?`text-amber-300`:t?.state===`error`?`text-rose-300`:t?.state===`paused`?`text-amber-300`:r&&!t?`text-rose-300`:o?`text-cyan-400`:`text-zinc-500`;return(0,z.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,className:W(`shrink-0 overflow-visible`,i),"aria-hidden":!a||void 0,children:[a?(0,z.jsx)(`title`,{children:a}):null,(0,z.jsx)(`g`,{className:W(`origin-center transition-[color,transform] duration-500`,s,o&&`scale-[0.62]`),children:e===`pi`?(0,z.jsxs)(`svg`,{viewBox:`0 0 800 800`,width:`24`,height:`24`,children:[(0,z.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z`}),(0,z.jsx)(`path`,{fill:`currentColor`,d:`M517.36 400H634.72V634.72H517.36Z`})]}):e===`claude`?(0,z.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z`}):e===`codex`?(0,z.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z`}):(0,z.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,z.jsx)(`polyline`,{points:`4 17 10 11 4 5`}),(0,z.jsx)(`line`,{x1:`12`,y1:`19`,x2:`20`,y2:`19`})]})}),(0,z.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,className:`text-cyan-400`,children:[(0,z.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`5`,className:W(`opacity-0 transition-opacity duration-500`,o&&`opacity-25`)}),(0,z.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`5`,pathLength:`100`,strokeDasharray:`30 70`,className:W(`opacity-0 transition-opacity duration-500`,o&&`animate-comet opacity-100 motion-reduce:animate-none`)})]})]})}var Sz=Object.defineProperty,Cz=(e,t)=>Sz(e,`name`,{value:t,configurable:!0}),wz=`horizontal`,Tz=[`horizontal`,`vertical`],Ez=R.forwardRef(Cz(function(e,t){let{decorative:n,orientation:r=wz,...i}=e,a=Dz(r)?r:wz,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,z.jsx)(oI.div,{"data-orientation":a,...o,...i,ref:t})},`Separator`));function Dz(e){return Tz.includes(e)}Cz(Dz,`isValidOrientation`);var Oz=Ez,kz=R.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,z.jsx)(Oz,{ref:i,decorative:n,orientation:t,className:W(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));kz.displayName=Oz.displayName;var Az=`(max-width: 700px)`;function jz(e){let t=window.matchMedia(Az);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function Mz(){return window.matchMedia(Az).matches}function Nz(){return(0,R.useSyncExternalStore)(jz,Mz,()=>!1)}var Pz=pL,Fz=yL,Iz=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(xL,{className:W(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));Iz.displayName=xL.displayName;var Lz=bp(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),Rz=R.forwardRef(({side:e=`right`,className:t,children:n,showCloseButton:r=!0,...i},a)=>(0,z.jsxs)(Fz,{children:[(0,z.jsx)(Iz,{}),(0,z.jsxs)(TL,{ref:a,className:W(Lz({side:e}),t),...i,children:[r?(0,z.jsxs)(PL,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,z.jsx)(Xf,{className:`size-4`}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Close`})]}):null,n]})]}));Rz.displayName=TL.displayName;var zz=({className:e,...t})=>(0,z.jsx)(`div`,{className:W(`flex flex-col gap-2 text-center sm:text-left`,e),...t});zz.displayName=`SheetHeader`;var Bz=({className:e,...t})=>(0,z.jsx)(`div`,{className:W(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t});Bz.displayName=`SheetFooter`;var Vz=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(AL,{ref:n,className:W(`text-lg font-semibold text-foreground`,e),...t}));Vz.displayName=AL.displayName;var Hz=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(ML,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));Hz.displayName=ML.displayName;function Uz({className:e,...t}){return(0,z.jsx)(`div`,{className:W(`animate-pulse rounded-md bg-primary/10`,e),...t})}var Wz=`16rem`,Gz=`min(88vw, 21rem)`,Kz=`3rem`,qz=R.createContext(null);function Jz(){let e=R.useContext(qz);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}var Yz=R.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o},s)=>{let c=Nz(),[l,u]=R.useState(!1),d=R.useRef(null),f=R.useRef(!1),p=R.useCallback(e=>{u(t=>{let n=typeof e==`function`?e(t):e;return!t&&n&&(d.current=document.activeElement instanceof HTMLElement?document.activeElement:null),n})},[]),m=R.useCallback(()=>{f.current=!0,u(!1)},[]),[h,g]=R.useState(e),_=t??h,v=R.useCallback(e=>{let t=typeof e==`function`?e(_):e;n?n(t):g(t)},[n,_]),y=R.useCallback(()=>{c&&p(e=>!e)},[c,p]),b=_?`expanded`:`collapsed`,x=R.useMemo(()=>({state:b,open:_,setOpen:v,isMobile:c,openMobile:l,setOpenMobile:p,mobileRestoreFocusRef:d,skipMobileFocusRestoreRef:f,closeMobileWithoutFocusRestore:m,toggleSidebar:y}),[b,_,v,c,l,p,y]);return(0,z.jsx)(qz.Provider,{value:x,children:(0,z.jsx)(ef,{delayDuration:0,children:(0,z.jsx)(`div`,{style:{"--sidebar-width":Wz,"--sidebar-width-icon":Kz,...i},className:W(`group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar`,r),ref:s,...o,children:a})})})});Yz.displayName=`SidebarProvider`;var Xz=R.forwardRef(({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,mobileTitle:a=`Sidebar`,mobileDescription:o=`Displays the mobile sidebar.`,...s},c)=>{let{isMobile:l,state:u,openMobile:d,setOpenMobile:f,mobileRestoreFocusRef:p,skipMobileFocusRestoreRef:m}=Jz();return l?(0,z.jsx)(Pz,{open:d,onOpenChange:f,children:(0,z.jsxs)(Rz,{"data-sidebar":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width-mobile) bg-zinc-900/95 p-0 text-zinc-100 backdrop-blur-xl`,style:{"--sidebar-width-mobile":Gz},side:e,showCloseButton:!1,onCloseAutoFocus:e=>{e.preventDefault(),m.current?m.current=!1:p.current?.isConnected&&p.current.focus()},children:[(0,z.jsxs)(zz,{className:`sr-only`,children:[(0,z.jsx)(Vz,{children:a}),(0,z.jsx)(Hz,{children:o})]}),(0,z.jsx)(`div`,{ref:c,className:W(`flex h-full w-full flex-col`,r),...s,children:i})]})}):n===`none`?(0,z.jsx)(`div`,{className:W(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),ref:c,...s,children:i}):(0,z.jsxs)(`div`,{ref:c,className:`group peer hidden text-sidebar-foreground min-[701px]:block`,"data-state":u,"data-collapsible":u===`collapsed`?n:``,"data-variant":t,"data-side":e,children:[(0,z.jsx)(`div`,{className:W(`relative w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]`:`group-data-[collapsible=icon]:w-[--sidebar-width-icon]`)}),(0,z.jsx)(`div`,{className:W(`fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear min-[701px]:flex`,e===`left`?`left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]`:`right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]`:`group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...s,children:(0,z.jsx)(`div`,{"data-sidebar":`sidebar`,className:`flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow`,children:i})})]})});Xz.displayName=`Sidebar`;var Zz=R.forwardRef(({className:e,onClick:t,children:n,...r},i)=>{let{toggleSidebar:a}=Jz();return(0,z.jsxs)(G,{ref:i,"data-sidebar":`trigger`,variant:`ghost`,size:`icon`,className:W(`size-7`,e),onClick:e=>{t?.(e),a()},...r,children:[n??(0,z.jsx)(Yf,{}),r[`aria-label`]?null:(0,z.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})});Zz.displayName=`SidebarTrigger`;var Qz=R.forwardRef(({className:e,...t},n)=>{let{toggleSidebar:r}=Jz();return(0,z.jsx)(`button`,{ref:n,"data-sidebar":`rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onClick:r,title:`Toggle Sidebar`,className:W(`absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 min-[701px]:flex`,`[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,e),...t})});Qz.displayName=`SidebarRail`;var $z=R.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,z.jsx)(t?ap:`main`,{ref:r,className:W(`relative flex w-full flex-1 flex-col bg-background`,`min-[701px]:peer-data-[variant=inset]:m-2 min-[701px]:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 min-[701px]:peer-data-[variant=inset]:ml-0 min-[701px]:peer-data-[variant=inset]:rounded-xl min-[701px]:peer-data-[variant=inset]:shadow`,e),...n}));$z.displayName=`SidebarInset`;var eB=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(cz,{ref:n,"data-sidebar":`input`,className:W(`h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring`,e),...t}));eB.displayName=`SidebarInput`;var tB=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`div`,{ref:n,"data-sidebar":`header`,className:W(`flex flex-col gap-2 p-2`,e),...t}));tB.displayName=`SidebarHeader`;var nB=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`div`,{ref:n,"data-sidebar":`footer`,className:W(`flex flex-col gap-2 p-2`,e),...t}));nB.displayName=`SidebarFooter`;var rB=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(kz,{ref:n,"data-sidebar":`separator`,className:W(`mx-2 w-auto bg-sidebar-border`,e),...t}));rB.displayName=`SidebarSeparator`;var iB=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`div`,{ref:n,"data-sidebar":`content`,className:W(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t}));iB.displayName=`SidebarContent`;var aB=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`div`,{ref:n,"data-sidebar":`group`,className:W(`relative flex w-full min-w-0 flex-col p-2`,e),...t}));aB.displayName=`SidebarGroup`;var oB=R.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,z.jsx)(t?ap:`div`,{ref:r,"data-sidebar":`group-label`,className:W(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0`,e),...n}));oB.displayName=`SidebarGroupLabel`;var sB=R.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,z.jsx)(t?ap:`button`,{ref:r,"data-sidebar":`group-action`,className:W(`absolute right-3 top-3.5 flex size-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:min-[701px]:hidden`,`group-data-[collapsible=icon]:hidden`,e),...n}));sB.displayName=`SidebarGroupAction`;var cB=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`div`,{ref:n,"data-sidebar":`group-content`,className:W(`w-full text-sm`,e),...t}));cB.displayName=`SidebarGroupContent`;var lB=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`ul`,{ref:n,"data-sidebar":`menu`,className:W(`flex w-full min-w-0 flex-col gap-1`,e),...t}));lB.displayName=`SidebarMenu`;var uB=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`li`,{ref:n,"data-sidebar":`menu-item`,className:W(`group/menu-item relative`,e),...t}));uB.displayName=`SidebarMenuItem`;var dB=bp(`peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:!p-0`}},defaultVariants:{variant:`default`,size:`default`}}),fB=R.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o},s)=>{let c=e?ap:`button`,{isMobile:l,state:u}=Jz(),d=(0,z.jsx)(c,{ref:s,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:W(dB({variant:n,size:r}),a),...o});return i?(typeof i==`string`&&(i={children:i}),(0,z.jsxs)(tf,{children:[(0,z.jsx)(nf,{asChild:!0,children:d}),(0,z.jsx)(rf,{side:`right`,align:`center`,hidden:u!==`collapsed`||l,...i})]})):d});fB.displayName=`SidebarMenuButton`;var pB=R.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>(0,z.jsx)(t?ap:`button`,{ref:i,"data-sidebar":`menu-action`,className:W(`absolute right-1 top-1.5 flex size-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:min-[701px]:hidden`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,n&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground min-[701px]:opacity-0`,e),...r}));pB.displayName=`SidebarMenuAction`;var mB=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`div`,{ref:n,"data-sidebar":`menu-badge`,className:W(`pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground`,`peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));mB.displayName=`SidebarMenuBadge`;var hB=R.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{let i=R.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return(0,z.jsxs)(`div`,{ref:r,"data-sidebar":`menu-skeleton`,className:W(`flex h-8 items-center gap-2 rounded-md px-2`,e),...n,children:[t&&(0,z.jsx)(Uz,{className:`size-4 rounded-md`,"data-sidebar":`menu-skeleton-icon`}),(0,z.jsx)(Uz,{className:`h-4 max-w-[--skeleton-width] flex-1`,"data-sidebar":`menu-skeleton-text`,style:{"--skeleton-width":i}})]})});hB.displayName=`SidebarMenuSkeleton`;var gB=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`ul`,{ref:n,"data-sidebar":`menu-sub`,className:W(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));gB.displayName=`SidebarMenuSub`;var _B=R.forwardRef(({...e},t)=>(0,z.jsx)(`li`,{ref:t,...e}));_B.displayName=`SidebarMenuSubItem`;var vB=R.forwardRef(({asChild:e=!1,size:t=`md`,isActive:n,className:r,...i},a)=>(0,z.jsx)(e?ap:`a`,{ref:a,"data-sidebar":`menu-sub-button`,"data-size":t,"data-active":n,className:W(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,`data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground`,t===`sm`&&`text-xs`,t===`md`&&`text-sm`,`group-data-[collapsible=icon]:hidden`,r),...i}));vB.displayName=`SidebarMenuSubButton`;function yB({label:e,tooltip:t=e,className:n,disabled:r,keyShortcuts:i,onClick:a,children:o}){return(0,z.jsxs)(tf,{children:[(0,z.jsx)(nf,{asChild:!0,children:(0,z.jsxs)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,className:n,"aria-label":e,"aria-keyshortcuts":i,disabled:r,onClick:e=>a(e.currentTarget),children:[o,(0,z.jsx)(`span`,{className:`touch-target`,"aria-hidden":`true`})]})}),(0,z.jsx)(rf,{side:`top`,children:t})]})}var bB=240,xB=420,SB=272,CB=`treeport-sidebar-width`,wB=(0,R.createContext)(null),TB=(0,R.createContext)(null);function EB(e){return Math.min(xB,Math.max(bB,e))}function DB(){let e=(0,R.useContext)(wB);if(!e)throw Error(`useProjectSwitcher must be used within WorkspaceShell.`);return e}function OB({children:e}){let[t,n]=(0,R.useState)(!1),r=(0,R.useRef)(null),i=(0,R.useRef)(!1),[a,o]=(0,R.useState)(()=>{let e=Number.parseInt(localStorage.getItem(CB)??``,10);return Number.isFinite(e)?EB(e):SB}),[s,c]=(0,R.useState)(!1);return(0,z.jsx)(wB.Provider,{value:{open:t,setOpen:n,triggerRef:r,dismissedIntoTerminalRef:i},children:(0,z.jsx)(TB.Provider,{value:{width:a,resizing:s,setWidth:e=>{let t=EB(e);o(t),localStorage.setItem(CB,String(t))},setResizing:c},children:(0,z.jsx)(Yz,{className:W(`app-frame isolate grid h-dvh min-h-0 grid-cols-[var(--sidebar-width)_minmax(0,1fr)] bg-zinc-950 max-[700px]:grid-cols-1 max-[700px]:grid-rows-[3.25rem_minmax(0,1fr)]`,s&&`select-none`),style:{"--sidebar-width":`${a}px`,"--sidebar-width-mobile":`min(88vw, 21rem)`},children:e})})})}function kB({children:e}){let{isMobile:t,openMobile:n}=Jz(),r=DB();return(0,z.jsx)($z,{asChild:!0,children:(0,z.jsx)(`div`,{className:`grid min-h-0 min-w-0 grid-rows-[minmax(0,1fr)] overflow-hidden bg-zinc-950`,inert:t&&n?!0:void 0,"aria-hidden":t&&n?!0:void 0,onPointerDownCapture:()=>{r.open&&(r.dismissedIntoTerminalRef.current=!0,r.setOpen(!1))},children:e})})}function AB(){let e=(0,R.useContext)(TB),t=(0,R.useRef)(null);if(!e)throw Error(`ResizableSidebarRail must be used within WorkspaceShell.`);let n=n=>{n.button===0&&(t.current={pointerX:n.clientX,width:e.width},n.currentTarget.setPointerCapture(n.pointerId),e.setResizing(!0))},r=n=>{t.current&&e.setWidth(t.current.width+n.clientX-t.current.pointerX)},i=n=>{t.current=null,n.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId),e.setResizing(!1)};return(0,z.jsx)(`div`,{className:W(`absolute inset-y-0 right-0 z-20 hidden w-3 translate-x-1/2 touch-none cursor-col-resize outline-none before:absolute before:inset-y-0 before:left-1/2 before:w-px before:-translate-x-1/2 before:bg-white/8 after:absolute after:top-1/2 after:left-1/2 after:h-8 after:w-1 after:-translate-1/2 after:rounded-full after:bg-zinc-700 hover:before:w-0.5 hover:before:bg-cyan-400/60 hover:after:bg-cyan-400 focus-visible:before:w-0.5 focus-visible:before:bg-cyan-400 focus-visible:after:bg-cyan-400 min-[701px]:block`,e.resizing&&`before:w-0.5 before:bg-cyan-400`),role:`separator`,"aria-label":`Resize sidebar`,"aria-orientation":`vertical`,"aria-controls":`worktree-sidebar`,"aria-valuemin":bB,"aria-valuemax":xB,"aria-valuenow":e.width,"aria-valuetext":`${e.width} pixels`,title:`Drag to resize; double-click to reset`,tabIndex:0,onPointerDown:n,onPointerMove:r,onPointerUp:i,onPointerCancel:i,onKeyDown:t=>{let n=e.width;if(t.key===`ArrowLeft`)n-=t.shiftKey?32:16;else if(t.key===`ArrowRight`)n+=t.shiftKey?32:16;else if(t.key===`Home`)n=bB;else if(t.key===`End`)n=xB;else return;t.preventDefault(),e.setWidth(n)},onDoubleClick:()=>e.setWidth(SB)})}function jB({blocked:e}){let t=/Mac|iPhone|iPad|iPod/.test(navigator.platform),{isMobile:n,setOpenMobile:r}=Jz(),i=DB();return(0,R.useEffect)(()=>{let a=a=>{let o=t?a.metaKey&&!a.ctrlKey:a.ctrlKey&&!a.metaKey;a.isComposing||a.key.toLocaleLowerCase()!==`p`||!a.shiftKey||a.altKey||!o||e||(a.preventDefault(),a.stopPropagation(),n?(r(!0),window.requestAnimationFrame(()=>i.setOpen(!0))):i.setOpen(!0))};return document.addEventListener(`keydown`,a,!0),()=>document.removeEventListener(`keydown`,a,!0)},[e,n,i.setOpen,r]),null}function MB({projects:e,activeProject:t,closingProjectId:n,onSelectProject:r,onProjectOpened:i,onRequestProjectClose:a,onOpenProjectDialog:o}){let s=/Mac|iPhone|iPad|iPod/.test(navigator.platform),{isMobile:c}=Jz(),l=DB(),{attention:u,progress:d}=$P(),[f,p]=(0,R.useState)(``),[m,h]=(0,R.useState)(null),g=dt({...gz,enabled:l.open}),_=pt({mutationFn:async e=>(await Tf(CE.api.projects[`:projectId`].open.$post({param:{projectId:e.id}}))).project,onSuccess:i,onError:(e,t)=>{xF(e,{operation:`reopen project “${t.name}”`})}}),v=e=>{r(e),p(``),h(null)},y=e=>{_.mutate(e),p(``),h(null)},b=f.trim().toLocaleLowerCase(),x=e.filter(e=>!b||e.name.toLocaleLowerCase().includes(b)||e.repositoryPath.toLocaleLowerCase().includes(b)),S=new Set(e.map(e=>e.id)),C=(g.data??[]).filter(e=>!S.has(e.id)),w=C.filter(e=>!b||e.name.toLocaleLowerCase().includes(b)||e.repositoryPath.toLocaleLowerCase().includes(b)),T=[...x.map(e=>({kind:`open`,project:e})),...w.map(e=>({kind:`recent`,project:e}))],E=T.find(e=>e.project.id===m)??T[0]??null;return(0,z.jsxs)(Vh,{open:l.open,onOpenChange:e=>{l.setOpen(e),h(null),p(``)},children:[(0,z.jsx)(Hh,{asChild:!0,children:(0,z.jsxs)(G,{ref:l.triggerRef,type:`button`,variant:`ghost`,className:`h-11 min-w-0 flex-1 justify-start gap-2 px-2 text-base text-zinc-100 hover:bg-white/5 min-[701px]:h-8 min-[701px]:text-sm`,"aria-label":t?`Switch project, current project ${t.name}`:`Open project`,"aria-keyshortcuts":s?`Meta+Shift+P`:`Control+Shift+P`,title:`${t?.repositoryPath??`Open project`} — ${s?`⌘⇧P`:`Ctrl+Shift+P`}`,children:[(0,z.jsx)(`span`,{className:`truncate font-medium`,children:t?.name??`Open project`}),(0,z.jsx)(HR,{className:`ml-auto shrink-0 fill-zinc-600`,"data-icon":`inline-end`})]})}),(0,z.jsxs)(Uh,{align:`start`,portalled:!c,className:`grid w-[min(17rem,calc(100vw-1rem))] gap-1 p-1 min-[701px]:w-60`,onOpenAutoFocus:e=>{c&&e.preventDefault()},onCloseAutoFocus:e=>{l.dismissedIntoTerminalRef.current&&(e.preventDefault(),l.dismissedIntoTerminalRef.current=!1)},children:[(0,z.jsxs)(`div`,{className:`relative`,children:[(0,z.jsx)(QR,{className:`pointer-events-none absolute top-1/2 left-2 size-4 -translate-y-1/2 fill-zinc-600`}),(0,z.jsx)(cz,{name:`project-search`,value:f,onChange:e=>{p(e.target.value),h(null)},onKeyDown:e=>{if(e.nativeEvent.isComposing||!T.length)return;if(e.key===`Enter`){e.preventDefault(),E?.kind===`open`?v(E.project):E?.kind===`recent`&&!_.isPending&&y(E.project);return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=Math.max(0,T.findIndex(e=>e.project.id===E?.project.id)),n=e.key===`ArrowDown`?Math.min(t+1,T.length-1):Math.max(t-1,0),r=T[n];h(r.project.id),window.requestAnimationFrame(()=>document.getElementById(`project-switcher-option-${r.project.id}`)?.scrollIntoView({block:`nearest`}))},className:`h-11! bg-zinc-950/50 pr-2 pl-8 text-base! ring-white/8 focus-visible:ring-1! focus-visible:ring-white/20! min-[701px]:h-7! min-[701px]:py-1 min-[701px]:pr-2 min-[701px]:pl-7 min-[701px]:text-sm! min-[701px]:placeholder:text-sm`,placeholder:`Search projects…`,"aria-label":`Search projects`,"aria-activedescendant":E?`project-switcher-option-${E.project.id}`:void 0,autoFocus:!c})]}),(0,z.jsxs)(`div`,{className:`grid max-h-[min(28rem,70vh)] gap-1 overflow-y-auto p-0.5 min-[701px]:max-h-[min(22rem,70vh)] min-[701px]:gap-0.5 min-[701px]:p-0 [scrollbar-color:var(--color-zinc-700)_transparent]`,children:[x.length?(0,z.jsx)(`ul`,{role:`list`,className:`grid gap-1 min-[701px]:gap-0.5`,children:x.map(e=>{let r=e.worktrees.flatMap(e=>e.terminals),i=r.some(e=>u.has(e.id)),o=r.map(e=>d.get(e.id)).find(e=>e!==void 0);return(0,z.jsxs)(`li`,{className:W(`group/project-option relative flex h-11 min-w-0 items-center gap-0.5 rounded-md pr-1 has-[button:hover]:bg-white/5 focus-within:bg-white/5 min-[701px]:h-7`,E?.project.id===e.id&&`bg-white/8`),onMouseEnter:()=>h(e.id),children:[(0,z.jsxs)(G,{id:`project-switcher-option-${e.id}`,type:`button`,variant:`ghost`,className:`h-11 min-w-0 flex-1 justify-start px-2 text-left text-base hover:bg-transparent min-[701px]:h-7 min-[701px]:px-1.5 min-[701px]:text-sm max-[700px]:pr-8`,"data-highlighted":E?.project.id===e.id||void 0,onClick:()=>v(e),children:[(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,z.jsx)(`span`,{className:`truncate font-medium text-zinc-100`,children:e.name}),t?.id===e.id?(0,z.jsx)(IR,{className:`shrink-0 fill-zinc-400`}):null]}),o||i?(0,z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 min-[701px]:group-hover/project-option:opacity-0 min-[701px]:group-focus-within/project-option:opacity-0`,children:[o?(0,z.jsx)(xz,{program:null,progress:o,attention:!1,exited:!1,className:`size-4`,title:Qh(o)}):null,i?(0,z.jsx)(xz,{program:null,progress:null,attention:!0,exited:!1,className:`size-4`,title:`Terminal needs attention`}):null]}):null]}),(0,z.jsx)(yB,{label:`Close project ${e.name}`,tooltip:`Close project`,disabled:n===e.id,className:`absolute right-1 shrink-0 fill-zinc-500 opacity-0 hover:bg-white/5 hover:fill-rose-300 group-hover/project-option:opacity-100 group-focus-within/project-option:opacity-100 max-[700px]:opacity-100`,onClick:()=>a(e),children:n===e.id?(0,z.jsx)(OR,{className:`animate-spin`}):(0,z.jsx)(oz,{})})]},e.id)})}):(0,z.jsx)(`p`,{className:`px-2 py-1.5 text-base text-pretty text-zinc-500 min-[701px]:px-1.5 min-[701px]:py-1 min-[701px]:text-sm`,children:`No open projects found.`}),!g.isSuccess||C.length?(0,z.jsxs)(`section`,{className:`grid gap-1 min-[701px]:gap-0.5`,"aria-labelledby":`recent-projects-switcher-title`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 py-1.5 min-[701px]:px-1.5 min-[701px]:py-1`,children:[(0,z.jsx)(`h3`,{id:`recent-projects-switcher-title`,className:`text-sm font-medium text-balance text-zinc-500 min-[701px]:text-xs`,children:`Recent projects`}),g.isFetching?(0,z.jsx)(OR,{className:`size-4 shrink-0 animate-spin fill-zinc-600`,"aria-label":`Refreshing recent projects`}):null]}),g.isError?(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 py-1.5 min-[701px]:px-1.5 min-[701px]:py-1`,children:[(0,z.jsx)(`p`,{className:`text-base text-pretty text-zinc-500 min-[701px]:text-sm`,children:`Recent projects unavailable.`}),(0,z.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-9 text-base min-[701px]:h-7 min-[701px]:text-sm`,onClick:()=>void g.refetch(),children:`Retry`})]}):null,g.isSuccess&&w.length?(0,z.jsx)(`ul`,{role:`list`,className:`grid gap-1 min-[701px]:gap-0.5`,children:w.map(e=>(0,z.jsx)(`li`,{onMouseEnter:()=>h(e.id),children:(0,z.jsx)(G,{id:`project-switcher-option-${e.id}`,type:`button`,variant:`ghost`,className:W(`h-11 w-full min-w-0 justify-start px-2 text-left text-base min-[701px]:h-7 min-[701px]:px-1.5 min-[701px]:text-sm`,E?.project.id===e.id&&`bg-white/8`),"data-highlighted":E?.project.id===e.id||void 0,disabled:_.isPending,onClick:()=>y(e),children:(0,z.jsx)(`span`,{className:`truncate font-medium text-zinc-200`,children:e.name})})},e.id))}):null,g.isSuccess&&!w.length?(0,z.jsx)(`p`,{className:`px-2 py-1.5 text-base text-pretty text-zinc-500 min-[701px]:px-1.5 min-[701px]:py-1 min-[701px]:text-sm`,children:`No recent projects found.`}):null]}):null]}),(0,z.jsx)(kz,{className:`bg-white/8`}),(0,z.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-11 w-full justify-start text-base font-normal text-zinc-500 hover:text-zinc-100 min-[701px]:h-7 min-[701px]:text-sm`,onClick:e=>{l.setOpen(!1),o(l.triggerRef.current??e.currentTarget)},children:[(0,z.jsx)(ez,{"data-icon":`inline-start`}),` Open project…`]})]})]})}function NB({className:e,children:t,...n}){return(0,z.jsxs)(`span`,{className:`grid grid-cols-[1fr_--spacing(8)]`,children:[(0,z.jsx)(`select`,{"data-slot":`native-select`,className:W(`col-span-full row-start-1 h-11 w-full appearance-none rounded-md bg-zinc-950/70 py-2 pr-8 pl-3 text-base text-zinc-100 ring-1 ring-white/12 outline-none focus-visible:ring-2 focus-visible:ring-cyan-400 sm:h-9 sm:text-sm`,e),...n,children:t}),(0,z.jsx)(RR,{className:`pointer-events-none col-start-2 row-start-1 size-4 place-self-center text-zinc-500`})]})}function PB({projectSwitcher:e,notificationCenter:t,children:n}){return(0,z.jsxs)(Xz,{id:`worktree-sidebar`,collapsible:`none`,mobileTitle:`Projects and worktrees`,mobileDescription:`Navigate projects, worktrees, and terminals.`,className:`sidebar relative min-h-0 border-r border-white/8 bg-zinc-900/80 text-zinc-200 backdrop-blur-xl`,children:[(0,z.jsxs)(tB,{className:`gap-0 border-b border-white/8 p-0`,children:[(0,z.jsx)(`div`,{className:`hidden justify-end p-2 max-[700px]:flex`,children:(0,z.jsxs)(Zz,{type:`button`,size:`icon-sm`,className:`icon-button mobile-close text-zinc-400 hover:bg-white/5 hover:text-zinc-100`,"aria-label":`Close drawer`,children:[(0,z.jsx)(oz,{}),(0,z.jsx)(`span`,{className:`touch-target`,"aria-hidden":`true`})]})}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1 p-2 max-[700px]:pt-0`,children:[(0,z.jsx)(`div`,{className:`min-w-0 flex-1`,children:e}),(0,z.jsx)(`div`,{className:`max-[700px]:hidden`,children:t})]})]}),(0,z.jsx)(iB,{className:`gap-0 overflow-hidden`,children:n}),(0,z.jsx)(AB,{})]})}function FB({selectedTerminalId:e,terminals:t,onSelectTerminal:n,notificationCenter:r}){let{isMobile:i,openMobile:a}=Jz(),{titles:o}=$P();return(0,z.jsxs)(`header`,{className:`mobile-bar hidden min-w-0 grid-cols-[2.75rem_minmax(0,1fr)_2.75rem] items-center gap-2 border-b border-white/8 bg-zinc-900/95 px-2 backdrop-blur max-[700px]:grid`,inert:i&&a?!0:void 0,children:[(0,z.jsxs)(Zz,{type:`button`,size:`icon`,className:`icon-button text-zinc-400 hover:bg-white/5 hover:text-zinc-100`,"aria-label":`Open worktree drawer`,children:[(0,z.jsx)(MR,{}),(0,z.jsx)(`span`,{className:`touch-target`,"aria-hidden":`true`})]}),(0,z.jsxs)(NB,{className:`h-9 border-0 bg-zinc-800/80 text-base ring-0`,name:`terminal-selector`,"aria-label":`Terminal selector`,value:e??``,onChange:e=>{let r=t.find(t=>t.id===e.target.value);r&&n(r)},children:[(0,z.jsx)(`option`,{value:``,children:`Select terminal`}),t.map(e=>(0,z.jsx)(`option`,{value:e.id,children:o.get(e.id)||e.name},e.id))]}),r]})}var IB=Object.defineProperty,LB=(e,t)=>IB(e,`name`,{value:t,configurable:!0});function RB(e){let t=e+`CollectionProvider`,[n,r]=kF(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=LB(e=>{let{scope:t,children:n}=e,r=R.useRef(null),a=R.useRef(new Map).current;return(0,z.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=ip(s),l=R.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=tp(t,a(s,n).collectionRef);return(0,z.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=ip(u),p=R.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=R.useRef(null),s=tp(t,o),c=a(u,n);return R.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,z.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return R.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return LB(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}LB(RB,`createCollection`);var zB=new WeakMap,BB=class e extends Map{static{LB(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],zB.set(this,!0)}set(e,t){return zB.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=UB(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=VB(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=VB(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return VB(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function VB(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=HB(e,t);return n===-1?void 0:e[n]}LB(VB,`at`);function HB(e,t){let n=e.length,r=UB(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}LB(HB,`toSafeIndex`);function UB(e){return e!==e||e===0?0:Math.trunc(e)}LB(UB,`toSafeInteger`);function WB(e){let t=e+`CollectionProvider`,[n,r]=kF(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new BB,setItemMap:LB(()=>void 0,`setItemMap`)}),o=LB(({state:e,...t})=>e?(0,z.jsx)(c,{...t,state:e}):(0,z.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=LB(e=>{let t=h();return(0,z.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=LB(e=>{let{scope:t,children:n,state:r}=e,a=R.useRef(null),[o,s]=R.useState(null),c=tp(a,s),[l,u]=r;return R.useEffect(()=>{if(!o)return;let e=JB(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,z.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=ip(l),d=R.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=tp(t,a(l,n).collectionRef);return(0,z.jsx)(u,{ref:i,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=ip(f),m=R.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=R.useRef(null),[s,c]=R.useState(null),l=tp(t,o,c),{setItemMap:u}=a(f,n),d=R.useRef(i);GB(d.current,i)||(d.current=i);let m=d.current;return R.useEffect(()=>{let e=m;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(qB):(t.set(s,{...e,element:s}),t.toSorted(qB)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new BB(e)))}},[s,m,u]),(0,z.jsx)(p,{"data-radix-collection-item":``,ref:l,children:r})});m.displayName=f;function h(){return R.useState(new BB)}LB(h,`useInitCollection`);function g(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return LB(g,`useCollection`),[{Provider:o,Slot:d,ItemSlot:m},{createCollectionScope:r,useCollection:g,useInitCollection:h}]}LB(WB,`createCollection`);function GB(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}LB(GB,`shallowEqual`);function KB(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}LB(KB,`isElementPreceding`);function qB(e,t){return!e[1].element||!t[1].element?0:KB(e[1].element,t[1].element)?-1:1}LB(qB,`sortByDocumentPosition`);function JB(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}LB(JB,`getChildListObserver`);var YB=Object.defineProperty,XB=(e,t)=>YB(e,`name`,{value:t,configurable:!0}),ZB=R.createContext(void 0);function QB(e){let t=R.useContext(ZB);return e||t||`ltr`}XB(QB,`useDirection`);var $B=Object.defineProperty,eV=(e,t)=>$B(e,`name`,{value:t,configurable:!0});function tV(e){let[t,n]=R.useState(void 0);return zF(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}eV(tV,`useSize`);var nV=Object.defineProperty,rV=(e,t)=>nV(e,`name`,{value:t,configurable:!0}),iV=`Popper`,[aV,oV]=kF(iV),[sV,cV]=aV(iV),lV=rV(e=>{let{__scopePopper:t,children:n}=e,[r,i]=R.useState(null),[a,o]=R.useState(void 0);return(0,z.jsx)(sV,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),uV=`PopperAnchor`,dV=R.forwardRef(rV(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=cV(uV,n),o=R.useRef(null),s=a.onAnchorChange,c=tp(t,R.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=R.useRef(null);R.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&vV(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,z.jsx)(oI.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),fV=`PopperContent`,[pV,mV]=aV(fV),hV=R.forwardRef(rV(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=cV(fV,n),[_,v]=R.useState(null),y=tp(t,v),[b,x]=R.useState(null),S=tV(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(gV),altBoundary:O},{refs:ee,floatingStyles:te,placement:A,isPositioned:j,middlewareData:M}=Wc({strategy:`fixed`,placement:T,whileElementsMounted:rV((...e)=>Ac(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[Kc({mainAxis:i+w,alignmentAxis:o}),c&&qc({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Jc():void 0,...k}),c&&Yc({...k}),Xc({...k,apply:rV(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),b&&Qc({element:b,padding:s}),_V({arrowWidth:C,arrowHeight:w}),f&&Zc({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),ne=g.setPlacementState;zF(()=>(ne(A),()=>{ne(void 0)}),[A,ne]);let[N,P]=vV(A),re=uI(m);zF(()=>{j&&re?.()},[j,re]);let ie=M.arrow?.x,ae=M.arrow?.y,F=M.arrow?.centerOffset!==0,[I,L]=R.useState();return zF(()=>{_&&L(window.getComputedStyle(_).zIndex)},[_]),(0,z.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:j?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:I,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(` `),...M.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,z.jsx)(pV,{scope:n,placedSide:N,placedAlign:P,onArrowChange:x,arrowX:ie,arrowY:ae,shouldHideArrow:F,children:(0,z.jsx)(oI.div,{"data-side":N,"data-align":P,...h,ref:y,style:{...h.style,animation:j?h.style?.animation:`none`}})})})},`PopperContent`));function gV(e){return e!==null}rV(gV,`isNotNull`);var _V=rV(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=vV(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function vV(e){let[t,n=`center`]=e.split(`-`);return[t,n]}rV(vV,`getSideAndAlignFromPlacement`);var yV=lV,bV=dV,xV=hV,SV=Object.defineProperty,CV=(e,t)=>SV(e,`name`,{value:t,configurable:!0}),wV=!1;function TV(){let[e,t]=R.useState(wV);return R.useEffect(()=>{wV||(wV=!0,t(!0))},[]),e}CV(TV,`useIsHydrated`);var EV=R.useSyncExternalStore;function DV(){return()=>{}}CV(DV,`subscribe`);function OV(){return EV(DV,()=>!0,()=>!1)}CV(OV,`useIsHydratedModern`);var kV=typeof EV==`function`?OV:TV,AV=Object.defineProperty,jV=(e,t)=>AV(e,`name`,{value:t,configurable:!0}),MV=`rovingFocusGroup.onEntryFocus`,NV={bubbles:!1,cancelable:!0},PV=`RovingFocusGroup`,[FV,IV,LV]=RB(PV),[RV,zV]=kF(PV,[LV]),[BV,VV]=RV(PV),HV=R.forwardRef(jV(function(e,t){return(0,z.jsx)(FV.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,z.jsx)(FV.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,z.jsx)(UV,{...e,ref:t})})})},`RovingFocusGroup`)),UV=R.forwardRef(jV(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=R.useRef(null),p=tp(t,f),m=QB(a),[h,g]=$F({prop:o,defaultProp:s??null,onChange:c,caller:PV}),[_,v]=R.useState(!1),y=uI(l),b=IV(n),x=R.useRef(!1),[S,C]=R.useState(0);return R.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(MV,y),()=>e.removeEventListener(MV,y)},[y]),(0,z.jsx)(BV,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:R.useCallback(e=>g(e),[g]),onItemShiftTab:R.useCallback(()=>v(!0),[]),onFocusableItemAdd:R.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:R.useCallback(()=>C(e=>e-1),[]),children:(0,z.jsx)(oI.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:PF(e.onMouseDown,()=>{x.current=!0}),onFocus:PF(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(MV,NV);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);YV([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:PF(e.onBlur,()=>v(!1))})})},`RovingFocusGroupImpl`)),WV=`RovingFocusGroupItem`,GV=R.forwardRef(jV(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=WF(),l=a||c,u=VV(WV,n),d=u.currentTabStopId===l,f=IV(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=kV();return zF(()=>{if(!(!g||!r))return p(),()=>m()},[g,r,p,m]),R.useEffect(()=>{if(!(g||!r))return p(),()=>m()},[g,r,p,m]),(0,z.jsx)(FV.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,z.jsx)(oI.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:PF(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:PF(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:PF(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=JV(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?XV(n,r+1):n.slice(r+1)}setTimeout(()=>YV(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),KV={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function qV(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}jV(qV,`getDirectionAwareKey`);function JV(e,t,n){let r=qV(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return KV[r]}jV(JV,`getFocusIntent`);function YV(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}jV(YV,`focusFirst`);function XV(e,t){return e.map((n,r)=>e[(t+r)%e.length])}jV(XV,`wrapArray`);var ZV=HV,QV=GV,$V=Object.defineProperty,eH=(e,t)=>$V(e,`name`,{value:t,configurable:!0}),tH=[`Enter`,` `],nH=[`ArrowDown`,`PageUp`,`Home`],rH=[`ArrowUp`,`PageDown`,`End`],iH=[...nH,...rH];[...tH],[...tH];var aH=`Menu`,[oH,sH,cH]=RB(aH),[lH,uH]=kF(aH,[cH,oV,zV]),dH=oV(),fH=zV(),[pH,mH]=lH(aH),[hH,gH]=lH(aH),_H=eH(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=dH(t),[c,l]=R.useState(null),u=R.useRef(!1),d=uI(a),f=QB(i);return R.useEffect(()=>{let e=eH(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=eH(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),R.useEffect(()=>{if(!n)return;let e=eH(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,z.jsx)(yV,{...s,children:(0,z.jsx)(pH,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,z.jsx)(hH,{scope:t,onClose:R.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),vH=R.forwardRef(eH(function(e,t){let{__scopeMenu:n,...r}=e,i=dH(n);return(0,z.jsx)(bV,{...i,...r,ref:t})},`MenuAnchor`)),yH=`MenuPortal`,[bH,xH]=lH(yH,{forceMount:void 0}),SH=eH(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=mH(yH,t);return(0,z.jsx)(bH,{scope:t,forceMount:n,children:(0,z.jsx)(qI,{present:n||a.open,children:(0,z.jsx)(UI,{asChild:!0,container:i,children:r})})})},`MenuPortal`),CH=`MenuContent`,[wH,TH]=lH(CH),EH=R.forwardRef(eH(function(e,t){let n=xH(CH,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=mH(CH,e.__scopeMenu),o=gH(CH,e.__scopeMenu);return(0,z.jsx)(oH.Provider,{scope:e.__scopeMenu,children:(0,z.jsx)(qI,{present:r||a.open,children:(0,z.jsx)(oH.Slot,{scope:e.__scopeMenu,children:o.modal?(0,z.jsx)(DH,{...i,ref:t}):(0,z.jsx)(OH,{...i,ref:t})})})})},`MenuContent`)),DH=R.forwardRef(eH(function(e,t){let n=mH(CH,e.__scopeMenu),r=R.useRef(null),i=tp(t,r);return R.useEffect(()=>{let e=r.current;if(e)return tm(e)},[]),(0,z.jsx)(AH,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:PF(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),OH=R.forwardRef(eH(function(e,t){let n=mH(CH,e.__scopeMenu);return(0,z.jsx)(AH,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),kH=ip(`MenuContent.ScrollLock`),AH=R.forwardRef(eH(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=mH(CH,n),_=gH(CH,n),v=dH(n),y=fH(n),b=sH(n),[x,S]=R.useState(null),C=R.useRef(null),w=tp(t,C,g.onContentChange),T=R.useRef(0),E=R.useRef(``),D=R.useRef(0),O=R.useRef(null),k=R.useRef(`right`),ee=R.useRef(0),te=m?uh:R.Fragment,A=m?{as:kH,allowPinchZoom:!0}:void 0,j=eH(e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=qH(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;eH((function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);R.useEffect(()=>()=>window.clearTimeout(T.current),[]),iL();let M=R.useCallback(e=>k.current===O.current?.side&&YH(e,O.current?.area),[]);return(0,z.jsx)(wH,{scope:n,searchRef:E,onItemEnter:R.useCallback(e=>{M(e)&&e.preventDefault()},[M]),onItemLeave:R.useCallback(e=>{M(e)||(C.current?.focus(),S(null))},[M]),onTriggerLeave:R.useCallback(e=>{M(e)&&e.preventDefault()},[M]),pointerGraceTimerRef:D,onPointerGraceIntentChange:R.useCallback(e=>{O.current=e},[]),children:(0,z.jsx)(te,{...A,children:(0,z.jsx)(AI,{asChild:!0,trapped:i,onMountAutoFocus:PF(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,z.jsx)(vI,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,z.jsx)(ZV,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:PF(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,z.jsx)(xV,{role:`menu`,"aria-orientation":`vertical`,"data-state":HH(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:PF(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&j(e.key));let i=C.current;if(e.target!==i||!iH.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);rH.includes(e.key)&&a.reverse(),GH(a)}),onBlur:PF(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:PF(e.onPointerMove,XH(e=>{let t=e.target,n=ee.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>ee.current?`right`:`left`;k.current=t,ee.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),jH=R.forwardRef(eH(function(e,t){let{__scopeMenu:n,...r}=e;return(0,z.jsx)(oI.div,{role:`group`,...r,ref:t})},`MenuGroup`)),MH=`MenuItem`,NH=`menu.itemSelect`,PH=R.forwardRef(eH(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=R.useRef(null),o=gH(MH,e.__scopeMenu),s=TH(MH,e.__scopeMenu),c=tp(t,a),l=R.useRef(!1),u=eH(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(NH,{bubbles:!0,cancelable:!0});e.addEventListener(NH,e=>r?.(e),{once:!0}),sI(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,z.jsx)(FH,{...i,ref:c,disabled:n,onClick:PF(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:PF(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:PF(e.onKeyDown,e=>{n||e.target!==e.currentTarget||s.searchRef.current!==``&&e.key===` `||tH.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),FH=R.forwardRef(eH(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=TH(MH,n),s=fH(n),c=R.useRef(null),l=tp(t,c),[u,d]=R.useState(!1),[f,p]=R.useState(``);return R.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,z.jsx)(oH.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,z.jsx)(QV,{asChild:!0,...s,focusable:!r,children:(0,z.jsx)(oI.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:PF(e.onPointerMove,XH(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:PF(e.onPointerLeave,XH(e=>o.onItemLeave(e))),onFocus:PF(e.onFocus,()=>d(!0)),onBlur:PF(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[IH,LH]=lH(`MenuRadioGroup`,{value:void 0,onValueChange:eH(()=>{},`onValueChange`)}),[RH,zH]=lH(`MenuItemIndicator`,{checked:!1}),[BH,VH]=lH(`MenuSub`);function HH(e){return e?`open`:`closed`}eH(HH,`getOpenState`);function UH(e){return e===`indeterminate`}eH(UH,`isIndeterminate`);function WH(e){return UH(e)?`indeterminate`:e?`checked`:`unchecked`}eH(WH,`getCheckedState`);function GH(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}eH(GH,`focusFirst`);function KH(e,t){return e.map((n,r)=>e[(t+r)%e.length])}eH(KH,`wrapArray`);function qH(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=KH(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}eH(qH,`getNextMatch`);function JH(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}eH(JH,`isPointInPolygon`);function YH(e,t){return t?JH({x:e.clientX,y:e.clientY},t):!1}eH(YH,`isPointerInGraceArea`);function XH(e){return t=>t.pointerType===`mouse`?e(t):void 0}eH(XH,`whenMouse`);var ZH=_H,QH=vH,$H=SH,eU=EH,tU=jH,nU=PH,rU=Object.defineProperty,iU=(e,t)=>rU(e,`name`,{value:t,configurable:!0}),aU=`ContextMenu`,[oU,sU]=kF(aU,[uH]),cU=uH(),[lU,uU]=oU(aU),dU=iU(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=R.useRef(!1),[c,l]=$F({prop:i,defaultProp:!1,onChange:r,caller:aU}),u=cU(t);return(0,z.jsx)(lU,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,z.jsx)(ZH,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})},`ContextMenu`),fU=`ContextMenuTrigger`,pU=R.forwardRef(iU(function(e,t){let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=uU(fU,n),o=cU(n),[s,c]=R.useState({x:0,y:0}),l=R.useMemo(()=>({current:{getBoundingClientRect:iU(()=>DOMRect.fromRect({width:0,height:0,...s}),`getBoundingClientRect`)}}),[s]),u=R.useRef(0),d=R.useCallback(()=>window.clearTimeout(u.current),[]),f=iU(e=>{a.hasInteractedRef.current=!0,c({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)},`handleOpen`);return R.useEffect(()=>d,[d]),R.useEffect(()=>void(r&&d()),[r,d]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(QH,{...o,virtualRef:l}),(0,z.jsx)(oI.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:PF(e.onContextMenu,e=>{d(),f(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:PF(e.onPointerDown,yU(e=>{d(),a.open&&a.onOpenChange(!1),u.current=window.setTimeout(()=>f(e),700)})),onPointerMove:r?e.onPointerMove:PF(e.onPointerMove,yU(d)),onPointerCancel:r?e.onPointerCancel:PF(e.onPointerCancel,yU(d)),onPointerUp:r?e.onPointerUp:PF(e.onPointerUp,yU(d))})]})},`ContextMenuTrigger`)),mU=iU(e=>{let{__scopeContextMenu:t,...n}=e,r=cU(t);return(0,z.jsx)($H,{...r,...n})},`ContextMenuPortal`),hU=`ContextMenuContent`,gU=R.forwardRef(iU(function(e,t){let{__scopeContextMenu:n,...r}=e,i=uU(hU,n),a=cU(n),o=R.useRef(!1);return(0,z.jsx)(eU,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuContent`)),_U=R.forwardRef(iU(function(e,t){let{__scopeContextMenu:n,...r}=e,i=cU(n);return(0,z.jsx)(tU,{...i,...r,ref:t})},`ContextMenuGroup`)),vU=R.forwardRef(iU(function(e,t){let{__scopeContextMenu:n,...r}=e,i=cU(n);return(0,z.jsx)(nU,{...i,...r,ref:t})},`ContextMenuItem`));function yU(e){return t=>t.pointerType===`mouse`?void 0:e(t)}iU(yU,`whenTouchOrPen`);var bU=dU,xU=pU,SU=mU,CU=gU,wU=_U,TU=vU;function EU(e){return(0,z.jsx)(bU,{...e})}function DU(e){return(0,z.jsx)(xU,{...e})}function OU({className:e,...t}){return(0,z.jsx)(SU,{children:(0,z.jsx)(CU,{className:W(`z-100 min-w-44 max-w-[calc(100vw-1rem)] rounded-md bg-zinc-900 p-1 text-zinc-200 shadow-xl ring-1 ring-white/10 outline-none`,e),...t})})}function kU(e){return(0,z.jsx)(wU,{...e})}function AU({className:e,variant:t=`default`,...n}){return(0,z.jsx)(TU,{"data-variant":t,className:W(`relative flex min-h-8 cursor-default items-center gap-1.5 rounded-sm px-2 py-1.5 text-sm outline-none select-none [&_svg]:size-3.5 [&_svg]:shrink-0 data-[disabled]:pointer-events-none data-[disabled]:opacity-45 data-[highlighted]:bg-white/7 data-[highlighted]:text-zinc-50 data-[variant=destructive]:text-rose-300`,e),...n})}function jU({name:e,title:t,icon:n,status:r,selected:i=!1,pending:a=!1,busy:o=!1,id:s,className:c,ariaLabel:l,onClick:u}){let d=W(`worktree-row flex h-auto min-h-11 w-full min-w-0 items-center justify-start gap-1.5 rounded-md px-2 py-1.5 text-left text-base/5 font-medium min-[701px]:min-h-8 min-[701px]:py-0.5 min-[701px]:text-sm/5`,a?`text-zinc-300`:i?`selected text-zinc-50 min-[701px]:bg-white/8!`:`text-zinc-300 hover:bg-white/5 hover:text-zinc-50`,`max-[700px]:flex-1 max-[700px]:hover:bg-transparent`,(a||o)&&`motion-safe:animate-pulse`,a&&`pointer-events-none`,c),f=(0,z.jsxs)(z.Fragment,{children:[n,(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,z.jsx)(`span`,{className:`truncate`,children:e}),r]})]});return(0,z.jsx)(fB,{asChild:!0,isActive:i,children:(0,z.jsx)(G,{id:s,variant:`ghost`,type:`button`,className:d,onClick:a?void 0:u,title:t,role:a?`status`:void 0,"aria-label":a?`Creating worktree ${e}`:l,"aria-live":a||l?`polite`:void 0,"aria-disabled":a||void 0,tabIndex:a?-1:void 0,children:f})})}function MU({projects:e,projectsPending:t,projectsError:n,projectsLoaded:r,activeProject:i,selectedWorktree:a,selectedTerminalId:o,selectedPendingTerminalId:s,selectedWebPanelId:c,webPanelRuntimeTitles:l,pendingTerminals:u,pendingWorktrees:d,pendingRemovals:f,onRetryProjects:p,onSelectTerminal:m,onSelectPendingTerminal:h,onCloseTerminal:g,onSelectWebPanel:_,onCloseWebPanel:v,onSelectWorktree:y,onPrepareRemoval:b,onOpenPanelDialog:x,onOpenWorktreeDialog:S}){let{attention:C,titles:w,programs:T,progress:E}=$P(),D=window.treeportDesktop,O=D?D.platform===`darwin`?`⌘N`:`Ctrl+N`:null,k=D?D.platform===`darwin`?`⌘⇧T`:`Ctrl+Shift+T`:null;return(0,z.jsxs)(`nav`,{className:`tree min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-2 pt-3 pb-5 min-[701px]:px-1.5 min-[701px]:pt-2 min-[701px]:pb-4 [scrollbar-color:var(--color-zinc-700)_transparent]`,"aria-label":`Projects and worktrees`,children:[t?(0,z.jsx)(`p`,{className:`sidebar-note px-2 py-3 text-base text-zinc-500 min-[701px]:text-sm`,children:`Loading repositories…`}):null,n&&!r?(0,z.jsxs)(`div`,{className:`flex flex-col items-start gap-2 px-2 py-3`,children:[(0,z.jsx)(`p`,{className:`sidebar-note text-base text-rose-300 min-[701px]:text-sm`,children:`Projects could not be loaded.`}),(0,z.jsx)(G,{type:`button`,variant:`secondary`,size:`sm`,onClick:p,children:`Retry`})]}):null,!t&&!n&&!e.length?(0,z.jsx)(`p`,{className:`sidebar-note px-2 py-3 text-base text-pretty text-zinc-500 min-[701px]:text-sm`,children:`Open a Git repository to begin.`}):null,(0,z.jsx)(`div`,{className:`grid gap-4`,children:e.filter(e=>e.id===i?.id).map(e=>(0,z.jsxs)(`div`,{className:`project-tree min-w-0`,children:[e.availability.state===`unavailable`?(0,z.jsx)(`p`,{className:`mx-1 mb-2 rounded-md bg-amber-400/8 px-2 py-1.5 text-sm text-amber-200`,role:`status`,children:e.availability.message||`Git repository unavailable`}):null,(0,z.jsxs)(lB,{className:`gap-2 min-[701px]:gap-1`,children:[e.worktrees.map(t=>(0,z.jsxs)(uB,{className:`group/worktree min-w-0`,children:[(0,z.jsxs)(EU,{children:[(0,z.jsx)(DU,{asChild:!0,disabled:t.kind!==`linked`,children:(0,z.jsxs)(`div`,{className:W(`relative min-w-0 max-[700px]:flex max-[700px]:items-center max-[700px]:gap-0.5 max-[700px]:rounded-md max-[700px]:has-[button:hover]:bg-white/5`,a?.id===t.id&&`max-[700px]:bg-white/8`),children:[(0,z.jsx)(jU,{id:`worktree-${t.id}`,name:t.name,title:`${t.path}${t.branch?` · ${t.branch}`:` · detached at ${t.head.slice(0,8)}`}`,selected:a?.id===t.id,className:W(a?.id===t.id&&`min-[701px]:pr-6`),busy:!!f[t.id],ariaLabel:f[t.id]===`checking`?`${t.name}, preparing removal`:f[t.id]?`${t.name}, removing`:void 0,onClick:()=>y(t),icon:f[t.id]?(0,z.jsx)(Jf,{className:`worktree-progress-icon worktree-removing-icon size-4 shrink-0 stroke-rose-400 stroke-[1.5] min-[701px]:size-3.5!`,"aria-hidden":`true`}):t.kind===`main`?(0,z.jsx)(qf,{className:`size-4 shrink-0 stroke-zinc-600 stroke-[1.5] min-[701px]:size-3.5!`,"aria-hidden":`true`}):(0,z.jsx)(Jf,{className:`shrink-0 stroke-zinc-600 stroke-[1.5] min-[701px]:size-3.5!`,"aria-hidden":`true`})}),a?.id===t.id?(0,z.jsx)(`div`,{className:`worktree-actions absolute inset-y-0 right-0 z-10 flex items-center max-[700px]:static max-[700px]:shrink-0`,children:(0,z.jsx)(yB,{label:`New panel in ${t.name}`,tooltip:`New panel in ${t.name}${k?` — ${k}`:``}`,...k?{keyShortcuts:D?.platform===`darwin`?`Meta+Shift+T`:`Control+Shift+T`}:{},className:`text-zinc-500 hover:bg-transparent hover:text-zinc-100 min-[701px]:size-6`,onClick:n=>x(e,t,n),children:(0,z.jsx)(ez,{})})}):null]})}),t.kind===`linked`?(0,z.jsx)(OU,{children:(0,z.jsx)(kU,{children:(0,z.jsxs)(AU,{variant:`destructive`,disabled:e.availability.state===`unavailable`||!!f[t.id],onSelect:()=>void b(t,document.getElementById(`worktree-${t.id}`)),children:[(0,z.jsx)(nz,{}),e.availability.state===`unavailable`?`Git repository unavailable`:f[t.id]?`Removal in progress`:`Remove worktree…`]})})}):null]}),(0,z.jsxs)(gB,{className:`terminal-list mr-0 ml-4 gap-px border-white/6 pr-0 pl-2 min-[701px]:ml-2.5 min-[701px]:pl-1.5`,"aria-label":`${t.name} terminals`,children:[t.terminals.map((e,n)=>{let r=w.get(e.id)||e.name,i=C.has(e.id),s=E.get(e.id),c=!!s&&!i&&s.state!==`paused`&&s.state!==`error`,l=[s?Qh(s):e.status,i?`bell`:null].filter(Boolean).join(`, `),u=a?.id===t.id&&n<9?n+1:null;return(0,z.jsxs)(_B,{className:`group/terminal relative min-w-0`,children:[(0,z.jsx)(vB,{asChild:!0,isActive:o===e.id,children:(0,z.jsxs)(G,{variant:`ghost`,type:`button`,className:W(`terminal-row grid h-auto min-h-11 w-full min-w-0 grid-cols-[1.25rem_minmax(0,1fr)_2rem] gap-1.5 rounded-md px-2 py-1.5 text-left text-base/5 font-normal min-[701px]:min-h-7 min-[701px]:grid-cols-[1rem_minmax(0,1fr)_1.75rem] min-[701px]:gap-1 min-[701px]:py-0 min-[701px]:text-xs/4`,o===e.id?`selected bg-cyan-400/8! text-cyan-50`:`text-zinc-300 hover:bg-white/5 hover:text-zinc-100`),onClick:()=>m(e),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&(t.preventDefault(),g(e))},"aria-label":`${r}, ${l}`,"aria-keyshortcuts":u?`Meta+${u}`:void 0,children:[(0,z.jsx)(xz,{program:T.get(e.id)??null,progress:s??null,attention:i,exited:e.status===`exited`,className:`size-4! min-[701px]:size-3.5!`}),(0,z.jsx)(`span`,{className:W(`truncate`,c&&`text-cyan-300`,i&&`text-amber-200`),"aria-hidden":`true`,children:r}),u?(0,z.jsxs)(`kbd`,{className:`justify-self-end font-sans text-[0.6875rem] font-normal text-zinc-500 tabular-nums group-hover/terminal:opacity-0 group-focus-within/terminal:opacity-0 max-[700px]:opacity-0`,"aria-hidden":`true`,children:[`⌘`,u]}):(0,z.jsx)(`span`,{"aria-hidden":`true`})]})}),(0,z.jsx)(`div`,{className:`absolute inset-y-0 right-0 z-10 flex items-center opacity-0 group-hover/terminal:opacity-100 group-focus-within/terminal:opacity-100 max-[700px]:opacity-100`,children:(0,z.jsx)(yB,{label:`Close ${r}`,tooltip:t.terminals.length===1?`Every worktree keeps at least one terminal`:`Close terminal`,disabled:t.terminals.length===1,className:`text-zinc-500 hover:bg-transparent hover:text-zinc-200`,onClick:()=>g(e),children:(0,z.jsx)(oz,{})})})]},e.id)}),t.panels.filter(e=>e.kind===`web`).map((e,n)=>{let r=l[e.id]??e.title,i=a?.id===t.id&&t.terminals.length+n<9?t.terminals.length+n+1:null;return(0,z.jsxs)(_B,{className:`group/terminal relative min-w-0`,children:[(0,z.jsx)(vB,{asChild:!0,isActive:c===e.id,children:(0,z.jsxs)(G,{variant:`ghost`,type:`button`,className:W(`terminal-row grid h-auto min-h-11 w-full min-w-0 grid-cols-[1.25rem_minmax(0,1fr)_2rem] gap-1.5 rounded-md px-2 py-1.5 text-left text-base/5 font-normal min-[701px]:min-h-7 min-[701px]:grid-cols-[1rem_minmax(0,1fr)_1.75rem] min-[701px]:gap-1 min-[701px]:py-0 min-[701px]:text-xs/4`,c===e.id?`selected bg-cyan-400/8! text-cyan-50`:`text-zinc-300 hover:bg-white/5 hover:text-zinc-100`),onClick:()=>_(e),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&(t.preventDefault(),v(e,t.currentTarget))},"aria-label":`${r}, web panel`,"aria-keyshortcuts":i?`Meta+${i}`:void 0,children:[(0,z.jsx)(iz,{className:`size-4! shrink-0 fill-zinc-500 min-[701px]:size-3.5!`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`truncate`,"aria-hidden":`true`,children:r}),i?(0,z.jsxs)(`kbd`,{className:`justify-self-end font-sans text-[0.6875rem] font-normal text-zinc-500 tabular-nums group-hover/terminal:opacity-0 group-focus-within/terminal:opacity-0 max-[700px]:opacity-0`,"aria-hidden":`true`,children:[`⌘`,i]}):(0,z.jsx)(`span`,{"aria-hidden":`true`})]})}),(0,z.jsx)(`div`,{className:`absolute inset-y-0 right-0 z-10 flex items-center opacity-0 group-hover/terminal:opacity-100 group-focus-within/terminal:opacity-100 max-[700px]:opacity-100`,children:(0,z.jsx)(yB,{label:`Close ${r}`,tooltip:`Close web panel`,className:`text-zinc-500 hover:bg-transparent hover:text-zinc-200`,onClick:t=>v(e,t),children:(0,z.jsx)(oz,{})})})]},e.id)}),u.filter(e=>e.worktreeId===t.id).map((e,n)=>{let r=t.panels.filter(e=>e.kind===`web`).length,i=t.terminals.length+r+n;return(0,z.jsx)(_B,{className:`min-w-0`,children:(0,z.jsx)(vB,{asChild:!0,isActive:s===e.id,children:(0,z.jsxs)(G,{variant:`ghost`,type:`button`,className:W(`terminal-row grid h-auto min-h-11 w-full min-w-0 grid-cols-[1.25rem_minmax(0,1fr)_auto] gap-1.5 rounded-md px-2 py-1.5 text-left text-base/5 font-normal min-[701px]:min-h-7 min-[701px]:grid-cols-[1rem_minmax(0,1fr)_auto] min-[701px]:gap-1 min-[701px]:py-0 min-[701px]:text-xs/4`,s===e.id?`selected bg-cyan-400/8! text-cyan-50`:`text-zinc-300 hover:bg-white/5 hover:text-zinc-100`),onClick:()=>h(e.id),"aria-label":`${e.name}, starting`,"aria-keyshortcuts":a?.id===t.id&&i<9?`Meta+${i+1}`:void 0,children:[(0,z.jsx)(OR,{className:`animate-spin fill-zinc-500`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`truncate`,"aria-hidden":`true`,children:e.name}),(0,z.jsx)(`span`,{className:`text-[0.6875rem] text-zinc-500`,"aria-hidden":`true`,children:`Starting…`})]})})},e.id)})]})]},t.id)),a?null:(0,z.jsx)(uB,{className:`min-w-0`,children:(0,z.jsx)(fB,{asChild:!0,children:(0,z.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-auto min-h-11 w-full justify-start gap-1.5 px-2 py-1.5 text-base/5 font-normal text-zinc-500 hover:bg-white/5 hover:text-zinc-100 min-[701px]:min-h-8 min-[701px]:py-0.5 min-[701px]:text-sm/5`,"aria-label":`New panel`,onClick:t=>x(e,null,t.currentTarget),children:[(0,z.jsx)(ez,{className:`min-[701px]:size-3.5!`}),(0,z.jsx)(`span`,{children:`New panel`})]})})}),d.filter(t=>t.projectId===e.id).map(e=>(0,z.jsx)(uB,{className:`min-w-0`,children:(0,z.jsx)(jU,{id:`pending-worktree-${e.id}`,name:e.typedName,title:`Creating ${e.typedName}`,pending:!0,icon:(0,z.jsx)(Jf,{className:`worktree-progress-icon size-4 shrink-0 stroke-cyan-400 stroke-[1.5] min-[701px]:size-3.5!`,"aria-hidden":`true`})})},e.id)),(0,z.jsx)(uB,{className:`min-w-0`,children:(0,z.jsx)(fB,{asChild:!0,children:(0,z.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-auto min-h-11 w-full justify-start gap-1.5 px-2 py-1.5 text-base/5 font-normal text-zinc-500 hover:bg-white/5 hover:text-zinc-100 min-[701px]:min-h-8 min-[701px]:py-0.5 min-[701px]:text-sm/5`,disabled:e.availability.state===`unavailable`,"aria-keyshortcuts":O?D?.platform===`darwin`?`Meta+N`:`Control+N`:void 0,title:O?`New worktree — ${O}`:void 0,onClick:t=>S(e,t.currentTarget),children:[(0,z.jsx)(ez,{className:`min-[701px]:size-3.5!`}),(0,z.jsx)(`span`,{children:`New worktree`}),O?(0,z.jsx)(`kbd`,{className:`ml-auto font-sans text-[0.6875rem] text-zinc-500`,"aria-hidden":`true`,children:O}):null]})})})]})]},e.id))})]})}function NU(e){let t=[],n=``,r=null,i=!1;for(let a=0;a<e.length;a+=1){let o=e[a];if(r===`single`){o===`'`?r=null:n+=o;continue}if(r===`double`){if(o===`"`)r=null;else if(o===`\\`){if(a+=1,a>=e.length)return{argv:null,error:`The command ends with an incomplete escape.`};n+=e[a]}else n+=o;continue}if(/\s/.test(o)){i&&=(t.push(n),n=``,!1);continue}if(i=!0,o===`'`)r=`single`;else if(o===`"`)r=`double`;else if(o===`\\`){if(a+=1,a>=e.length)return{argv:null,error:`The command ends with an incomplete escape.`};n+=e[a]}else n+=o}return r?{argv:null,error:`The command has an unclosed quote.`}:(i&&t.push(n),t.length===0?{argv:null,error:`Enter a command.`}:{argv:t,error:null})}function PU(e){return e.map(e=>e===``?`""`:/[\s"'\\]/.test(e)?`"${e.replace(/["\\]/g,`\\$&`)}"`:e).join(` `)}var FU=Object.defineProperty,IU=(e,t)=>FU(e,`name`,{value:t,configurable:!0}),LU=`Checkbox`,[RU,zU]=kF(LU),[BU,VU]=RU(LU);function HU(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=$F({prop:n,defaultProp:i??!1,onChange:c,caller:LU}),[m,h]=R.useState(null),[g,_]=R.useState(null),v=R.useRef(!1),[y,b]=R.useReducer(e=>e+1,0),x=!m||!!o||!!m.closest(`form`),S={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:y,onUserInteraction:b,required:l,defaultChecked:!ZU(i)&&i,isFormControl:x,bubbleInput:g,setBubbleInput:_};return(0,z.jsx)(BU,{scope:t,...S,children:XU(d)?d(S):r})}IU(HU,`CheckboxProvider`);var UU=`CheckboxTrigger`,WU=R.forwardRef(IU(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=VU(UU,e),g=tp(i,u),_=R.useRef(c);return R.useEffect(()=>{let e=a?.form;if(e){let t=IU(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,z.jsx)(oI.button,{type:`button`,role:`checkbox`,"aria-checked":ZU(c)?`mixed`:c,"aria-required":l,"data-state":QU(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:PF(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:PF(n,e=>{p(),d(e=>ZU(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),GU=R.forwardRef(IU(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,z.jsx)(HU,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(WU,{...d,ref:t,__scopeCheckbox:n}),e&&(0,z.jsx)(YU,{__scopeCheckbox:n})]})})},`Checkbox`)),KU=`CheckboxIndicator`,qU=R.forwardRef(IU(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=VU(KU,n);return(0,z.jsx)(qI,{present:r||ZU(a.checked)||a.checked===!0,children:(0,z.jsx)(oI.span,{"data-state":QU(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),JU=`CheckboxBubbleInput`,YU=R.forwardRef(IU(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=VU(JU,e),g=tp(r,h),_=tV(i),v=R.useRef(!1),y=R.useRef(s),b=R.useRef(o);R.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==b.current;b.current=o;let i=y.current!==s;y.current=s;let c=!(r&&a.current);if(i&&n){v.current=!r;let t=new Event(`click`,{bubbles:c});e.indeterminate=ZU(s),n.call(e,!ZU(s)&&s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let x=R.useRef(!ZU(s)&&s);return(0,z.jsx)(oI.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??x.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:PF(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function XU(e){return typeof e==`function`}IU(XU,`isFunction`);function ZU(e){return e===`indeterminate`}IU(ZU,`isIndeterminate`);function QU(e){return ZU(e)?`indeterminate`:e?`checked`:`unchecked`}IU(QU,`getState`);var $U=R.forwardRef(({className:e,...t},n)=>(0,z.jsx)(GU,{ref:n,className:W(`peer grid size-4 shrink-0 place-content-center rounded-sm border border-white/20 bg-zinc-950 text-zinc-950 outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-cyan-400 data-[state=checked]:bg-cyan-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-cyan-400`,e),...t,children:(0,z.jsx)(qU,{className:`grid place-content-center text-current`,children:(0,z.jsx)(Kf,{className:`size-3.5`})})}));$U.displayName=GU.displayName;function eW({presets:e,loading:t,loadError:n,onRetry:r}){let i=Ye(),[a,o]=(0,R.useState)({editingId:null,loadedUpdatedAt:null,name:``,command:``,closeOnSuccess:!1,commandError:null,notice:null}),{editingId:s,loadedUpdatedAt:c,name:l,command:u,closeOnSuccess:d,commandError:f,notice:p}=a,m=()=>{o({editingId:null,loadedUpdatedAt:null,name:``,command:``,closeOnSuccess:!1,commandError:null,notice:null})};if(s){let t=e.find(e=>e.id===s);t?t.updatedAt!==c&&o({editingId:t.id,loadedUpdatedAt:t.updatedAt,name:t.name,command:PU([t.executable,...t.args]),closeOnSuccess:t.closeOnSuccess,commandError:null,notice:c?`This preset changed, so the latest saved values were loaded.`:p}):o({editingId:null,loadedUpdatedAt:null,name:``,command:``,closeOnSuccess:!1,commandError:null,notice:`That preset was deleted. You can create a new one.`})}let h=pt({mutationFn:({presetId:e,input:t,expectedUpdatedAt:n})=>e?Tf(CE.api[`terminal-presets`][`:presetId`].$patch({param:{presetId:e},json:{...t,expectedUpdatedAt:n}})).then(e=>e.preset):Tf(CE.api[`terminal-presets`].$post({json:t})).then(e=>e.preset),onSuccess:(e,t)=>{i.setQueryData(mz,n=>t.presetId?n?.map(t=>t.id===e.id?e:t):[...n??[],e]),o({editingId:e.id,loadedUpdatedAt:e.updatedAt,name:e.name,command:PU([e.executable,...e.args]),closeOnSuccess:e.closeOnSuccess,commandError:null,notice:`Preset saved.`})},onError:(e,{presetId:t,input:n})=>{i.invalidateQueries({queryKey:mz}),xF(e,{operation:`${t?`update`:`create`} terminal preset “${n.name}”`})},onSettled:async()=>{await Promise.all([i.invalidateQueries({queryKey:mz}),i.invalidateQueries({queryKey:[`terminal-preset-definitions`]})])}}),g=pt({mutationFn:e=>Tf(CE.api[`terminal-presets`][`:presetId`].$delete({param:{presetId:e.id},json:{expectedUpdatedAt:e.updatedAt}})),onSuccess:(e,t)=>{i.setQueryData(mz,e=>e?.filter(e=>e.id!==t.id)),s===t.id&&o({editingId:null,loadedUpdatedAt:null,name:``,command:``,closeOnSuccess:!1,commandError:null,notice:`Preset deleted.`})},onError:(e,t)=>{i.invalidateQueries({queryKey:mz}),xF(e,{operation:`delete terminal preset “${t.name}”`})},onSettled:async()=>{await Promise.all([i.invalidateQueries({queryKey:mz}),i.invalidateQueries({queryKey:[`terminal-preset-definitions`]})])}}),_=h.isPending||g.isPending;return(0,z.jsx)(z.Fragment,{children:(0,z.jsxs)(`div`,{className:`grid min-h-0 gap-5 border-t border-white/8 pt-4 md:grid-cols-[minmax(12rem,0.8fr)_minmax(0,1.35fr)]`,children:[(0,z.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-2`,"aria-labelledby":`saved-presets-title`,children:[(0,z.jsxs)(`div`,{className:`flex min-h-8 items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{id:`saved-presets-title`,className:`text-sm font-medium text-zinc-200`,children:`Presets`}),(0,z.jsxs)(G,{type:`button`,variant:`secondary`,size:`sm`,disabled:_,onClick:m,children:[(0,z.jsx)(ez,{}),` New`]})]}),(0,z.jsxs)(`div`,{className:`max-h-72 overflow-y-auto rounded-lg bg-white/3 p-1 ring-1 ring-white/8 [scrollbar-color:var(--color-zinc-700)_transparent]`,children:[(0,z.jsxs)(`div`,{className:`grid min-h-14 min-w-0 content-center gap-0.5 rounded-md px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`truncate text-sm font-medium text-zinc-100`,children:`Shell`}),(0,z.jsx)(`span`,{className:`truncate text-xs text-zinc-500`,children:`Built in · login shell`})]}),e.map(e=>(0,z.jsxs)(`div`,{className:W(`group/preset flex min-h-14 items-center rounded-md px-1 transition-colors hover:bg-white/5`,s===e.id&&`bg-white/7 hover:bg-white/7`),children:[(0,z.jsxs)(`button`,{type:`button`,className:`grid min-w-0 flex-1 cursor-pointer gap-0.5 rounded-sm px-2 py-2 text-left outline-none focus-visible:outline-2 focus-visible:outline-cyan-400`,"aria-current":s===e.id?`true`:void 0,disabled:_,onClick:()=>{o({editingId:e.id,loadedUpdatedAt:e.updatedAt,name:e.name,command:PU([e.executable,...e.args]),closeOnSuccess:e.closeOnSuccess,commandError:null,notice:null})},children:[(0,z.jsx)(`span`,{className:`truncate text-sm font-medium text-zinc-100`,children:e.name}),(0,z.jsx)(`span`,{className:`truncate text-xs text-zinc-500`,children:PU([e.executable,...e.args])})]}),(0,z.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`mr-1 size-11 shrink-0 hover:text-rose-300 min-[701px]:size-8 min-[701px]:opacity-0 min-[701px]:group-hover/preset:opacity-100 min-[701px]:focus-visible:opacity-100`,"aria-label":`Delete ${e.name}`,disabled:_,onClick:()=>{window.confirm(`Delete terminal preset “${e.name}”?`)&&g.mutate(e)},children:(0,z.jsx)(nz,{})})]},e.id)),t&&(0,z.jsx)(`p`,{className:`px-2.5 py-3 text-sm text-zinc-500`,role:`status`,children:`Loading presets…`}),n&&(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2.5 py-3`,children:[(0,z.jsx)(`p`,{className:`text-sm text-zinc-400`,children:`Could not load presets.`}),(0,z.jsx)(G,{type:`button`,variant:`secondary`,size:`sm`,onClick:r,children:`Retry`})]})]})]}),(0,z.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:e=>{e.preventDefault();let t=NU(u);if(t.argv===null){o(e=>({...e,commandError:t.error}));return}let[n,...r]=t.argv;h.mutate({presetId:s,input:{name:l,executable:n,args:r,closeOnSuccess:d},expectedUpdatedAt:c})},children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium text-zinc-200`,children:`Preset details`}),p&&(0,z.jsx)(`span`,{className:`text-xs text-zinc-400`,role:`status`,children:p})]}),(0,z.jsxs)(sz,{children:[(0,z.jsx)(lz,{htmlFor:`preset-name`,children:`Name`}),(0,z.jsx)(cz,{id:`preset-name`,name:`preset-name`,value:l,maxLength:120,disabled:_,autoFocus:!0,required:!0,onChange:e=>{o(t=>({...t,name:e.target.value,notice:null}))},placeholder:`Code review`})]}),(0,z.jsxs)(sz,{children:[(0,z.jsx)(lz,{htmlFor:`preset-command`,children:`Command`}),(0,z.jsx)(cz,{id:`preset-command`,name:`preset-command`,value:u,disabled:_,required:!0,"aria-invalid":f?!0:void 0,"aria-describedby":f?`preset-command-error`:void 0,onChange:e=>{o(t=>({...t,command:e.target.value,commandError:null,notice:null}))},placeholder:`diff main --mode split`}),f&&(0,z.jsx)(`p`,{id:`preset-command-error`,className:`text-xs text-rose-300`,role:`alert`,children:f})]}),(0,z.jsx)(sz,{children:(0,z.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,z.jsx)($U,{id:`preset-close-on-success`,checked:d,disabled:_,onCheckedChange:e=>{o(t=>({...t,closeOnSuccess:e===!0,notice:null}))}}),(0,z.jsxs)(`div`,{className:`grid gap-1`,children:[(0,z.jsx)(lz,{htmlFor:`preset-close-on-success`,children:`Close on success`}),(0,z.jsx)(`p`,{className:`form-note`,children:`Use for one-off commands such as opening an editor. Failed commands remain open for inspection.`})]})]})}),(0,z.jsx)(G,{type:`submit`,className:`self-end`,disabled:_||!l.trim()||!u.trim()||s!==null&&c===null,children:h.isPending?`Saving…`:s?`Save changes`:`Create preset`})]})]})})}function tW({open:e,onOpenChange:t,restoreFocusTo:n,presets:r,loading:i,loadError:a,onRetry:o}){return(0,z.jsx)(vR,{open:e,onOpenChange:t,children:(0,z.jsxs)(CR,{className:`max-w-3xl`,restoreFocusTo:n,children:[(0,z.jsxs)(wR,{children:[(0,z.jsx)(TR,{children:`Global terminal presets`}),(0,z.jsx)(ER,{children:`Create commands available in every repository. Arguments are passed exactly as entered.`})]}),(0,z.jsx)(eW,{presets:r,loading:i,loadError:a,onRetry:o})]})})}function nW(e){return e.source.type===`repository`?e.source.format===`zed`?`Repository · Zed`:`Repository`:e.source.type===`user`?`Global`:`${e.source.scope===`project`?`Repository`:`Global`} · ${e.source.packageId}`}function rW({open:e,onOpenChange:t,restoreFocusTo:n,worktreeName:r,presets:i,presetDiagnostics:a,presetsLoading:o,presetsError:s,webPanelDefinitions:c,webPanelDefinitionsLoading:l,webPanelDefinitionsError:u,launchDisabled:d,onCreateTerminal:f,onCreateWebPanel:p,onManagePresets:m}){let[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(0),y=h.trim().toLocaleLowerCase(),b=`shell`.includes(y),x=i.filter(e=>[e.name,e.executable,nW(e),PU([e.executable,...e.args])].some(e=>e.toLocaleLowerCase().includes(y))),S=c.filter(e=>[e.title,e.id].some(e=>e.toLocaleLowerCase().includes(y))),C=x.length+ +!!b,w=C===0&&S.length===0;return(0,z.jsx)(vR,{open:e,onOpenChange:e=>{e||(g(``),v(0)),t(e)},children:(0,z.jsxs)(CR,{className:`max-w-xl gap-0 overflow-hidden rounded-xl bg-zinc-800/95 p-0 shadow-2xl ring-white/15 backdrop-blur-2xl max-[700px]:p-0 max-[700px]:pb-0 [&>button.absolute]:hidden`,mobilePresentation:`dialog`,overlayClassName:`bg-transparent backdrop-blur-[1px]`,restoreFocusTo:n,children:[(0,z.jsx)(TR,{className:`sr-only`,children:`New panel`}),(0,z.jsxs)(ER,{className:`sr-only`,children:[`Search for a terminal or web panel to start`,r?` in ${r}`:``,`.`]}),(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 border-b border-white/8 px-4`,children:[(0,z.jsx)(QR,{className:`size-4 shrink-0 fill-zinc-400`,"aria-hidden":`true`}),(0,z.jsx)(`input`,{type:`search`,name:`panel-launcher-search`,className:`h-14 min-w-0 flex-1 bg-transparent text-base text-zinc-50 outline-none placeholder:text-zinc-500 sm:h-12 sm:text-sm`,value:h,autoComplete:`off`,autoFocus:!0,"aria-label":`Search panels`,placeholder:r?`New panel in ${r}`:`New panel`,onChange:e=>{g(e.target.value),v(0)},onKeyDown:e=>{let t=Array.from(e.currentTarget.closest(`[role="dialog"]`)?.querySelectorAll(`[data-panel-launch]:not(:disabled)`)??[]);if(t.length===0)return;if(e.key===`Enter`){e.preventDefault(),t[_]?.click();return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let n=e.key===`ArrowDown`?1:-1;v((_+n+t.length)%t.length)}}),(0,z.jsx)(`kbd`,{className:`hidden shrink-0 rounded bg-white/6 px-1.5 py-0.5 font-sans text-[0.6875rem] text-zinc-500 ring-1 ring-white/8 sm:inline`,children:`esc`})]}),(0,z.jsxs)(`div`,{className:`max-h-[min(22rem,55dvh)] overflow-y-auto p-1.5 [scrollbar-color:var(--color-zinc-600)_transparent] [&_[data-selected]]:bg-white/8`,onKeyDown:e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=Array.from(e.currentTarget.querySelectorAll(`[data-panel-launch]:not(:disabled)`)),n=t.indexOf(e.target);n<0||t.length<2||(e.preventDefault(),t[(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus())},children:[(0,z.jsxs)(`div`,{role:`group`,"aria-label":`Terminals`,children:[C>0||o||s||a.length>0?(0,z.jsx)(`p`,{className:`px-2 py-1 text-xs font-medium text-zinc-500`,children:`Terminals`}):null,b?(0,z.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-12 w-full justify-start gap-3 rounded-lg py-2 pr-3 pl-2 text-base font-normal text-zinc-100 hover:bg-white/8 focus-visible:bg-white/8 sm:h-9 sm:text-sm`,"aria-label":`Shell`,"data-panel-launch":!0,"data-selected":_===0?``:void 0,disabled:d,onFocus:()=>v(0),onMouseMove:()=>v(0),onClick:()=>{g(``),v(0),f({name:`Shell`})},children:[(0,z.jsx)(KR,{className:`size-4 shrink-0 fill-zinc-400`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:`Shell`}),(0,z.jsx)(`span`,{className:`shrink-0 text-zinc-500`,children:`Login shell`})]}):null,x.map((e,t)=>{let n=t+ +!!b,r=nW(e),i=PU([e.executable,...e.args]);return(0,z.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-12 w-full justify-start gap-3 rounded-lg py-2 pr-3 pl-2 text-base font-normal text-zinc-100 hover:bg-white/8 focus-visible:bg-white/8 sm:h-9 sm:text-sm`,"aria-label":`${e.name}, ${r}, ${i}`,"data-panel-launch":!0,"data-selected":_===n?``:void 0,disabled:d,onFocus:()=>v(n),onMouseMove:()=>v(n),onClick:()=>{g(``),v(0),f({name:e.name,argv:[e.executable,...e.args],...e.cwd?{cwd:e.cwd}:{},...Object.keys(e.env).length?{env:{...e.env}}:{},...e.closeOnSuccess?{closeOnSuccess:!0}:{returnToShell:!0}})},children:[(0,z.jsx)(KR,{className:`size-4 shrink-0 fill-zinc-400`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e.name}),(0,z.jsxs)(`span`,{className:`min-w-0 max-w-1/2 truncate text-zinc-500`,children:[r,` · `,i]})]},e.id)}),o?(0,z.jsx)(`p`,{className:`px-3 py-2 text-base text-zinc-500 sm:text-sm`,role:`status`,children:`Loading presets…`}):null,s?(0,z.jsx)(`p`,{className:`px-3 py-2 text-base text-zinc-500 sm:text-sm`,role:`status`,children:`Presets unavailable`}):null,a.map(e=>(0,z.jsx)(`p`,{className:`px-3 py-2 text-base text-amber-300 sm:text-sm`,role:`status`,children:e.message},`${e.path}:${e.itemId??`file`}:${e.message}`))]}),(0,z.jsxs)(`div`,{role:`group`,"aria-label":`Web panels`,children:[S.length>0||l||u?(0,z.jsx)(`p`,{className:`mt-1 px-2 py-1 text-xs font-medium text-zinc-500`,children:`Web panels`}):null,S.map((e,t)=>{let n=C+t;return(0,z.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-12 w-full justify-start gap-3 rounded-lg py-2 pr-3 pl-2 text-base font-normal text-zinc-100 hover:bg-white/8 focus-visible:bg-white/8 sm:h-9 sm:text-sm`,"aria-label":`${e.title}, web panel`,"data-panel-launch":!0,"data-selected":_===n?``:void 0,disabled:d,onFocus:()=>v(n),onMouseMove:()=>v(n),onClick:()=>{g(``),v(0),p(e)},children:[(0,z.jsx)(iz,{className:`size-4 shrink-0 fill-zinc-400`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e.title}),(0,z.jsx)(`span`,{className:`min-w-0 max-w-1/2 truncate text-zinc-500`,children:e.source.type===`project`?`Project`:`${e.source.scope===`project`?`Project`:`Global`} · ${e.source.packageId}`})]},e.id)}),l?(0,z.jsx)(`p`,{className:`px-3 py-2 text-base text-zinc-500 sm:text-sm`,role:`status`,children:`Loading web panels…`}):null,u?(0,z.jsx)(`p`,{className:`px-3 py-2 text-base text-zinc-500 sm:text-sm`,role:`status`,children:`Web panels unavailable`}):null]}),w&&!o&&!l?(0,z.jsx)(`p`,{className:`px-3 py-8 text-center text-base text-zinc-500 sm:text-sm`,children:`No matching panels.`}):null]}),(0,z.jsxs)(`div`,{className:`border-t border-white/8 p-1.5`,children:[(0,z.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-12 w-full justify-start gap-3 rounded-lg py-2 pr-3 pl-2 text-base font-normal text-zinc-400 hover:bg-white/8 hover:text-zinc-100 sm:h-9 sm:text-sm`,onClick:()=>{g(``),v(0),m()},children:[(0,z.jsx)(WR,{className:`size-4 shrink-0 fill-zinc-500`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Manage global presets`})]}),(0,z.jsx)(G,{asChild:!0,variant:`ghost`,className:`h-12 w-full justify-start gap-3 rounded-lg py-2 pr-3 pl-2 text-base font-normal text-zinc-400 hover:bg-white/8 hover:text-zinc-100 sm:h-9 sm:text-sm`,children:(0,z.jsxs)(`a`,{href:`https://treeport.app/features/terminal-presets/#repository-presets`,target:`_blank`,rel:`noreferrer`,children:[(0,z.jsx)(PR,{className:`size-4 shrink-0 fill-zinc-500`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Configure repository presets`})]})})]})]})})}var iW={phase:`closed`,degraded:!1,controller:!1,controlPending:!1,title:null,bellActive:!1,bellSerial:0,exitSerial:0,fileTransfer:null,hasSelection:!1,selecting:!1,viewingHistory:!1,pasteRequestSerial:0,error:null};function aW({worktree:e,terminal:t,pendingTerminals:n,selectedPendingTerminalId:r,loading:i,autoFocusBlocked:a,onStatusChange:o}){let s=(0,R.useRef)(null),c=(0,R.useRef)(null),l=(0,R.useRef)(null),[u,d]=(0,R.useState)(null),[f,p]=(0,R.useState)(!1),[m,h]=(0,R.useState)(!1),[g,_]=(0,R.useState)({terminalId:null,open:!1,value:``}),v=(0,R.useRef)(o);v.current=o;let y=Nz();(0,R.useLayoutEffect)(()=>{if(!t){d(null);return}let e=VP.acquire(t.id);return d(e),()=>VP.release(t.id)},[t?.id]);let b=u?.terminalId===t?.id?u:null,x=(0,R.useSyncExternalStore)((0,R.useCallback)(e=>{if(!b)return()=>void 0;let t=b.getSnapshot();return b.subscribe(()=>{let n=b.getSnapshot();n.pasteRequestSerial>t.pasteRequestSerial&&_(e=>({terminalId:b.terminalId,open:!0,value:e.terminalId===b.terminalId?e.value:``})),n.exitSerial>t.exitSerial&&v.current(),t=n,e()})},[b]),b?.getSnapshot??(()=>iW),()=>iW),S=g.terminalId===t?.id&&g.open,C=g.terminalId===t?.id?g.value:``,{titles:w}=$P();(0,R.useLayoutEffect)(()=>{let e=c.current;if(!(!e||!b))return b.mount(e),()=>b.unmount(e)},[b]),lf({terminalId:t?.id??null,session:b,blocked:a}),(0,R.useEffect)(()=>{if(b)return b.setInputModifiers(f,m,()=>{p(!1),h(!1)}),()=>b.setInputModifiers(!1,!1,()=>void 0)},[b,m,f]);let T=e=>{let t=e;f&&e.length===1&&(t=String.fromCharCode(e.toUpperCase().charCodeAt(0)&31)),m&&(t=`\u001b${t}`),b?.sendText(t),p(!1),h(!1)},E=e=>{b?.sendArrow(e,m),p(!1),h(!1)},D=e=>{e&&(b?.pasteText(e),_({terminalId:t?.id??null,open:!1,value:``}))},O=()=>{b?.requestControl(),_(e=>({terminalId:t?.id??null,open:!0,value:e.terminalId===t?.id?e.value:``})),navigator.clipboard&&navigator.clipboard.readText().then(e=>D(e),()=>void 0)},k=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`label`,{htmlFor:`terminal-paste-input`,className:`text-xs font-medium text-zinc-200`,children:`Paste text here`}),(0,z.jsx)(`textarea`,{id:`terminal-paste-input`,autoFocus:!0,rows:2,value:C,placeholder:`Touch and hold here, then choose Paste`,className:`min-h-16 resize-none rounded-md border border-white/10 bg-zinc-950 px-3 py-2 text-base text-zinc-100 outline-none focus:border-cyan-500`,onChange:e=>_({terminalId:t?.id??null,open:!0,value:e.target.value}),onPaste:e=>{let t=e.clipboardData.getData(`text`);t&&(e.preventDefault(),D(t))}}),(0,z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,z.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>_({terminalId:t?.id??null,open:!1,value:``}),children:`Cancel`}),(0,z.jsx)(G,{type:`button`,size:`sm`,disabled:!C,onClick:()=>D(C),children:`Send`})]})]}),ee=n.find(e=>e.id===r),te=t?w.get(t.id)||t.name:ee?.name??``;return(0,z.jsxs)(`main`,{ref:s,className:W(`terminal-shell grid min-h-0 min-w-0 grid-rows-[minmax(0,1fr)] bg-zinc-950 max-[700px]:grid-rows-[minmax(0,1fr)_3.25rem]`,x.bellActive&&`terminal-bell`),"aria-label":ee?`Starting ${ee.name} terminal`:t?`${te} terminal`:`Terminal panel`,children:[ee?(0,z.jsx)(`div`,{className:`grid min-h-0 place-items-center bg-[radial-gradient(circle_at_center,var(--color-zinc-900)_0,var(--color-zinc-950)_55%)] p-8`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-zinc-300`,role:`status`,children:[(0,z.jsx)(OR,{className:`size-4 animate-spin fill-zinc-500`,"aria-hidden":`true`}),`Starting `,ee.name,`…`]})}):t?(0,z.jsxs)(`div`,{className:`relative min-h-0 min-w-0 overflow-hidden`,children:[(0,z.jsx)(`div`,{className:`xterm-host absolute inset-0 min-h-0 min-w-0 overflow-hidden p-2.5 outline-none max-[700px]:p-1.5`,ref:c,onMouseDown:()=>b?.focus({requestControl:!0})},t.id),x.viewingHistory&&!S?(0,z.jsxs)(`div`,{className:`absolute top-3 left-1/2 z-20 flex -translate-x-1/2 items-center gap-2 rounded-full bg-zinc-900/95 py-1 pr-1 pl-3 text-xs text-zinc-300 shadow-lg ring-1 ring-amber-400/20 backdrop-blur`,children:[(0,z.jsxs)(`span`,{role:`status`,className:`whitespace-nowrap leading-tight`,children:[(0,z.jsx)(`strong`,{className:`block font-medium text-zinc-100`,children:x.hasSelection||x.selecting?`Selection is active`:`Scrolled back in tmux`}),(0,z.jsx)(`span`,{className:`block text-[0.6875rem] text-zinc-400`,children:`New output is continuing off-screen`})]}),(0,z.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 rounded-full px-2.5 text-xs text-cyan-200 hover:bg-white/8 hover:text-cyan-100`,onClick:()=>{x.hasSelection||x.selecting?b?.clearSelectionAndJumpToLatest():b?.jumpToLatest()},children:x.hasSelection||x.selecting?`Clear`:`Follow latest`})]}):null,x.phase===`ready`&&!x.controller?(0,z.jsxs)(`span`,{className:`absolute top-3 right-3 z-10 inline-flex shrink-0 items-center gap-1.5 rounded-full bg-zinc-900/90 px-2 py-1 text-[0.6875rem] font-medium text-zinc-400 shadow ring-1 ring-white/8 backdrop-blur`,title:`Interact with the terminal to control it`,children:[(0,z.jsx)(`span`,{className:W(`size-1.5 rounded-full bg-zinc-500`,x.controlPending&&`animate-pulse bg-cyan-400`),"aria-hidden":`true`}),x.controlPending?`Taking control…`:`Viewing`]}):null,S&&(y?(0,z.jsx)(vR,{open:!0,onOpenChange:e=>{e||_({terminalId:t.id,open:!1,value:``})},children:(0,z.jsxs)(CR,{className:`max-w-sm gap-3 p-4`,mobilePresentation:`dialog`,restoreFocusTo:l.current,children:[(0,z.jsxs)(wR,{children:[(0,z.jsx)(TR,{className:`text-lg sm:text-lg`,children:`Paste into terminal`}),(0,z.jsx)(ER,{className:`sr-only`,children:`Paste text and send it to the active terminal.`})]}),k]})}):(0,z.jsx)(`div`,{className:`absolute inset-x-3 bottom-3 z-20 grid gap-2 rounded-lg bg-zinc-900 p-3 shadow-xl ring-1 ring-white/15`,role:`dialog`,"aria-label":`Paste into terminal`,children:k})),x.hasSelection&&!S&&(0,z.jsxs)(`div`,{className:`terminal-selection-actions absolute right-3 bottom-3 z-10 overflow-hidden rounded-md bg-zinc-800 shadow-lg ring-1 ring-white/15 max-[700px]:bottom-2`,"aria-label":`Terminal text selection`,children:[(0,z.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`rounded-none border-r border-white/10 px-3 text-zinc-100`,onClick:()=>b?.copySelection(),children:`Copy`}),(0,z.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`rounded-none px-3 text-zinc-300`,onClick:()=>b?.clearSelection(),children:`Clear`})]}),(x.degraded||x.fileTransfer)&&(0,z.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 top-3 z-10 flex flex-col items-center gap-2`,children:[x.degraded&&(0,z.jsx)(`span`,{className:`max-w-[calc(100%-1.5rem)] rounded-full bg-zinc-900/90 px-3 py-1 text-center text-xs text-amber-200 shadow ring-1 ring-amber-400/20 backdrop-blur`,children:x.error?`${x.error} Retrying…`:`Reconnecting…`}),x.fileTransfer&&(0,z.jsx)(`span`,{className:W(`rounded-full bg-zinc-900/90 px-3 py-1 text-xs shadow ring-1 backdrop-blur`,x.fileTransfer.state===`error`?`text-rose-100 ring-rose-400/30`:`text-cyan-100 ring-cyan-400/20`),role:x.fileTransfer.state===`error`?`alert`:`status`,children:x.fileTransfer.message})]}),x.phase===`closed`&&x.error&&(0,z.jsx)(`div`,{className:`absolute inset-x-0 top-3 z-10 flex justify-center`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-full bg-rose-950/95 px-3 py-1 text-xs text-rose-100 shadow ring-1 ring-rose-400/30 backdrop-blur`,children:[(0,z.jsx)(`span`,{children:x.error}),(0,z.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs text-rose-100 hover:bg-rose-900`,onClick:()=>b?.retry(),children:`Retry`})]})}),(0,z.jsxs)(`span`,{className:`sr-only`,"aria-live":`polite`,children:[x.phase===`ready`?x.controller?`Controlling terminal`:x.controlPending?`Taking control of terminal`:`Viewing terminal`:``,x.bellActive?` Bell from ${te}`:``]})]}):i?(0,z.jsx)(`div`,{className:`grid min-h-0 place-items-center bg-[radial-gradient(circle_at_center,var(--color-zinc-900)_0,var(--color-zinc-950)_55%)] p-8`,children:(0,z.jsx)(`div`,{role:`status`,"aria-label":`Loading workspace`,children:(0,z.jsx)(OR,{className:`size-6 animate-spin fill-zinc-500`,"aria-hidden":`true`})})}):(0,z.jsx)(`div`,{className:`empty-state grid min-h-0 place-items-center bg-[radial-gradient(circle_at_center,var(--color-zinc-900)_0,var(--color-zinc-950)_55%)] p-8`,children:(0,z.jsxs)(`div`,{className:`grid max-w-lg gap-3`,children:[(0,z.jsx)(`p`,{className:`eyebrow`,children:`No terminal open`}),(0,z.jsx)(`h1`,{className:`text-balance text-2xl font-semibold tracking-tight text-zinc-50 sm:text-3xl`,children:e?`Start a terminal for this worktree.`:`Choose a worktree.`}),(0,z.jsx)(`p`,{className:`max-w-[52ch] text-base text-pretty text-zinc-400 sm:text-sm`,children:e?`Use New panel in the sidebar to start a login shell, preset, or web panel.`:`Select a worktree from the sidebar to view its terminals.`})]})}),t&&(0,z.jsxs)(`div`,{className:`accessory-row hidden min-w-0 touch-pan-x overflow-x-auto overflow-y-hidden border-t border-white/8 bg-zinc-900 pt-1 pr-[env(safe-area-inset-right)] pb-[calc(0.25rem+env(safe-area-inset-bottom))] pl-[env(safe-area-inset-left)] max-[700px]:flex [&_button]:h-11 [&_button]:min-w-11 [&_button]:grow [&_button]:rounded-none [&_button]:border-r [&_button]:border-white/8 [&_button]:text-sm [&_button:last-child]:border-r-0`,"aria-label":`Terminal accessory keys`,onPointerDownCapture:()=>b?.requestControl(),children:[(0,z.jsx)(G,{variant:`ghost`,type:`button`,onClick:()=>T(`\x1B`),children:`Esc`}),(0,z.jsx)(G,{variant:`ghost`,type:`button`,className:f?`latched bg-cyan-950 text-cyan-100`:``,"aria-pressed":f,onClick:()=>{p(e=>!e),b?.focus()},children:`Ctrl`}),(0,z.jsx)(G,{variant:`ghost`,type:`button`,className:m?`latched bg-cyan-950 text-cyan-100`:``,"aria-pressed":m,onClick:()=>{h(e=>!e),b?.focus()},children:`Alt`}),(0,z.jsx)(G,{ref:l,variant:`ghost`,type:`button`,onClick:O,children:`Paste`}),(0,z.jsx)(G,{variant:`ghost`,type:`button`,onClick:()=>T(` `),children:`Tab`}),(0,z.jsx)(G,{variant:`ghost`,type:`button`,onClick:()=>{b?.sendText(`\x1B[Z`),p(!1),h(!1)},children:`Shift+Tab`}),(0,z.jsx)(G,{variant:`ghost`,type:`button`,onClick:()=>T(`\r`),children:`Enter`}),(0,z.jsx)(G,{variant:`ghost`,type:`button`,"aria-label":`Arrow left`,onClick:()=>E(`left`),children:`←`}),(0,z.jsx)(G,{variant:`ghost`,type:`button`,"aria-label":`Arrow up`,onClick:()=>E(`up`),children:`↑`}),(0,z.jsx)(G,{variant:`ghost`,type:`button`,"aria-label":`Arrow down`,onClick:()=>E(`down`),children:`↓`}),(0,z.jsx)(G,{variant:`ghost`,type:`button`,"aria-label":`Arrow right`,onClick:()=>E(`right`),children:`→`})]})]})}function oW({projects:e,selectedWorktree:t,selectedTerminal:n}){let r=Ye(),{closeMobileWithoutFocusRestore:i}=Jz(),a=Ca(),o=yz(),s=(0,R.useRef)(new Set),c=(0,R.useRef)(0),l=(0,R.useRef)(null),u=(0,R.useRef)(a.pathname),[d,f]=(0,R.useState)([]),[p,m]=(0,R.useState)(null);u.current=a.pathname;let h=d.find(e=>e.id===p&&e.worktreeId===t?.id),g=n?.id??null,_=pt({mutationFn:({worktreeId:e,name:t,argv:n,cwd:r,env:i,returnToShell:a,closeOnSuccess:o,initialSize:s})=>Tf(CE.api.worktrees[`:worktreeId`].terminals.$post({param:{worktreeId:e},json:{name:t,...n?{argv:n}:{},...r?{cwd:r}:{},...i?{env:i}:{},...a?{returnToShell:!0}:{},...o?{closeOnSuccess:!0}:{},...s?{initialSize:s}:{}}})).then(e=>e.terminal),onSuccess:async(t,{pendingTerminal:n})=>{let i=l.current===n.id,a=i&&u.current===n.originPath;f(e=>e.filter(e=>e.id!==n.id)),i&&(l.current=null,m(null));let s=e.find(e=>e.id===n.projectId),c=s?.worktrees.find(e=>e.id===n.worktreeId);if(!s||!c){await r.invalidateQueries({queryKey:fz});return}let d=n.originPath===oF(s.id,c.id).pathname;r.setQueryData(fz,e=>e?.map(e=>({...e,worktrees:e.worktrees.map(e=>e.id===c.id?{...e,terminals:[...e.terminals.filter(e=>e.id!==t.id),t]}:e)}))),a&&await o(sF(s.id,c.id,t.id),d),await r.invalidateQueries({queryKey:fz})},onError:async(e,{pendingTerminal:t})=>{f(e=>e.filter(e=>e.id!==t.id)),l.current===t.id&&(l.current=null,m(null)),xF(e,{operation:`create terminal “${t.name}”`}),await r.invalidateQueries({queryKey:fz})}}),v=pt({mutationFn:({terminal:e})=>Tf(CE.api.terminals[`:terminalId`].$delete({param:{terminalId:e.id}})),onSuccess:async()=>{await r.invalidateQueries({queryKey:fz})},onError:(e,t)=>{r.setQueryData(fz,e=>e?.map(e=>({...e,worktrees:e.worktrees.map(e=>{if(e.id!==t.terminal.worktreeId||e.terminals.some(e=>e.id===t.terminal.id))return e;let n=[...e.terminals];return n.splice(t.index,0,t.terminal),{...e,terminals:n}})}))),xF(e,{operation:`close terminal “${t.terminal.name}”`})},onSettled:(e,t,n)=>{s.current.delete(n.terminal.id)}});return{pendingTerminals:d,selectedPendingTerminal:h,createTerminalInWorktree:(t,r,o)=>{let s=e.find(e=>e.id===t.id),u=s?.worktrees.find(e=>e.id===r.id);if(!s||!u||s.availability.state===`unavailable`||u.prunable)return;let d=n?.worktreeId===u.id?VP.getInitialSize(n.id):null,p={id:`pending-terminal-${++c.current}`,projectId:s.id,worktreeId:u.id,name:o.name,originPath:a.pathname};l.current=p.id,f(e=>[...e,p]),m(p.id),i(),_.mutate({worktreeId:u.id,name:o.name,...o.argv?{argv:[...o.argv]}:{},...o.cwd?{cwd:o.cwd}:{},...o.env?{env:{...o.env}}:{},...o.returnToShell?{returnToShell:!0}:{},...o.closeOnSuccess?{closeOnSuccess:!0}:{},...d?{initialSize:d}:{},pendingTerminal:p})},requestCloseTerminal:(t,n)=>{let i=e.find(e=>e.worktrees.some(e=>e.id===t.worktreeId)),a=i?.worktrees.find(e=>e.id===t.worktreeId),c=a?.terminals.filter(e=>e.id!==t.id&&!s.current.has(e.id));if(!i||!a||s.current.has(t.id)||!c?.length)return;let l=n?.title??VP.getTitleSnapshot().get(t.id)??t.name;if((n?.hasForegroundProcess??VP.getForegroundProcessSnapshot().has(t.id))&&!window.confirm(`Close terminal “${l}”? Its foreground process will be terminated.`))return;let u=a.terminals.findIndex(e=>e.id===t.id);if(s.current.add(t.id),r.cancelQueries({queryKey:fz}),g===t.id){let e=a.terminals.slice(u+1).find(e=>!s.current.has(e.id))??a.terminals.slice(0,u).reverse().find(e=>!s.current.has(e.id));e&&o(sF(i.id,a.id,e.id),!0)}VP.forget(t.id),r.setQueryData(fz,e=>e?.map(e=>({...e,worktrees:e.worktrees.map(e=>e.id===a.id?{...e,terminals:e.terminals.filter(e=>e.id!==t.id)}:e)}))),v.mutate({terminal:t,index:u})},clearPendingTerminalSelection:()=>{l.current=null,m(null)},selectPendingTerminal:e=>{d.some(t=>t.id===e)&&(l.current=e,m(e),i())}}}function sW({selectedWorktree:e,selectedTerminal:t,selectedPendingTerminal:n,pendingTerminals:r,loading:i,dialogOpen:a}){let o=Ye(),{isMobile:s,openMobile:c}=Jz(),{open:l}=DB();return(0,z.jsx)(aW,{worktree:e,terminal:n?null:t,pendingTerminals:r.filter(t=>t.worktreeId===e?.id),selectedPendingTerminalId:n?.id??null,loading:i,autoFocusBlocked:a||l||s&&c,onStatusChange:()=>void o.invalidateQueries({queryKey:fz})})}var cW=`treeport-initial-terminal-preset`;function lW({project:e,presets:t,presetDiagnostics:n,presetsLoading:r,presetsError:i,onRetryPresets:a,busy:o,onSubmit:s}){let[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)(`default`),[f,p]=(0,R.useState)(()=>localStorage.getItem(cW)??`shell`),m=t.filter(e=>!e.closeOnSuccess),h=m.some(e=>e.id===f),g=f!==`shell`&&!h,_=g&&r,v=g&&!r&&!i,y=g&&!r?`shell`:f,b=u==="default"?`default`:`current`;return(0,z.jsxs)(`form`,{className:`flex flex-col gap-5`,autoComplete:`off`,onSubmit:e=>{e.preventDefault();let t=c.trim();if(o||!t)return;let n=m.find(e=>e.id===y);v&&localStorage.setItem(cW,`shell`),s(t,b,n?{name:n.name,argv:[n.executable,...n.args],returnToShell:!0}:{name:`Shell`},b===`current`?u:void 0)},children:[(0,z.jsxs)(sz,{children:[(0,z.jsx)(lz,{htmlFor:`worktree-name`,children:`Name`}),(0,z.jsx)(cz,{id:`worktree-name`,name:`worktree-name`,value:c,onChange:e=>l(e.target.value),placeholder:`feature-name`,"aria-label":`Worktree name`,autoCapitalize:`none`,spellCheck:!1,required:!0,autoFocus:!0,disabled:o})]}),(0,z.jsxs)(sz,{children:[(0,z.jsx)(lz,{htmlFor:`worktree-base`,children:`Start from`}),(0,z.jsxs)(NB,{id:`worktree-base`,name:`worktree-base`,value:u,onChange:e=>d(e.target.value),disabled:o,children:[(0,z.jsxs)(`option`,{value:`default`,children:[e.defaultBranch,` · latest from origin`]}),e.worktrees.map(e=>(0,z.jsxs)(`option`,{value:e.id,children:[e.name,` · current commit`]},e.id))]})]}),(0,z.jsxs)(sz,{children:[(0,z.jsx)(lz,{htmlFor:`initial-terminal-preset`,children:`Initial terminal`}),(0,z.jsxs)(NB,{id:`initial-terminal-preset`,name:`initial-terminal-preset`,value:y,onChange:e=>{p(e.target.value),localStorage.setItem(cW,e.target.value)},disabled:o,children:[_&&(0,z.jsx)(`option`,{value:f,children:`Loading saved preset…`}),(0,z.jsx)(`option`,{value:`shell`,children:`Shell`}),m.map(e=>(0,z.jsxs)(`option`,{value:e.id,children:[e.name,` — `,nW(e),` —`,` `,PU([e.executable,...e.args])]},e.id))]}),v&&(0,z.jsx)(`p`,{className:`form-note`,role:`status`,children:`The selected preset cannot be used as an initial terminal. Initial terminal changed to Shell.`}),r&&(0,z.jsx)(`p`,{className:`form-note`,role:`status`,children:`Loading terminal presets…`}),i&&(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`p`,{className:`form-note`,children:`Presets could not be loaded. Shell is still available.`}),(0,z.jsx)(G,{type:`button`,variant:`secondary`,size:`sm`,onClick:a,children:`Retry`})]}),n.map(e=>(0,z.jsx)(`p`,{className:`form-note`,role:`status`,children:e.message},`${e.path}:${e.itemId??`file`}:${e.message}`))]}),(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pt-1`,children:[(0,z.jsx)(`p`,{className:`hidden text-xs text-zinc-600 sm:block`,children:`Press Enter to create`}),(0,z.jsx)(G,{type:`submit`,className:`ml-auto`,disabled:o||_||!c.trim(),children:o?`Creating…`:`Create worktree`})]})]})}function uW({project:e,onOpenChange:t,restoreFocusTo:n,presets:r,presetDiagnostics:i,presetsLoading:a,presetsError:o,onRetryPresets:s,onSubmit:c}){let l=(0,R.useRef)(!1);return(0,z.jsx)(vR,{open:e!==null,onOpenChange:t,children:e?(0,z.jsxs)(CR,{className:`max-w-md`,mobilePresentation:`dialog`,restoreFocusTo:n,onCloseAutoFocus:e=>{l.current&&(l.current=!1,e.preventDefault())},children:[(0,z.jsxs)(wR,{children:[(0,z.jsx)(`p`,{className:`eyebrow`,children:e.name}),(0,z.jsx)(TR,{children:`Create worktree`}),(0,z.jsx)(ER,{className:`sr-only`,children:`Create a linked worktree and choose its starting point and initial terminal.`})]}),(0,z.jsx)(lW,{project:e,presets:r,presetDiagnostics:i,presetsLoading:a,presetsError:o,onRetryPresets:s,busy:!1,onSubmit:(t,n,r,i)=>{l.current=!0,c(e,t,n,r,i)}})]}):null})}function dW({worktree:e,preview:t,busy:n,onOpenChange:r,restoreFocusTo:i,onConfirm:a}){let o=!!t?.warnings.length,s=t?.name??e?.name,c=t?.branch??e?.branch,l=t?.detached??e?.detached,u=t?.head??e?.head,d=t?.path??e?.path;return(0,z.jsx)(oR,{open:e!==null,onOpenChange:r,children:e&&t?(0,z.jsxs)(lR,{restoreFocusTo:i,children:[(0,z.jsxs)(uR,{children:[(0,z.jsx)(`p`,{className:`eyebrow`,children:o?`Destructive removal`:`Worktree`}),(0,z.jsx)(fR,{children:`Remove worktree`}),(0,z.jsx)(pR,{children:`Review what will be removed before continuing.`})]}),(0,z.jsxs)(`dl`,{className:`facts`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Name`}),(0,z.jsx)(`dd`,{children:s})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Git state`}),(0,z.jsx)(`dd`,{children:!l&&c?`Branch ${c} (preserved)`:`Detached at ${u?.slice(0,8)}`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Path`}),(0,z.jsx)(`dd`,{children:d})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Uncommitted`}),(0,z.jsx)(`dd`,{children:`${t.dirty.total} (${t.dirty.staged} staged, ${t.dirty.unstaged} unstaged, ${t.dirty.untracked} untracked, ${t.dirty.conflicts} conflicted)`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Terminals stopped`}),(0,z.jsx)(`dd`,{children:t.terminals.map(e=>e.name).join(`, `)||`none`})]})]}),t.reasons.length>0?(0,z.jsxs)(`div`,{className:`warning`,children:[(0,z.jsx)(`strong`,{children:`Removal refused`}),(0,z.jsx)(`ul`,{role:`list`,children:t.reasons.map(e=>(0,z.jsx)(`li`,{children:e},e))})]}):null,t.warnings.length>0?(0,z.jsxs)(`div`,{className:`warning danger`,children:[(0,z.jsx)(`strong`,{children:`Local work may be lost.`}),(0,z.jsx)(`ul`,{role:`list`,children:t.warnings.map(e=>(0,z.jsx)(`li`,{children:e},e))})]}):null,(0,z.jsxs)(dR,{children:[(0,z.jsx)(hR,{children:`Cancel`}),(0,z.jsx)(mR,{asChild:!0,children:(0,z.jsx)(G,{type:`button`,variant:`destructive`,disabled:n||!t.eligible,onClick:n=>{n.preventDefault(),a(e,t)},children:n?`Removing…`:o?`Remove anyway`:`Remove worktree`})})]})]}):null})}function fW({projects:e,setDrawerOpen:t,onWorktreeSubmitted:n,onRemovalNeedsConfirmation:r,onRemovalCompleted:i,selectedTerminalId:a}){let o=Ye(),s=Ca(),c=yz(),l=dt({queryKey:[`worktree-creations`],queryFn:async()=>(await Tf(CE.api.operations.$get({query:{kind:`create`}}))).operations,refetchInterval:2e3,refetchOnReconnect:!0,refetchOnWindowFocus:!0}),u=dt({queryKey:[`worktree-removals`],queryFn:async()=>(await Tf(CE.api.operations.$get({query:{kind:`remove`}}))).operations,refetchInterval:2e3,refetchOnReconnect:!0,refetchOnWindowFocus:!0}),[d,f]=(0,R.useState)([]),p=(l.data??[]).flatMap(e=>{if(e.kind!==`create`)return[];let t=e.request.name;return e.projectId&&typeof t==`string`?[{id:e.id,projectId:e.projectId,typedName:t}]:[]}),m=(0,R.useRef)(new Set),h=(0,R.useRef)(new Set),g=lt({queries:d.map(e=>({queryKey:[`operation`,e.id],queryFn:async()=>(await Tf(CE.api.operations[`:operationId`].$get({param:{operationId:e.id}}))).operation,refetchInterval:500}))}),_=new Set(g.flatMap(t=>{let n=t.data;if(n?.status!==`completed`||n.kind!==`create`)return[];let r=n.result?.worktreeId,i=typeof r==`string`?r:n.worktreeId;return i&&e.some(e=>e.worktrees.some(e=>e.id===i))?[n.id]:[]})),v=p.filter(e=>!_.has(e.id)),y=new Set(v.map(e=>e.id)),b=[...v,...d.filter(e=>!y.has(e.id)&&!_.has(e.id)).map(({id:e,projectId:t,typedName:n})=>({id:e,projectId:t,typedName:n}))],[x,S]=(0,R.useState)({}),C=(u.data??[]).reduce((e,t)=>(t.kind===`remove`&&t.request.preview&&(e[t.request.preview.worktreeId]=`removing`),e),{...x}),w=(0,R.useRef)(new Set),T=pt({mutationFn:e=>Tf(CE.api.projects[`:projectId`][`worktree-operations`].$post({param:{projectId:e.projectId},json:{name:e.typedName,base:e.base,initialTerminal:e.initialTerminal,...e.sourceWorktreeId?{sourceWorktreeId:e.sourceWorktreeId}:{}}})).then(e=>e.operation),onSuccess:(e,t)=>{let n=e.kind===`create`?e.request.name:t.typedName;f(r=>[...r,{id:e.id,projectId:t.projectId,typedName:n,replacesEmptyProject:s.pathname===aF(t.projectId).pathname}]),o.invalidateQueries({queryKey:[`worktree-creations`]})},onError:(e,n)=>{t(!1),xF(e,{operation:`create worktree “${n.typedName}”`})}});(0,R.useEffect)(()=>{for(let e of b)d.some(t=>t.id===e.id)&&!h.current.has(e.id)&&(h.current.add(e.id),window.requestAnimationFrame(()=>{document.getElementById(`pending-worktree-${e.id}`)?.focus()}))},[d,b]),(0,R.useEffect)(()=>{g.forEach((e,n)=>{let r=e.data,i=d[n];!r||r.kind!==`create`||!i||r.status!==`completed`&&r.status!==`failed`||m.current.has(r.id)||(m.current.add(r.id),(async()=>{if(await o.invalidateQueries({queryKey:[`worktree-creations`]}),r.status===`failed`)xF(r.error??`Worktree creation failed`,{operation:`create worktree “${i.typedName}”`});else{await o.invalidateQueries({queryKey:fz});let e=(await Tf(CE.api.projects.$get())).projects;o.setQueryData(fz,e);let n=r.result,a=typeof n?.worktreeId==`string`?n.worktreeId:r.worktreeId,s=typeof n?.terminalId==`string`?n.terminalId:null,l=e.find(e=>e.id===i.projectId)?.worktrees.find(e=>e.id===a);if(l){let e=s?sF(i.projectId,l.id,s):oF(i.projectId,l.id);await c(e,i.replacesEmptyProject)}t(!1),typeof n?.setupError==`string`?xF(n.setupError,{operation:`start setup for newly created worktree “${i.typedName}”`}):typeof n?.terminalError==`string`&&xF(n.terminalError,{operation:`start a terminal for newly created worktree “${i.typedName}”`})}f(e=>e.filter(e=>e.id!==r.id))})())})},[c,g,d,o,t]);let E=(e,t,r,i,o)=>{let s=a?VP.getInitialSize(a):null,c={projectId:e.id,typedName:t,base:r,initialTerminal:{name:i.name,...i.argv?{argv:[...i.argv]}:{},...i.returnToShell?{returnToShell:!0}:{},...s?{initialSize:s}:{}},...o?{sourceWorktreeId:o}:{}};n(),T.mutate(c)},D=(e,t)=>S(n=>({...n,[e]:t})),O=e=>{w.current.delete(e),S(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n})},k=async(e,t,n,a)=>{D(e.id,`removing`);try{await Tf(CE.api.worktrees[`:worktreeId`].remove.$post({param:{worktreeId:e.id},json:{confirmationToken:t.confirmationToken,confirmDestructive:n}})),await o.invalidateQueries({queryKey:[`worktree-removals`]}),O(e.id),i(e.id),o.invalidateQueries({queryKey:fz},{cancelRefetch:!1})}catch(t){if(kE(t).code===`REMOVE_PREVIEW_STALE`&&a>0){D(e.id,`checking`);try{let t=(await Tf(CE.api.worktrees[`:worktreeId`][`remove-preview`].$get({param:{worktreeId:e.id}}))).preview;if(t.eligible&&t.warnings.length===0){await k(e,t,!1,a-1);return}O(e.id),r(e,t);return}catch(t){O(e.id),xF(t,{operation:`refresh removal details for worktree “${e.name}”`});return}}O(e.id),xF(t,{operation:`remove worktree “${e.name}”`})}};return{pendingWorktrees:b,pendingRemovals:C,submitWorktreeCreation:E,prepareRemoval:async(e,t)=>{if(!(w.current.has(e.id)||C[e.id])){w.current.add(e.id),D(e.id,`checking`);try{let n=(await Tf(CE.api.worktrees[`:worktreeId`][`remove-preview`].$get({param:{worktreeId:e.id}}))).preview;if(n.eligible&&n.warnings.length===0){await k(e,n,!1,1);return}O(e.id),r(e,n,t)}catch(t){O(e.id),xF(t,{operation:`check whether worktree “${e.name}” can be removed`})}}},confirmRemoval:(e,t)=>{w.current.has(e.id)||(w.current.add(e.id),k(e,t,t.warnings.length>0,1))}}}function pW(e,t){let n=Ye(),r=(0,R.useRef)(t);r.current=t;let[i,a]=(0,R.useState)(!1);return(0,R.useEffect)(()=>{let e=xE(`/events`,{path:DN,transports:[`websocket`],autoConnect:!1,retries:0}),t=Pf(()=>n.invalidateQueries({queryKey:fz},{cancelRefetch:!1})),i=Pf(()=>Promise.all([n.invalidateQueries({queryKey:fz},{cancelRefetch:!1}),n.invalidateQueries({queryKey:pz},{cancelRefetch:!1}),n.invalidateQueries({queryKey:[`terminal-preset-definitions`]},{cancelRefetch:!1}),n.invalidateQueries({queryKey:[`web-panel-definitions`]},{cancelRefetch:!1})])),o=()=>{t.schedule(),Promise.all([n.invalidateQueries({queryKey:[`worktree-creations`]}),n.invalidateQueries({queryKey:[`worktree-removals`]})])},s=()=>i.schedule(),c=e=>{let t=lP(e);if(!t){a(!0);return}VP.replaceRuntimeMetadata(t.terminalMetadata),a(!1),o()},l=e=>{let t=uP(e);if(t){if(t.type===`terminal.metadata`){VP.applyRuntimeMetadata({terminalId:t.data.terminalId,title:t.data.title,program:t.data.program,hasForegroundProcess:t.data.hasForegroundProcess,progress:t.data.progress,progressStartedAt:t.data.progressStartedAt,progressClearedAt:t.data.progressClearedAt,bell:t.data.bell});return}if(t.type===`panel.open_requested`){o(),r.current?.(t.data);return}if(t.type===`project.updated`){s();return}if(t.type===`project.removed`){s();return}t.type!==`terminal.controller_changed`&&o()}},u=()=>a(!0);return e.on(`snapshot`,c),e.on(`product_event`,l),e.on(`disconnect`,u),e.on(`connect_error`,u),e.connect(),()=>{t.dispose(),i.dispose(),e.disconnect()}},[n]),(0,R.useEffect)(()=>{e&&VP.reconcile(e.flatMap(e=>e.worktrees.flatMap(e=>e.terminals)))},[e]),i}function mW(){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(OB,{children:(0,z.jsx)(hW,{})}),(0,z.jsx)(qh,{})]})}function hW(){let e=window.treeportDesktop,t=yz(),n=Ye(),r=Ca(),i=dt(hz),a=i.data??[],o=dt(_z),s=o.data??[],c=localStorage.getItem(tF),l=i.data?bF(a,r.pathname,c):null,u=l?.selection.project??null,d=l?.selection.worktree??null,f=l?.selection.terminal??null,p=f?.id??null,m=l?.selection.panel??null,h=m?.id??null,g=u,{isMobile:_,openMobile:v,setOpenMobile:y,closeMobileWithoutFocusRestore:b}=Jz(),x=DB(),S=x.open,[C,w]=(0,R.useState)(null),[T,E]=(0,R.useState)(!1),[D,O]=(0,R.useState)(!1),[k,ee]=(0,R.useState)(()=>new Set),[te,A]=(0,R.useState)({}),[j,M]=(0,R.useState)({}),ne=(0,R.useCallback)((e,t)=>{M(n=>{if(t===null){if(n[e]===void 0)return n;let t={...n};return delete t[e],t}return n[e]===t?n:{...n,[e]:t}})},[]);(0,R.useEffect)(()=>{let e=new Set(a.flatMap(e=>e.worktrees.flatMap(e=>e.panels.filter(e=>e.kind===`web`).map(e=>e.id))));M(t=>{let n=Object.keys(t).filter(t=>!e.has(t));if(n.length===0)return t;let r={...t};return n.forEach(e=>delete r[e]),r})},[a]);let N=C?.type===`panel`?a.find(e=>e.id===C.projectId)??null:null,P=C?.type===`panel`&&C.worktreeId?N?.worktrees.find(e=>e.id===C.worktreeId)??null:null,re=dt(vz(C?.type===`worktree`?{projectId:C.project.id}:P?{worktreeId:P.id}:d?{worktreeId:d.id}:u?{projectId:u.id}:void 0)),ie=re.data?.definitions??[],ae=re.data?.diagnostics??[],F=dt({queryKey:[`web-panel-definitions`,P?.id],queryFn:async()=>(await Tf(CE.api.worktrees[`:worktreeId`][`web-panel-definitions`].$get({param:{worktreeId:P.id}}))).definitions,enabled:!!P}),I=pt({mutationFn:({worktree:e,definition:t,input:n})=>Tf(CE.api.worktrees[`:worktreeId`].panels.$post({param:{worktreeId:e.id},json:{definitionId:t.id,input:n,launchCwd:null}})).then(e=>e.panel),onSuccess:async e=>{w(null),await n.invalidateQueries({queryKey:hz.queryKey});let r=fF(n.getQueryData(hz.queryKey)??a,e);r&&await t(r)},onError:(e,{worktree:t,definition:n})=>{xF(e,{operation:`create web panel “${n.title}” in worktree “${t.name}”`})}}),L=pt({mutationFn:({panel:e,discardStoredData:t=!1})=>Tf(CE.api.panels[`:panelId`].$delete({param:{panelId:e.id},query:{...t?{discardStoredData:`true`}:{}}})),onSuccess:async(e,{panel:r})=>{if(ne(r.id,null),w(e=>e?.type===`close-web-panel`&&e.panel.id===r.id?null:e),m?.id===r.id){let e=a.flatMap(e=>e.worktrees).find(e=>e.id===r.worktreeId),n=e?mF(a,e):null;n&&await t(n,!0)}await n.invalidateQueries({queryKey:hz.queryKey})},onError:(e,{panel:t})=>{xF(e,{operation:`close web panel “${t.title}”`})}}),oe=(e,t)=>{Tf(CE.api.panels[`:panelId`].storage.$get({param:{panelId:e.id}})).then(({hasData:n})=>{n?fe({type:`close-web-panel`,panel:e},t):L.mutate({panel:e})},t=>{xF(t,{operation:`check stored data for web panel “${e.title}”`})})},se=(0,R.useCallback)(e=>{A(t=>({...t,[e.panelId]:(t[e.panelId]??0)+1})),rF(e.sourceTerminalId,p)&&n.invalidateQueries({queryKey:hz.queryKey}).then(async()=>{let r=n.getQueryData(hz.queryKey)??[],i=r.flatMap(e=>e.worktrees).find(t=>t.id===e.worktreeId)?.panels.find(t=>t.kind===`web`&&t.id===e.panelId),a=i?fF(r,i):null;a&&await t(a)}).catch(e=>{xF(e,{operation:`open web panel`})})},[t,n,p]),ce=pW(i.data,se),[le,ue]=(0,R.useState)(!1),de=(0,R.useRef)(null),fe=(e,t)=>{de.current=t??document.activeElement,w(e)};(0,R.useEffect)(()=>{h&&ee(e=>{if(e.has(h))return e;let t=new Set(e);return t.add(h),t})},[h]),(0,R.useEffect)(()=>{!l||l.canonical||t(l.target,!0)},[t,l?.canonical,l?.target.pathname]),(0,R.useEffect)(()=>{l?.canonical&&(l.target.kind===`root`?localStorage.removeItem(tF):localStorage.setItem(tF,l.target.pathname),l.target.kind===`terminal`&&localStorage.setItem(`${nF}${l.target.projectId}`,l.target.terminalId))},[l?.canonical,l?.target.pathname]),(0,R.useEffect)(()=>{if(!(i.data!==void 0&&(ce||i.isRefetchError))){ue(!1);return}let e=window.setTimeout(()=>ue(!0),jf);return()=>window.clearTimeout(e)},[ce,i.data,i.isRefetchError]);let pe=(0,R.useMemo)(()=>g?.worktrees.flatMap(e=>e.terminals)??[],[g]),me=(0,R.useMemo)(()=>a.flatMap(e=>e.worktrees).flatMap(e=>e.panels).filter(e=>e.kind===`web`&&(k.has(e.id)||e.id===h)),[a,k,h]),he=(0,R.useCallback)(e=>{let n=pF(a,e);n&&t(n),b()},[b,t,a]),ge=e=>{let n=mF(a,e,p);n&&t(n),b()},_e=e=>uF(e,localStorage.getItem(`${nF}${e.id}`)),ve=e=>{let n=_e(e);x.dismissedIntoTerminalRef.current=!_&&n.kind===`terminal`,t(n,!1,!_),x.setOpen(!1),b()},{closingProjectId:ye,requestProjectClose:be,projectOpened:xe}=bz({projects:a,selectedProject:u,targetForProject:_e,projectSwitcherTriggerRef:x.triggerRef,closeProjectUi:()=>x.setOpen(!1),openedProjectUi:()=>{x.setOpen(!1),b(),w(null)}}),Se=e=>{let t=_e(e);return x.dismissedIntoTerminalRef.current=!_&&t.kind===`terminal`,xe(e,!_)},{pendingWorktrees:Ce,pendingRemovals:we,submitWorktreeCreation:Te,prepareRemoval:Ee,confirmRemoval:De}=fW({projects:a,setDrawerOpen:e=>{e?y(!0):b()},onWorktreeSubmitted:()=>w(null),onRemovalNeedsConfirmation:(e,t,n)=>fe({type:`remove`,worktree:e,preview:t},n),onRemovalCompleted:e=>w(t=>t?.type===`remove`&&t.worktree.id===e?null:t),selectedTerminalId:p}),Oe=oW({projects:a,selectedWorktree:d,selectedTerminal:f}),ke=(0,R.useCallback)(e=>{E(!1),O(!1),Oe.clearPendingTerminalSelection(),he(e)},[he,Oe.clearPendingTerminalSelection]),Ae=(0,R.useCallback)(e=>{Oe.clearPendingTerminalSelection();let n=fF(a,e);n&&t(n),b()},[b,t,a,Oe.clearPendingTerminalSelection]),je=(0,R.useCallback)(e=>{if(C||S||_&&v||!d)return!1;let t=d.terminals[e];if(t)return ke(t),!0;let n=d.panels.filter(e=>e.kind===`web`),r=n[e-d.terminals.length];if(r)return Ae(r),!0;let i=Oe.pendingTerminals.filter(e=>e.worktreeId===d.id)[e-d.terminals.length-n.length];return i?(Oe.selectPendingTerminal(i.id),!0):!1},[C,v,_,S,d,ke,Ae,Oe.pendingTerminals,Oe.selectPendingTerminal]);(0,R.useEffect)(()=>{let e=e=>{if(!e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)return;let t=Number(e.key)-1;!Number.isInteger(t)||t<0||t>8||je(t)&&(e.preventDefault(),e.stopPropagation())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[je]);let Me=!N||!P||N.availability.state===`unavailable`||!!P.prunable||!!we[P.id];return(0,R.useEffect)(()=>{if(e)return e.onCommand(e=>{if(!(C||S||_&&v)){if(e===`new-worktree`){g&&g.availability.state!==`unavailable`&&fe({type:`worktree`,project:g});return}!u||!d||(e===`new-terminal`?Oe.createTerminalInWorktree(u,d,{name:`Shell`}):e===`new-panel`?fe({type:`panel`,projectId:u.id,worktreeId:d.id}):e===`close-panel`&&(m?oe(m):!Oe.selectedPendingTerminal&&f&&Oe.requestCloseTerminal(f)))}})},[g,C,v,_,S,u,f,m,d,Oe.selectedPendingTerminal]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(TF,{projects:a,selectedTerminalId:p}),(0,z.jsx)(jB,{blocked:C!==null}),(0,z.jsx)(FB,{selectedTerminalId:Oe.selectedPendingTerminal||m?null:p,terminals:pe,onSelectTerminal:ke,notificationCenter:(0,z.jsx)(CF,{projects:a,navigateToWorkspace:t,open:D,onOpenChange:O})}),(0,z.jsx)(PB,{notificationCenter:(0,z.jsx)(CF,{projects:a,navigateToWorkspace:t,open:T,onOpenChange:E}),projectSwitcher:(0,z.jsx)(MB,{projects:a,activeProject:g,closingProjectId:ye,onSelectProject:ve,onProjectOpened:Se,onRequestProjectClose:be,onOpenProjectDialog:e=>fe({type:`project`},e)}),children:(0,z.jsx)(MU,{projects:a,projectsPending:i.isPending,projectsError:i.isError,projectsLoaded:i.data!==void 0,activeProject:g,selectedWorktree:d,selectedTerminalId:Oe.selectedPendingTerminal||m?null:p,selectedWebPanelId:Oe.selectedPendingTerminal?null:m?.id??null,webPanelRuntimeTitles:j,selectedPendingTerminalId:Oe.selectedPendingTerminal?.id??null,pendingTerminals:Oe.pendingTerminals,pendingWorktrees:Ce,pendingRemovals:we,onRetryProjects:()=>void i.refetch(),onSelectTerminal:ke,onSelectPendingTerminal:Oe.selectPendingTerminal,onCloseTerminal:Oe.requestCloseTerminal,onSelectWebPanel:Ae,onCloseWebPanel:oe,onSelectWorktree:ge,onPrepareRemoval:Ee,onOpenPanelDialog:(e,t,n)=>fe({type:`panel`,projectId:e.id,worktreeId:t?.id??null},n),onOpenWorktreeDialog:(e,t)=>fe({type:`worktree`,project:e},t)})}),(0,z.jsxs)(kB,{children:[me.map(e=>(0,z.jsx)(_R,{panel:e,active:e.id===h&&!Oe.selectedPendingTerminal,title:j[e.id]??e.title,reloadRevision:te[e.id]??0,autoFocusBlocked:C!==null||S||_&&v,onTitleChange:ne,onSelectWorkspace:je},e.id)),(!m||Oe.selectedPendingTerminal)&&(0,z.jsx)(sW,{selectedWorktree:d,selectedTerminal:f,selectedPendingTerminal:Oe.selectedPendingTerminal,pendingTerminals:Oe.pendingTerminals,loading:i.isPending,dialogOpen:C!==null})]}),le?(0,z.jsx)(`div`,{className:`fixed right-4 bottom-4 z-70 flex max-w-[min(30rem,calc(100vw-2rem))] items-center gap-3 rounded-lg bg-zinc-800 p-3 text-sm text-zinc-300 shadow-2xl ring-1 ring-white/10`,role:`status`,inert:_&&v?!0:void 0,"aria-hidden":_&&v?!0:void 0,children:(0,z.jsx)(`span`,{children:`Updates paused; showing the last known project state.`})}):null,(0,z.jsx)(dz,{open:C?.type===`project`,onOpenChange:e=>!e&&w(null),restoreFocusTo:de.current,onOpened:xe}),(0,z.jsx)(uW,{project:C?.type===`worktree`?C.project:null,onOpenChange:e=>!e&&w(null),restoreFocusTo:de.current,presets:ie,presetDiagnostics:ae,presetsLoading:re.isPending,presetsError:re.isError,onRetryPresets:()=>void re.refetch(),onSubmit:Te}),(0,z.jsx)(rW,{open:C?.type===`panel`,onOpenChange:e=>!e&&w(null),restoreFocusTo:de.current,worktreeName:P?.name??null,presets:ie,presetDiagnostics:ae,presetsLoading:re.isPending,presetsError:re.isError,webPanelDefinitions:F.data??[],webPanelDefinitionsLoading:!!P&&F.isPending,webPanelDefinitionsError:F.isError,launchDisabled:Me||I.isPending,onCreateTerminal:e=>{!N||!P||(w(null),Oe.createTerminalInWorktree(N,P,e))},onCreateWebPanel:e=>{P&&I.mutate({worktree:P,definition:e,input:null})},onManagePresets:()=>w({type:`presets`})}),(0,z.jsx)(tW,{open:C?.type===`presets`,onOpenChange:e=>!e&&w(null),restoreFocusTo:de.current,presets:s,loading:o.isPending,loadError:o.isError,onRetry:()=>void o.refetch()}),(0,z.jsx)(gR,{panel:C?.type===`close-web-panel`?C.panel:null,busy:L.isPending,onOpenChange:e=>!e&&w(null),restoreFocusTo:de.current,onConfirm:e=>L.mutate({panel:e,discardStoredData:!0})}),(0,z.jsx)(dW,{worktree:C?.type===`remove`?C.worktree:null,preview:C?.type===`remove`?C.preview:null,busy:C?.type===`remove`&&we[C.worktree.id]!==void 0,onOpenChange:e=>!e&&w(null),restoreFocusTo:de.current,onConfirm:De})]})}function gW({reset:e}){return(0,z.jsx)(`main`,{className:`grid min-h-dvh place-items-center bg-zinc-950 p-6 text-zinc-100`,"aria-labelledby":`app-error-title`,children:(0,z.jsxs)(`section`,{className:`w-full max-w-lg rounded-xl bg-zinc-900 p-6 shadow-2xl ring-1 ring-white/10`,role:`alert`,children:[(0,z.jsx)(`p`,{className:`text-sm font-medium text-rose-300`,children:`Unexpected error`}),(0,z.jsx)(`h1`,{id:`app-error-title`,className:`mt-2 text-xl font-semibold`,children:`Treeport couldn’t display this workspace`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm text-zinc-400`,children:`Try recovering the interface. If the problem continues, reload Treeport; your persistent terminal sessions will keep running.`}),(0,z.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-3`,children:[(0,z.jsx)(G,{type:`button`,onClick:e,children:`Try again`}),(0,z.jsx)(G,{type:`button`,variant:`secondary`,onClick:()=>window.location.reload(),children:`Reload Treeport`})]})]})})}var _W=ra({component:mW,errorComponent:gW,onCatch:e=>console.error(`Unexpected application crash`,e)}),vW=ta({getParentRoute:()=>_W,path:`/`}),yW=ta({getParentRoute:()=>_W,path:`projects/$projectId`}),bW=ta({getParentRoute:()=>yW,path:`worktrees/$worktreeId`}),xW=ta({getParentRoute:()=>bW,path:`terminals/$terminalId`}),SW=ta({getParentRoute:()=>bW,path:`panels/$panelId`}),CW=ya({routeTree:_W.addChildren([vW,yW.addChildren([bW.addChildren([xW,SW])])]),defaultPreload:!1,scrollRestoration:!1}),wW=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,TW=document.querySelector(`meta[name="viewport"]`);wW&&TW&&!TW.content.includes(`maximum-scale`)&&(TW.content=`${TW.content}, maximum-scale=1`);var EW=new Ge({defaultOptions:{queries:{retry:Mf,retryDelay:Nf,refetchOnReconnect:!0},mutations:{retry:!1}}});(0,wa.createRoot)(document.getElementById(`root`)).render((0,z.jsx)(R.StrictMode,{children:(0,z.jsx)(Xe,{client:EW,children:(0,z.jsx)(ef,{children:(0,z.jsxs)(sf,{children:[(0,z.jsx)(Sa,{router:CW}),(0,z.jsx)(to,{})]})})})}));