kaizenai 0.2.1 → 0.3.0

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.
@@ -1,598 +0,0 @@
1
- var _4=Object.defineProperty;var LC=e=>{throw TypeError(e)};var b4=(e,t,n)=>t in e?_4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Hn=(e,t,n)=>b4(e,typeof t!="symbol"?t+"":t,n),zC=(e,t,n)=>t.has(e)||LC("Cannot "+n);var yu=(e,t,n)=>(zC(e,t,"read from private field"),n?n.call(e):t.get(e)),PC=(e,t,n)=>t.has(e)?LC("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),BC=(e,t,n,r)=>(zC(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function y4(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(r,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();function Ym(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yv={exports:{}},xu={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var IC;function x4(){if(IC)return xu;IC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,a){var l=null;if(a!==void 0&&(l=""+a),s.key!==void 0&&(l=""+s.key),"key"in s){a={};for(var u in s)u!=="key"&&(a[u]=s[u])}else a=s;return s=a.ref,{$$typeof:e,type:r,key:l,ref:s!==void 0?s:null,props:a}}return xu.Fragment=t,xu.jsx=n,xu.jsxs=n,xu}var HC;function w4(){return HC||(HC=1,Yv.exports=x4()),Yv.exports}var f=w4(),Xv={exports:{}},lt={};/**
10
- * @license React
11
- * react.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var FC;function S4(){if(FC)return lt;FC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),v=Symbol.iterator;function y(B){return B===null||typeof B!="object"?null:(B=v&&B[v]||B["@@iterator"],typeof B=="function"?B:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function k(B,X,A){this.props=B,this.context=X,this.refs=C,this.updater=A||w}k.prototype.isReactComponent={},k.prototype.setState=function(B,X){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,X,"setState")},k.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function R(){}R.prototype=k.prototype;function E(B,X,A){this.props=B,this.context=X,this.refs=C,this.updater=A||w}var N=E.prototype=new R;N.constructor=E,S(N,k.prototype),N.isPureReactComponent=!0;var j=Array.isArray;function D(){}var L={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function Y(B,X,A){var re=A.ref;return{$$typeof:e,type:B,key:X,ref:re!==void 0?re:null,props:A}}function P(B,X){return Y(B.type,X,B.props)}function V(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function I(B){var X={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(A){return X[A]})}var W=/\/+/g;function K(B,X){return typeof B=="object"&&B!==null&&B.key!=null?I(""+B.key):X.toString(36)}function q(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(D,D):(B.status="pending",B.then(function(X){B.status==="pending"&&(B.status="fulfilled",B.value=X)},function(X){B.status==="pending"&&(B.status="rejected",B.reason=X)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function O(B,X,A,re,se){var Z=typeof B;(Z==="undefined"||Z==="boolean")&&(B=null);var te=!1;if(B===null)te=!0;else switch(Z){case"bigint":case"string":case"number":te=!0;break;case"object":switch(B.$$typeof){case e:case t:te=!0;break;case g:return te=B._init,O(te(B._payload),X,A,re,se)}}if(te)return se=se(B),te=re===""?"."+K(B,0):re,j(se)?(A="",te!=null&&(A=te.replace(W,"$&/")+"/"),O(se,X,A,"",function(xe){return xe})):se!=null&&(V(se)&&(se=P(se,A+(se.key==null||B&&B.key===se.key?"":(""+se.key).replace(W,"$&/")+"/")+te)),X.push(se)),1;te=0;var le=re===""?".":re+":";if(j(B))for(var pe=0;pe<B.length;pe++)re=B[pe],Z=le+K(re,pe),te+=O(re,X,A,Z,se);else if(pe=y(B),typeof pe=="function")for(B=pe.call(B),pe=0;!(re=B.next()).done;)re=re.value,Z=le+K(re,pe++),te+=O(re,X,A,Z,se);else if(Z==="object"){if(typeof B.then=="function")return O(q(B),X,A,re,se);throw X=String(B),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return te}function F(B,X,A){if(B==null)return B;var re=[],se=0;return O(B,re,"","",function(Z){return X.call(A,Z,se++)}),re}function H(B){if(B._status===-1){var X=B._result;X=X(),X.then(function(A){(B._status===0||B._status===-1)&&(B._status=1,B._result=A)},function(A){(B._status===0||B._status===-1)&&(B._status=2,B._result=A)}),B._status===-1&&(B._status=0,B._result=X)}if(B._status===1)return B._result.default;throw B._result}var $=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},M={map:F,forEach:function(B,X,A){F(B,function(){X.apply(this,arguments)},A)},count:function(B){var X=0;return F(B,function(){X++}),X},toArray:function(B){return F(B,function(X){return X})||[]},only:function(B){if(!V(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return lt.Activity=p,lt.Children=M,lt.Component=k,lt.Fragment=n,lt.Profiler=s,lt.PureComponent=E,lt.StrictMode=r,lt.Suspense=h,lt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,lt.__COMPILER_RUNTIME={__proto__:null,c:function(B){return L.H.useMemoCache(B)}},lt.cache=function(B){return function(){return B.apply(null,arguments)}},lt.cacheSignal=function(){return null},lt.cloneElement=function(B,X,A){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var re=S({},B.props),se=B.key;if(X!=null)for(Z in X.key!==void 0&&(se=""+X.key),X)!U.call(X,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&X.ref===void 0||(re[Z]=X[Z]);var Z=arguments.length-2;if(Z===1)re.children=A;else if(1<Z){for(var te=Array(Z),le=0;le<Z;le++)te[le]=arguments[le+2];re.children=te}return Y(B.type,se,re)},lt.createContext=function(B){return B={$$typeof:l,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:a,_context:B},B},lt.createElement=function(B,X,A){var re,se={},Z=null;if(X!=null)for(re in X.key!==void 0&&(Z=""+X.key),X)U.call(X,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(se[re]=X[re]);var te=arguments.length-2;if(te===1)se.children=A;else if(1<te){for(var le=Array(te),pe=0;pe<te;pe++)le[pe]=arguments[pe+2];se.children=le}if(B&&B.defaultProps)for(re in te=B.defaultProps,te)se[re]===void 0&&(se[re]=te[re]);return Y(B,Z,se)},lt.createRef=function(){return{current:null}},lt.forwardRef=function(B){return{$$typeof:u,render:B}},lt.isValidElement=V,lt.lazy=function(B){return{$$typeof:g,_payload:{_status:-1,_result:B},_init:H}},lt.memo=function(B,X){return{$$typeof:d,type:B,compare:X===void 0?null:X}},lt.startTransition=function(B){var X=L.T,A={};L.T=A;try{var re=B(),se=L.S;se!==null&&se(A,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(D,$)}catch(Z){$(Z)}finally{X!==null&&A.types!==null&&(X.types=A.types),L.T=X}},lt.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},lt.use=function(B){return L.H.use(B)},lt.useActionState=function(B,X,A){return L.H.useActionState(B,X,A)},lt.useCallback=function(B,X){return L.H.useCallback(B,X)},lt.useContext=function(B){return L.H.useContext(B)},lt.useDebugValue=function(){},lt.useDeferredValue=function(B,X){return L.H.useDeferredValue(B,X)},lt.useEffect=function(B,X){return L.H.useEffect(B,X)},lt.useEffectEvent=function(B){return L.H.useEffectEvent(B)},lt.useId=function(){return L.H.useId()},lt.useImperativeHandle=function(B,X,A){return L.H.useImperativeHandle(B,X,A)},lt.useInsertionEffect=function(B,X){return L.H.useInsertionEffect(B,X)},lt.useLayoutEffect=function(B,X){return L.H.useLayoutEffect(B,X)},lt.useMemo=function(B,X){return L.H.useMemo(B,X)},lt.useOptimistic=function(B,X){return L.H.useOptimistic(B,X)},lt.useReducer=function(B,X,A){return L.H.useReducer(B,X,A)},lt.useRef=function(B){return L.H.useRef(B)},lt.useState=function(B){return L.H.useState(B)},lt.useSyncExternalStore=function(B,X,A){return L.H.useSyncExternalStore(B,X,A)},lt.useTransition=function(){return L.H.useTransition()},lt.version="19.2.1",lt}var UC;function i0(){return UC||(UC=1,Xv.exports=S4()),Xv.exports}var _=i0();const ye=Ym(_),nT=y4({__proto__:null,default:ye},[_]);var Zv={exports:{}},wu={},Qv={exports:{}},Jv={};/**
18
- * @license React
19
- * scheduler.production.js
20
- *
21
- * Copyright (c) Meta Platforms, Inc. and affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var $C;function C4(){return $C||($C=1,(function(e){function t(O,F){var H=O.length;O.push(F);e:for(;0<H;){var $=H-1>>>1,M=O[$];if(0<s(M,F))O[$]=F,O[H]=M,H=$;else break e}}function n(O){return O.length===0?null:O[0]}function r(O){if(O.length===0)return null;var F=O[0],H=O.pop();if(H!==F){O[0]=H;e:for(var $=0,M=O.length,B=M>>>1;$<B;){var X=2*($+1)-1,A=O[X],re=X+1,se=O[re];if(0>s(A,H))re<M&&0>s(se,A)?(O[$]=se,O[re]=H,$=re):(O[$]=A,O[X]=H,$=X);else if(re<M&&0>s(se,H))O[$]=se,O[re]=H,$=re;else break e}}return F}function s(O,F){var H=O.sortIndex-F.sortIndex;return H!==0?H:O.id-F.id}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 l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var h=[],d=[],g=1,p=null,v=3,y=!1,w=!1,S=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function N(O){for(var F=n(d);F!==null;){if(F.callback===null)r(d);else if(F.startTime<=O)r(d),F.sortIndex=F.expirationTime,t(h,F);else break;F=n(d)}}function j(O){if(S=!1,N(O),!w)if(n(h)!==null)w=!0,D||(D=!0,I());else{var F=n(d);F!==null&&q(j,F.startTime-O)}}var D=!1,L=-1,U=5,Y=-1;function P(){return C?!0:!(e.unstable_now()-Y<U)}function V(){if(C=!1,D){var O=e.unstable_now();Y=O;var F=!0;try{e:{w=!1,S&&(S=!1,R(L),L=-1),y=!0;var H=v;try{t:{for(N(O),p=n(h);p!==null&&!(p.expirationTime>O&&P());){var $=p.callback;if(typeof $=="function"){p.callback=null,v=p.priorityLevel;var M=$(p.expirationTime<=O);if(O=e.unstable_now(),typeof M=="function"){p.callback=M,N(O),F=!0;break t}p===n(h)&&r(h),N(O)}else r(h);p=n(h)}if(p!==null)F=!0;else{var B=n(d);B!==null&&q(j,B.startTime-O),F=!1}}break e}finally{p=null,v=H,y=!1}F=void 0}}finally{F?I():D=!1}}}var I;if(typeof E=="function")I=function(){E(V)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,K=W.port2;W.port1.onmessage=V,I=function(){K.postMessage(null)}}else I=function(){k(V,0)};function q(O,F){L=k(function(){O(e.unstable_now())},F)}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(O){O.callback=null},e.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<O?Math.floor(1e3/O):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(O){switch(v){case 1:case 2:case 3:var F=3;break;default:F=v}var H=v;v=F;try{return O()}finally{v=H}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(O,F){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var H=v;v=O;try{return F()}finally{v=H}},e.unstable_scheduleCallback=function(O,F,H){var $=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?$+H:$):H=$,O){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=H+M,O={id:g++,callback:F,priorityLevel:O,startTime:H,expirationTime:M,sortIndex:-1},H>$?(O.sortIndex=H,t(d,O),n(h)===null&&O===n(d)&&(S?(R(L),L=-1):S=!0,q(j,H-$))):(O.sortIndex=M,t(h,O),w||y||(w=!0,D||(D=!0,I()))),O},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(O){var F=v;return function(){var H=v;v=F;try{return O.apply(this,arguments)}finally{v=H}}}})(Jv)),Jv}var WC;function k4(){return WC||(WC=1,Qv.exports=C4()),Qv.exports}var e_={exports:{}},mr={};/**
26
- * @license React
27
- * react-dom.production.js
28
- *
29
- * Copyright (c) Meta Platforms, Inc. and affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var VC;function E4(){if(VC)return mr;VC=1;var e=i0();function t(h){var d="https://react.dev/errors/"+h;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)d+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+h+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(h,d,g){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:p==null?null:""+p,children:h,containerInfo:d,implementation:g}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(h,d){if(h==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return mr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,mr.createPortal=function(h,d){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return a(h,d,null,g)},mr.flushSync=function(h){var d=l.T,g=r.p;try{if(l.T=null,r.p=2,h)return h()}finally{l.T=d,r.p=g,r.d.f()}},mr.preconnect=function(h,d){typeof h=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(h,d))},mr.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},mr.preinit=function(h,d){if(typeof h=="string"&&d&&typeof d.as=="string"){var g=d.as,p=u(g,d.crossOrigin),v=typeof d.integrity=="string"?d.integrity:void 0,y=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;g==="style"?r.d.S(h,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:p,integrity:v,fetchPriority:y}):g==="script"&&r.d.X(h,{crossOrigin:p,integrity:v,fetchPriority:y,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},mr.preinitModule=function(h,d){if(typeof h=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var g=u(d.as,d.crossOrigin);r.d.M(h,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(h)},mr.preload=function(h,d){if(typeof h=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var g=d.as,p=u(g,d.crossOrigin);r.d.L(h,g,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},mr.preloadModule=function(h,d){if(typeof h=="string")if(d){var g=u(d.as,d.crossOrigin);r.d.m(h,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(h)},mr.requestFormReset=function(h){r.d.r(h)},mr.unstable_batchedUpdates=function(h,d){return h(d)},mr.useFormState=function(h,d,g){return l.H.useFormState(h,d,g)},mr.useFormStatus=function(){return l.H.useHostTransitionStatus()},mr.version="19.2.1",mr}var qC;function rT(){if(qC)return e_.exports;qC=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),e_.exports=E4(),e_.exports}/**
34
- * @license React
35
- * react-dom-client.production.js
36
- *
37
- * Copyright (c) Meta Platforms, Inc. and affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */var KC;function R4(){if(KC)return wu;KC=1;var e=k4(),t=i0(),n=rT();function r(i){var o="https://react.dev/errors/"+i;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)o+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+i+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function a(i){var o=i,c=i;if(i.alternate)for(;o.return;)o=o.return;else{i=o;do o=i,(o.flags&4098)!==0&&(c=o.return),i=o.return;while(i)}return o.tag===3?c:null}function l(i){if(i.tag===13){var o=i.memoizedState;if(o===null&&(i=i.alternate,i!==null&&(o=i.memoizedState)),o!==null)return o.dehydrated}return null}function u(i){if(i.tag===31){var o=i.memoizedState;if(o===null&&(i=i.alternate,i!==null&&(o=i.memoizedState)),o!==null)return o.dehydrated}return null}function h(i){if(a(i)!==i)throw Error(r(188))}function d(i){var o=i.alternate;if(!o){if(o=a(i),o===null)throw Error(r(188));return o!==i?null:i}for(var c=i,m=o;;){var b=c.return;if(b===null)break;var x=b.alternate;if(x===null){if(m=b.return,m!==null){c=m;continue}break}if(b.child===x.child){for(x=b.child;x;){if(x===c)return h(b),i;if(x===m)return h(b),o;x=x.sibling}throw Error(r(188))}if(c.return!==m.return)c=b,m=x;else{for(var T=!1,z=b.child;z;){if(z===c){T=!0,c=b,m=x;break}if(z===m){T=!0,m=b,c=x;break}z=z.sibling}if(!T){for(z=x.child;z;){if(z===c){T=!0,c=x,m=b;break}if(z===m){T=!0,m=x,c=b;break}z=z.sibling}if(!T)throw Error(r(189))}}if(c.alternate!==m)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?i:o}function g(i){var o=i.tag;if(o===5||o===26||o===27||o===6)return i;for(i=i.child;i!==null;){if(o=g(i),o!==null)return o;i=i.sibling}return null}var p=Object.assign,v=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),E=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function I(i){return i===null||typeof i!="object"?null:(i=V&&i[V]||i["@@iterator"],typeof i=="function"?i:null)}var W=Symbol.for("react.client.reference");function K(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===W?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case S:return"Fragment";case k:return"Profiler";case C:return"StrictMode";case j:return"Suspense";case D:return"SuspenseList";case Y:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case w:return"Portal";case E:return i.displayName||"Context";case R:return(i._context.displayName||"Context")+".Consumer";case N:var o=i.render;return i=i.displayName,i||(i=o.displayName||o.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case L:return o=i.displayName||null,o!==null?o:K(i.type)||"Memo";case U:o=i._payload,i=i._init;try{return K(i(o))}catch{}}return null}var q=Array.isArray,O=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H={pending:!1,data:null,method:null,action:null},$=[],M=-1;function B(i){return{current:i}}function X(i){0>M||(i.current=$[M],$[M]=null,M--)}function A(i,o){M++,$[M]=i.current,i.current=o}var re=B(null),se=B(null),Z=B(null),te=B(null);function le(i,o){switch(A(Z,o),A(se,i),A(re,null),o.nodeType){case 9:case 11:i=(i=o.documentElement)&&(i=i.namespaceURI)?iC(i):0;break;default:if(i=o.tagName,o=o.namespaceURI)o=iC(o),i=sC(o,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}X(re),A(re,i)}function pe(){X(re),X(se),X(Z)}function xe(i){i.memoizedState!==null&&A(te,i);var o=re.current,c=sC(o,i.type);o!==c&&(A(se,i),A(re,c))}function Me(i){se.current===i&&(X(re),X(se)),te.current===i&&(X(te),gu._currentValue=H)}var Re,je;function Xe(i){if(Re===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);Re=o&&o[1]||"",je=-1<c.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+Re+i+je}var ft=!1;function pt(i,o){if(!i||ft)return"";ft=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(o){var ve=function(){throw Error()};if(Object.defineProperty(ve.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ve,[])}catch(de){var ue=de}Reflect.construct(i,[],ve)}else{try{ve.call()}catch(de){ue=de}i.call(ve.prototype)}}else{try{throw Error()}catch(de){ue=de}(ve=i())&&typeof ve.catch=="function"&&ve.catch(function(){})}}catch(de){if(de&&ue&&typeof de.stack=="string")return[de.stack,ue.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=m.DetermineComponentFrameRoot(),T=x[0],z=x[1];if(T&&z){var Q=T.split(`
44
- `),ae=z.split(`
45
- `);for(b=m=0;m<Q.length&&!Q[m].includes("DetermineComponentFrameRoot");)m++;for(;b<ae.length&&!ae[b].includes("DetermineComponentFrameRoot");)b++;if(m===Q.length||b===ae.length)for(m=Q.length-1,b=ae.length-1;1<=m&&0<=b&&Q[m]!==ae[b];)b--;for(;1<=m&&0<=b;m--,b--)if(Q[m]!==ae[b]){if(m!==1||b!==1)do if(m--,b--,0>b||Q[m]!==ae[b]){var fe=`
46
- `+Q[m].replace(" at new "," at ");return i.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",i.displayName)),fe}while(1<=m&&0<=b);break}}}finally{ft=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?Xe(c):""}function he(i,o){switch(i.tag){case 26:case 27:case 5:return Xe(i.type);case 16:return Xe("Lazy");case 13:return i.child!==o&&o!==null?Xe("Suspense Fallback"):Xe("Suspense");case 19:return Xe("SuspenseList");case 0:case 15:return pt(i.type,!1);case 11:return pt(i.type.render,!1);case 1:return pt(i.type,!0);case 31:return Xe("Activity");default:return""}}function Le(i){try{var o="",c=null;do o+=he(i,c),c=i,i=i.return;while(i);return o}catch(m){return`
47
- Error generating stack: `+m.message+`
48
- `+m.stack}}var Ae=Object.prototype.hasOwnProperty,nt=e.unstable_scheduleCallback,gt=e.unstable_cancelCallback,qe=e.unstable_shouldYield,vt=e.unstable_requestPaint,Se=e.unstable_now,De=e.unstable_getCurrentPriorityLevel,ce=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,Oe=e.unstable_NormalPriority,We=e.unstable_LowPriority,we=e.unstable_IdlePriority,Ie=e.log,ot=e.unstable_setDisableYieldValue,rt=null,ze=null;function St(i){if(typeof Ie=="function"&&ot(i),ze&&typeof ze.setStrictMode=="function")try{ze.setStrictMode(rt,i)}catch{}}var at=Math.clz32?Math.clz32:Nn,vn=Math.log,tn=Math.LN2;function Nn(i){return i>>>=0,i===0?32:31-(vn(i)/tn|0)|0}var xr=256,rr=262144,jt=4194304;function zt(i){var o=i&42;if(o!==0)return o;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function He(i,o,c){var m=i.pendingLanes;if(m===0)return 0;var b=0,x=i.suspendedLanes,T=i.pingedLanes;i=i.warmLanes;var z=m&134217727;return z!==0?(m=z&~x,m!==0?b=zt(m):(T&=z,T!==0?b=zt(T):c||(c=z&~i,c!==0&&(b=zt(c))))):(z=m&~x,z!==0?b=zt(z):T!==0?b=zt(T):c||(c=m&~i,c!==0&&(b=zt(c)))),b===0?0:o!==0&&o!==b&&(o&x)===0&&(x=b&-b,c=o&-o,x>=c||x===32&&(c&4194048)!==0)?o:b}function ct(i,o){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&o)===0}function st(i,o){switch(i){case 1:case 2:case 4:case 8:case 64:return o+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 o+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 mt(){var i=jt;return jt<<=1,(jt&62914560)===0&&(jt=4194304),i}function an(i){for(var o=[],c=0;31>c;c++)o.push(i);return o}function Ce(i,o){i.pendingLanes|=o,o!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Te(i,o,c,m,b,x){var T=i.pendingLanes;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=c,i.entangledLanes&=c,i.errorRecoveryDisabledLanes&=c,i.shellSuspendCounter=0;var z=i.entanglements,Q=i.expirationTimes,ae=i.hiddenUpdates;for(c=T&~c;0<c;){var fe=31-at(c),ve=1<<fe;z[fe]=0,Q[fe]=-1;var ue=ae[fe];if(ue!==null)for(ae[fe]=null,fe=0;fe<ue.length;fe++){var de=ue[fe];de!==null&&(de.lane&=-536870913)}c&=~ve}m!==0&&_t(i,m,0),x!==0&&b===0&&i.tag!==0&&(i.suspendedLanes|=x&~(T&~o))}function _t(i,o,c){i.pendingLanes|=o,i.suspendedLanes&=~o;var m=31-at(o);i.entangledLanes|=o,i.entanglements[m]=i.entanglements[m]|1073741824|c&261930}function Qe(i,o){var c=i.entangledLanes|=o;for(i=i.entanglements;c;){var m=31-at(c),b=1<<m;b&o|i[m]&o&&(i[m]|=o),c&=~b}}function bt(i,o){var c=o&-o;return c=(c&42)!==0?1:qt(c),(c&(i.suspendedLanes|o))!==0?0:c}function qt(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Ot(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function sn(){var i=F.p;return i!==0?i:(i=window.event,i===void 0?32:TC(i.type))}function G(i,o){var c=F.p;try{return F.p=i,o()}finally{F.p=c}}var Ye=Math.random().toString(36).slice(2),It="__reactFiber$"+Ye,Cn="__reactProps$"+Ye,li="__reactContainer$"+Ye,$t="__reactEvents$"+Ye,ir="__reactListeners$"+Ye,Ac="__reactHandles$"+Ye,Gd="__reactResources$"+Ye,sa="__reactMarker$"+Ye;function Dc(i){delete i[It],delete i[Cn],delete i[$t],delete i[ir],delete i[Ac]}function lo(i){var o=i[It];if(o)return o;for(var c=i.parentNode;c;){if(o=c[li]||c[It]){if(c=o.alternate,o.child!==null||c!==null&&c.child!==null)for(i=hC(i);i!==null;){if(c=i[It])return c;i=hC(i)}return o}i=c,c=i.parentNode}return null}function co(i){if(i=i[It]||i[li]){var o=i.tag;if(o===5||o===6||o===13||o===31||o===26||o===27||o===3)return i}return null}function oa(i){var o=i.tag;if(o===5||o===26||o===27||o===6)return i.stateNode;throw Error(r(33))}function Yi(i){var o=i[Gd];return o||(o=i[Gd]={hoistableStyles:new Map,hoistableScripts:new Map}),o}function Mn(i){i[sa]=!0}var Yd=new Set,Xd={};function Xi(i,o){ws(i,o),ws(i+"Capture",o)}function ws(i,o){for(Xd[i]=o,i=0;i<o.length;i++)Yd.add(o[i])}var Zd=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]*$"),J={},ie={};function Ee(i){return Ae.call(ie,i)?!0:Ae.call(J,i)?!1:Zd.test(i)?ie[i]=!0:(J[i]=!0,!1)}function Fe(i,o,c){if(Ee(o))if(c===null)i.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":i.removeAttribute(o);return;case"boolean":var m=o.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){i.removeAttribute(o);return}}i.setAttribute(o,""+c)}}function Nt(i,o,c){if(c===null)i.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(o);return}i.setAttribute(o,""+c)}}function Wt(i,o,c,m){if(m===null)i.removeAttribute(c);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(c);return}i.setAttributeNS(o,c,""+m)}}function Vt(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Dr(i){var o=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function Qd(i,o,c){var m=Object.getOwnPropertyDescriptor(i.constructor.prototype,o);if(!i.hasOwnProperty(o)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var b=m.get,x=m.set;return Object.defineProperty(i,o,{configurable:!0,get:function(){return b.call(this)},set:function(T){c=""+T,x.call(this,T)}}),Object.defineProperty(i,o,{enumerable:m.enumerable}),{getValue:function(){return c},setValue:function(T){c=""+T},stopTracking:function(){i._valueTracker=null,delete i[o]}}}}function sl(i){if(!i._valueTracker){var o=Dr(i)?"checked":"value";i._valueTracker=Qd(i,o,""+i[o])}}function Zx(i){if(!i)return!1;var o=i._valueTracker;if(!o)return!0;var c=o.getValue(),m="";return i&&(m=Dr(i)?i.checked?"true":"false":i.value),i=m,i!==c?(o.setValue(i),!0):!1}function Jd(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var h3=/[\n"\\]/g;function ci(i){return i.replace(h3,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function $p(i,o,c,m,b,x,T,z){i.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?i.type=T:i.removeAttribute("type"),o!=null?T==="number"?(o===0&&i.value===""||i.value!=o)&&(i.value=""+Vt(o)):i.value!==""+Vt(o)&&(i.value=""+Vt(o)):T!=="submit"&&T!=="reset"||i.removeAttribute("value"),o!=null?Wp(i,T,Vt(o)):c!=null?Wp(i,T,Vt(c)):m!=null&&i.removeAttribute("value"),b==null&&x!=null&&(i.defaultChecked=!!x),b!=null&&(i.checked=b&&typeof b!="function"&&typeof b!="symbol"),z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?i.name=""+Vt(z):i.removeAttribute("name")}function Qx(i,o,c,m,b,x,T,z){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(i.type=x),o!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||o!=null)){sl(i);return}c=c!=null?""+Vt(c):"",o=o!=null?""+Vt(o):c,z||o===i.value||(i.value=o),i.defaultValue=o}m=m??b,m=typeof m!="function"&&typeof m!="symbol"&&!!m,i.checked=z?i.checked:!!m,i.defaultChecked=!!m,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(i.name=T),sl(i)}function Wp(i,o,c){o==="number"&&Jd(i.ownerDocument)===i||i.defaultValue===""+c||(i.defaultValue=""+c)}function ol(i,o,c,m){if(i=i.options,o){o={};for(var b=0;b<c.length;b++)o["$"+c[b]]=!0;for(c=0;c<i.length;c++)b=o.hasOwnProperty("$"+i[c].value),i[c].selected!==b&&(i[c].selected=b),b&&m&&(i[c].defaultSelected=!0)}else{for(c=""+Vt(c),o=null,b=0;b<i.length;b++){if(i[b].value===c){i[b].selected=!0,m&&(i[b].defaultSelected=!0);return}o!==null||i[b].disabled||(o=i[b])}o!==null&&(o.selected=!0)}}function Jx(i,o,c){if(o!=null&&(o=""+Vt(o),o!==i.value&&(i.value=o),c==null)){i.defaultValue!==o&&(i.defaultValue=o);return}i.defaultValue=c!=null?""+Vt(c):""}function e1(i,o,c,m){if(o==null){if(m!=null){if(c!=null)throw Error(r(92));if(q(m)){if(1<m.length)throw Error(r(93));m=m[0]}c=m}c==null&&(c=""),o=c}c=Vt(o),i.defaultValue=c,m=i.textContent,m===c&&m!==""&&m!==null&&(i.value=m),sl(i)}function al(i,o){if(o){var c=i.firstChild;if(c&&c===i.lastChild&&c.nodeType===3){c.nodeValue=o;return}}i.textContent=o}var f3=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 t1(i,o,c){var m=o.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?m?i.setProperty(o,""):o==="float"?i.cssFloat="":i[o]="":m?i.setProperty(o,c):typeof c!="number"||c===0||f3.has(o)?o==="float"?i.cssFloat=c:i[o]=(""+c).trim():i[o]=c+"px"}function n1(i,o,c){if(o!=null&&typeof o!="object")throw Error(r(62));if(i=i.style,c!=null){for(var m in c)!c.hasOwnProperty(m)||o!=null&&o.hasOwnProperty(m)||(m.indexOf("--")===0?i.setProperty(m,""):m==="float"?i.cssFloat="":i[m]="");for(var b in o)m=o[b],o.hasOwnProperty(b)&&c[b]!==m&&t1(i,b,m)}else for(var x in o)o.hasOwnProperty(x)&&t1(i,x,o[x])}function Vp(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var m3=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"]]),p3=/^[\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 eh(i){return p3.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Ss(){}var qp=null;function Kp(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var ll=null,cl=null;function r1(i){var o=co(i);if(o&&(i=o.stateNode)){var c=i[Cn]||null;e:switch(i=o.stateNode,o.type){case"input":if($p(i,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),o=c.name,c.type==="radio"&&o!=null){for(c=i;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+ci(""+o)+'"][type="radio"]'),o=0;o<c.length;o++){var m=c[o];if(m!==i&&m.form===i.form){var b=m[Cn]||null;if(!b)throw Error(r(90));$p(m,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(o=0;o<c.length;o++)m=c[o],m.form===i.form&&Zx(m)}break e;case"textarea":Jx(i,c.value,c.defaultValue);break e;case"select":o=c.value,o!=null&&ol(i,!!c.multiple,o,!1)}}}var Gp=!1;function i1(i,o,c){if(Gp)return i(o,c);Gp=!0;try{var m=i(o);return m}finally{if(Gp=!1,(ll!==null||cl!==null)&&(Fh(),ll&&(o=ll,i=cl,cl=ll=null,r1(o),i)))for(o=0;o<i.length;o++)r1(i[o])}}function jc(i,o){var c=i.stateNode;if(c===null)return null;var m=c[Cn]||null;if(m===null)return null;c=m[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(i=i.type,m=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!m;break e;default:i=!1}if(i)return null;if(c&&typeof c!="function")throw Error(r(231,o,typeof c));return c}var Cs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yp=!1;if(Cs)try{var Oc={};Object.defineProperty(Oc,"passive",{get:function(){Yp=!0}}),window.addEventListener("test",Oc,Oc),window.removeEventListener("test",Oc,Oc)}catch{Yp=!1}var uo=null,Xp=null,th=null;function s1(){if(th)return th;var i,o=Xp,c=o.length,m,b="value"in uo?uo.value:uo.textContent,x=b.length;for(i=0;i<c&&o[i]===b[i];i++);var T=c-i;for(m=1;m<=T&&o[c-m]===b[x-m];m++);return th=b.slice(i,1<m?1-m:void 0)}function nh(i){var o=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&o===13&&(i=13)):i=o,i===10&&(i=13),32<=i||i===13?i:0}function rh(){return!0}function o1(){return!1}function jr(i){function o(c,m,b,x,T){this._reactName=c,this._targetInst=b,this.type=m,this.nativeEvent=x,this.target=T,this.currentTarget=null;for(var z in i)i.hasOwnProperty(z)&&(c=i[z],this[z]=c?c(x):x[z]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?rh:o1,this.isPropagationStopped=o1,this}return p(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=rh)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=rh)},persist:function(){},isPersistent:rh}),o}var aa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ih=jr(aa),Lc=p({},aa,{view:0,detail:0}),g3=jr(Lc),Zp,Qp,zc,sh=p({},Lc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:eg,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==zc&&(zc&&i.type==="mousemove"?(Zp=i.screenX-zc.screenX,Qp=i.screenY-zc.screenY):Qp=Zp=0,zc=i),Zp)},movementY:function(i){return"movementY"in i?i.movementY:Qp}}),a1=jr(sh),v3=p({},sh,{dataTransfer:0}),_3=jr(v3),b3=p({},Lc,{relatedTarget:0}),Jp=jr(b3),y3=p({},aa,{animationName:0,elapsedTime:0,pseudoElement:0}),x3=jr(y3),w3=p({},aa,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),S3=jr(w3),C3=p({},aa,{data:0}),l1=jr(C3),k3={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},E3={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"},R3={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function T3(i){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(i):(i=R3[i])?!!o[i]:!1}function eg(){return T3}var N3=p({},Lc,{key:function(i){if(i.key){var o=k3[i.key]||i.key;if(o!=="Unidentified")return o}return i.type==="keypress"?(i=nh(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?E3[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:eg,charCode:function(i){return i.type==="keypress"?nh(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?nh(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),M3=jr(N3),A3=p({},sh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),c1=jr(A3),D3=p({},Lc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:eg}),j3=jr(D3),O3=p({},aa,{propertyName:0,elapsedTime:0,pseudoElement:0}),L3=jr(O3),z3=p({},sh,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),P3=jr(z3),B3=p({},aa,{newState:0,oldState:0}),I3=jr(B3),H3=[9,13,27,32],tg=Cs&&"CompositionEvent"in window,Pc=null;Cs&&"documentMode"in document&&(Pc=document.documentMode);var F3=Cs&&"TextEvent"in window&&!Pc,u1=Cs&&(!tg||Pc&&8<Pc&&11>=Pc),d1=" ",h1=!1;function f1(i,o){switch(i){case"keyup":return H3.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function m1(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var ul=!1;function U3(i,o){switch(i){case"compositionend":return m1(o);case"keypress":return o.which!==32?null:(h1=!0,d1);case"textInput":return i=o.data,i===d1&&h1?null:i;default:return null}}function $3(i,o){if(ul)return i==="compositionend"||!tg&&f1(i,o)?(i=s1(),th=Xp=uo=null,ul=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return u1&&o.locale!=="ko"?null:o.data;default:return null}}var W3={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 p1(i){var o=i&&i.nodeName&&i.nodeName.toLowerCase();return o==="input"?!!W3[i.type]:o==="textarea"}function g1(i,o,c,m){ll?cl?cl.push(m):cl=[m]:ll=m,o=Gh(o,"onChange"),0<o.length&&(c=new ih("onChange","change",null,c,m),i.push({event:c,listeners:o}))}var Bc=null,Ic=null;function V3(i){QS(i,0)}function oh(i){var o=oa(i);if(Zx(o))return i}function v1(i,o){if(i==="change")return o}var _1=!1;if(Cs){var ng;if(Cs){var rg="oninput"in document;if(!rg){var b1=document.createElement("div");b1.setAttribute("oninput","return;"),rg=typeof b1.oninput=="function"}ng=rg}else ng=!1;_1=ng&&(!document.documentMode||9<document.documentMode)}function y1(){Bc&&(Bc.detachEvent("onpropertychange",x1),Ic=Bc=null)}function x1(i){if(i.propertyName==="value"&&oh(Ic)){var o=[];g1(o,Ic,i,Kp(i)),i1(V3,o)}}function q3(i,o,c){i==="focusin"?(y1(),Bc=o,Ic=c,Bc.attachEvent("onpropertychange",x1)):i==="focusout"&&y1()}function K3(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return oh(Ic)}function G3(i,o){if(i==="click")return oh(o)}function Y3(i,o){if(i==="input"||i==="change")return oh(o)}function X3(i,o){return i===o&&(i!==0||1/i===1/o)||i!==i&&o!==o}var qr=typeof Object.is=="function"?Object.is:X3;function Hc(i,o){if(qr(i,o))return!0;if(typeof i!="object"||i===null||typeof o!="object"||o===null)return!1;var c=Object.keys(i),m=Object.keys(o);if(c.length!==m.length)return!1;for(m=0;m<c.length;m++){var b=c[m];if(!Ae.call(o,b)||!qr(i[b],o[b]))return!1}return!0}function w1(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function S1(i,o){var c=w1(i);i=0;for(var m;c;){if(c.nodeType===3){if(m=i+c.textContent.length,i<=o&&m>=o)return{node:c,offset:o-i};i=m}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=w1(c)}}function C1(i,o){return i&&o?i===o?!0:i&&i.nodeType===3?!1:o&&o.nodeType===3?C1(i,o.parentNode):"contains"in i?i.contains(o):i.compareDocumentPosition?!!(i.compareDocumentPosition(o)&16):!1:!1}function k1(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var o=Jd(i.document);o instanceof i.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)i=o.contentWindow;else break;o=Jd(i.document)}return o}function ig(i){var o=i&&i.nodeName&&i.nodeName.toLowerCase();return o&&(o==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||o==="textarea"||i.contentEditable==="true")}var Z3=Cs&&"documentMode"in document&&11>=document.documentMode,dl=null,sg=null,Fc=null,og=!1;function E1(i,o,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;og||dl==null||dl!==Jd(m)||(m=dl,"selectionStart"in m&&ig(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Fc&&Hc(Fc,m)||(Fc=m,m=Gh(sg,"onSelect"),0<m.length&&(o=new ih("onSelect","select",null,o,c),i.push({event:o,listeners:m}),o.target=dl)))}function la(i,o){var c={};return c[i.toLowerCase()]=o.toLowerCase(),c["Webkit"+i]="webkit"+o,c["Moz"+i]="moz"+o,c}var hl={animationend:la("Animation","AnimationEnd"),animationiteration:la("Animation","AnimationIteration"),animationstart:la("Animation","AnimationStart"),transitionrun:la("Transition","TransitionRun"),transitionstart:la("Transition","TransitionStart"),transitioncancel:la("Transition","TransitionCancel"),transitionend:la("Transition","TransitionEnd")},ag={},R1={};Cs&&(R1=document.createElement("div").style,"AnimationEvent"in window||(delete hl.animationend.animation,delete hl.animationiteration.animation,delete hl.animationstart.animation),"TransitionEvent"in window||delete hl.transitionend.transition);function ca(i){if(ag[i])return ag[i];if(!hl[i])return i;var o=hl[i],c;for(c in o)if(o.hasOwnProperty(c)&&c in R1)return ag[i]=o[c];return i}var T1=ca("animationend"),N1=ca("animationiteration"),M1=ca("animationstart"),Q3=ca("transitionrun"),J3=ca("transitionstart"),eO=ca("transitioncancel"),A1=ca("transitionend"),D1=new Map,lg="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(" ");lg.push("scrollEnd");function Oi(i,o){D1.set(i,o),Xi(o,[i])}var ah=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},ui=[],fl=0,cg=0;function lh(){for(var i=fl,o=cg=fl=0;o<i;){var c=ui[o];ui[o++]=null;var m=ui[o];ui[o++]=null;var b=ui[o];ui[o++]=null;var x=ui[o];if(ui[o++]=null,m!==null&&b!==null){var T=m.pending;T===null?b.next=b:(b.next=T.next,T.next=b),m.pending=b}x!==0&&j1(c,b,x)}}function ch(i,o,c,m){ui[fl++]=i,ui[fl++]=o,ui[fl++]=c,ui[fl++]=m,cg|=m,i.lanes|=m,i=i.alternate,i!==null&&(i.lanes|=m)}function ug(i,o,c,m){return ch(i,o,c,m),uh(i)}function ua(i,o){return ch(i,null,null,o),uh(i)}function j1(i,o,c){i.lanes|=c;var m=i.alternate;m!==null&&(m.lanes|=c);for(var b=!1,x=i.return;x!==null;)x.childLanes|=c,m=x.alternate,m!==null&&(m.childLanes|=c),x.tag===22&&(i=x.stateNode,i===null||i._visibility&1||(b=!0)),i=x,x=x.return;return i.tag===3?(x=i.stateNode,b&&o!==null&&(b=31-at(c),i=x.hiddenUpdates,m=i[b],m===null?i[b]=[o]:m.push(o),o.lane=c|536870912),x):null}function uh(i){if(50<cu)throw cu=0,bv=null,Error(r(185));for(var o=i.return;o!==null;)i=o,o=i.return;return i.tag===3?i.stateNode:null}var ml={};function tO(i,o,c,m){this.tag=i,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kr(i,o,c,m){return new tO(i,o,c,m)}function dg(i){return i=i.prototype,!(!i||!i.isReactComponent)}function ks(i,o){var c=i.alternate;return c===null?(c=Kr(i.tag,o,i.key,i.mode),c.elementType=i.elementType,c.type=i.type,c.stateNode=i.stateNode,c.alternate=i,i.alternate=c):(c.pendingProps=o,c.type=i.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=i.flags&65011712,c.childLanes=i.childLanes,c.lanes=i.lanes,c.child=i.child,c.memoizedProps=i.memoizedProps,c.memoizedState=i.memoizedState,c.updateQueue=i.updateQueue,o=i.dependencies,c.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},c.sibling=i.sibling,c.index=i.index,c.ref=i.ref,c.refCleanup=i.refCleanup,c}function O1(i,o){i.flags&=65011714;var c=i.alternate;return c===null?(i.childLanes=0,i.lanes=o,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=c.childLanes,i.lanes=c.lanes,i.child=c.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=c.memoizedProps,i.memoizedState=c.memoizedState,i.updateQueue=c.updateQueue,i.type=c.type,o=c.dependencies,i.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),i}function dh(i,o,c,m,b,x){var T=0;if(m=i,typeof i=="function")dg(i)&&(T=1);else if(typeof i=="string")T=o4(i,c,re.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case Y:return i=Kr(31,c,o,b),i.elementType=Y,i.lanes=x,i;case S:return da(c.children,b,x,o);case C:T=8,b|=24;break;case k:return i=Kr(12,c,o,b|2),i.elementType=k,i.lanes=x,i;case j:return i=Kr(13,c,o,b),i.elementType=j,i.lanes=x,i;case D:return i=Kr(19,c,o,b),i.elementType=D,i.lanes=x,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case E:T=10;break e;case R:T=9;break e;case N:T=11;break e;case L:T=14;break e;case U:T=16,m=null;break e}T=29,c=Error(r(130,i===null?"null":typeof i,"")),m=null}return o=Kr(T,c,o,b),o.elementType=i,o.type=m,o.lanes=x,o}function da(i,o,c,m){return i=Kr(7,i,m,o),i.lanes=c,i}function hg(i,o,c){return i=Kr(6,i,null,o),i.lanes=c,i}function L1(i){var o=Kr(18,null,null,0);return o.stateNode=i,o}function fg(i,o,c){return o=Kr(4,i.children!==null?i.children:[],i.key,o),o.lanes=c,o.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},o}var z1=new WeakMap;function di(i,o){if(typeof i=="object"&&i!==null){var c=z1.get(i);return c!==void 0?c:(o={value:i,source:o,stack:Le(o)},z1.set(i,o),o)}return{value:i,source:o,stack:Le(o)}}var pl=[],gl=0,hh=null,Uc=0,hi=[],fi=0,ho=null,Zi=1,Qi="";function Es(i,o){pl[gl++]=Uc,pl[gl++]=hh,hh=i,Uc=o}function P1(i,o,c){hi[fi++]=Zi,hi[fi++]=Qi,hi[fi++]=ho,ho=i;var m=Zi;i=Qi;var b=32-at(m)-1;m&=~(1<<b),c+=1;var x=32-at(o)+b;if(30<x){var T=b-b%5;x=(m&(1<<T)-1).toString(32),m>>=T,b-=T,Zi=1<<32-at(o)+b|c<<b|m,Qi=x+i}else Zi=1<<x|c<<b|m,Qi=i}function mg(i){i.return!==null&&(Es(i,1),P1(i,1,0))}function pg(i){for(;i===hh;)hh=pl[--gl],pl[gl]=null,Uc=pl[--gl],pl[gl]=null;for(;i===ho;)ho=hi[--fi],hi[fi]=null,Qi=hi[--fi],hi[fi]=null,Zi=hi[--fi],hi[fi]=null}function B1(i,o){hi[fi++]=Zi,hi[fi++]=Qi,hi[fi++]=ho,Zi=o.id,Qi=o.overflow,ho=i}var sr=null,ln=null,Dt=!1,fo=null,mi=!1,gg=Error(r(519));function mo(i){var o=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw $c(di(o,i)),gg}function I1(i){var o=i.stateNode,c=i.type,m=i.memoizedProps;switch(o[It]=i,o[Cn]=m,c){case"dialog":kt("cancel",o),kt("close",o);break;case"iframe":case"object":case"embed":kt("load",o);break;case"video":case"audio":for(c=0;c<du.length;c++)kt(du[c],o);break;case"source":kt("error",o);break;case"img":case"image":case"link":kt("error",o),kt("load",o);break;case"details":kt("toggle",o);break;case"input":kt("invalid",o),Qx(o,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":kt("invalid",o);break;case"textarea":kt("invalid",o),e1(o,m.value,m.defaultValue,m.children)}c=m.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||o.textContent===""+c||m.suppressHydrationWarning===!0||nC(o.textContent,c)?(m.popover!=null&&(kt("beforetoggle",o),kt("toggle",o)),m.onScroll!=null&&kt("scroll",o),m.onScrollEnd!=null&&kt("scrollend",o),m.onClick!=null&&(o.onclick=Ss),o=!0):o=!1,o||mo(i,!0)}function H1(i){for(sr=i.return;sr;)switch(sr.tag){case 5:case 31:case 13:mi=!1;return;case 27:case 3:mi=!0;return;default:sr=sr.return}}function vl(i){if(i!==sr)return!1;if(!Dt)return H1(i),Dt=!0,!1;var o=i.tag,c;if((c=o!==3&&o!==27)&&((c=o===5)&&(c=i.type,c=!(c!=="form"&&c!=="button")||Ov(i.type,i.memoizedProps)),c=!c),c&&ln&&mo(i),H1(i),o===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));ln=dC(i)}else if(o===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));ln=dC(i)}else o===27?(o=ln,To(i.type)?(i=Iv,Iv=null,ln=i):ln=o):ln=sr?gi(i.stateNode.nextSibling):null;return!0}function ha(){ln=sr=null,Dt=!1}function vg(){var i=fo;return i!==null&&(Pr===null?Pr=i:Pr.push.apply(Pr,i),fo=null),i}function $c(i){fo===null?fo=[i]:fo.push(i)}var _g=B(null),fa=null,Rs=null;function po(i,o,c){A(_g,o._currentValue),o._currentValue=c}function Ts(i){i._currentValue=_g.current,X(_g)}function bg(i,o,c){for(;i!==null;){var m=i.alternate;if((i.childLanes&o)!==o?(i.childLanes|=o,m!==null&&(m.childLanes|=o)):m!==null&&(m.childLanes&o)!==o&&(m.childLanes|=o),i===c)break;i=i.return}}function yg(i,o,c,m){var b=i.child;for(b!==null&&(b.return=i);b!==null;){var x=b.dependencies;if(x!==null){var T=b.child;x=x.firstContext;e:for(;x!==null;){var z=x;x=b;for(var Q=0;Q<o.length;Q++)if(z.context===o[Q]){x.lanes|=c,z=x.alternate,z!==null&&(z.lanes|=c),bg(x.return,c,i),m||(T=null);break e}x=z.next}}else if(b.tag===18){if(T=b.return,T===null)throw Error(r(341));T.lanes|=c,x=T.alternate,x!==null&&(x.lanes|=c),bg(T,c,i),T=null}else T=b.child;if(T!==null)T.return=b;else for(T=b;T!==null;){if(T===i){T=null;break}if(b=T.sibling,b!==null){b.return=T.return,T=b;break}T=T.return}b=T}}function _l(i,o,c,m){i=null;for(var b=o,x=!1;b!==null;){if(!x){if((b.flags&524288)!==0)x=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var T=b.alternate;if(T===null)throw Error(r(387));if(T=T.memoizedProps,T!==null){var z=b.type;qr(b.pendingProps.value,T.value)||(i!==null?i.push(z):i=[z])}}else if(b===te.current){if(T=b.alternate,T===null)throw Error(r(387));T.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(i!==null?i.push(gu):i=[gu])}b=b.return}i!==null&&yg(o,i,c,m),o.flags|=262144}function fh(i){for(i=i.firstContext;i!==null;){if(!qr(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function ma(i){fa=i,Rs=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function or(i){return F1(fa,i)}function mh(i,o){return fa===null&&ma(i),F1(i,o)}function F1(i,o){var c=o._currentValue;if(o={context:o,memoizedValue:c,next:null},Rs===null){if(i===null)throw Error(r(308));Rs=o,i.dependencies={lanes:0,firstContext:o},i.flags|=524288}else Rs=Rs.next=o;return c}var nO=typeof AbortController<"u"?AbortController:function(){var i=[],o=this.signal={aborted:!1,addEventListener:function(c,m){i.push(m)}};this.abort=function(){o.aborted=!0,i.forEach(function(c){return c()})}},rO=e.unstable_scheduleCallback,iO=e.unstable_NormalPriority,An={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function xg(){return{controller:new nO,data:new Map,refCount:0}}function Wc(i){i.refCount--,i.refCount===0&&rO(iO,function(){i.controller.abort()})}var Vc=null,wg=0,bl=0,yl=null;function sO(i,o){if(Vc===null){var c=Vc=[];wg=0,bl=kv(),yl={status:"pending",value:void 0,then:function(m){c.push(m)}}}return wg++,o.then(U1,U1),o}function U1(){if(--wg===0&&Vc!==null){yl!==null&&(yl.status="fulfilled");var i=Vc;Vc=null,bl=0,yl=null;for(var o=0;o<i.length;o++)(0,i[o])()}}function oO(i,o){var c=[],m={status:"pending",value:null,reason:null,then:function(b){c.push(b)}};return i.then(function(){m.status="fulfilled",m.value=o;for(var b=0;b<c.length;b++)(0,c[b])(o)},function(b){for(m.status="rejected",m.reason=b,b=0;b<c.length;b++)(0,c[b])(void 0)}),m}var $1=O.S;O.S=function(i,o){ES=Se(),typeof o=="object"&&o!==null&&typeof o.then=="function"&&sO(i,o),$1!==null&&$1(i,o)};var pa=B(null);function Sg(){var i=pa.current;return i!==null?i:nn.pooledCache}function ph(i,o){o===null?A(pa,pa.current):A(pa,o.pool)}function W1(){var i=Sg();return i===null?null:{parent:An._currentValue,pool:i}}var xl=Error(r(460)),Cg=Error(r(474)),gh=Error(r(542)),vh={then:function(){}};function V1(i){return i=i.status,i==="fulfilled"||i==="rejected"}function q1(i,o,c){switch(c=i[c],c===void 0?i.push(o):c!==o&&(o.then(Ss,Ss),o=c),o.status){case"fulfilled":return o.value;case"rejected":throw i=o.reason,G1(i),i;default:if(typeof o.status=="string")o.then(Ss,Ss);else{if(i=nn,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=o,i.status="pending",i.then(function(m){if(o.status==="pending"){var b=o;b.status="fulfilled",b.value=m}},function(m){if(o.status==="pending"){var b=o;b.status="rejected",b.reason=m}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw i=o.reason,G1(i),i}throw va=o,xl}}function ga(i){try{var o=i._init;return o(i._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(va=c,xl):c}}var va=null;function K1(){if(va===null)throw Error(r(459));var i=va;return va=null,i}function G1(i){if(i===xl||i===gh)throw Error(r(483))}var wl=null,qc=0;function _h(i){var o=qc;return qc+=1,wl===null&&(wl=[]),q1(wl,i,o)}function Kc(i,o){o=o.props.ref,i.ref=o!==void 0?o:null}function bh(i,o){throw o.$$typeof===v?Error(r(525)):(i=Object.prototype.toString.call(o),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":i)))}function Y1(i){function o(ne,ee){if(i){var oe=ne.deletions;oe===null?(ne.deletions=[ee],ne.flags|=16):oe.push(ee)}}function c(ne,ee){if(!i)return null;for(;ee!==null;)o(ne,ee),ee=ee.sibling;return null}function m(ne){for(var ee=new Map;ne!==null;)ne.key!==null?ee.set(ne.key,ne):ee.set(ne.index,ne),ne=ne.sibling;return ee}function b(ne,ee){return ne=ks(ne,ee),ne.index=0,ne.sibling=null,ne}function x(ne,ee,oe){return ne.index=oe,i?(oe=ne.alternate,oe!==null?(oe=oe.index,oe<ee?(ne.flags|=67108866,ee):oe):(ne.flags|=67108866,ee)):(ne.flags|=1048576,ee)}function T(ne){return i&&ne.alternate===null&&(ne.flags|=67108866),ne}function z(ne,ee,oe,ge){return ee===null||ee.tag!==6?(ee=hg(oe,ne.mode,ge),ee.return=ne,ee):(ee=b(ee,oe),ee.return=ne,ee)}function Q(ne,ee,oe,ge){var Ze=oe.type;return Ze===S?fe(ne,ee,oe.props.children,ge,oe.key):ee!==null&&(ee.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===U&&ga(Ze)===ee.type)?(ee=b(ee,oe.props),Kc(ee,oe),ee.return=ne,ee):(ee=dh(oe.type,oe.key,oe.props,null,ne.mode,ge),Kc(ee,oe),ee.return=ne,ee)}function ae(ne,ee,oe,ge){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==oe.containerInfo||ee.stateNode.implementation!==oe.implementation?(ee=fg(oe,ne.mode,ge),ee.return=ne,ee):(ee=b(ee,oe.children||[]),ee.return=ne,ee)}function fe(ne,ee,oe,ge,Ze){return ee===null||ee.tag!==7?(ee=da(oe,ne.mode,ge,Ze),ee.return=ne,ee):(ee=b(ee,oe),ee.return=ne,ee)}function ve(ne,ee,oe){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return ee=hg(""+ee,ne.mode,oe),ee.return=ne,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:return oe=dh(ee.type,ee.key,ee.props,null,ne.mode,oe),Kc(oe,ee),oe.return=ne,oe;case w:return ee=fg(ee,ne.mode,oe),ee.return=ne,ee;case U:return ee=ga(ee),ve(ne,ee,oe)}if(q(ee)||I(ee))return ee=da(ee,ne.mode,oe,null),ee.return=ne,ee;if(typeof ee.then=="function")return ve(ne,_h(ee),oe);if(ee.$$typeof===E)return ve(ne,mh(ne,ee),oe);bh(ne,ee)}return null}function ue(ne,ee,oe,ge){var Ze=ee!==null?ee.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return Ze!==null?null:z(ne,ee,""+oe,ge);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case y:return oe.key===Ze?Q(ne,ee,oe,ge):null;case w:return oe.key===Ze?ae(ne,ee,oe,ge):null;case U:return oe=ga(oe),ue(ne,ee,oe,ge)}if(q(oe)||I(oe))return Ze!==null?null:fe(ne,ee,oe,ge,null);if(typeof oe.then=="function")return ue(ne,ee,_h(oe),ge);if(oe.$$typeof===E)return ue(ne,ee,mh(ne,oe),ge);bh(ne,oe)}return null}function de(ne,ee,oe,ge,Ze){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return ne=ne.get(oe)||null,z(ee,ne,""+ge,Ze);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case y:return ne=ne.get(ge.key===null?oe:ge.key)||null,Q(ee,ne,ge,Ze);case w:return ne=ne.get(ge.key===null?oe:ge.key)||null,ae(ee,ne,ge,Ze);case U:return ge=ga(ge),de(ne,ee,oe,ge,Ze)}if(q(ge)||I(ge))return ne=ne.get(oe)||null,fe(ee,ne,ge,Ze,null);if(typeof ge.then=="function")return de(ne,ee,oe,_h(ge),Ze);if(ge.$$typeof===E)return de(ne,ee,oe,mh(ee,ge),Ze);bh(ee,ge)}return null}function $e(ne,ee,oe,ge){for(var Ze=null,Pt=null,Ge=ee,dt=ee=0,At=null;Ge!==null&&dt<oe.length;dt++){Ge.index>dt?(At=Ge,Ge=null):At=Ge.sibling;var Bt=ue(ne,Ge,oe[dt],ge);if(Bt===null){Ge===null&&(Ge=At);break}i&&Ge&&Bt.alternate===null&&o(ne,Ge),ee=x(Bt,ee,dt),Pt===null?Ze=Bt:Pt.sibling=Bt,Pt=Bt,Ge=At}if(dt===oe.length)return c(ne,Ge),Dt&&Es(ne,dt),Ze;if(Ge===null){for(;dt<oe.length;dt++)Ge=ve(ne,oe[dt],ge),Ge!==null&&(ee=x(Ge,ee,dt),Pt===null?Ze=Ge:Pt.sibling=Ge,Pt=Ge);return Dt&&Es(ne,dt),Ze}for(Ge=m(Ge);dt<oe.length;dt++)At=de(Ge,ne,dt,oe[dt],ge),At!==null&&(i&&At.alternate!==null&&Ge.delete(At.key===null?dt:At.key),ee=x(At,ee,dt),Pt===null?Ze=At:Pt.sibling=At,Pt=At);return i&&Ge.forEach(function(jo){return o(ne,jo)}),Dt&&Es(ne,dt),Ze}function et(ne,ee,oe,ge){if(oe==null)throw Error(r(151));for(var Ze=null,Pt=null,Ge=ee,dt=ee=0,At=null,Bt=oe.next();Ge!==null&&!Bt.done;dt++,Bt=oe.next()){Ge.index>dt?(At=Ge,Ge=null):At=Ge.sibling;var jo=ue(ne,Ge,Bt.value,ge);if(jo===null){Ge===null&&(Ge=At);break}i&&Ge&&jo.alternate===null&&o(ne,Ge),ee=x(jo,ee,dt),Pt===null?Ze=jo:Pt.sibling=jo,Pt=jo,Ge=At}if(Bt.done)return c(ne,Ge),Dt&&Es(ne,dt),Ze;if(Ge===null){for(;!Bt.done;dt++,Bt=oe.next())Bt=ve(ne,Bt.value,ge),Bt!==null&&(ee=x(Bt,ee,dt),Pt===null?Ze=Bt:Pt.sibling=Bt,Pt=Bt);return Dt&&Es(ne,dt),Ze}for(Ge=m(Ge);!Bt.done;dt++,Bt=oe.next())Bt=de(Ge,ne,dt,Bt.value,ge),Bt!==null&&(i&&Bt.alternate!==null&&Ge.delete(Bt.key===null?dt:Bt.key),ee=x(Bt,ee,dt),Pt===null?Ze=Bt:Pt.sibling=Bt,Pt=Bt);return i&&Ge.forEach(function(v4){return o(ne,v4)}),Dt&&Es(ne,dt),Ze}function Zt(ne,ee,oe,ge){if(typeof oe=="object"&&oe!==null&&oe.type===S&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case y:e:{for(var Ze=oe.key;ee!==null;){if(ee.key===Ze){if(Ze=oe.type,Ze===S){if(ee.tag===7){c(ne,ee.sibling),ge=b(ee,oe.props.children),ge.return=ne,ne=ge;break e}}else if(ee.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===U&&ga(Ze)===ee.type){c(ne,ee.sibling),ge=b(ee,oe.props),Kc(ge,oe),ge.return=ne,ne=ge;break e}c(ne,ee);break}else o(ne,ee);ee=ee.sibling}oe.type===S?(ge=da(oe.props.children,ne.mode,ge,oe.key),ge.return=ne,ne=ge):(ge=dh(oe.type,oe.key,oe.props,null,ne.mode,ge),Kc(ge,oe),ge.return=ne,ne=ge)}return T(ne);case w:e:{for(Ze=oe.key;ee!==null;){if(ee.key===Ze)if(ee.tag===4&&ee.stateNode.containerInfo===oe.containerInfo&&ee.stateNode.implementation===oe.implementation){c(ne,ee.sibling),ge=b(ee,oe.children||[]),ge.return=ne,ne=ge;break e}else{c(ne,ee);break}else o(ne,ee);ee=ee.sibling}ge=fg(oe,ne.mode,ge),ge.return=ne,ne=ge}return T(ne);case U:return oe=ga(oe),Zt(ne,ee,oe,ge)}if(q(oe))return $e(ne,ee,oe,ge);if(I(oe)){if(Ze=I(oe),typeof Ze!="function")throw Error(r(150));return oe=Ze.call(oe),et(ne,ee,oe,ge)}if(typeof oe.then=="function")return Zt(ne,ee,_h(oe),ge);if(oe.$$typeof===E)return Zt(ne,ee,mh(ne,oe),ge);bh(ne,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,ee!==null&&ee.tag===6?(c(ne,ee.sibling),ge=b(ee,oe),ge.return=ne,ne=ge):(c(ne,ee),ge=hg(oe,ne.mode,ge),ge.return=ne,ne=ge),T(ne)):c(ne,ee)}return function(ne,ee,oe,ge){try{qc=0;var Ze=Zt(ne,ee,oe,ge);return wl=null,Ze}catch(Ge){if(Ge===xl||Ge===gh)throw Ge;var Pt=Kr(29,Ge,null,ne.mode);return Pt.lanes=ge,Pt.return=ne,Pt}finally{}}}var _a=Y1(!0),X1=Y1(!1),go=!1;function kg(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Eg(i,o){i=i.updateQueue,o.updateQueue===i&&(o.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function vo(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function _o(i,o,c){var m=i.updateQueue;if(m===null)return null;if(m=m.shared,(Ht&2)!==0){var b=m.pending;return b===null?o.next=o:(o.next=b.next,b.next=o),m.pending=o,o=uh(i),j1(i,null,c),o}return ch(i,m,o,c),uh(i)}function Gc(i,o,c){if(o=o.updateQueue,o!==null&&(o=o.shared,(c&4194048)!==0)){var m=o.lanes;m&=i.pendingLanes,c|=m,o.lanes=c,Qe(i,c)}}function Rg(i,o){var c=i.updateQueue,m=i.alternate;if(m!==null&&(m=m.updateQueue,c===m)){var b=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var T={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?b=x=T:x=x.next=T,c=c.next}while(c!==null);x===null?b=x=o:x=x.next=o}else b=x=o;c={baseState:m.baseState,firstBaseUpdate:b,lastBaseUpdate:x,shared:m.shared,callbacks:m.callbacks},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=o:i.next=o,c.lastBaseUpdate=o}var Tg=!1;function Yc(){if(Tg){var i=yl;if(i!==null)throw i}}function Xc(i,o,c,m){Tg=!1;var b=i.updateQueue;go=!1;var x=b.firstBaseUpdate,T=b.lastBaseUpdate,z=b.shared.pending;if(z!==null){b.shared.pending=null;var Q=z,ae=Q.next;Q.next=null,T===null?x=ae:T.next=ae,T=Q;var fe=i.alternate;fe!==null&&(fe=fe.updateQueue,z=fe.lastBaseUpdate,z!==T&&(z===null?fe.firstBaseUpdate=ae:z.next=ae,fe.lastBaseUpdate=Q))}if(x!==null){var ve=b.baseState;T=0,fe=ae=Q=null,z=x;do{var ue=z.lane&-536870913,de=ue!==z.lane;if(de?(Mt&ue)===ue:(m&ue)===ue){ue!==0&&ue===bl&&(Tg=!0),fe!==null&&(fe=fe.next={lane:0,tag:z.tag,payload:z.payload,callback:null,next:null});e:{var $e=i,et=z;ue=o;var Zt=c;switch(et.tag){case 1:if($e=et.payload,typeof $e=="function"){ve=$e.call(Zt,ve,ue);break e}ve=$e;break e;case 3:$e.flags=$e.flags&-65537|128;case 0:if($e=et.payload,ue=typeof $e=="function"?$e.call(Zt,ve,ue):$e,ue==null)break e;ve=p({},ve,ue);break e;case 2:go=!0}}ue=z.callback,ue!==null&&(i.flags|=64,de&&(i.flags|=8192),de=b.callbacks,de===null?b.callbacks=[ue]:de.push(ue))}else de={lane:ue,tag:z.tag,payload:z.payload,callback:z.callback,next:null},fe===null?(ae=fe=de,Q=ve):fe=fe.next=de,T|=ue;if(z=z.next,z===null){if(z=b.shared.pending,z===null)break;de=z,z=de.next,de.next=null,b.lastBaseUpdate=de,b.shared.pending=null}}while(!0);fe===null&&(Q=ve),b.baseState=Q,b.firstBaseUpdate=ae,b.lastBaseUpdate=fe,x===null&&(b.shared.lanes=0),So|=T,i.lanes=T,i.memoizedState=ve}}function Z1(i,o){if(typeof i!="function")throw Error(r(191,i));i.call(o)}function Q1(i,o){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)Z1(c[i],o)}var Sl=B(null),yh=B(0);function J1(i,o){i=Ps,A(yh,i),A(Sl,o),Ps=i|o.baseLanes}function Ng(){A(yh,Ps),A(Sl,Sl.current)}function Mg(){Ps=yh.current,X(Sl),X(yh)}var Gr=B(null),pi=null;function bo(i){var o=i.alternate;A(kn,kn.current&1),A(Gr,i),pi===null&&(o===null||Sl.current!==null||o.memoizedState!==null)&&(pi=i)}function Ag(i){A(kn,kn.current),A(Gr,i),pi===null&&(pi=i)}function ew(i){i.tag===22?(A(kn,kn.current),A(Gr,i),pi===null&&(pi=i)):yo()}function yo(){A(kn,kn.current),A(Gr,Gr.current)}function Yr(i){X(Gr),pi===i&&(pi=null),X(kn)}var kn=B(0);function xh(i){for(var o=i;o!==null;){if(o.tag===13){var c=o.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Pv(c)||Bv(c)))return o}else if(o.tag===19&&(o.memoizedProps.revealOrder==="forwards"||o.memoizedProps.revealOrder==="backwards"||o.memoizedProps.revealOrder==="unstable_legacy-backwards"||o.memoizedProps.revealOrder==="together")){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===i)break;for(;o.sibling===null;){if(o.return===null||o.return===i)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Ns=0,ut=null,Yt=null,Dn=null,wh=!1,Cl=!1,ba=!1,Sh=0,Zc=0,kl=null,aO=0;function _n(){throw Error(r(321))}function Dg(i,o){if(o===null)return!1;for(var c=0;c<o.length&&c<i.length;c++)if(!qr(i[c],o[c]))return!1;return!0}function jg(i,o,c,m,b,x){return Ns=x,ut=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,O.H=i===null||i.memoizedState===null?Pw:Gg,ba=!1,x=c(m,b),ba=!1,Cl&&(x=nw(o,c,m,b)),tw(i),x}function tw(i){O.H=eu;var o=Yt!==null&&Yt.next!==null;if(Ns=0,Dn=Yt=ut=null,wh=!1,Zc=0,kl=null,o)throw Error(r(300));i===null||jn||(i=i.dependencies,i!==null&&fh(i)&&(jn=!0))}function nw(i,o,c,m){ut=i;var b=0;do{if(Cl&&(kl=null),Zc=0,Cl=!1,25<=b)throw Error(r(301));if(b+=1,Dn=Yt=null,i.updateQueue!=null){var x=i.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}O.H=Bw,x=o(c,m)}while(Cl);return x}function lO(){var i=O.H,o=i.useState()[0];return o=typeof o.then=="function"?Qc(o):o,i=i.useState()[0],(Yt!==null?Yt.memoizedState:null)!==i&&(ut.flags|=1024),o}function Og(){var i=Sh!==0;return Sh=0,i}function Lg(i,o,c){o.updateQueue=i.updateQueue,o.flags&=-2053,i.lanes&=~c}function zg(i){if(wh){for(i=i.memoizedState;i!==null;){var o=i.queue;o!==null&&(o.pending=null),i=i.next}wh=!1}Ns=0,Dn=Yt=ut=null,Cl=!1,Zc=Sh=0,kl=null}function wr(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dn===null?ut.memoizedState=Dn=i:Dn=Dn.next=i,Dn}function En(){if(Yt===null){var i=ut.alternate;i=i!==null?i.memoizedState:null}else i=Yt.next;var o=Dn===null?ut.memoizedState:Dn.next;if(o!==null)Dn=o,Yt=i;else{if(i===null)throw ut.alternate===null?Error(r(467)):Error(r(310));Yt=i,i={memoizedState:Yt.memoizedState,baseState:Yt.baseState,baseQueue:Yt.baseQueue,queue:Yt.queue,next:null},Dn===null?ut.memoizedState=Dn=i:Dn=Dn.next=i}return Dn}function Ch(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Qc(i){var o=Zc;return Zc+=1,kl===null&&(kl=[]),i=q1(kl,i,o),o=ut,(Dn===null?o.memoizedState:Dn.next)===null&&(o=o.alternate,O.H=o===null||o.memoizedState===null?Pw:Gg),i}function kh(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Qc(i);if(i.$$typeof===E)return or(i)}throw Error(r(438,String(i)))}function Pg(i){var o=null,c=ut.updateQueue;if(c!==null&&(o=c.memoCache),o==null){var m=ut.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(o={data:m.data.map(function(b){return b.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),c===null&&(c=Ch(),ut.updateQueue=c),c.memoCache=o,c=o.data[o.index],c===void 0)for(c=o.data[o.index]=Array(i),m=0;m<i;m++)c[m]=P;return o.index++,c}function Ms(i,o){return typeof o=="function"?o(i):o}function Eh(i){var o=En();return Bg(o,Yt,i)}function Bg(i,o,c){var m=i.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=c;var b=i.baseQueue,x=m.pending;if(x!==null){if(b!==null){var T=b.next;b.next=x.next,x.next=T}o.baseQueue=b=x,m.pending=null}if(x=i.baseState,b===null)i.memoizedState=x;else{o=b.next;var z=T=null,Q=null,ae=o,fe=!1;do{var ve=ae.lane&-536870913;if(ve!==ae.lane?(Mt&ve)===ve:(Ns&ve)===ve){var ue=ae.revertLane;if(ue===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),ve===bl&&(fe=!0);else if((Ns&ue)===ue){ae=ae.next,ue===bl&&(fe=!0);continue}else ve={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Q===null?(z=Q=ve,T=x):Q=Q.next=ve,ut.lanes|=ue,So|=ue;ve=ae.action,ba&&c(x,ve),x=ae.hasEagerState?ae.eagerState:c(x,ve)}else ue={lane:ve,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Q===null?(z=Q=ue,T=x):Q=Q.next=ue,ut.lanes|=ve,So|=ve;ae=ae.next}while(ae!==null&&ae!==o);if(Q===null?T=x:Q.next=z,!qr(x,i.memoizedState)&&(jn=!0,fe&&(c=yl,c!==null)))throw c;i.memoizedState=x,i.baseState=T,i.baseQueue=Q,m.lastRenderedState=x}return b===null&&(m.lanes=0),[i.memoizedState,m.dispatch]}function Ig(i){var o=En(),c=o.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=i;var m=c.dispatch,b=c.pending,x=o.memoizedState;if(b!==null){c.pending=null;var T=b=b.next;do x=i(x,T.action),T=T.next;while(T!==b);qr(x,o.memoizedState)||(jn=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),c.lastRenderedState=x}return[x,m]}function rw(i,o,c){var m=ut,b=En(),x=Dt;if(x){if(c===void 0)throw Error(r(407));c=c()}else c=o();var T=!qr((Yt||b).memoizedState,c);if(T&&(b.memoizedState=c,jn=!0),b=b.queue,Ug(ow.bind(null,m,b,i),[i]),b.getSnapshot!==o||T||Dn!==null&&Dn.memoizedState.tag&1){if(m.flags|=2048,El(9,{destroy:void 0},sw.bind(null,m,b,c,o),null),nn===null)throw Error(r(349));x||(Ns&127)!==0||iw(m,o,c)}return c}function iw(i,o,c){i.flags|=16384,i={getSnapshot:o,value:c},o=ut.updateQueue,o===null?(o=Ch(),ut.updateQueue=o,o.stores=[i]):(c=o.stores,c===null?o.stores=[i]:c.push(i))}function sw(i,o,c,m){o.value=c,o.getSnapshot=m,aw(o)&&lw(i)}function ow(i,o,c){return c(function(){aw(o)&&lw(i)})}function aw(i){var o=i.getSnapshot;i=i.value;try{var c=o();return!qr(i,c)}catch{return!0}}function lw(i){var o=ua(i,2);o!==null&&Br(o,i,2)}function Hg(i){var o=wr();if(typeof i=="function"){var c=i;if(i=c(),ba){St(!0);try{c()}finally{St(!1)}}}return o.memoizedState=o.baseState=i,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:i},o}function cw(i,o,c,m){return i.baseState=c,Bg(i,Yt,typeof m=="function"?m:Ms)}function cO(i,o,c,m,b){if(Nh(i))throw Error(r(485));if(i=o.action,i!==null){var x={payload:b,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(T){x.listeners.push(T)}};O.T!==null?c(!0):x.isTransition=!1,m(x),c=o.pending,c===null?(x.next=o.pending=x,uw(o,x)):(x.next=c.next,o.pending=c.next=x)}}function uw(i,o){var c=o.action,m=o.payload,b=i.state;if(o.isTransition){var x=O.T,T={};O.T=T;try{var z=c(b,m),Q=O.S;Q!==null&&Q(T,z),dw(i,o,z)}catch(ae){Fg(i,o,ae)}finally{x!==null&&T.types!==null&&(x.types=T.types),O.T=x}}else try{x=c(b,m),dw(i,o,x)}catch(ae){Fg(i,o,ae)}}function dw(i,o,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(m){hw(i,o,m)},function(m){return Fg(i,o,m)}):hw(i,o,c)}function hw(i,o,c){o.status="fulfilled",o.value=c,fw(o),i.state=c,o=i.pending,o!==null&&(c=o.next,c===o?i.pending=null:(c=c.next,o.next=c,uw(i,c)))}function Fg(i,o,c){var m=i.pending;if(i.pending=null,m!==null){m=m.next;do o.status="rejected",o.reason=c,fw(o),o=o.next;while(o!==m)}i.action=null}function fw(i){i=i.listeners;for(var o=0;o<i.length;o++)(0,i[o])()}function mw(i,o){return o}function pw(i,o){if(Dt){var c=nn.formState;if(c!==null){e:{var m=ut;if(Dt){if(ln){t:{for(var b=ln,x=mi;b.nodeType!==8;){if(!x){b=null;break t}if(b=gi(b.nextSibling),b===null){b=null;break t}}x=b.data,b=x==="F!"||x==="F"?b:null}if(b){ln=gi(b.nextSibling),m=b.data==="F!";break e}}mo(m)}m=!1}m&&(o=c[0])}}return c=wr(),c.memoizedState=c.baseState=o,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mw,lastRenderedState:o},c.queue=m,c=Ow.bind(null,ut,m),m.dispatch=c,m=Hg(!1),x=Kg.bind(null,ut,!1,m.queue),m=wr(),b={state:o,dispatch:null,action:i,pending:null},m.queue=b,c=cO.bind(null,ut,b,x,c),b.dispatch=c,m.memoizedState=i,[o,c,!1]}function gw(i){var o=En();return vw(o,Yt,i)}function vw(i,o,c){if(o=Bg(i,o,mw)[0],i=Eh(Ms)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var m=Qc(o)}catch(T){throw T===xl?gh:T}else m=o;o=En();var b=o.queue,x=b.dispatch;return c!==o.memoizedState&&(ut.flags|=2048,El(9,{destroy:void 0},uO.bind(null,b,c),null)),[m,x,i]}function uO(i,o){i.action=o}function _w(i){var o=En(),c=Yt;if(c!==null)return vw(o,c,i);En(),o=o.memoizedState,c=En();var m=c.queue.dispatch;return c.memoizedState=i,[o,m,!1]}function El(i,o,c,m){return i={tag:i,create:c,deps:m,inst:o,next:null},o=ut.updateQueue,o===null&&(o=Ch(),ut.updateQueue=o),c=o.lastEffect,c===null?o.lastEffect=i.next=i:(m=c.next,c.next=i,i.next=m,o.lastEffect=i),i}function bw(){return En().memoizedState}function Rh(i,o,c,m){var b=wr();ut.flags|=i,b.memoizedState=El(1|o,{destroy:void 0},c,m===void 0?null:m)}function Th(i,o,c,m){var b=En();m=m===void 0?null:m;var x=b.memoizedState.inst;Yt!==null&&m!==null&&Dg(m,Yt.memoizedState.deps)?b.memoizedState=El(o,x,c,m):(ut.flags|=i,b.memoizedState=El(1|o,x,c,m))}function yw(i,o){Rh(8390656,8,i,o)}function Ug(i,o){Th(2048,8,i,o)}function dO(i){ut.flags|=4;var o=ut.updateQueue;if(o===null)o=Ch(),ut.updateQueue=o,o.events=[i];else{var c=o.events;c===null?o.events=[i]:c.push(i)}}function xw(i){var o=En().memoizedState;return dO({ref:o,nextImpl:i}),function(){if((Ht&2)!==0)throw Error(r(440));return o.impl.apply(void 0,arguments)}}function ww(i,o){return Th(4,2,i,o)}function Sw(i,o){return Th(4,4,i,o)}function Cw(i,o){if(typeof o=="function"){i=i();var c=o(i);return function(){typeof c=="function"?c():o(null)}}if(o!=null)return i=i(),o.current=i,function(){o.current=null}}function kw(i,o,c){c=c!=null?c.concat([i]):null,Th(4,4,Cw.bind(null,o,i),c)}function $g(){}function Ew(i,o){var c=En();o=o===void 0?null:o;var m=c.memoizedState;return o!==null&&Dg(o,m[1])?m[0]:(c.memoizedState=[i,o],i)}function Rw(i,o){var c=En();o=o===void 0?null:o;var m=c.memoizedState;if(o!==null&&Dg(o,m[1]))return m[0];if(m=i(),ba){St(!0);try{i()}finally{St(!1)}}return c.memoizedState=[m,o],m}function Wg(i,o,c){return c===void 0||(Ns&1073741824)!==0&&(Mt&261930)===0?i.memoizedState=o:(i.memoizedState=c,i=TS(),ut.lanes|=i,So|=i,c)}function Tw(i,o,c,m){return qr(c,o)?c:Sl.current!==null?(i=Wg(i,c,m),qr(i,o)||(jn=!0),i):(Ns&42)===0||(Ns&1073741824)!==0&&(Mt&261930)===0?(jn=!0,i.memoizedState=c):(i=TS(),ut.lanes|=i,So|=i,o)}function Nw(i,o,c,m,b){var x=F.p;F.p=x!==0&&8>x?x:8;var T=O.T,z={};O.T=z,Kg(i,!1,o,c);try{var Q=b(),ae=O.S;if(ae!==null&&ae(z,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var fe=oO(Q,m);Jc(i,o,fe,Qr(i))}else Jc(i,o,m,Qr(i))}catch(ve){Jc(i,o,{then:function(){},status:"rejected",reason:ve},Qr())}finally{F.p=x,T!==null&&z.types!==null&&(T.types=z.types),O.T=T}}function hO(){}function Vg(i,o,c,m){if(i.tag!==5)throw Error(r(476));var b=Mw(i).queue;Nw(i,b,o,H,c===null?hO:function(){return Aw(i),c(m)})}function Mw(i){var o=i.memoizedState;if(o!==null)return o;o={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:H},next:null};var c={};return o.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:c},next:null},i.memoizedState=o,i=i.alternate,i!==null&&(i.memoizedState=o),o}function Aw(i){var o=Mw(i);o.next===null&&(o=i.alternate.memoizedState),Jc(i,o.next.queue,{},Qr())}function qg(){return or(gu)}function Dw(){return En().memoizedState}function jw(){return En().memoizedState}function fO(i){for(var o=i.return;o!==null;){switch(o.tag){case 24:case 3:var c=Qr();i=vo(c);var m=_o(o,i,c);m!==null&&(Br(m,o,c),Gc(m,o,c)),o={cache:xg()},i.payload=o;return}o=o.return}}function mO(i,o,c){var m=Qr();c={lane:m,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Nh(i)?Lw(o,c):(c=ug(i,o,c,m),c!==null&&(Br(c,i,m),zw(c,o,m)))}function Ow(i,o,c){var m=Qr();Jc(i,o,c,m)}function Jc(i,o,c,m){var b={lane:m,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Nh(i))Lw(o,b);else{var x=i.alternate;if(i.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var T=o.lastRenderedState,z=x(T,c);if(b.hasEagerState=!0,b.eagerState=z,qr(z,T))return ch(i,o,b,0),nn===null&&lh(),!1}catch{}finally{}if(c=ug(i,o,b,m),c!==null)return Br(c,i,m),zw(c,o,m),!0}return!1}function Kg(i,o,c,m){if(m={lane:2,revertLane:kv(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},Nh(i)){if(o)throw Error(r(479))}else o=ug(i,c,m,2),o!==null&&Br(o,i,2)}function Nh(i){var o=i.alternate;return i===ut||o!==null&&o===ut}function Lw(i,o){Cl=wh=!0;var c=i.pending;c===null?o.next=o:(o.next=c.next,c.next=o),i.pending=o}function zw(i,o,c){if((c&4194048)!==0){var m=o.lanes;m&=i.pendingLanes,c|=m,o.lanes=c,Qe(i,c)}}var eu={readContext:or,use:kh,useCallback:_n,useContext:_n,useEffect:_n,useImperativeHandle:_n,useLayoutEffect:_n,useInsertionEffect:_n,useMemo:_n,useReducer:_n,useRef:_n,useState:_n,useDebugValue:_n,useDeferredValue:_n,useTransition:_n,useSyncExternalStore:_n,useId:_n,useHostTransitionStatus:_n,useFormState:_n,useActionState:_n,useOptimistic:_n,useMemoCache:_n,useCacheRefresh:_n};eu.useEffectEvent=_n;var Pw={readContext:or,use:kh,useCallback:function(i,o){return wr().memoizedState=[i,o===void 0?null:o],i},useContext:or,useEffect:yw,useImperativeHandle:function(i,o,c){c=c!=null?c.concat([i]):null,Rh(4194308,4,Cw.bind(null,o,i),c)},useLayoutEffect:function(i,o){return Rh(4194308,4,i,o)},useInsertionEffect:function(i,o){Rh(4,2,i,o)},useMemo:function(i,o){var c=wr();o=o===void 0?null:o;var m=i();if(ba){St(!0);try{i()}finally{St(!1)}}return c.memoizedState=[m,o],m},useReducer:function(i,o,c){var m=wr();if(c!==void 0){var b=c(o);if(ba){St(!0);try{c(o)}finally{St(!1)}}}else b=o;return m.memoizedState=m.baseState=b,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:b},m.queue=i,i=i.dispatch=mO.bind(null,ut,i),[m.memoizedState,i]},useRef:function(i){var o=wr();return i={current:i},o.memoizedState=i},useState:function(i){i=Hg(i);var o=i.queue,c=Ow.bind(null,ut,o);return o.dispatch=c,[i.memoizedState,c]},useDebugValue:$g,useDeferredValue:function(i,o){var c=wr();return Wg(c,i,o)},useTransition:function(){var i=Hg(!1);return i=Nw.bind(null,ut,i.queue,!0,!1),wr().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,o,c){var m=ut,b=wr();if(Dt){if(c===void 0)throw Error(r(407));c=c()}else{if(c=o(),nn===null)throw Error(r(349));(Mt&127)!==0||iw(m,o,c)}b.memoizedState=c;var x={value:c,getSnapshot:o};return b.queue=x,yw(ow.bind(null,m,x,i),[i]),m.flags|=2048,El(9,{destroy:void 0},sw.bind(null,m,x,c,o),null),c},useId:function(){var i=wr(),o=nn.identifierPrefix;if(Dt){var c=Qi,m=Zi;c=(m&~(1<<32-at(m)-1)).toString(32)+c,o="_"+o+"R_"+c,c=Sh++,0<c&&(o+="H"+c.toString(32)),o+="_"}else c=aO++,o="_"+o+"r_"+c.toString(32)+"_";return i.memoizedState=o},useHostTransitionStatus:qg,useFormState:pw,useActionState:pw,useOptimistic:function(i){var o=wr();o.memoizedState=o.baseState=i;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=c,o=Kg.bind(null,ut,!0,c),c.dispatch=o,[i,o]},useMemoCache:Pg,useCacheRefresh:function(){return wr().memoizedState=fO.bind(null,ut)},useEffectEvent:function(i){var o=wr(),c={impl:i};return o.memoizedState=c,function(){if((Ht&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}},Gg={readContext:or,use:kh,useCallback:Ew,useContext:or,useEffect:Ug,useImperativeHandle:kw,useInsertionEffect:ww,useLayoutEffect:Sw,useMemo:Rw,useReducer:Eh,useRef:bw,useState:function(){return Eh(Ms)},useDebugValue:$g,useDeferredValue:function(i,o){var c=En();return Tw(c,Yt.memoizedState,i,o)},useTransition:function(){var i=Eh(Ms)[0],o=En().memoizedState;return[typeof i=="boolean"?i:Qc(i),o]},useSyncExternalStore:rw,useId:Dw,useHostTransitionStatus:qg,useFormState:gw,useActionState:gw,useOptimistic:function(i,o){var c=En();return cw(c,Yt,i,o)},useMemoCache:Pg,useCacheRefresh:jw};Gg.useEffectEvent=xw;var Bw={readContext:or,use:kh,useCallback:Ew,useContext:or,useEffect:Ug,useImperativeHandle:kw,useInsertionEffect:ww,useLayoutEffect:Sw,useMemo:Rw,useReducer:Ig,useRef:bw,useState:function(){return Ig(Ms)},useDebugValue:$g,useDeferredValue:function(i,o){var c=En();return Yt===null?Wg(c,i,o):Tw(c,Yt.memoizedState,i,o)},useTransition:function(){var i=Ig(Ms)[0],o=En().memoizedState;return[typeof i=="boolean"?i:Qc(i),o]},useSyncExternalStore:rw,useId:Dw,useHostTransitionStatus:qg,useFormState:_w,useActionState:_w,useOptimistic:function(i,o){var c=En();return Yt!==null?cw(c,Yt,i,o):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:Pg,useCacheRefresh:jw};Bw.useEffectEvent=xw;function Yg(i,o,c,m){o=i.memoizedState,c=c(m,o),c=c==null?o:p({},o,c),i.memoizedState=c,i.lanes===0&&(i.updateQueue.baseState=c)}var Xg={enqueueSetState:function(i,o,c){i=i._reactInternals;var m=Qr(),b=vo(m);b.payload=o,c!=null&&(b.callback=c),o=_o(i,b,m),o!==null&&(Br(o,i,m),Gc(o,i,m))},enqueueReplaceState:function(i,o,c){i=i._reactInternals;var m=Qr(),b=vo(m);b.tag=1,b.payload=o,c!=null&&(b.callback=c),o=_o(i,b,m),o!==null&&(Br(o,i,m),Gc(o,i,m))},enqueueForceUpdate:function(i,o){i=i._reactInternals;var c=Qr(),m=vo(c);m.tag=2,o!=null&&(m.callback=o),o=_o(i,m,c),o!==null&&(Br(o,i,c),Gc(o,i,c))}};function Iw(i,o,c,m,b,x,T){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(m,x,T):o.prototype&&o.prototype.isPureReactComponent?!Hc(c,m)||!Hc(b,x):!0}function Hw(i,o,c,m){i=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(c,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(c,m),o.state!==i&&Xg.enqueueReplaceState(o,o.state,null)}function ya(i,o){var c=o;if("ref"in o){c={};for(var m in o)m!=="ref"&&(c[m]=o[m])}if(i=i.defaultProps){c===o&&(c=p({},c));for(var b in i)c[b]===void 0&&(c[b]=i[b])}return c}function Fw(i){ah(i)}function Uw(i){console.error(i)}function $w(i){ah(i)}function Mh(i,o){try{var c=i.onUncaughtError;c(o.value,{componentStack:o.stack})}catch(m){setTimeout(function(){throw m})}}function Ww(i,o,c){try{var m=i.onCaughtError;m(c.value,{componentStack:c.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function Zg(i,o,c){return c=vo(c),c.tag=3,c.payload={element:null},c.callback=function(){Mh(i,o)},c}function Vw(i){return i=vo(i),i.tag=3,i}function qw(i,o,c,m){var b=c.type.getDerivedStateFromError;if(typeof b=="function"){var x=m.value;i.payload=function(){return b(x)},i.callback=function(){Ww(o,c,m)}}var T=c.stateNode;T!==null&&typeof T.componentDidCatch=="function"&&(i.callback=function(){Ww(o,c,m),typeof b!="function"&&(Co===null?Co=new Set([this]):Co.add(this));var z=m.stack;this.componentDidCatch(m.value,{componentStack:z!==null?z:""})})}function pO(i,o,c,m,b){if(c.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(o=c.alternate,o!==null&&_l(o,c,b,!0),c=Gr.current,c!==null){switch(c.tag){case 31:case 13:return pi===null?Uh():c.alternate===null&&bn===0&&(bn=3),c.flags&=-257,c.flags|=65536,c.lanes=b,m===vh?c.flags|=16384:(o=c.updateQueue,o===null?c.updateQueue=new Set([m]):o.add(m),wv(i,m,b)),!1;case 22:return c.flags|=65536,m===vh?c.flags|=16384:(o=c.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([m])},c.updateQueue=o):(c=o.retryQueue,c===null?o.retryQueue=new Set([m]):c.add(m)),wv(i,m,b)),!1}throw Error(r(435,c.tag))}return wv(i,m,b),Uh(),!1}if(Dt)return o=Gr.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=b,m!==gg&&(i=Error(r(422),{cause:m}),$c(di(i,c)))):(m!==gg&&(o=Error(r(423),{cause:m}),$c(di(o,c))),i=i.current.alternate,i.flags|=65536,b&=-b,i.lanes|=b,m=di(m,c),b=Zg(i.stateNode,m,b),Rg(i,b),bn!==4&&(bn=2)),!1;var x=Error(r(520),{cause:m});if(x=di(x,c),lu===null?lu=[x]:lu.push(x),bn!==4&&(bn=2),o===null)return!0;m=di(m,c),c=o;do{switch(c.tag){case 3:return c.flags|=65536,i=b&-b,c.lanes|=i,i=Zg(c.stateNode,m,i),Rg(c,i),!1;case 1:if(o=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Co===null||!Co.has(x))))return c.flags|=65536,b&=-b,c.lanes|=b,b=Vw(b),qw(b,i,c,m),Rg(c,b),!1}c=c.return}while(c!==null);return!1}var Qg=Error(r(461)),jn=!1;function ar(i,o,c,m){o.child=i===null?X1(o,null,c,m):_a(o,i.child,c,m)}function Kw(i,o,c,m,b){c=c.render;var x=o.ref;if("ref"in m){var T={};for(var z in m)z!=="ref"&&(T[z]=m[z])}else T=m;return ma(o),m=jg(i,o,c,T,x,b),z=Og(),i!==null&&!jn?(Lg(i,o,b),As(i,o,b)):(Dt&&z&&mg(o),o.flags|=1,ar(i,o,m,b),o.child)}function Gw(i,o,c,m,b){if(i===null){var x=c.type;return typeof x=="function"&&!dg(x)&&x.defaultProps===void 0&&c.compare===null?(o.tag=15,o.type=x,Yw(i,o,x,m,b)):(i=dh(c.type,null,m,o,o.mode,b),i.ref=o.ref,i.return=o,o.child=i)}if(x=i.child,!ov(i,b)){var T=x.memoizedProps;if(c=c.compare,c=c!==null?c:Hc,c(T,m)&&i.ref===o.ref)return As(i,o,b)}return o.flags|=1,i=ks(x,m),i.ref=o.ref,i.return=o,o.child=i}function Yw(i,o,c,m,b){if(i!==null){var x=i.memoizedProps;if(Hc(x,m)&&i.ref===o.ref)if(jn=!1,o.pendingProps=m=x,ov(i,b))(i.flags&131072)!==0&&(jn=!0);else return o.lanes=i.lanes,As(i,o,b)}return Jg(i,o,c,m,b)}function Xw(i,o,c,m){var b=m.children,x=i!==null?i.memoizedState:null;if(i===null&&o.stateNode===null&&(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((o.flags&128)!==0){if(x=x!==null?x.baseLanes|c:c,i!==null){for(m=o.child=i.child,b=0;m!==null;)b=b|m.lanes|m.childLanes,m=m.sibling;m=b&~x}else m=0,o.child=null;return Zw(i,o,x,c,m)}if((c&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},i!==null&&ph(o,x!==null?x.cachePool:null),x!==null?J1(o,x):Ng(),ew(o);else return m=o.lanes=536870912,Zw(i,o,x!==null?x.baseLanes|c:c,c,m)}else x!==null?(ph(o,x.cachePool),J1(o,x),yo(),o.memoizedState=null):(i!==null&&ph(o,null),Ng(),yo());return ar(i,o,b,c),o.child}function tu(i,o){return i!==null&&i.tag===22||o.stateNode!==null||(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.sibling}function Zw(i,o,c,m,b){var x=Sg();return x=x===null?null:{parent:An._currentValue,pool:x},o.memoizedState={baseLanes:c,cachePool:x},i!==null&&ph(o,null),Ng(),ew(o),i!==null&&_l(i,o,m,!0),o.childLanes=b,null}function Ah(i,o){return o=jh({mode:o.mode,children:o.children},i.mode),o.ref=i.ref,i.child=o,o.return=i,o}function Qw(i,o,c){return _a(o,i.child,null,c),i=Ah(o,o.pendingProps),i.flags|=2,Yr(o),o.memoizedState=null,i}function gO(i,o,c){var m=o.pendingProps,b=(o.flags&128)!==0;if(o.flags&=-129,i===null){if(Dt){if(m.mode==="hidden")return i=Ah(o,m),o.lanes=536870912,tu(null,i);if(Ag(o),(i=ln)?(i=uC(i,mi),i=i!==null&&i.data==="&"?i:null,i!==null&&(o.memoizedState={dehydrated:i,treeContext:ho!==null?{id:Zi,overflow:Qi}:null,retryLane:536870912,hydrationErrors:null},c=L1(i),c.return=o,o.child=c,sr=o,ln=null)):i=null,i===null)throw mo(o);return o.lanes=536870912,null}return Ah(o,m)}var x=i.memoizedState;if(x!==null){var T=x.dehydrated;if(Ag(o),b)if(o.flags&256)o.flags&=-257,o=Qw(i,o,c);else if(o.memoizedState!==null)o.child=i.child,o.flags|=128,o=null;else throw Error(r(558));else if(jn||_l(i,o,c,!1),b=(c&i.childLanes)!==0,jn||b){if(m=nn,m!==null&&(T=bt(m,c),T!==0&&T!==x.retryLane))throw x.retryLane=T,ua(i,T),Br(m,i,T),Qg;Uh(),o=Qw(i,o,c)}else i=x.treeContext,ln=gi(T.nextSibling),sr=o,Dt=!0,fo=null,mi=!1,i!==null&&B1(o,i),o=Ah(o,m),o.flags|=4096;return o}return i=ks(i.child,{mode:m.mode,children:m.children}),i.ref=o.ref,o.child=i,i.return=o,i}function Dh(i,o){var c=o.ref;if(c===null)i!==null&&i.ref!==null&&(o.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(i===null||i.ref!==c)&&(o.flags|=4194816)}}function Jg(i,o,c,m,b){return ma(o),c=jg(i,o,c,m,void 0,b),m=Og(),i!==null&&!jn?(Lg(i,o,b),As(i,o,b)):(Dt&&m&&mg(o),o.flags|=1,ar(i,o,c,b),o.child)}function Jw(i,o,c,m,b,x){return ma(o),o.updateQueue=null,c=nw(o,m,c,b),tw(i),m=Og(),i!==null&&!jn?(Lg(i,o,x),As(i,o,x)):(Dt&&m&&mg(o),o.flags|=1,ar(i,o,c,x),o.child)}function eS(i,o,c,m,b){if(ma(o),o.stateNode===null){var x=ml,T=c.contextType;typeof T=="object"&&T!==null&&(x=or(T)),x=new c(m,x),o.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Xg,o.stateNode=x,x._reactInternals=o,x=o.stateNode,x.props=m,x.state=o.memoizedState,x.refs={},kg(o),T=c.contextType,x.context=typeof T=="object"&&T!==null?or(T):ml,x.state=o.memoizedState,T=c.getDerivedStateFromProps,typeof T=="function"&&(Yg(o,c,T,m),x.state=o.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(T=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),T!==x.state&&Xg.enqueueReplaceState(x,x.state,null),Xc(o,m,x,b),Yc(),x.state=o.memoizedState),typeof x.componentDidMount=="function"&&(o.flags|=4194308),m=!0}else if(i===null){x=o.stateNode;var z=o.memoizedProps,Q=ya(c,z);x.props=Q;var ae=x.context,fe=c.contextType;T=ml,typeof fe=="object"&&fe!==null&&(T=or(fe));var ve=c.getDerivedStateFromProps;fe=typeof ve=="function"||typeof x.getSnapshotBeforeUpdate=="function",z=o.pendingProps!==z,fe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(z||ae!==T)&&Hw(o,x,m,T),go=!1;var ue=o.memoizedState;x.state=ue,Xc(o,m,x,b),Yc(),ae=o.memoizedState,z||ue!==ae||go?(typeof ve=="function"&&(Yg(o,c,ve,m),ae=o.memoizedState),(Q=go||Iw(o,c,Q,m,ue,ae,T))?(fe||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(o.flags|=4194308)):(typeof x.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=ae),x.props=m,x.state=ae,x.context=T,m=Q):(typeof x.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{x=o.stateNode,Eg(i,o),T=o.memoizedProps,fe=ya(c,T),x.props=fe,ve=o.pendingProps,ue=x.context,ae=c.contextType,Q=ml,typeof ae=="object"&&ae!==null&&(Q=or(ae)),z=c.getDerivedStateFromProps,(ae=typeof z=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T!==ve||ue!==Q)&&Hw(o,x,m,Q),go=!1,ue=o.memoizedState,x.state=ue,Xc(o,m,x,b),Yc();var de=o.memoizedState;T!==ve||ue!==de||go||i!==null&&i.dependencies!==null&&fh(i.dependencies)?(typeof z=="function"&&(Yg(o,c,z,m),de=o.memoizedState),(fe=go||Iw(o,c,fe,m,ue,de,Q)||i!==null&&i.dependencies!==null&&fh(i.dependencies))?(ae||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(m,de,Q),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(m,de,Q)),typeof x.componentDidUpdate=="function"&&(o.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof x.componentDidUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(o.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=de),x.props=m,x.state=de,x.context=Q,m=fe):(typeof x.componentDidUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(o.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(o.flags|=1024),m=!1)}return x=m,Dh(i,o),m=(o.flags&128)!==0,x||m?(x=o.stateNode,c=m&&typeof c.getDerivedStateFromError!="function"?null:x.render(),o.flags|=1,i!==null&&m?(o.child=_a(o,i.child,null,b),o.child=_a(o,null,c,b)):ar(i,o,c,b),o.memoizedState=x.state,i=o.child):i=As(i,o,b),i}function tS(i,o,c,m){return ha(),o.flags|=256,ar(i,o,c,m),o.child}var ev={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function tv(i){return{baseLanes:i,cachePool:W1()}}function nv(i,o,c){return i=i!==null?i.childLanes&~c:0,o&&(i|=Zr),i}function nS(i,o,c){var m=o.pendingProps,b=!1,x=(o.flags&128)!==0,T;if((T=x)||(T=i!==null&&i.memoizedState===null?!1:(kn.current&2)!==0),T&&(b=!0,o.flags&=-129),T=(o.flags&32)!==0,o.flags&=-33,i===null){if(Dt){if(b?bo(o):yo(),(i=ln)?(i=uC(i,mi),i=i!==null&&i.data!=="&"?i:null,i!==null&&(o.memoizedState={dehydrated:i,treeContext:ho!==null?{id:Zi,overflow:Qi}:null,retryLane:536870912,hydrationErrors:null},c=L1(i),c.return=o,o.child=c,sr=o,ln=null)):i=null,i===null)throw mo(o);return Bv(i)?o.lanes=32:o.lanes=536870912,null}var z=m.children;return m=m.fallback,b?(yo(),b=o.mode,z=jh({mode:"hidden",children:z},b),m=da(m,b,c,null),z.return=o,m.return=o,z.sibling=m,o.child=z,m=o.child,m.memoizedState=tv(c),m.childLanes=nv(i,T,c),o.memoizedState=ev,tu(null,m)):(bo(o),rv(o,z))}var Q=i.memoizedState;if(Q!==null&&(z=Q.dehydrated,z!==null)){if(x)o.flags&256?(bo(o),o.flags&=-257,o=iv(i,o,c)):o.memoizedState!==null?(yo(),o.child=i.child,o.flags|=128,o=null):(yo(),z=m.fallback,b=o.mode,m=jh({mode:"visible",children:m.children},b),z=da(z,b,c,null),z.flags|=2,m.return=o,z.return=o,m.sibling=z,o.child=m,_a(o,i.child,null,c),m=o.child,m.memoizedState=tv(c),m.childLanes=nv(i,T,c),o.memoizedState=ev,o=tu(null,m));else if(bo(o),Bv(z)){if(T=z.nextSibling&&z.nextSibling.dataset,T)var ae=T.dgst;T=ae,m=Error(r(419)),m.stack="",m.digest=T,$c({value:m,source:null,stack:null}),o=iv(i,o,c)}else if(jn||_l(i,o,c,!1),T=(c&i.childLanes)!==0,jn||T){if(T=nn,T!==null&&(m=bt(T,c),m!==0&&m!==Q.retryLane))throw Q.retryLane=m,ua(i,m),Br(T,i,m),Qg;Pv(z)||Uh(),o=iv(i,o,c)}else Pv(z)?(o.flags|=192,o.child=i.child,o=null):(i=Q.treeContext,ln=gi(z.nextSibling),sr=o,Dt=!0,fo=null,mi=!1,i!==null&&B1(o,i),o=rv(o,m.children),o.flags|=4096);return o}return b?(yo(),z=m.fallback,b=o.mode,Q=i.child,ae=Q.sibling,m=ks(Q,{mode:"hidden",children:m.children}),m.subtreeFlags=Q.subtreeFlags&65011712,ae!==null?z=ks(ae,z):(z=da(z,b,c,null),z.flags|=2),z.return=o,m.return=o,m.sibling=z,o.child=m,tu(null,m),m=o.child,z=i.child.memoizedState,z===null?z=tv(c):(b=z.cachePool,b!==null?(Q=An._currentValue,b=b.parent!==Q?{parent:Q,pool:Q}:b):b=W1(),z={baseLanes:z.baseLanes|c,cachePool:b}),m.memoizedState=z,m.childLanes=nv(i,T,c),o.memoizedState=ev,tu(i.child,m)):(bo(o),c=i.child,i=c.sibling,c=ks(c,{mode:"visible",children:m.children}),c.return=o,c.sibling=null,i!==null&&(T=o.deletions,T===null?(o.deletions=[i],o.flags|=16):T.push(i)),o.child=c,o.memoizedState=null,c)}function rv(i,o){return o=jh({mode:"visible",children:o},i.mode),o.return=i,i.child=o}function jh(i,o){return i=Kr(22,i,null,o),i.lanes=0,i}function iv(i,o,c){return _a(o,i.child,null,c),i=rv(o,o.pendingProps.children),i.flags|=2,o.memoizedState=null,i}function rS(i,o,c){i.lanes|=o;var m=i.alternate;m!==null&&(m.lanes|=o),bg(i.return,o,c)}function sv(i,o,c,m,b,x){var T=i.memoizedState;T===null?i.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:c,tailMode:b,treeForkCount:x}:(T.isBackwards=o,T.rendering=null,T.renderingStartTime=0,T.last=m,T.tail=c,T.tailMode=b,T.treeForkCount=x)}function iS(i,o,c){var m=o.pendingProps,b=m.revealOrder,x=m.tail;m=m.children;var T=kn.current,z=(T&2)!==0;if(z?(T=T&1|2,o.flags|=128):T&=1,A(kn,T),ar(i,o,m,c),m=Dt?Uc:0,!z&&i!==null&&(i.flags&128)!==0)e:for(i=o.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&rS(i,c,o);else if(i.tag===19)rS(i,c,o);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===o)break e;for(;i.sibling===null;){if(i.return===null||i.return===o)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(b){case"forwards":for(c=o.child,b=null;c!==null;)i=c.alternate,i!==null&&xh(i)===null&&(b=c),c=c.sibling;c=b,c===null?(b=o.child,o.child=null):(b=c.sibling,c.sibling=null),sv(o,!1,b,c,x,m);break;case"backwards":case"unstable_legacy-backwards":for(c=null,b=o.child,o.child=null;b!==null;){if(i=b.alternate,i!==null&&xh(i)===null){o.child=b;break}i=b.sibling,b.sibling=c,c=b,b=i}sv(o,!0,c,null,x,m);break;case"together":sv(o,!1,null,null,void 0,m);break;default:o.memoizedState=null}return o.child}function As(i,o,c){if(i!==null&&(o.dependencies=i.dependencies),So|=o.lanes,(c&o.childLanes)===0)if(i!==null){if(_l(i,o,c,!1),(c&o.childLanes)===0)return null}else return null;if(i!==null&&o.child!==i.child)throw Error(r(153));if(o.child!==null){for(i=o.child,c=ks(i,i.pendingProps),o.child=c,c.return=o;i.sibling!==null;)i=i.sibling,c=c.sibling=ks(i,i.pendingProps),c.return=o;c.sibling=null}return o.child}function ov(i,o){return(i.lanes&o)!==0?!0:(i=i.dependencies,!!(i!==null&&fh(i)))}function vO(i,o,c){switch(o.tag){case 3:le(o,o.stateNode.containerInfo),po(o,An,i.memoizedState.cache),ha();break;case 27:case 5:xe(o);break;case 4:le(o,o.stateNode.containerInfo);break;case 10:po(o,o.type,o.memoizedProps.value);break;case 31:if(o.memoizedState!==null)return o.flags|=128,Ag(o),null;break;case 13:var m=o.memoizedState;if(m!==null)return m.dehydrated!==null?(bo(o),o.flags|=128,null):(c&o.child.childLanes)!==0?nS(i,o,c):(bo(o),i=As(i,o,c),i!==null?i.sibling:null);bo(o);break;case 19:var b=(i.flags&128)!==0;if(m=(c&o.childLanes)!==0,m||(_l(i,o,c,!1),m=(c&o.childLanes)!==0),b){if(m)return iS(i,o,c);o.flags|=128}if(b=o.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),A(kn,kn.current),m)break;return null;case 22:return o.lanes=0,Xw(i,o,c,o.pendingProps);case 24:po(o,An,i.memoizedState.cache)}return As(i,o,c)}function sS(i,o,c){if(i!==null)if(i.memoizedProps!==o.pendingProps)jn=!0;else{if(!ov(i,c)&&(o.flags&128)===0)return jn=!1,vO(i,o,c);jn=(i.flags&131072)!==0}else jn=!1,Dt&&(o.flags&1048576)!==0&&P1(o,Uc,o.index);switch(o.lanes=0,o.tag){case 16:e:{var m=o.pendingProps;if(i=ga(o.elementType),o.type=i,typeof i=="function")dg(i)?(m=ya(i,m),o.tag=1,o=eS(null,o,i,m,c)):(o.tag=0,o=Jg(null,o,i,m,c));else{if(i!=null){var b=i.$$typeof;if(b===N){o.tag=11,o=Kw(null,o,i,m,c);break e}else if(b===L){o.tag=14,o=Gw(null,o,i,m,c);break e}}throw o=K(i)||i,Error(r(306,o,""))}}return o;case 0:return Jg(i,o,o.type,o.pendingProps,c);case 1:return m=o.type,b=ya(m,o.pendingProps),eS(i,o,m,b,c);case 3:e:{if(le(o,o.stateNode.containerInfo),i===null)throw Error(r(387));m=o.pendingProps;var x=o.memoizedState;b=x.element,Eg(i,o),Xc(o,m,null,c);var T=o.memoizedState;if(m=T.cache,po(o,An,m),m!==x.cache&&yg(o,[An],c,!0),Yc(),m=T.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:T.cache},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){o=tS(i,o,m,c);break e}else if(m!==b){b=di(Error(r(424)),o),$c(b),o=tS(i,o,m,c);break e}else{switch(i=o.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(ln=gi(i.firstChild),sr=o,Dt=!0,fo=null,mi=!0,c=X1(o,null,m,c),o.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(ha(),m===b){o=As(i,o,c);break e}ar(i,o,m,c)}o=o.child}return o;case 26:return Dh(i,o),i===null?(c=gC(o.type,null,o.pendingProps,null))?o.memoizedState=c:Dt||(c=o.type,i=o.pendingProps,m=Yh(Z.current).createElement(c),m[It]=o,m[Cn]=i,lr(m,c,i),Mn(m),o.stateNode=m):o.memoizedState=gC(o.type,i.memoizedProps,o.pendingProps,i.memoizedState),null;case 27:return xe(o),i===null&&Dt&&(m=o.stateNode=fC(o.type,o.pendingProps,Z.current),sr=o,mi=!0,b=ln,To(o.type)?(Iv=b,ln=gi(m.firstChild)):ln=b),ar(i,o,o.pendingProps.children,c),Dh(i,o),i===null&&(o.flags|=4194304),o.child;case 5:return i===null&&Dt&&((b=m=ln)&&(m=KO(m,o.type,o.pendingProps,mi),m!==null?(o.stateNode=m,sr=o,ln=gi(m.firstChild),mi=!1,b=!0):b=!1),b||mo(o)),xe(o),b=o.type,x=o.pendingProps,T=i!==null?i.memoizedProps:null,m=x.children,Ov(b,x)?m=null:T!==null&&Ov(b,T)&&(o.flags|=32),o.memoizedState!==null&&(b=jg(i,o,lO,null,null,c),gu._currentValue=b),Dh(i,o),ar(i,o,m,c),o.child;case 6:return i===null&&Dt&&((i=c=ln)&&(c=GO(c,o.pendingProps,mi),c!==null?(o.stateNode=c,sr=o,ln=null,i=!0):i=!1),i||mo(o)),null;case 13:return nS(i,o,c);case 4:return le(o,o.stateNode.containerInfo),m=o.pendingProps,i===null?o.child=_a(o,null,m,c):ar(i,o,m,c),o.child;case 11:return Kw(i,o,o.type,o.pendingProps,c);case 7:return ar(i,o,o.pendingProps,c),o.child;case 8:return ar(i,o,o.pendingProps.children,c),o.child;case 12:return ar(i,o,o.pendingProps.children,c),o.child;case 10:return m=o.pendingProps,po(o,o.type,m.value),ar(i,o,m.children,c),o.child;case 9:return b=o.type._context,m=o.pendingProps.children,ma(o),b=or(b),m=m(b),o.flags|=1,ar(i,o,m,c),o.child;case 14:return Gw(i,o,o.type,o.pendingProps,c);case 15:return Yw(i,o,o.type,o.pendingProps,c);case 19:return iS(i,o,c);case 31:return gO(i,o,c);case 22:return Xw(i,o,c,o.pendingProps);case 24:return ma(o),m=or(An),i===null?(b=Sg(),b===null&&(b=nn,x=xg(),b.pooledCache=x,x.refCount++,x!==null&&(b.pooledCacheLanes|=c),b=x),o.memoizedState={parent:m,cache:b},kg(o),po(o,An,b)):((i.lanes&c)!==0&&(Eg(i,o),Xc(o,null,null,c),Yc()),b=i.memoizedState,x=o.memoizedState,b.parent!==m?(b={parent:m,cache:m},o.memoizedState=b,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=b),po(o,An,m)):(m=x.cache,po(o,An,m),m!==b.cache&&yg(o,[An],c,!0))),ar(i,o,o.pendingProps.children,c),o.child;case 29:throw o.pendingProps}throw Error(r(156,o.tag))}function Ds(i){i.flags|=4}function av(i,o,c,m,b){if((o=(i.mode&32)!==0)&&(o=!1),o){if(i.flags|=16777216,(b&335544128)===b)if(i.stateNode.complete)i.flags|=8192;else if(DS())i.flags|=8192;else throw va=vh,Cg}else i.flags&=-16777217}function oS(i,o){if(o.type!=="stylesheet"||(o.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!xC(o))if(DS())i.flags|=8192;else throw va=vh,Cg}function Oh(i,o){o!==null&&(i.flags|=4),i.flags&16384&&(o=i.tag!==22?mt():536870912,i.lanes|=o,Ml|=o)}function nu(i,o){if(!Dt)switch(i.tailMode){case"hidden":o=i.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?i.tail=null:c.sibling=null;break;case"collapsed":c=i.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?o||i.tail===null?i.tail=null:i.tail.sibling=null:m.sibling=null}}function cn(i){var o=i.alternate!==null&&i.alternate.child===i.child,c=0,m=0;if(o)for(var b=i.child;b!==null;)c|=b.lanes|b.childLanes,m|=b.subtreeFlags&65011712,m|=b.flags&65011712,b.return=i,b=b.sibling;else for(b=i.child;b!==null;)c|=b.lanes|b.childLanes,m|=b.subtreeFlags,m|=b.flags,b.return=i,b=b.sibling;return i.subtreeFlags|=m,i.childLanes=c,o}function _O(i,o,c){var m=o.pendingProps;switch(pg(o),o.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cn(o),null;case 1:return cn(o),null;case 3:return c=o.stateNode,m=null,i!==null&&(m=i.memoizedState.cache),o.memoizedState.cache!==m&&(o.flags|=2048),Ts(An),pe(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(vl(o)?Ds(o):i===null||i.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,vg())),cn(o),null;case 26:var b=o.type,x=o.memoizedState;return i===null?(Ds(o),x!==null?(cn(o),oS(o,x)):(cn(o),av(o,b,null,m,c))):x?x!==i.memoizedState?(Ds(o),cn(o),oS(o,x)):(cn(o),o.flags&=-16777217):(i=i.memoizedProps,i!==m&&Ds(o),cn(o),av(o,b,i,m,c)),null;case 27:if(Me(o),c=Z.current,b=o.type,i!==null&&o.stateNode!=null)i.memoizedProps!==m&&Ds(o);else{if(!m){if(o.stateNode===null)throw Error(r(166));return cn(o),null}i=re.current,vl(o)?I1(o):(i=fC(b,m,c),o.stateNode=i,Ds(o))}return cn(o),null;case 5:if(Me(o),b=o.type,i!==null&&o.stateNode!=null)i.memoizedProps!==m&&Ds(o);else{if(!m){if(o.stateNode===null)throw Error(r(166));return cn(o),null}if(x=re.current,vl(o))I1(o);else{var T=Yh(Z.current);switch(x){case 1:x=T.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:x=T.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":x=T.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":x=T.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":x=T.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof m.is=="string"?T.createElement("select",{is:m.is}):T.createElement("select"),m.multiple?x.multiple=!0:m.size&&(x.size=m.size);break;default:x=typeof m.is=="string"?T.createElement(b,{is:m.is}):T.createElement(b)}}x[It]=o,x[Cn]=m;e:for(T=o.child;T!==null;){if(T.tag===5||T.tag===6)x.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===o)break e;for(;T.sibling===null;){if(T.return===null||T.return===o)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}o.stateNode=x;e:switch(lr(x,b,m),b){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&Ds(o)}}return cn(o),av(o,o.type,i===null?null:i.memoizedProps,o.pendingProps,c),null;case 6:if(i&&o.stateNode!=null)i.memoizedProps!==m&&Ds(o);else{if(typeof m!="string"&&o.stateNode===null)throw Error(r(166));if(i=Z.current,vl(o)){if(i=o.stateNode,c=o.memoizedProps,m=null,b=sr,b!==null)switch(b.tag){case 27:case 5:m=b.memoizedProps}i[It]=o,i=!!(i.nodeValue===c||m!==null&&m.suppressHydrationWarning===!0||nC(i.nodeValue,c)),i||mo(o,!0)}else i=Yh(i).createTextNode(m),i[It]=o,o.stateNode=i}return cn(o),null;case 31:if(c=o.memoizedState,i===null||i.memoizedState!==null){if(m=vl(o),c!==null){if(i===null){if(!m)throw Error(r(318));if(i=o.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[It]=o}else ha(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;cn(o),i=!1}else c=vg(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=c),i=!0;if(!i)return o.flags&256?(Yr(o),o):(Yr(o),null);if((o.flags&128)!==0)throw Error(r(558))}return cn(o),null;case 13:if(m=o.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(b=vl(o),m!==null&&m.dehydrated!==null){if(i===null){if(!b)throw Error(r(318));if(b=o.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(r(317));b[It]=o}else ha(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;cn(o),b=!1}else b=vg(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=b),b=!0;if(!b)return o.flags&256?(Yr(o),o):(Yr(o),null)}return Yr(o),(o.flags&128)!==0?(o.lanes=c,o):(c=m!==null,i=i!==null&&i.memoizedState!==null,c&&(m=o.child,b=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(b=m.alternate.memoizedState.cachePool.pool),x=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(x=m.memoizedState.cachePool.pool),x!==b&&(m.flags|=2048)),c!==i&&c&&(o.child.flags|=8192),Oh(o,o.updateQueue),cn(o),null);case 4:return pe(),i===null&&Nv(o.stateNode.containerInfo),cn(o),null;case 10:return Ts(o.type),cn(o),null;case 19:if(X(kn),m=o.memoizedState,m===null)return cn(o),null;if(b=(o.flags&128)!==0,x=m.rendering,x===null)if(b)nu(m,!1);else{if(bn!==0||i!==null&&(i.flags&128)!==0)for(i=o.child;i!==null;){if(x=xh(i),x!==null){for(o.flags|=128,nu(m,!1),i=x.updateQueue,o.updateQueue=i,Oh(o,i),o.subtreeFlags=0,i=c,c=o.child;c!==null;)O1(c,i),c=c.sibling;return A(kn,kn.current&1|2),Dt&&Es(o,m.treeForkCount),o.child}i=i.sibling}m.tail!==null&&Se()>Ih&&(o.flags|=128,b=!0,nu(m,!1),o.lanes=4194304)}else{if(!b)if(i=xh(x),i!==null){if(o.flags|=128,b=!0,i=i.updateQueue,o.updateQueue=i,Oh(o,i),nu(m,!0),m.tail===null&&m.tailMode==="hidden"&&!x.alternate&&!Dt)return cn(o),null}else 2*Se()-m.renderingStartTime>Ih&&c!==536870912&&(o.flags|=128,b=!0,nu(m,!1),o.lanes=4194304);m.isBackwards?(x.sibling=o.child,o.child=x):(i=m.last,i!==null?i.sibling=x:o.child=x,m.last=x)}return m.tail!==null?(i=m.tail,m.rendering=i,m.tail=i.sibling,m.renderingStartTime=Se(),i.sibling=null,c=kn.current,A(kn,b?c&1|2:c&1),Dt&&Es(o,m.treeForkCount),i):(cn(o),null);case 22:case 23:return Yr(o),Mg(),m=o.memoizedState!==null,i!==null?i.memoizedState!==null!==m&&(o.flags|=8192):m&&(o.flags|=8192),m?(c&536870912)!==0&&(o.flags&128)===0&&(cn(o),o.subtreeFlags&6&&(o.flags|=8192)):cn(o),c=o.updateQueue,c!==null&&Oh(o,c.retryQueue),c=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),m=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(m=o.memoizedState.cachePool.pool),m!==c&&(o.flags|=2048),i!==null&&X(pa),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),o.memoizedState.cache!==c&&(o.flags|=2048),Ts(An),cn(o),null;case 25:return null;case 30:return null}throw Error(r(156,o.tag))}function bO(i,o){switch(pg(o),o.tag){case 1:return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 3:return Ts(An),pe(),i=o.flags,(i&65536)!==0&&(i&128)===0?(o.flags=i&-65537|128,o):null;case 26:case 27:case 5:return Me(o),null;case 31:if(o.memoizedState!==null){if(Yr(o),o.alternate===null)throw Error(r(340));ha()}return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 13:if(Yr(o),i=o.memoizedState,i!==null&&i.dehydrated!==null){if(o.alternate===null)throw Error(r(340));ha()}return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 19:return X(kn),null;case 4:return pe(),null;case 10:return Ts(o.type),null;case 22:case 23:return Yr(o),Mg(),i!==null&&X(pa),i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 24:return Ts(An),null;case 25:return null;default:return null}}function aS(i,o){switch(pg(o),o.tag){case 3:Ts(An),pe();break;case 26:case 27:case 5:Me(o);break;case 4:pe();break;case 31:o.memoizedState!==null&&Yr(o);break;case 13:Yr(o);break;case 19:X(kn);break;case 10:Ts(o.type);break;case 22:case 23:Yr(o),Mg(),i!==null&&X(pa);break;case 24:Ts(An)}}function ru(i,o){try{var c=o.updateQueue,m=c!==null?c.lastEffect:null;if(m!==null){var b=m.next;c=b;do{if((c.tag&i)===i){m=void 0;var x=c.create,T=c.inst;m=x(),T.destroy=m}c=c.next}while(c!==b)}}catch(z){Gt(o,o.return,z)}}function xo(i,o,c){try{var m=o.updateQueue,b=m!==null?m.lastEffect:null;if(b!==null){var x=b.next;m=x;do{if((m.tag&i)===i){var T=m.inst,z=T.destroy;if(z!==void 0){T.destroy=void 0,b=o;var Q=c,ae=z;try{ae()}catch(fe){Gt(b,Q,fe)}}}m=m.next}while(m!==x)}}catch(fe){Gt(o,o.return,fe)}}function lS(i){var o=i.updateQueue;if(o!==null){var c=i.stateNode;try{Q1(o,c)}catch(m){Gt(i,i.return,m)}}}function cS(i,o,c){c.props=ya(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(m){Gt(i,o,m)}}function iu(i,o){try{var c=i.ref;if(c!==null){switch(i.tag){case 26:case 27:case 5:var m=i.stateNode;break;case 30:m=i.stateNode;break;default:m=i.stateNode}typeof c=="function"?i.refCleanup=c(m):c.current=m}}catch(b){Gt(i,o,b)}}function Ji(i,o){var c=i.ref,m=i.refCleanup;if(c!==null)if(typeof m=="function")try{m()}catch(b){Gt(i,o,b)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(b){Gt(i,o,b)}else c.current=null}function uS(i){var o=i.type,c=i.memoizedProps,m=i.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":c.autoFocus&&m.focus();break e;case"img":c.src?m.src=c.src:c.srcSet&&(m.srcset=c.srcSet)}}catch(b){Gt(i,i.return,b)}}function lv(i,o,c){try{var m=i.stateNode;FO(m,i.type,c,o),m[Cn]=o}catch(b){Gt(i,i.return,b)}}function dS(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&To(i.type)||i.tag===4}function cv(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||dS(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&To(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function uv(i,o,c){var m=i.tag;if(m===5||m===6)i=i.stateNode,o?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(i,o):(o=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,o.appendChild(i),c=c._reactRootContainer,c!=null||o.onclick!==null||(o.onclick=Ss));else if(m!==4&&(m===27&&To(i.type)&&(c=i.stateNode,o=null),i=i.child,i!==null))for(uv(i,o,c),i=i.sibling;i!==null;)uv(i,o,c),i=i.sibling}function Lh(i,o,c){var m=i.tag;if(m===5||m===6)i=i.stateNode,o?c.insertBefore(i,o):c.appendChild(i);else if(m!==4&&(m===27&&To(i.type)&&(c=i.stateNode),i=i.child,i!==null))for(Lh(i,o,c),i=i.sibling;i!==null;)Lh(i,o,c),i=i.sibling}function hS(i){var o=i.stateNode,c=i.memoizedProps;try{for(var m=i.type,b=o.attributes;b.length;)o.removeAttributeNode(b[0]);lr(o,m,c),o[It]=i,o[Cn]=c}catch(x){Gt(i,i.return,x)}}var js=!1,On=!1,dv=!1,fS=typeof WeakSet=="function"?WeakSet:Set,Kn=null;function yO(i,o){if(i=i.containerInfo,Dv=nf,i=k1(i),ig(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var m=c.getSelection&&c.getSelection();if(m&&m.rangeCount!==0){c=m.anchorNode;var b=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var T=0,z=-1,Q=-1,ae=0,fe=0,ve=i,ue=null;t:for(;;){for(var de;ve!==c||b!==0&&ve.nodeType!==3||(z=T+b),ve!==x||m!==0&&ve.nodeType!==3||(Q=T+m),ve.nodeType===3&&(T+=ve.nodeValue.length),(de=ve.firstChild)!==null;)ue=ve,ve=de;for(;;){if(ve===i)break t;if(ue===c&&++ae===b&&(z=T),ue===x&&++fe===m&&(Q=T),(de=ve.nextSibling)!==null)break;ve=ue,ue=ve.parentNode}ve=de}c=z===-1||Q===-1?null:{start:z,end:Q}}else c=null}c=c||{start:0,end:0}}else c=null;for(jv={focusedElem:i,selectionRange:c},nf=!1,Kn=o;Kn!==null;)if(o=Kn,i=o.child,(o.subtreeFlags&1028)!==0&&i!==null)i.return=o,Kn=i;else for(;Kn!==null;){switch(o=Kn,x=o.alternate,i=o.flags,o.tag){case 0:if((i&4)!==0&&(i=o.updateQueue,i=i!==null?i.events:null,i!==null))for(c=0;c<i.length;c++)b=i[c],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&x!==null){i=void 0,c=o,b=x.memoizedProps,x=x.memoizedState,m=c.stateNode;try{var $e=ya(c.type,b);i=m.getSnapshotBeforeUpdate($e,x),m.__reactInternalSnapshotBeforeUpdate=i}catch(et){Gt(c,c.return,et)}}break;case 3:if((i&1024)!==0){if(i=o.stateNode.containerInfo,c=i.nodeType,c===9)zv(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":zv(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(r(163))}if(i=o.sibling,i!==null){i.return=o.return,Kn=i;break}Kn=o.return}}function mS(i,o,c){var m=c.flags;switch(c.tag){case 0:case 11:case 15:Ls(i,c),m&4&&ru(5,c);break;case 1:if(Ls(i,c),m&4)if(i=c.stateNode,o===null)try{i.componentDidMount()}catch(T){Gt(c,c.return,T)}else{var b=ya(c.type,o.memoizedProps);o=o.memoizedState;try{i.componentDidUpdate(b,o,i.__reactInternalSnapshotBeforeUpdate)}catch(T){Gt(c,c.return,T)}}m&64&&lS(c),m&512&&iu(c,c.return);break;case 3:if(Ls(i,c),m&64&&(i=c.updateQueue,i!==null)){if(o=null,c.child!==null)switch(c.child.tag){case 27:case 5:o=c.child.stateNode;break;case 1:o=c.child.stateNode}try{Q1(i,o)}catch(T){Gt(c,c.return,T)}}break;case 27:o===null&&m&4&&hS(c);case 26:case 5:Ls(i,c),o===null&&m&4&&uS(c),m&512&&iu(c,c.return);break;case 12:Ls(i,c);break;case 31:Ls(i,c),m&4&&vS(i,c);break;case 13:Ls(i,c),m&4&&_S(i,c),m&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=NO.bind(null,c),YO(i,c))));break;case 22:if(m=c.memoizedState!==null||js,!m){o=o!==null&&o.memoizedState!==null||On,b=js;var x=On;js=m,(On=o)&&!x?zs(i,c,(c.subtreeFlags&8772)!==0):Ls(i,c),js=b,On=x}break;case 30:break;default:Ls(i,c)}}function pS(i){var o=i.alternate;o!==null&&(i.alternate=null,pS(o)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(o=i.stateNode,o!==null&&Dc(o)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var dn=null,Or=!1;function Os(i,o,c){for(c=c.child;c!==null;)gS(i,o,c),c=c.sibling}function gS(i,o,c){if(ze&&typeof ze.onCommitFiberUnmount=="function")try{ze.onCommitFiberUnmount(rt,c)}catch{}switch(c.tag){case 26:On||Ji(c,o),Os(i,o,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:On||Ji(c,o);var m=dn,b=Or;To(c.type)&&(dn=c.stateNode,Or=!1),Os(i,o,c),fu(c.stateNode),dn=m,Or=b;break;case 5:On||Ji(c,o);case 6:if(m=dn,b=Or,dn=null,Os(i,o,c),dn=m,Or=b,dn!==null)if(Or)try{(dn.nodeType===9?dn.body:dn.nodeName==="HTML"?dn.ownerDocument.body:dn).removeChild(c.stateNode)}catch(x){Gt(c,o,x)}else try{dn.removeChild(c.stateNode)}catch(x){Gt(c,o,x)}break;case 18:dn!==null&&(Or?(i=dn,lC(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),Bl(i)):lC(dn,c.stateNode));break;case 4:m=dn,b=Or,dn=c.stateNode.containerInfo,Or=!0,Os(i,o,c),dn=m,Or=b;break;case 0:case 11:case 14:case 15:xo(2,c,o),On||xo(4,c,o),Os(i,o,c);break;case 1:On||(Ji(c,o),m=c.stateNode,typeof m.componentWillUnmount=="function"&&cS(c,o,m)),Os(i,o,c);break;case 21:Os(i,o,c);break;case 22:On=(m=On)||c.memoizedState!==null,Os(i,o,c),On=m;break;default:Os(i,o,c)}}function vS(i,o){if(o.memoizedState===null&&(i=o.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Bl(i)}catch(c){Gt(o,o.return,c)}}}function _S(i,o){if(o.memoizedState===null&&(i=o.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Bl(i)}catch(c){Gt(o,o.return,c)}}function xO(i){switch(i.tag){case 31:case 13:case 19:var o=i.stateNode;return o===null&&(o=i.stateNode=new fS),o;case 22:return i=i.stateNode,o=i._retryCache,o===null&&(o=i._retryCache=new fS),o;default:throw Error(r(435,i.tag))}}function zh(i,o){var c=xO(i);o.forEach(function(m){if(!c.has(m)){c.add(m);var b=MO.bind(null,i,m);m.then(b,b)}})}function Lr(i,o){var c=o.deletions;if(c!==null)for(var m=0;m<c.length;m++){var b=c[m],x=i,T=o,z=T;e:for(;z!==null;){switch(z.tag){case 27:if(To(z.type)){dn=z.stateNode,Or=!1;break e}break;case 5:dn=z.stateNode,Or=!1;break e;case 3:case 4:dn=z.stateNode.containerInfo,Or=!0;break e}z=z.return}if(dn===null)throw Error(r(160));gS(x,T,b),dn=null,Or=!1,x=b.alternate,x!==null&&(x.return=null),b.return=null}if(o.subtreeFlags&13886)for(o=o.child;o!==null;)bS(o,i),o=o.sibling}var Li=null;function bS(i,o){var c=i.alternate,m=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Lr(o,i),zr(i),m&4&&(xo(3,i,i.return),ru(3,i),xo(5,i,i.return));break;case 1:Lr(o,i),zr(i),m&512&&(On||c===null||Ji(c,c.return)),m&64&&js&&(i=i.updateQueue,i!==null&&(m=i.callbacks,m!==null&&(c=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=c===null?m:c.concat(m))));break;case 26:var b=Li;if(Lr(o,i),zr(i),m&512&&(On||c===null||Ji(c,c.return)),m&4){var x=c!==null?c.memoizedState:null;if(m=i.memoizedState,c===null)if(m===null)if(i.stateNode===null){e:{m=i.type,c=i.memoizedProps,b=b.ownerDocument||b;t:switch(m){case"title":x=b.getElementsByTagName("title")[0],(!x||x[sa]||x[It]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=b.createElement(m),b.head.insertBefore(x,b.querySelector("head > title"))),lr(x,m,c),x[It]=i,Mn(x),m=x;break e;case"link":var T=bC("link","href",b).get(m+(c.href||""));if(T){for(var z=0;z<T.length;z++)if(x=T[z],x.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&x.getAttribute("rel")===(c.rel==null?null:c.rel)&&x.getAttribute("title")===(c.title==null?null:c.title)&&x.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){T.splice(z,1);break t}}x=b.createElement(m),lr(x,m,c),b.head.appendChild(x);break;case"meta":if(T=bC("meta","content",b).get(m+(c.content||""))){for(z=0;z<T.length;z++)if(x=T[z],x.getAttribute("content")===(c.content==null?null:""+c.content)&&x.getAttribute("name")===(c.name==null?null:c.name)&&x.getAttribute("property")===(c.property==null?null:c.property)&&x.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&x.getAttribute("charset")===(c.charSet==null?null:c.charSet)){T.splice(z,1);break t}}x=b.createElement(m),lr(x,m,c),b.head.appendChild(x);break;default:throw Error(r(468,m))}x[It]=i,Mn(x),m=x}i.stateNode=m}else yC(b,i.type,i.stateNode);else i.stateNode=_C(b,m,i.memoizedProps);else x!==m?(x===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):x.count--,m===null?yC(b,i.type,i.stateNode):_C(b,m,i.memoizedProps)):m===null&&i.stateNode!==null&&lv(i,i.memoizedProps,c.memoizedProps)}break;case 27:Lr(o,i),zr(i),m&512&&(On||c===null||Ji(c,c.return)),c!==null&&m&4&&lv(i,i.memoizedProps,c.memoizedProps);break;case 5:if(Lr(o,i),zr(i),m&512&&(On||c===null||Ji(c,c.return)),i.flags&32){b=i.stateNode;try{al(b,"")}catch($e){Gt(i,i.return,$e)}}m&4&&i.stateNode!=null&&(b=i.memoizedProps,lv(i,b,c!==null?c.memoizedProps:b)),m&1024&&(dv=!0);break;case 6:if(Lr(o,i),zr(i),m&4){if(i.stateNode===null)throw Error(r(162));m=i.memoizedProps,c=i.stateNode;try{c.nodeValue=m}catch($e){Gt(i,i.return,$e)}}break;case 3:if(Qh=null,b=Li,Li=Xh(o.containerInfo),Lr(o,i),Li=b,zr(i),m&4&&c!==null&&c.memoizedState.isDehydrated)try{Bl(o.containerInfo)}catch($e){Gt(i,i.return,$e)}dv&&(dv=!1,yS(i));break;case 4:m=Li,Li=Xh(i.stateNode.containerInfo),Lr(o,i),zr(i),Li=m;break;case 12:Lr(o,i),zr(i);break;case 31:Lr(o,i),zr(i),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,zh(i,m)));break;case 13:Lr(o,i),zr(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Bh=Se()),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,zh(i,m)));break;case 22:b=i.memoizedState!==null;var Q=c!==null&&c.memoizedState!==null,ae=js,fe=On;if(js=ae||b,On=fe||Q,Lr(o,i),On=fe,js=ae,zr(i),m&8192)e:for(o=i.stateNode,o._visibility=b?o._visibility&-2:o._visibility|1,b&&(c===null||Q||js||On||xa(i)),c=null,o=i;;){if(o.tag===5||o.tag===26){if(c===null){Q=c=o;try{if(x=Q.stateNode,b)T=x.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none";else{z=Q.stateNode;var ve=Q.memoizedProps.style,ue=ve!=null&&ve.hasOwnProperty("display")?ve.display:null;z.style.display=ue==null||typeof ue=="boolean"?"":(""+ue).trim()}}catch($e){Gt(Q,Q.return,$e)}}}else if(o.tag===6){if(c===null){Q=o;try{Q.stateNode.nodeValue=b?"":Q.memoizedProps}catch($e){Gt(Q,Q.return,$e)}}}else if(o.tag===18){if(c===null){Q=o;try{var de=Q.stateNode;b?cC(de,!0):cC(Q.stateNode,!1)}catch($e){Gt(Q,Q.return,$e)}}}else if((o.tag!==22&&o.tag!==23||o.memoizedState===null||o===i)&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===i)break e;for(;o.sibling===null;){if(o.return===null||o.return===i)break e;c===o&&(c=null),o=o.return}c===o&&(c=null),o.sibling.return=o.return,o=o.sibling}m&4&&(m=i.updateQueue,m!==null&&(c=m.retryQueue,c!==null&&(m.retryQueue=null,zh(i,c))));break;case 19:Lr(o,i),zr(i),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,zh(i,m)));break;case 30:break;case 21:break;default:Lr(o,i),zr(i)}}function zr(i){var o=i.flags;if(o&2){try{for(var c,m=i.return;m!==null;){if(dS(m)){c=m;break}m=m.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var b=c.stateNode,x=cv(i);Lh(i,x,b);break;case 5:var T=c.stateNode;c.flags&32&&(al(T,""),c.flags&=-33);var z=cv(i);Lh(i,z,T);break;case 3:case 4:var Q=c.stateNode.containerInfo,ae=cv(i);uv(i,ae,Q);break;default:throw Error(r(161))}}catch(fe){Gt(i,i.return,fe)}i.flags&=-3}o&4096&&(i.flags&=-4097)}function yS(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var o=i;yS(o),o.tag===5&&o.flags&1024&&o.stateNode.reset(),i=i.sibling}}function Ls(i,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)mS(i,o.alternate,o),o=o.sibling}function xa(i){for(i=i.child;i!==null;){var o=i;switch(o.tag){case 0:case 11:case 14:case 15:xo(4,o,o.return),xa(o);break;case 1:Ji(o,o.return);var c=o.stateNode;typeof c.componentWillUnmount=="function"&&cS(o,o.return,c),xa(o);break;case 27:fu(o.stateNode);case 26:case 5:Ji(o,o.return),xa(o);break;case 22:o.memoizedState===null&&xa(o);break;case 30:xa(o);break;default:xa(o)}i=i.sibling}}function zs(i,o,c){for(c=c&&(o.subtreeFlags&8772)!==0,o=o.child;o!==null;){var m=o.alternate,b=i,x=o,T=x.flags;switch(x.tag){case 0:case 11:case 15:zs(b,x,c),ru(4,x);break;case 1:if(zs(b,x,c),m=x,b=m.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(ae){Gt(m,m.return,ae)}if(m=x,b=m.updateQueue,b!==null){var z=m.stateNode;try{var Q=b.shared.hiddenCallbacks;if(Q!==null)for(b.shared.hiddenCallbacks=null,b=0;b<Q.length;b++)Z1(Q[b],z)}catch(ae){Gt(m,m.return,ae)}}c&&T&64&&lS(x),iu(x,x.return);break;case 27:hS(x);case 26:case 5:zs(b,x,c),c&&m===null&&T&4&&uS(x),iu(x,x.return);break;case 12:zs(b,x,c);break;case 31:zs(b,x,c),c&&T&4&&vS(b,x);break;case 13:zs(b,x,c),c&&T&4&&_S(b,x);break;case 22:x.memoizedState===null&&zs(b,x,c),iu(x,x.return);break;case 30:break;default:zs(b,x,c)}o=o.sibling}}function hv(i,o){var c=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),i=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(i=o.memoizedState.cachePool.pool),i!==c&&(i!=null&&i.refCount++,c!=null&&Wc(c))}function fv(i,o){i=null,o.alternate!==null&&(i=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==i&&(o.refCount++,i!=null&&Wc(i))}function zi(i,o,c,m){if(o.subtreeFlags&10256)for(o=o.child;o!==null;)xS(i,o,c,m),o=o.sibling}function xS(i,o,c,m){var b=o.flags;switch(o.tag){case 0:case 11:case 15:zi(i,o,c,m),b&2048&&ru(9,o);break;case 1:zi(i,o,c,m);break;case 3:zi(i,o,c,m),b&2048&&(i=null,o.alternate!==null&&(i=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==i&&(o.refCount++,i!=null&&Wc(i)));break;case 12:if(b&2048){zi(i,o,c,m),i=o.stateNode;try{var x=o.memoizedProps,T=x.id,z=x.onPostCommit;typeof z=="function"&&z(T,o.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(Q){Gt(o,o.return,Q)}}else zi(i,o,c,m);break;case 31:zi(i,o,c,m);break;case 13:zi(i,o,c,m);break;case 23:break;case 22:x=o.stateNode,T=o.alternate,o.memoizedState!==null?x._visibility&2?zi(i,o,c,m):su(i,o):x._visibility&2?zi(i,o,c,m):(x._visibility|=2,Rl(i,o,c,m,(o.subtreeFlags&10256)!==0||!1)),b&2048&&hv(T,o);break;case 24:zi(i,o,c,m),b&2048&&fv(o.alternate,o);break;default:zi(i,o,c,m)}}function Rl(i,o,c,m,b){for(b=b&&((o.subtreeFlags&10256)!==0||!1),o=o.child;o!==null;){var x=i,T=o,z=c,Q=m,ae=T.flags;switch(T.tag){case 0:case 11:case 15:Rl(x,T,z,Q,b),ru(8,T);break;case 23:break;case 22:var fe=T.stateNode;T.memoizedState!==null?fe._visibility&2?Rl(x,T,z,Q,b):su(x,T):(fe._visibility|=2,Rl(x,T,z,Q,b)),b&&ae&2048&&hv(T.alternate,T);break;case 24:Rl(x,T,z,Q,b),b&&ae&2048&&fv(T.alternate,T);break;default:Rl(x,T,z,Q,b)}o=o.sibling}}function su(i,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var c=i,m=o,b=m.flags;switch(m.tag){case 22:su(c,m),b&2048&&hv(m.alternate,m);break;case 24:su(c,m),b&2048&&fv(m.alternate,m);break;default:su(c,m)}o=o.sibling}}var ou=8192;function Tl(i,o,c){if(i.subtreeFlags&ou)for(i=i.child;i!==null;)wS(i,o,c),i=i.sibling}function wS(i,o,c){switch(i.tag){case 26:Tl(i,o,c),i.flags&ou&&i.memoizedState!==null&&a4(c,Li,i.memoizedState,i.memoizedProps);break;case 5:Tl(i,o,c);break;case 3:case 4:var m=Li;Li=Xh(i.stateNode.containerInfo),Tl(i,o,c),Li=m;break;case 22:i.memoizedState===null&&(m=i.alternate,m!==null&&m.memoizedState!==null?(m=ou,ou=16777216,Tl(i,o,c),ou=m):Tl(i,o,c));break;default:Tl(i,o,c)}}function SS(i){var o=i.alternate;if(o!==null&&(i=o.child,i!==null)){o.child=null;do o=i.sibling,i.sibling=null,i=o;while(i!==null)}}function au(i){var o=i.deletions;if((i.flags&16)!==0){if(o!==null)for(var c=0;c<o.length;c++){var m=o[c];Kn=m,kS(m,i)}SS(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)CS(i),i=i.sibling}function CS(i){switch(i.tag){case 0:case 11:case 15:au(i),i.flags&2048&&xo(9,i,i.return);break;case 3:au(i);break;case 12:au(i);break;case 22:var o=i.stateNode;i.memoizedState!==null&&o._visibility&2&&(i.return===null||i.return.tag!==13)?(o._visibility&=-3,Ph(i)):au(i);break;default:au(i)}}function Ph(i){var o=i.deletions;if((i.flags&16)!==0){if(o!==null)for(var c=0;c<o.length;c++){var m=o[c];Kn=m,kS(m,i)}SS(i)}for(i=i.child;i!==null;){switch(o=i,o.tag){case 0:case 11:case 15:xo(8,o,o.return),Ph(o);break;case 22:c=o.stateNode,c._visibility&2&&(c._visibility&=-3,Ph(o));break;default:Ph(o)}i=i.sibling}}function kS(i,o){for(;Kn!==null;){var c=Kn;switch(c.tag){case 0:case 11:case 15:xo(8,c,o);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var m=c.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:Wc(c.memoizedState.cache)}if(m=c.child,m!==null)m.return=c,Kn=m;else e:for(c=i;Kn!==null;){m=Kn;var b=m.sibling,x=m.return;if(pS(m),m===c){Kn=null;break e}if(b!==null){b.return=x,Kn=b;break e}Kn=x}}}var wO={getCacheForType:function(i){var o=or(An),c=o.data.get(i);return c===void 0&&(c=i(),o.data.set(i,c)),c},cacheSignal:function(){return or(An).controller.signal}},SO=typeof WeakMap=="function"?WeakMap:Map,Ht=0,nn=null,Ct=null,Mt=0,Kt=0,Xr=null,wo=!1,Nl=!1,mv=!1,Ps=0,bn=0,So=0,wa=0,pv=0,Zr=0,Ml=0,lu=null,Pr=null,gv=!1,Bh=0,ES=0,Ih=1/0,Hh=null,Co=null,In=0,ko=null,Al=null,Bs=0,vv=0,_v=null,RS=null,cu=0,bv=null;function Qr(){return(Ht&2)!==0&&Mt!==0?Mt&-Mt:O.T!==null?kv():sn()}function TS(){if(Zr===0)if((Mt&536870912)===0||Dt){var i=rr;rr<<=1,(rr&3932160)===0&&(rr=262144),Zr=i}else Zr=536870912;return i=Gr.current,i!==null&&(i.flags|=32),Zr}function Br(i,o,c){(i===nn&&(Kt===2||Kt===9)||i.cancelPendingCommit!==null)&&(Dl(i,0),Eo(i,Mt,Zr,!1)),Ce(i,c),((Ht&2)===0||i!==nn)&&(i===nn&&((Ht&2)===0&&(wa|=c),bn===4&&Eo(i,Mt,Zr,!1)),es(i))}function NS(i,o,c){if((Ht&6)!==0)throw Error(r(327));var m=!c&&(o&127)===0&&(o&i.expiredLanes)===0||ct(i,o),b=m?EO(i,o):xv(i,o,!0),x=m;do{if(b===0){Nl&&!m&&Eo(i,o,0,!1);break}else{if(c=i.current.alternate,x&&!CO(c)){b=xv(i,o,!1),x=!1;continue}if(b===2){if(x=o,i.errorRecoveryDisabledLanes&x)var T=0;else T=i.pendingLanes&-536870913,T=T!==0?T:T&536870912?536870912:0;if(T!==0){o=T;e:{var z=i;b=lu;var Q=z.current.memoizedState.isDehydrated;if(Q&&(Dl(z,T).flags|=256),T=xv(z,T,!1),T!==2){if(mv&&!Q){z.errorRecoveryDisabledLanes|=x,wa|=x,b=4;break e}x=Pr,Pr=b,x!==null&&(Pr===null?Pr=x:Pr.push.apply(Pr,x))}b=T}if(x=!1,b!==2)continue}}if(b===1){Dl(i,0),Eo(i,o,0,!0);break}e:{switch(m=i,x=b,x){case 0:case 1:throw Error(r(345));case 4:if((o&4194048)!==o)break;case 6:Eo(m,o,Zr,!wo);break e;case 2:Pr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((o&62914560)===o&&(b=Bh+300-Se(),10<b)){if(Eo(m,o,Zr,!wo),He(m,0,!0)!==0)break e;Bs=o,m.timeoutHandle=oC(MS.bind(null,m,c,Pr,Hh,gv,o,Zr,wa,Ml,wo,x,"Throttled",-0,0),b);break e}MS(m,c,Pr,Hh,gv,o,Zr,wa,Ml,wo,x,null,-0,0)}}break}while(!0);es(i)}function MS(i,o,c,m,b,x,T,z,Q,ae,fe,ve,ue,de){if(i.timeoutHandle=-1,ve=o.subtreeFlags,ve&8192||(ve&16785408)===16785408){ve={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ss},wS(o,x,ve);var $e=(x&62914560)===x?Bh-Se():(x&4194048)===x?ES-Se():0;if($e=l4(ve,$e),$e!==null){Bs=x,i.cancelPendingCommit=$e(BS.bind(null,i,o,x,c,m,b,T,z,Q,fe,ve,null,ue,de)),Eo(i,x,T,!ae);return}}BS(i,o,x,c,m,b,T,z,Q)}function CO(i){for(var o=i;;){var c=o.tag;if((c===0||c===11||c===15)&&o.flags&16384&&(c=o.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var m=0;m<c.length;m++){var b=c[m],x=b.getSnapshot;b=b.value;try{if(!qr(x(),b))return!1}catch{return!1}}if(c=o.child,o.subtreeFlags&16384&&c!==null)c.return=o,o=c;else{if(o===i)break;for(;o.sibling===null;){if(o.return===null||o.return===i)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Eo(i,o,c,m){o&=~pv,o&=~wa,i.suspendedLanes|=o,i.pingedLanes&=~o,m&&(i.warmLanes|=o),m=i.expirationTimes;for(var b=o;0<b;){var x=31-at(b),T=1<<x;m[x]=-1,b&=~T}c!==0&&_t(i,c,o)}function Fh(){return(Ht&6)===0?(uu(0),!1):!0}function yv(){if(Ct!==null){if(Kt===0)var i=Ct.return;else i=Ct,Rs=fa=null,zg(i),wl=null,qc=0,i=Ct;for(;i!==null;)aS(i.alternate,i),i=i.return;Ct=null}}function Dl(i,o){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,WO(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),Bs=0,yv(),nn=i,Ct=c=ks(i.current,null),Mt=o,Kt=0,Xr=null,wo=!1,Nl=ct(i,o),mv=!1,Ml=Zr=pv=wa=So=bn=0,Pr=lu=null,gv=!1,(o&8)!==0&&(o|=o&32);var m=i.entangledLanes;if(m!==0)for(i=i.entanglements,m&=o;0<m;){var b=31-at(m),x=1<<b;o|=i[b],m&=~x}return Ps=o,lh(),c}function AS(i,o){ut=null,O.H=eu,o===xl||o===gh?(o=K1(),Kt=3):o===Cg?(o=K1(),Kt=4):Kt=o===Qg?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,Xr=o,Ct===null&&(bn=1,Mh(i,di(o,i.current)))}function DS(){var i=Gr.current;return i===null?!0:(Mt&4194048)===Mt?pi===null:(Mt&62914560)===Mt||(Mt&536870912)!==0?i===pi:!1}function jS(){var i=O.H;return O.H=eu,i===null?eu:i}function OS(){var i=O.A;return O.A=wO,i}function Uh(){bn=4,wo||(Mt&4194048)!==Mt&&Gr.current!==null||(Nl=!0),(So&134217727)===0&&(wa&134217727)===0||nn===null||Eo(nn,Mt,Zr,!1)}function xv(i,o,c){var m=Ht;Ht|=2;var b=jS(),x=OS();(nn!==i||Mt!==o)&&(Hh=null,Dl(i,o)),o=!1;var T=bn;e:do try{if(Kt!==0&&Ct!==null){var z=Ct,Q=Xr;switch(Kt){case 8:yv(),T=6;break e;case 3:case 2:case 9:case 6:Gr.current===null&&(o=!0);var ae=Kt;if(Kt=0,Xr=null,jl(i,z,Q,ae),c&&Nl){T=0;break e}break;default:ae=Kt,Kt=0,Xr=null,jl(i,z,Q,ae)}}kO(),T=bn;break}catch(fe){AS(i,fe)}while(!0);return o&&i.shellSuspendCounter++,Rs=fa=null,Ht=m,O.H=b,O.A=x,Ct===null&&(nn=null,Mt=0,lh()),T}function kO(){for(;Ct!==null;)LS(Ct)}function EO(i,o){var c=Ht;Ht|=2;var m=jS(),b=OS();nn!==i||Mt!==o?(Hh=null,Ih=Se()+500,Dl(i,o)):Nl=ct(i,o);e:do try{if(Kt!==0&&Ct!==null){o=Ct;var x=Xr;t:switch(Kt){case 1:Kt=0,Xr=null,jl(i,o,x,1);break;case 2:case 9:if(V1(x)){Kt=0,Xr=null,zS(o);break}o=function(){Kt!==2&&Kt!==9||nn!==i||(Kt=7),es(i)},x.then(o,o);break e;case 3:Kt=7;break e;case 4:Kt=5;break e;case 7:V1(x)?(Kt=0,Xr=null,zS(o)):(Kt=0,Xr=null,jl(i,o,x,7));break;case 5:var T=null;switch(Ct.tag){case 26:T=Ct.memoizedState;case 5:case 27:var z=Ct;if(T?xC(T):z.stateNode.complete){Kt=0,Xr=null;var Q=z.sibling;if(Q!==null)Ct=Q;else{var ae=z.return;ae!==null?(Ct=ae,$h(ae)):Ct=null}break t}}Kt=0,Xr=null,jl(i,o,x,5);break;case 6:Kt=0,Xr=null,jl(i,o,x,6);break;case 8:yv(),bn=6;break e;default:throw Error(r(462))}}RO();break}catch(fe){AS(i,fe)}while(!0);return Rs=fa=null,O.H=m,O.A=b,Ht=c,Ct!==null?0:(nn=null,Mt=0,lh(),bn)}function RO(){for(;Ct!==null&&!qe();)LS(Ct)}function LS(i){var o=sS(i.alternate,i,Ps);i.memoizedProps=i.pendingProps,o===null?$h(i):Ct=o}function zS(i){var o=i,c=o.alternate;switch(o.tag){case 15:case 0:o=Jw(c,o,o.pendingProps,o.type,void 0,Mt);break;case 11:o=Jw(c,o,o.pendingProps,o.type.render,o.ref,Mt);break;case 5:zg(o);default:aS(c,o),o=Ct=O1(o,Ps),o=sS(c,o,Ps)}i.memoizedProps=i.pendingProps,o===null?$h(i):Ct=o}function jl(i,o,c,m){Rs=fa=null,zg(o),wl=null,qc=0;var b=o.return;try{if(pO(i,b,o,c,Mt)){bn=1,Mh(i,di(c,i.current)),Ct=null;return}}catch(x){if(b!==null)throw Ct=b,x;bn=1,Mh(i,di(c,i.current)),Ct=null;return}o.flags&32768?(Dt||m===1?i=!0:Nl||(Mt&536870912)!==0?i=!1:(wo=i=!0,(m===2||m===9||m===3||m===6)&&(m=Gr.current,m!==null&&m.tag===13&&(m.flags|=16384))),PS(o,i)):$h(o)}function $h(i){var o=i;do{if((o.flags&32768)!==0){PS(o,wo);return}i=o.return;var c=_O(o.alternate,o,Ps);if(c!==null){Ct=c;return}if(o=o.sibling,o!==null){Ct=o;return}Ct=o=i}while(o!==null);bn===0&&(bn=5)}function PS(i,o){do{var c=bO(i.alternate,i);if(c!==null){c.flags&=32767,Ct=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!o&&(i=i.sibling,i!==null)){Ct=i;return}Ct=i=c}while(i!==null);bn=6,Ct=null}function BS(i,o,c,m,b,x,T,z,Q){i.cancelPendingCommit=null;do Wh();while(In!==0);if((Ht&6)!==0)throw Error(r(327));if(o!==null){if(o===i.current)throw Error(r(177));if(x=o.lanes|o.childLanes,x|=cg,Te(i,c,x,T,z,Q),i===nn&&(Ct=nn=null,Mt=0),Al=o,ko=i,Bs=c,vv=x,_v=b,RS=m,(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,AO(Oe,function(){return $S(),null})):(i.callbackNode=null,i.callbackPriority=0),m=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||m){m=O.T,O.T=null,b=F.p,F.p=2,T=Ht,Ht|=4;try{yO(i,o,c)}finally{Ht=T,F.p=b,O.T=m}}In=1,IS(),HS(),FS()}}function IS(){if(In===1){In=0;var i=ko,o=Al,c=(o.flags&13878)!==0;if((o.subtreeFlags&13878)!==0||c){c=O.T,O.T=null;var m=F.p;F.p=2;var b=Ht;Ht|=4;try{bS(o,i);var x=jv,T=k1(i.containerInfo),z=x.focusedElem,Q=x.selectionRange;if(T!==z&&z&&z.ownerDocument&&C1(z.ownerDocument.documentElement,z)){if(Q!==null&&ig(z)){var ae=Q.start,fe=Q.end;if(fe===void 0&&(fe=ae),"selectionStart"in z)z.selectionStart=ae,z.selectionEnd=Math.min(fe,z.value.length);else{var ve=z.ownerDocument||document,ue=ve&&ve.defaultView||window;if(ue.getSelection){var de=ue.getSelection(),$e=z.textContent.length,et=Math.min(Q.start,$e),Zt=Q.end===void 0?et:Math.min(Q.end,$e);!de.extend&&et>Zt&&(T=Zt,Zt=et,et=T);var ne=S1(z,et),ee=S1(z,Zt);if(ne&&ee&&(de.rangeCount!==1||de.anchorNode!==ne.node||de.anchorOffset!==ne.offset||de.focusNode!==ee.node||de.focusOffset!==ee.offset)){var oe=ve.createRange();oe.setStart(ne.node,ne.offset),de.removeAllRanges(),et>Zt?(de.addRange(oe),de.extend(ee.node,ee.offset)):(oe.setEnd(ee.node,ee.offset),de.addRange(oe))}}}}for(ve=[],de=z;de=de.parentNode;)de.nodeType===1&&ve.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof z.focus=="function"&&z.focus(),z=0;z<ve.length;z++){var ge=ve[z];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}nf=!!Dv,jv=Dv=null}finally{Ht=b,F.p=m,O.T=c}}i.current=o,In=2}}function HS(){if(In===2){In=0;var i=ko,o=Al,c=(o.flags&8772)!==0;if((o.subtreeFlags&8772)!==0||c){c=O.T,O.T=null;var m=F.p;F.p=2;var b=Ht;Ht|=4;try{mS(i,o.alternate,o)}finally{Ht=b,F.p=m,O.T=c}}In=3}}function FS(){if(In===4||In===3){In=0,vt();var i=ko,o=Al,c=Bs,m=RS;(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?In=5:(In=0,Al=ko=null,US(i,i.pendingLanes));var b=i.pendingLanes;if(b===0&&(Co=null),Ot(c),o=o.stateNode,ze&&typeof ze.onCommitFiberRoot=="function")try{ze.onCommitFiberRoot(rt,o,void 0,(o.current.flags&128)===128)}catch{}if(m!==null){o=O.T,b=F.p,F.p=2,O.T=null;try{for(var x=i.onRecoverableError,T=0;T<m.length;T++){var z=m[T];x(z.value,{componentStack:z.stack})}}finally{O.T=o,F.p=b}}(Bs&3)!==0&&Wh(),es(i),b=i.pendingLanes,(c&261930)!==0&&(b&42)!==0?i===bv?cu++:(cu=0,bv=i):cu=0,uu(0)}}function US(i,o){(i.pooledCacheLanes&=o)===0&&(o=i.pooledCache,o!=null&&(i.pooledCache=null,Wc(o)))}function Wh(){return IS(),HS(),FS(),$S()}function $S(){if(In!==5)return!1;var i=ko,o=vv;vv=0;var c=Ot(Bs),m=O.T,b=F.p;try{F.p=32>c?32:c,O.T=null,c=_v,_v=null;var x=ko,T=Bs;if(In=0,Al=ko=null,Bs=0,(Ht&6)!==0)throw Error(r(331));var z=Ht;if(Ht|=4,CS(x.current),xS(x,x.current,T,c),Ht=z,uu(0,!1),ze&&typeof ze.onPostCommitFiberRoot=="function")try{ze.onPostCommitFiberRoot(rt,x)}catch{}return!0}finally{F.p=b,O.T=m,US(i,o)}}function WS(i,o,c){o=di(c,o),o=Zg(i.stateNode,o,2),i=_o(i,o,2),i!==null&&(Ce(i,2),es(i))}function Gt(i,o,c){if(i.tag===3)WS(i,i,c);else for(;o!==null;){if(o.tag===3){WS(o,i,c);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Co===null||!Co.has(m))){i=di(c,i),c=Vw(2),m=_o(o,c,2),m!==null&&(qw(c,m,o,i),Ce(m,2),es(m));break}}o=o.return}}function wv(i,o,c){var m=i.pingCache;if(m===null){m=i.pingCache=new SO;var b=new Set;m.set(o,b)}else b=m.get(o),b===void 0&&(b=new Set,m.set(o,b));b.has(c)||(mv=!0,b.add(c),i=TO.bind(null,i,o,c),o.then(i,i))}function TO(i,o,c){var m=i.pingCache;m!==null&&m.delete(o),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,nn===i&&(Mt&c)===c&&(bn===4||bn===3&&(Mt&62914560)===Mt&&300>Se()-Bh?(Ht&2)===0&&Dl(i,0):pv|=c,Ml===Mt&&(Ml=0)),es(i)}function VS(i,o){o===0&&(o=mt()),i=ua(i,o),i!==null&&(Ce(i,o),es(i))}function NO(i){var o=i.memoizedState,c=0;o!==null&&(c=o.retryLane),VS(i,c)}function MO(i,o){var c=0;switch(i.tag){case 31:case 13:var m=i.stateNode,b=i.memoizedState;b!==null&&(c=b.retryLane);break;case 19:m=i.stateNode;break;case 22:m=i.stateNode._retryCache;break;default:throw Error(r(314))}m!==null&&m.delete(o),VS(i,c)}function AO(i,o){return nt(i,o)}var Vh=null,Ol=null,Sv=!1,qh=!1,Cv=!1,Ro=0;function es(i){i!==Ol&&i.next===null&&(Ol===null?Vh=Ol=i:Ol=Ol.next=i),qh=!0,Sv||(Sv=!0,jO())}function uu(i,o){if(!Cv&&qh){Cv=!0;do for(var c=!1,m=Vh;m!==null;){if(i!==0){var b=m.pendingLanes;if(b===0)var x=0;else{var T=m.suspendedLanes,z=m.pingedLanes;x=(1<<31-at(42|i)+1)-1,x&=b&~(T&~z),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,YS(m,x))}else x=Mt,x=He(m,m===nn?x:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(x&3)===0||ct(m,x)||(c=!0,YS(m,x));m=m.next}while(c);Cv=!1}}function DO(){qS()}function qS(){qh=Sv=!1;var i=0;Ro!==0&&$O()&&(i=Ro);for(var o=Se(),c=null,m=Vh;m!==null;){var b=m.next,x=KS(m,o);x===0?(m.next=null,c===null?Vh=b:c.next=b,b===null&&(Ol=c)):(c=m,(i!==0||(x&3)!==0)&&(qh=!0)),m=b}In!==0&&In!==5||uu(i),Ro!==0&&(Ro=0)}function KS(i,o){for(var c=i.suspendedLanes,m=i.pingedLanes,b=i.expirationTimes,x=i.pendingLanes&-62914561;0<x;){var T=31-at(x),z=1<<T,Q=b[T];Q===-1?((z&c)===0||(z&m)!==0)&&(b[T]=st(z,o)):Q<=o&&(i.expiredLanes|=z),x&=~z}if(o=nn,c=Mt,c=He(i,i===o?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),m=i.callbackNode,c===0||i===o&&(Kt===2||Kt===9)||i.cancelPendingCommit!==null)return m!==null&&m!==null&&gt(m),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||ct(i,c)){if(o=c&-c,o===i.callbackPriority)return o;switch(m!==null&&gt(m),Ot(c)){case 2:case 8:c=be;break;case 32:c=Oe;break;case 268435456:c=we;break;default:c=Oe}return m=GS.bind(null,i),c=nt(c,m),i.callbackPriority=o,i.callbackNode=c,o}return m!==null&&m!==null&&gt(m),i.callbackPriority=2,i.callbackNode=null,2}function GS(i,o){if(In!==0&&In!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(Wh()&&i.callbackNode!==c)return null;var m=Mt;return m=He(i,i===nn?m:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),m===0?null:(NS(i,m,o),KS(i,Se()),i.callbackNode!=null&&i.callbackNode===c?GS.bind(null,i):null)}function YS(i,o){if(Wh())return null;NS(i,o,!0)}function jO(){VO(function(){(Ht&6)!==0?nt(ce,DO):qS()})}function kv(){if(Ro===0){var i=bl;i===0&&(i=xr,xr<<=1,(xr&261888)===0&&(xr=256)),Ro=i}return Ro}function XS(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:eh(""+i)}function ZS(i,o){var c=o.ownerDocument.createElement("input");return c.name=o.name,c.value=o.value,i.id&&c.setAttribute("form",i.id),o.parentNode.insertBefore(c,o),i=new FormData(i),c.parentNode.removeChild(c),i}function OO(i,o,c,m,b){if(o==="submit"&&c&&c.stateNode===b){var x=XS((b[Cn]||null).action),T=m.submitter;T&&(o=(o=T[Cn]||null)?XS(o.formAction):T.getAttribute("formAction"),o!==null&&(x=o,T=null));var z=new ih("action","action",null,m,b);i.push({event:z,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(Ro!==0){var Q=T?ZS(b,T):new FormData(b);Vg(c,{pending:!0,data:Q,method:b.method,action:x},null,Q)}}else typeof x=="function"&&(z.preventDefault(),Q=T?ZS(b,T):new FormData(b),Vg(c,{pending:!0,data:Q,method:b.method,action:x},x,Q))},currentTarget:b}]})}}for(var Ev=0;Ev<lg.length;Ev++){var Rv=lg[Ev],LO=Rv.toLowerCase(),zO=Rv[0].toUpperCase()+Rv.slice(1);Oi(LO,"on"+zO)}Oi(T1,"onAnimationEnd"),Oi(N1,"onAnimationIteration"),Oi(M1,"onAnimationStart"),Oi("dblclick","onDoubleClick"),Oi("focusin","onFocus"),Oi("focusout","onBlur"),Oi(Q3,"onTransitionRun"),Oi(J3,"onTransitionStart"),Oi(eO,"onTransitionCancel"),Oi(A1,"onTransitionEnd"),ws("onMouseEnter",["mouseout","mouseover"]),ws("onMouseLeave",["mouseout","mouseover"]),ws("onPointerEnter",["pointerout","pointerover"]),ws("onPointerLeave",["pointerout","pointerover"]),Xi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Xi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Xi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Xi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Xi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Xi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var du="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(" "),PO=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(du));function QS(i,o){o=(o&4)!==0;for(var c=0;c<i.length;c++){var m=i[c],b=m.event;m=m.listeners;e:{var x=void 0;if(o)for(var T=m.length-1;0<=T;T--){var z=m[T],Q=z.instance,ae=z.currentTarget;if(z=z.listener,Q!==x&&b.isPropagationStopped())break e;x=z,b.currentTarget=ae;try{x(b)}catch(fe){ah(fe)}b.currentTarget=null,x=Q}else for(T=0;T<m.length;T++){if(z=m[T],Q=z.instance,ae=z.currentTarget,z=z.listener,Q!==x&&b.isPropagationStopped())break e;x=z,b.currentTarget=ae;try{x(b)}catch(fe){ah(fe)}b.currentTarget=null,x=Q}}}}function kt(i,o){var c=o[$t];c===void 0&&(c=o[$t]=new Set);var m=i+"__bubble";c.has(m)||(JS(o,i,2,!1),c.add(m))}function Tv(i,o,c){var m=0;o&&(m|=4),JS(c,i,m,o)}var Kh="_reactListening"+Math.random().toString(36).slice(2);function Nv(i){if(!i[Kh]){i[Kh]=!0,Yd.forEach(function(c){c!=="selectionchange"&&(PO.has(c)||Tv(c,!1,i),Tv(c,!0,i))});var o=i.nodeType===9?i:i.ownerDocument;o===null||o[Kh]||(o[Kh]=!0,Tv("selectionchange",!1,o))}}function JS(i,o,c,m){switch(TC(o)){case 2:var b=d4;break;case 8:b=h4;break;default:b=Wv}c=b.bind(null,o,c,i),b=void 0,!Yp||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(b=!0),m?b!==void 0?i.addEventListener(o,c,{capture:!0,passive:b}):i.addEventListener(o,c,!0):b!==void 0?i.addEventListener(o,c,{passive:b}):i.addEventListener(o,c,!1)}function Mv(i,o,c,m,b){var x=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var z=m.stateNode.containerInfo;if(z===b)break;if(T===4)for(T=m.return;T!==null;){var Q=T.tag;if((Q===3||Q===4)&&T.stateNode.containerInfo===b)return;T=T.return}for(;z!==null;){if(T=lo(z),T===null)return;if(Q=T.tag,Q===5||Q===6||Q===26||Q===27){m=x=T;continue e}z=z.parentNode}}m=m.return}i1(function(){var ae=x,fe=Kp(c),ve=[];e:{var ue=D1.get(i);if(ue!==void 0){var de=ih,$e=i;switch(i){case"keypress":if(nh(c)===0)break e;case"keydown":case"keyup":de=M3;break;case"focusin":$e="focus",de=Jp;break;case"focusout":$e="blur",de=Jp;break;case"beforeblur":case"afterblur":de=Jp;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":de=a1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=_3;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=j3;break;case T1:case N1:case M1:de=x3;break;case A1:de=L3;break;case"scroll":case"scrollend":de=g3;break;case"wheel":de=P3;break;case"copy":case"cut":case"paste":de=S3;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=c1;break;case"toggle":case"beforetoggle":de=I3}var et=(o&4)!==0,Zt=!et&&(i==="scroll"||i==="scrollend"),ne=et?ue!==null?ue+"Capture":null:ue;et=[];for(var ee=ae,oe;ee!==null;){var ge=ee;if(oe=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||oe===null||ne===null||(ge=jc(ee,ne),ge!=null&&et.push(hu(ee,ge,oe))),Zt)break;ee=ee.return}0<et.length&&(ue=new de(ue,$e,null,c,fe),ve.push({event:ue,listeners:et}))}}if((o&7)===0){e:{if(ue=i==="mouseover"||i==="pointerover",de=i==="mouseout"||i==="pointerout",ue&&c!==qp&&($e=c.relatedTarget||c.fromElement)&&(lo($e)||$e[li]))break e;if((de||ue)&&(ue=fe.window===fe?fe:(ue=fe.ownerDocument)?ue.defaultView||ue.parentWindow:window,de?($e=c.relatedTarget||c.toElement,de=ae,$e=$e?lo($e):null,$e!==null&&(Zt=a($e),et=$e.tag,$e!==Zt||et!==5&&et!==27&&et!==6)&&($e=null)):(de=null,$e=ae),de!==$e)){if(et=a1,ge="onMouseLeave",ne="onMouseEnter",ee="mouse",(i==="pointerout"||i==="pointerover")&&(et=c1,ge="onPointerLeave",ne="onPointerEnter",ee="pointer"),Zt=de==null?ue:oa(de),oe=$e==null?ue:oa($e),ue=new et(ge,ee+"leave",de,c,fe),ue.target=Zt,ue.relatedTarget=oe,ge=null,lo(fe)===ae&&(et=new et(ne,ee+"enter",$e,c,fe),et.target=oe,et.relatedTarget=Zt,ge=et),Zt=ge,de&&$e)t:{for(et=BO,ne=de,ee=$e,oe=0,ge=ne;ge;ge=et(ge))oe++;ge=0;for(var Ze=ee;Ze;Ze=et(Ze))ge++;for(;0<oe-ge;)ne=et(ne),oe--;for(;0<ge-oe;)ee=et(ee),ge--;for(;oe--;){if(ne===ee||ee!==null&&ne===ee.alternate){et=ne;break t}ne=et(ne),ee=et(ee)}et=null}else et=null;de!==null&&eC(ve,ue,de,et,!1),$e!==null&&Zt!==null&&eC(ve,Zt,$e,et,!0)}}e:{if(ue=ae?oa(ae):window,de=ue.nodeName&&ue.nodeName.toLowerCase(),de==="select"||de==="input"&&ue.type==="file")var Pt=v1;else if(p1(ue))if(_1)Pt=Y3;else{Pt=K3;var Ge=q3}else de=ue.nodeName,!de||de.toLowerCase()!=="input"||ue.type!=="checkbox"&&ue.type!=="radio"?ae&&Vp(ae.elementType)&&(Pt=v1):Pt=G3;if(Pt&&(Pt=Pt(i,ae))){g1(ve,Pt,c,fe);break e}Ge&&Ge(i,ue,ae),i==="focusout"&&ae&&ue.type==="number"&&ae.memoizedProps.value!=null&&Wp(ue,"number",ue.value)}switch(Ge=ae?oa(ae):window,i){case"focusin":(p1(Ge)||Ge.contentEditable==="true")&&(dl=Ge,sg=ae,Fc=null);break;case"focusout":Fc=sg=dl=null;break;case"mousedown":og=!0;break;case"contextmenu":case"mouseup":case"dragend":og=!1,E1(ve,c,fe);break;case"selectionchange":if(Z3)break;case"keydown":case"keyup":E1(ve,c,fe)}var dt;if(tg)e:{switch(i){case"compositionstart":var At="onCompositionStart";break e;case"compositionend":At="onCompositionEnd";break e;case"compositionupdate":At="onCompositionUpdate";break e}At=void 0}else ul?f1(i,c)&&(At="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(At="onCompositionStart");At&&(u1&&c.locale!=="ko"&&(ul||At!=="onCompositionStart"?At==="onCompositionEnd"&&ul&&(dt=s1()):(uo=fe,Xp="value"in uo?uo.value:uo.textContent,ul=!0)),Ge=Gh(ae,At),0<Ge.length&&(At=new l1(At,i,null,c,fe),ve.push({event:At,listeners:Ge}),dt?At.data=dt:(dt=m1(c),dt!==null&&(At.data=dt)))),(dt=F3?U3(i,c):$3(i,c))&&(At=Gh(ae,"onBeforeInput"),0<At.length&&(Ge=new l1("onBeforeInput","beforeinput",null,c,fe),ve.push({event:Ge,listeners:At}),Ge.data=dt)),OO(ve,i,ae,c,fe)}QS(ve,o)})}function hu(i,o,c){return{instance:i,listener:o,currentTarget:c}}function Gh(i,o){for(var c=o+"Capture",m=[];i!==null;){var b=i,x=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||x===null||(b=jc(i,c),b!=null&&m.unshift(hu(i,b,x)),b=jc(i,o),b!=null&&m.push(hu(i,b,x))),i.tag===3)return m;i=i.return}return[]}function BO(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function eC(i,o,c,m,b){for(var x=o._reactName,T=[];c!==null&&c!==m;){var z=c,Q=z.alternate,ae=z.stateNode;if(z=z.tag,Q!==null&&Q===m)break;z!==5&&z!==26&&z!==27||ae===null||(Q=ae,b?(ae=jc(c,x),ae!=null&&T.unshift(hu(c,ae,Q))):b||(ae=jc(c,x),ae!=null&&T.push(hu(c,ae,Q)))),c=c.return}T.length!==0&&i.push({event:o,listeners:T})}var IO=/\r\n?/g,HO=/\u0000|\uFFFD/g;function tC(i){return(typeof i=="string"?i:""+i).replace(IO,`
49
- `).replace(HO,"")}function nC(i,o){return o=tC(o),tC(i)===o}function Xt(i,o,c,m,b,x){switch(c){case"children":typeof m=="string"?o==="body"||o==="textarea"&&m===""||al(i,m):(typeof m=="number"||typeof m=="bigint")&&o!=="body"&&al(i,""+m);break;case"className":Nt(i,"class",m);break;case"tabIndex":Nt(i,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":Nt(i,c,m);break;case"style":n1(i,m,x);break;case"data":if(o!=="object"){Nt(i,"data",m);break}case"src":case"href":if(m===""&&(o!=="a"||c!=="href")){i.removeAttribute(c);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){i.removeAttribute(c);break}m=eh(""+m),i.setAttribute(c,m);break;case"action":case"formAction":if(typeof m=="function"){i.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(c==="formAction"?(o!=="input"&&Xt(i,o,"name",b.name,b,null),Xt(i,o,"formEncType",b.formEncType,b,null),Xt(i,o,"formMethod",b.formMethod,b,null),Xt(i,o,"formTarget",b.formTarget,b,null)):(Xt(i,o,"encType",b.encType,b,null),Xt(i,o,"method",b.method,b,null),Xt(i,o,"target",b.target,b,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){i.removeAttribute(c);break}m=eh(""+m),i.setAttribute(c,m);break;case"onClick":m!=null&&(i.onclick=Ss);break;case"onScroll":m!=null&&kt("scroll",i);break;case"onScrollEnd":m!=null&&kt("scrollend",i);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(c=m.__html,c!=null){if(b.children!=null)throw Error(r(60));i.innerHTML=c}}break;case"multiple":i.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":i.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){i.removeAttribute("xlink:href");break}c=eh(""+m),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(c,""+m):i.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":m&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(c,""):i.removeAttribute(c);break;case"capture":case"download":m===!0?i.setAttribute(c,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(c,m):i.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?i.setAttribute(c,m):i.removeAttribute(c);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?i.removeAttribute(c):i.setAttribute(c,m);break;case"popover":kt("beforetoggle",i),kt("toggle",i),Fe(i,"popover",m);break;case"xlinkActuate":Wt(i,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":Wt(i,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":Wt(i,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":Wt(i,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":Wt(i,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":Wt(i,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":Wt(i,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":Wt(i,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":Wt(i,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":Fe(i,"is",m);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=m3.get(c)||c,Fe(i,c,m))}}function Av(i,o,c,m,b,x){switch(c){case"style":n1(i,m,x);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(c=m.__html,c!=null){if(b.children!=null)throw Error(r(60));i.innerHTML=c}}break;case"children":typeof m=="string"?al(i,m):(typeof m=="number"||typeof m=="bigint")&&al(i,""+m);break;case"onScroll":m!=null&&kt("scroll",i);break;case"onScrollEnd":m!=null&&kt("scrollend",i);break;case"onClick":m!=null&&(i.onclick=Ss);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xd.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(b=c.endsWith("Capture"),o=c.slice(2,b?c.length-7:void 0),x=i[Cn]||null,x=x!=null?x[c]:null,typeof x=="function"&&i.removeEventListener(o,x,b),typeof m=="function")){typeof x!="function"&&x!==null&&(c in i?i[c]=null:i.hasAttribute(c)&&i.removeAttribute(c)),i.addEventListener(o,m,b);break e}c in i?i[c]=m:m===!0?i.setAttribute(c,""):Fe(i,c,m)}}}function lr(i,o,c){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":kt("error",i),kt("load",i);var m=!1,b=!1,x;for(x in c)if(c.hasOwnProperty(x)){var T=c[x];if(T!=null)switch(x){case"src":m=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,o));default:Xt(i,o,x,T,c,null)}}b&&Xt(i,o,"srcSet",c.srcSet,c,null),m&&Xt(i,o,"src",c.src,c,null);return;case"input":kt("invalid",i);var z=x=T=b=null,Q=null,ae=null;for(m in c)if(c.hasOwnProperty(m)){var fe=c[m];if(fe!=null)switch(m){case"name":b=fe;break;case"type":T=fe;break;case"checked":Q=fe;break;case"defaultChecked":ae=fe;break;case"value":x=fe;break;case"defaultValue":z=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(r(137,o));break;default:Xt(i,o,m,fe,c,null)}}Qx(i,x,z,Q,ae,T,b,!1);return;case"select":kt("invalid",i),m=T=x=null;for(b in c)if(c.hasOwnProperty(b)&&(z=c[b],z!=null))switch(b){case"value":x=z;break;case"defaultValue":T=z;break;case"multiple":m=z;default:Xt(i,o,b,z,c,null)}o=x,c=T,i.multiple=!!m,o!=null?ol(i,!!m,o,!1):c!=null&&ol(i,!!m,c,!0);return;case"textarea":kt("invalid",i),x=b=m=null;for(T in c)if(c.hasOwnProperty(T)&&(z=c[T],z!=null))switch(T){case"value":m=z;break;case"defaultValue":b=z;break;case"children":x=z;break;case"dangerouslySetInnerHTML":if(z!=null)throw Error(r(91));break;default:Xt(i,o,T,z,c,null)}e1(i,m,b,x);return;case"option":for(Q in c)if(c.hasOwnProperty(Q)&&(m=c[Q],m!=null))switch(Q){case"selected":i.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:Xt(i,o,Q,m,c,null)}return;case"dialog":kt("beforetoggle",i),kt("toggle",i),kt("cancel",i),kt("close",i);break;case"iframe":case"object":kt("load",i);break;case"video":case"audio":for(m=0;m<du.length;m++)kt(du[m],i);break;case"image":kt("error",i),kt("load",i);break;case"details":kt("toggle",i);break;case"embed":case"source":case"link":kt("error",i),kt("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in c)if(c.hasOwnProperty(ae)&&(m=c[ae],m!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,o));default:Xt(i,o,ae,m,c,null)}return;default:if(Vp(o)){for(fe in c)c.hasOwnProperty(fe)&&(m=c[fe],m!==void 0&&Av(i,o,fe,m,c,void 0));return}}for(z in c)c.hasOwnProperty(z)&&(m=c[z],m!=null&&Xt(i,o,z,m,c,null))}function FO(i,o,c,m){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,x=null,T=null,z=null,Q=null,ae=null,fe=null;for(de in c){var ve=c[de];if(c.hasOwnProperty(de)&&ve!=null)switch(de){case"checked":break;case"value":break;case"defaultValue":Q=ve;default:m.hasOwnProperty(de)||Xt(i,o,de,null,m,ve)}}for(var ue in m){var de=m[ue];if(ve=c[ue],m.hasOwnProperty(ue)&&(de!=null||ve!=null))switch(ue){case"type":x=de;break;case"name":b=de;break;case"checked":ae=de;break;case"defaultChecked":fe=de;break;case"value":T=de;break;case"defaultValue":z=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(r(137,o));break;default:de!==ve&&Xt(i,o,ue,de,m,ve)}}$p(i,T,z,Q,ae,fe,x,b);return;case"select":de=T=z=ue=null;for(x in c)if(Q=c[x],c.hasOwnProperty(x)&&Q!=null)switch(x){case"value":break;case"multiple":de=Q;default:m.hasOwnProperty(x)||Xt(i,o,x,null,m,Q)}for(b in m)if(x=m[b],Q=c[b],m.hasOwnProperty(b)&&(x!=null||Q!=null))switch(b){case"value":ue=x;break;case"defaultValue":z=x;break;case"multiple":T=x;default:x!==Q&&Xt(i,o,b,x,m,Q)}o=z,c=T,m=de,ue!=null?ol(i,!!c,ue,!1):!!m!=!!c&&(o!=null?ol(i,!!c,o,!0):ol(i,!!c,c?[]:"",!1));return;case"textarea":de=ue=null;for(z in c)if(b=c[z],c.hasOwnProperty(z)&&b!=null&&!m.hasOwnProperty(z))switch(z){case"value":break;case"children":break;default:Xt(i,o,z,null,m,b)}for(T in m)if(b=m[T],x=c[T],m.hasOwnProperty(T)&&(b!=null||x!=null))switch(T){case"value":ue=b;break;case"defaultValue":de=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(r(91));break;default:b!==x&&Xt(i,o,T,b,m,x)}Jx(i,ue,de);return;case"option":for(var $e in c)if(ue=c[$e],c.hasOwnProperty($e)&&ue!=null&&!m.hasOwnProperty($e))switch($e){case"selected":i.selected=!1;break;default:Xt(i,o,$e,null,m,ue)}for(Q in m)if(ue=m[Q],de=c[Q],m.hasOwnProperty(Q)&&ue!==de&&(ue!=null||de!=null))switch(Q){case"selected":i.selected=ue&&typeof ue!="function"&&typeof ue!="symbol";break;default:Xt(i,o,Q,ue,m,de)}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 et in c)ue=c[et],c.hasOwnProperty(et)&&ue!=null&&!m.hasOwnProperty(et)&&Xt(i,o,et,null,m,ue);for(ae in m)if(ue=m[ae],de=c[ae],m.hasOwnProperty(ae)&&ue!==de&&(ue!=null||de!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(r(137,o));break;default:Xt(i,o,ae,ue,m,de)}return;default:if(Vp(o)){for(var Zt in c)ue=c[Zt],c.hasOwnProperty(Zt)&&ue!==void 0&&!m.hasOwnProperty(Zt)&&Av(i,o,Zt,void 0,m,ue);for(fe in m)ue=m[fe],de=c[fe],!m.hasOwnProperty(fe)||ue===de||ue===void 0&&de===void 0||Av(i,o,fe,ue,m,de);return}}for(var ne in c)ue=c[ne],c.hasOwnProperty(ne)&&ue!=null&&!m.hasOwnProperty(ne)&&Xt(i,o,ne,null,m,ue);for(ve in m)ue=m[ve],de=c[ve],!m.hasOwnProperty(ve)||ue===de||ue==null&&de==null||Xt(i,o,ve,ue,m,de)}function rC(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function UO(){if(typeof performance.getEntriesByType=="function"){for(var i=0,o=0,c=performance.getEntriesByType("resource"),m=0;m<c.length;m++){var b=c[m],x=b.transferSize,T=b.initiatorType,z=b.duration;if(x&&z&&rC(T)){for(T=0,z=b.responseEnd,m+=1;m<c.length;m++){var Q=c[m],ae=Q.startTime;if(ae>z)break;var fe=Q.transferSize,ve=Q.initiatorType;fe&&rC(ve)&&(Q=Q.responseEnd,T+=fe*(Q<z?1:(z-ae)/(Q-ae)))}if(--m,o+=8*(x+T)/(b.duration/1e3),i++,10<i)break}}if(0<i)return o/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var Dv=null,jv=null;function Yh(i){return i.nodeType===9?i:i.ownerDocument}function iC(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function sC(i,o){if(i===0)switch(o){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&o==="foreignObject"?0:i}function Ov(i,o){return i==="textarea"||i==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.children=="bigint"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Lv=null;function $O(){var i=window.event;return i&&i.type==="popstate"?i===Lv?!1:(Lv=i,!0):(Lv=null,!1)}var oC=typeof setTimeout=="function"?setTimeout:void 0,WO=typeof clearTimeout=="function"?clearTimeout:void 0,aC=typeof Promise=="function"?Promise:void 0,VO=typeof queueMicrotask=="function"?queueMicrotask:typeof aC<"u"?function(i){return aC.resolve(null).then(i).catch(qO)}:oC;function qO(i){setTimeout(function(){throw i})}function To(i){return i==="head"}function lC(i,o){var c=o,m=0;do{var b=c.nextSibling;if(i.removeChild(c),b&&b.nodeType===8)if(c=b.data,c==="/$"||c==="/&"){if(m===0){i.removeChild(b),Bl(o);return}m--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")m++;else if(c==="html")fu(i.ownerDocument.documentElement);else if(c==="head"){c=i.ownerDocument.head,fu(c);for(var x=c.firstChild;x;){var T=x.nextSibling,z=x.nodeName;x[sa]||z==="SCRIPT"||z==="STYLE"||z==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=T}}else c==="body"&&fu(i.ownerDocument.body);c=b}while(c);Bl(o)}function cC(i,o){var c=i;i=0;do{var m=c.nextSibling;if(c.nodeType===1?o?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(o?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),m&&m.nodeType===8)if(c=m.data,c==="/$"){if(i===0)break;i--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||i++;c=m}while(c)}function zv(i){var o=i.firstChild;for(o&&o.nodeType===10&&(o=o.nextSibling);o;){var c=o;switch(o=o.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":zv(c),Dc(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function KO(i,o,c,m){for(;i.nodeType===1;){var b=c;if(i.nodeName.toLowerCase()!==o.toLowerCase()){if(!m&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(m){if(!i[sa])switch(o){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(x=i.getAttribute("rel"),x==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(x!==b.rel||i.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||i.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||i.getAttribute("title")!==(b.title==null?null:b.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(x=i.getAttribute("src"),(x!==(b.src==null?null:b.src)||i.getAttribute("type")!==(b.type==null?null:b.type)||i.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&x&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(o==="input"&&i.type==="hidden"){var x=b.name==null?null:""+b.name;if(b.type==="hidden"&&i.getAttribute("name")===x)return i}else return i;if(i=gi(i.nextSibling),i===null)break}return null}function GO(i,o,c){if(o==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=gi(i.nextSibling),i===null))return null;return i}function uC(i,o){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!o||(i=gi(i.nextSibling),i===null))return null;return i}function Pv(i){return i.data==="$?"||i.data==="$~"}function Bv(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function YO(i,o){var c=i.ownerDocument;if(i.data==="$~")i._reactRetry=o;else if(i.data!=="$?"||c.readyState!=="loading")o();else{var m=function(){o(),c.removeEventListener("DOMContentLoaded",m)};c.addEventListener("DOMContentLoaded",m),i._reactRetry=m}}function gi(i){for(;i!=null;i=i.nextSibling){var o=i.nodeType;if(o===1||o===3)break;if(o===8){if(o=i.data,o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"||o==="F!"||o==="F")break;if(o==="/$"||o==="/&")return null}}return i}var Iv=null;function dC(i){i=i.nextSibling;for(var o=0;i;){if(i.nodeType===8){var c=i.data;if(c==="/$"||c==="/&"){if(o===0)return gi(i.nextSibling);o--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||o++}i=i.nextSibling}return null}function hC(i){i=i.previousSibling;for(var o=0;i;){if(i.nodeType===8){var c=i.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(o===0)return i;o--}else c!=="/$"&&c!=="/&"||o++}i=i.previousSibling}return null}function fC(i,o,c){switch(o=Yh(c),i){case"html":if(i=o.documentElement,!i)throw Error(r(452));return i;case"head":if(i=o.head,!i)throw Error(r(453));return i;case"body":if(i=o.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function fu(i){for(var o=i.attributes;o.length;)i.removeAttributeNode(o[0]);Dc(i)}var vi=new Map,mC=new Set;function Xh(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Is=F.d;F.d={f:XO,r:ZO,D:QO,C:JO,L:e4,m:t4,X:r4,S:n4,M:i4};function XO(){var i=Is.f(),o=Fh();return i||o}function ZO(i){var o=co(i);o!==null&&o.tag===5&&o.type==="form"?Aw(o):Is.r(i)}var Ll=typeof document>"u"?null:document;function pC(i,o,c){var m=Ll;if(m&&typeof o=="string"&&o){var b=ci(o);b='link[rel="'+i+'"][href="'+b+'"]',typeof c=="string"&&(b+='[crossorigin="'+c+'"]'),mC.has(b)||(mC.add(b),i={rel:i,crossOrigin:c,href:o},m.querySelector(b)===null&&(o=m.createElement("link"),lr(o,"link",i),Mn(o),m.head.appendChild(o)))}}function QO(i){Is.D(i),pC("dns-prefetch",i,null)}function JO(i,o){Is.C(i,o),pC("preconnect",i,o)}function e4(i,o,c){Is.L(i,o,c);var m=Ll;if(m&&i&&o){var b='link[rel="preload"][as="'+ci(o)+'"]';o==="image"&&c&&c.imageSrcSet?(b+='[imagesrcset="'+ci(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(b+='[imagesizes="'+ci(c.imageSizes)+'"]')):b+='[href="'+ci(i)+'"]';var x=b;switch(o){case"style":x=zl(i);break;case"script":x=Pl(i)}vi.has(x)||(i=p({rel:"preload",href:o==="image"&&c&&c.imageSrcSet?void 0:i,as:o},c),vi.set(x,i),m.querySelector(b)!==null||o==="style"&&m.querySelector(mu(x))||o==="script"&&m.querySelector(pu(x))||(o=m.createElement("link"),lr(o,"link",i),Mn(o),m.head.appendChild(o)))}}function t4(i,o){Is.m(i,o);var c=Ll;if(c&&i){var m=o&&typeof o.as=="string"?o.as:"script",b='link[rel="modulepreload"][as="'+ci(m)+'"][href="'+ci(i)+'"]',x=b;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Pl(i)}if(!vi.has(x)&&(i=p({rel:"modulepreload",href:i},o),vi.set(x,i),c.querySelector(b)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(pu(x)))return}m=c.createElement("link"),lr(m,"link",i),Mn(m),c.head.appendChild(m)}}}function n4(i,o,c){Is.S(i,o,c);var m=Ll;if(m&&i){var b=Yi(m).hoistableStyles,x=zl(i);o=o||"default";var T=b.get(x);if(!T){var z={loading:0,preload:null};if(T=m.querySelector(mu(x)))z.loading=5;else{i=p({rel:"stylesheet",href:i,"data-precedence":o},c),(c=vi.get(x))&&Hv(i,c);var Q=T=m.createElement("link");Mn(Q),lr(Q,"link",i),Q._p=new Promise(function(ae,fe){Q.onload=ae,Q.onerror=fe}),Q.addEventListener("load",function(){z.loading|=1}),Q.addEventListener("error",function(){z.loading|=2}),z.loading|=4,Zh(T,o,m)}T={type:"stylesheet",instance:T,count:1,state:z},b.set(x,T)}}}function r4(i,o){Is.X(i,o);var c=Ll;if(c&&i){var m=Yi(c).hoistableScripts,b=Pl(i),x=m.get(b);x||(x=c.querySelector(pu(b)),x||(i=p({src:i,async:!0},o),(o=vi.get(b))&&Fv(i,o),x=c.createElement("script"),Mn(x),lr(x,"link",i),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},m.set(b,x))}}function i4(i,o){Is.M(i,o);var c=Ll;if(c&&i){var m=Yi(c).hoistableScripts,b=Pl(i),x=m.get(b);x||(x=c.querySelector(pu(b)),x||(i=p({src:i,async:!0,type:"module"},o),(o=vi.get(b))&&Fv(i,o),x=c.createElement("script"),Mn(x),lr(x,"link",i),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},m.set(b,x))}}function gC(i,o,c,m){var b=(b=Z.current)?Xh(b):null;if(!b)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(o=zl(c.href),c=Yi(b).hoistableStyles,m=c.get(o),m||(m={type:"style",instance:null,count:0,state:null},c.set(o,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){i=zl(c.href);var x=Yi(b).hoistableStyles,T=x.get(i);if(T||(b=b.ownerDocument||b,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(i,T),(x=b.querySelector(mu(i)))&&!x._p&&(T.instance=x,T.state.loading=5),vi.has(i)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},vi.set(i,c),x||s4(b,i,c,T.state))),o&&m===null)throw Error(r(528,""));return T}if(o&&m!==null)throw Error(r(529,""));return null;case"script":return o=c.async,c=c.src,typeof c=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(o=Pl(c),c=Yi(b).hoistableScripts,m=c.get(o),m||(m={type:"script",instance:null,count:0,state:null},c.set(o,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function zl(i){return'href="'+ci(i)+'"'}function mu(i){return'link[rel="stylesheet"]['+i+"]"}function vC(i){return p({},i,{"data-precedence":i.precedence,precedence:null})}function s4(i,o,c,m){i.querySelector('link[rel="preload"][as="style"]['+o+"]")?m.loading=1:(o=i.createElement("link"),m.preload=o,o.addEventListener("load",function(){return m.loading|=1}),o.addEventListener("error",function(){return m.loading|=2}),lr(o,"link",c),Mn(o),i.head.appendChild(o))}function Pl(i){return'[src="'+ci(i)+'"]'}function pu(i){return"script[async]"+i}function _C(i,o,c){if(o.count++,o.instance===null)switch(o.type){case"style":var m=i.querySelector('style[data-href~="'+ci(c.href)+'"]');if(m)return o.instance=m,Mn(m),m;var b=p({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return m=(i.ownerDocument||i).createElement("style"),Mn(m),lr(m,"style",b),Zh(m,c.precedence,i),o.instance=m;case"stylesheet":b=zl(c.href);var x=i.querySelector(mu(b));if(x)return o.state.loading|=4,o.instance=x,Mn(x),x;m=vC(c),(b=vi.get(b))&&Hv(m,b),x=(i.ownerDocument||i).createElement("link"),Mn(x);var T=x;return T._p=new Promise(function(z,Q){T.onload=z,T.onerror=Q}),lr(x,"link",m),o.state.loading|=4,Zh(x,c.precedence,i),o.instance=x;case"script":return x=Pl(c.src),(b=i.querySelector(pu(x)))?(o.instance=b,Mn(b),b):(m=c,(b=vi.get(x))&&(m=p({},c),Fv(m,b)),i=i.ownerDocument||i,b=i.createElement("script"),Mn(b),lr(b,"link",m),i.head.appendChild(b),o.instance=b);case"void":return null;default:throw Error(r(443,o.type))}else o.type==="stylesheet"&&(o.state.loading&4)===0&&(m=o.instance,o.state.loading|=4,Zh(m,c.precedence,i));return o.instance}function Zh(i,o,c){for(var m=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=m.length?m[m.length-1]:null,x=b,T=0;T<m.length;T++){var z=m[T];if(z.dataset.precedence===o)x=z;else if(x!==b)break}x?x.parentNode.insertBefore(i,x.nextSibling):(o=c.nodeType===9?c.head:c,o.insertBefore(i,o.firstChild))}function Hv(i,o){i.crossOrigin==null&&(i.crossOrigin=o.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=o.referrerPolicy),i.title==null&&(i.title=o.title)}function Fv(i,o){i.crossOrigin==null&&(i.crossOrigin=o.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=o.referrerPolicy),i.integrity==null&&(i.integrity=o.integrity)}var Qh=null;function bC(i,o,c){if(Qh===null){var m=new Map,b=Qh=new Map;b.set(c,m)}else b=Qh,m=b.get(c),m||(m=new Map,b.set(c,m));if(m.has(i))return m;for(m.set(i,null),c=c.getElementsByTagName(i),b=0;b<c.length;b++){var x=c[b];if(!(x[sa]||x[It]||i==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var T=x.getAttribute(o)||"";T=i+T;var z=m.get(T);z?z.push(x):m.set(T,[x])}}return m}function yC(i,o,c){i=i.ownerDocument||i,i.head.insertBefore(c,o==="title"?i.querySelector("head > title"):null)}function o4(i,o,c){if(c===1||o.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;switch(o.rel){case"stylesheet":return i=o.disabled,typeof o.precedence=="string"&&i==null;default:return!0}case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function xC(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function a4(i,o,c,m){if(c.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var b=zl(m.href),x=o.querySelector(mu(b));if(x){o=x._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(i.count++,i=Jh.bind(i),o.then(i,i)),c.state.loading|=4,c.instance=x,Mn(x);return}x=o.ownerDocument||o,m=vC(m),(b=vi.get(b))&&Hv(m,b),x=x.createElement("link"),Mn(x);var T=x;T._p=new Promise(function(z,Q){T.onload=z,T.onerror=Q}),lr(x,"link",m),c.instance=x}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(c,o),(o=c.state.preload)&&(c.state.loading&3)===0&&(i.count++,c=Jh.bind(i),o.addEventListener("load",c),o.addEventListener("error",c))}}var Uv=0;function l4(i,o){return i.stylesheets&&i.count===0&&tf(i,i.stylesheets),0<i.count||0<i.imgCount?function(c){var m=setTimeout(function(){if(i.stylesheets&&tf(i,i.stylesheets),i.unsuspend){var x=i.unsuspend;i.unsuspend=null,x()}},6e4+o);0<i.imgBytes&&Uv===0&&(Uv=62500*UO());var b=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&tf(i,i.stylesheets),i.unsuspend)){var x=i.unsuspend;i.unsuspend=null,x()}},(i.imgBytes>Uv?50:800)+o);return i.unsuspend=c,function(){i.unsuspend=null,clearTimeout(m),clearTimeout(b)}}:null}function Jh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tf(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var ef=null;function tf(i,o){i.stylesheets=null,i.unsuspend!==null&&(i.count++,ef=new Map,o.forEach(c4,i),ef=null,Jh.call(i))}function c4(i,o){if(!(o.state.loading&4)){var c=ef.get(i);if(c)var m=c.get(null);else{c=new Map,ef.set(i,c);for(var b=i.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<b.length;x++){var T=b[x];(T.nodeName==="LINK"||T.getAttribute("media")!=="not all")&&(c.set(T.dataset.precedence,T),m=T)}m&&c.set(null,m)}b=o.instance,T=b.getAttribute("data-precedence"),x=c.get(T)||m,x===m&&c.set(null,b),c.set(T,b),this.count++,m=Jh.bind(this),b.addEventListener("load",m),b.addEventListener("error",m),x?x.parentNode.insertBefore(b,x.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(b,i.firstChild)),o.state.loading|=4}}var gu={$$typeof:E,Provider:null,Consumer:null,_currentValue:H,_currentValue2:H,_threadCount:0};function u4(i,o,c,m,b,x,T,z,Q){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=an(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=an(0),this.hiddenUpdates=an(null),this.identifierPrefix=m,this.onUncaughtError=b,this.onCaughtError=x,this.onRecoverableError=T,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function wC(i,o,c,m,b,x,T,z,Q,ae,fe,ve){return i=new u4(i,o,c,T,Q,ae,fe,ve,z),o=1,x===!0&&(o|=24),x=Kr(3,null,null,o),i.current=x,x.stateNode=i,o=xg(),o.refCount++,i.pooledCache=o,o.refCount++,x.memoizedState={element:m,isDehydrated:c,cache:o},kg(x),i}function SC(i){return i?(i=ml,i):ml}function CC(i,o,c,m,b,x){b=SC(b),m.context===null?m.context=b:m.pendingContext=b,m=vo(o),m.payload={element:c},x=x===void 0?null:x,x!==null&&(m.callback=x),c=_o(i,m,o),c!==null&&(Br(c,i,o),Gc(c,i,o))}function kC(i,o){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<o?c:o}}function $v(i,o){kC(i,o),(i=i.alternate)&&kC(i,o)}function EC(i){if(i.tag===13||i.tag===31){var o=ua(i,67108864);o!==null&&Br(o,i,67108864),$v(i,67108864)}}function RC(i){if(i.tag===13||i.tag===31){var o=Qr();o=qt(o);var c=ua(i,o);c!==null&&Br(c,i,o),$v(i,o)}}var nf=!0;function d4(i,o,c,m){var b=O.T;O.T=null;var x=F.p;try{F.p=2,Wv(i,o,c,m)}finally{F.p=x,O.T=b}}function h4(i,o,c,m){var b=O.T;O.T=null;var x=F.p;try{F.p=8,Wv(i,o,c,m)}finally{F.p=x,O.T=b}}function Wv(i,o,c,m){if(nf){var b=Vv(m);if(b===null)Mv(i,o,m,rf,c),NC(i,m);else if(m4(b,i,o,c,m))m.stopPropagation();else if(NC(i,m),o&4&&-1<f4.indexOf(i)){for(;b!==null;){var x=co(b);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var T=zt(x.pendingLanes);if(T!==0){var z=x;for(z.pendingLanes|=2,z.entangledLanes|=2;T;){var Q=1<<31-at(T);z.entanglements[1]|=Q,T&=~Q}es(x),(Ht&6)===0&&(Ih=Se()+500,uu(0))}}break;case 31:case 13:z=ua(x,2),z!==null&&Br(z,x,2),Fh(),$v(x,2)}if(x=Vv(m),x===null&&Mv(i,o,m,rf,c),x===b)break;b=x}b!==null&&m.stopPropagation()}else Mv(i,o,m,null,c)}}function Vv(i){return i=Kp(i),qv(i)}var rf=null;function qv(i){if(rf=null,i=lo(i),i!==null){var o=a(i);if(o===null)i=null;else{var c=o.tag;if(c===13){if(i=l(o),i!==null)return i;i=null}else if(c===31){if(i=u(o),i!==null)return i;i=null}else if(c===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;i=null}else o!==i&&(i=null)}}return rf=i,null}function TC(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(De()){case ce:return 2;case be:return 8;case Oe:case We:return 32;case we:return 268435456;default:return 32}default:return 32}}var Kv=!1,No=null,Mo=null,Ao=null,vu=new Map,_u=new Map,Do=[],f4="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 NC(i,o){switch(i){case"focusin":case"focusout":No=null;break;case"dragenter":case"dragleave":Mo=null;break;case"mouseover":case"mouseout":Ao=null;break;case"pointerover":case"pointerout":vu.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":_u.delete(o.pointerId)}}function bu(i,o,c,m,b,x){return i===null||i.nativeEvent!==x?(i={blockedOn:o,domEventName:c,eventSystemFlags:m,nativeEvent:x,targetContainers:[b]},o!==null&&(o=co(o),o!==null&&EC(o)),i):(i.eventSystemFlags|=m,o=i.targetContainers,b!==null&&o.indexOf(b)===-1&&o.push(b),i)}function m4(i,o,c,m,b){switch(o){case"focusin":return No=bu(No,i,o,c,m,b),!0;case"dragenter":return Mo=bu(Mo,i,o,c,m,b),!0;case"mouseover":return Ao=bu(Ao,i,o,c,m,b),!0;case"pointerover":var x=b.pointerId;return vu.set(x,bu(vu.get(x)||null,i,o,c,m,b)),!0;case"gotpointercapture":return x=b.pointerId,_u.set(x,bu(_u.get(x)||null,i,o,c,m,b)),!0}return!1}function MC(i){var o=lo(i.target);if(o!==null){var c=a(o);if(c!==null){if(o=c.tag,o===13){if(o=l(c),o!==null){i.blockedOn=o,G(i.priority,function(){RC(c)});return}}else if(o===31){if(o=u(c),o!==null){i.blockedOn=o,G(i.priority,function(){RC(c)});return}}else if(o===3&&c.stateNode.current.memoizedState.isDehydrated){i.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}i.blockedOn=null}function sf(i){if(i.blockedOn!==null)return!1;for(var o=i.targetContainers;0<o.length;){var c=Vv(i.nativeEvent);if(c===null){c=i.nativeEvent;var m=new c.constructor(c.type,c);qp=m,c.target.dispatchEvent(m),qp=null}else return o=co(c),o!==null&&EC(o),i.blockedOn=c,!1;o.shift()}return!0}function AC(i,o,c){sf(i)&&c.delete(o)}function p4(){Kv=!1,No!==null&&sf(No)&&(No=null),Mo!==null&&sf(Mo)&&(Mo=null),Ao!==null&&sf(Ao)&&(Ao=null),vu.forEach(AC),_u.forEach(AC)}function of(i,o){i.blockedOn===o&&(i.blockedOn=null,Kv||(Kv=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,p4)))}var af=null;function DC(i){af!==i&&(af=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){af===i&&(af=null);for(var o=0;o<i.length;o+=3){var c=i[o],m=i[o+1],b=i[o+2];if(typeof m!="function"){if(qv(m||c)===null)continue;break}var x=co(c);x!==null&&(i.splice(o,3),o-=3,Vg(x,{pending:!0,data:b,method:c.method,action:m},m,b))}}))}function Bl(i){function o(Q){return of(Q,i)}No!==null&&of(No,i),Mo!==null&&of(Mo,i),Ao!==null&&of(Ao,i),vu.forEach(o),_u.forEach(o);for(var c=0;c<Do.length;c++){var m=Do[c];m.blockedOn===i&&(m.blockedOn=null)}for(;0<Do.length&&(c=Do[0],c.blockedOn===null);)MC(c),c.blockedOn===null&&Do.shift();if(c=(i.ownerDocument||i).$$reactFormReplay,c!=null)for(m=0;m<c.length;m+=3){var b=c[m],x=c[m+1],T=b[Cn]||null;if(typeof x=="function")T||DC(c);else if(T){var z=null;if(x&&x.hasAttribute("formAction")){if(b=x,T=x[Cn]||null)z=T.formAction;else if(qv(b)!==null)continue}else z=T.action;typeof z=="function"?c[m+1]=z:(c.splice(m,3),m-=3),DC(c)}}}function jC(){function i(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(T){return b=T})},focusReset:"manual",scroll:"manual"})}function o(){b!==null&&(b(),b=null),m||setTimeout(c,20)}function c(){if(!m&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,b=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",o),navigation.addEventListener("navigateerror",o),setTimeout(c,100),function(){m=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",o),navigation.removeEventListener("navigateerror",o),b!==null&&(b(),b=null)}}}function Gv(i){this._internalRoot=i}lf.prototype.render=Gv.prototype.render=function(i){var o=this._internalRoot;if(o===null)throw Error(r(409));var c=o.current,m=Qr();CC(c,m,i,o,null,null)},lf.prototype.unmount=Gv.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var o=i.containerInfo;CC(i.current,2,null,i,null,null),Fh(),o[li]=null}};function lf(i){this._internalRoot=i}lf.prototype.unstable_scheduleHydration=function(i){if(i){var o=sn();i={blockedOn:null,target:i,priority:o};for(var c=0;c<Do.length&&o!==0&&o<Do[c].priority;c++);Do.splice(c,0,i),c===0&&MC(i)}};var OC=t.version;if(OC!=="19.2.1")throw Error(r(527,OC,"19.2.1"));F.findDOMNode=function(i){var o=i._reactInternals;if(o===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=d(o),i=i!==null?g(i):null,i=i===null?null:i.stateNode,i};var g4={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:O,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cf.isDisabled&&cf.supportsFiber)try{rt=cf.inject(g4),ze=cf}catch{}}return wu.createRoot=function(i,o){if(!s(i))throw Error(r(299));var c=!1,m="",b=Fw,x=Uw,T=$w;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onUncaughtError!==void 0&&(b=o.onUncaughtError),o.onCaughtError!==void 0&&(x=o.onCaughtError),o.onRecoverableError!==void 0&&(T=o.onRecoverableError)),o=wC(i,1,!1,null,null,c,m,null,b,x,T,jC),i[li]=o.current,Nv(i),new Gv(o)},wu.hydrateRoot=function(i,o,c){if(!s(i))throw Error(r(299));var m=!1,b="",x=Fw,T=Uw,z=$w,Q=null;return c!=null&&(c.unstable_strictMode===!0&&(m=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onUncaughtError!==void 0&&(x=c.onUncaughtError),c.onCaughtError!==void 0&&(T=c.onCaughtError),c.onRecoverableError!==void 0&&(z=c.onRecoverableError),c.formState!==void 0&&(Q=c.formState)),o=wC(i,1,!0,o,c??null,m,b,Q,x,T,z,jC),o.context=SC(null),c=o.current,m=Qr(),m=qt(m),b=vo(m),b.callback=null,_o(c,b,m),c=m,o.current.lanes=c,Ce(o,c),es(o),i[li]=o.current,Nv(i),new lf(o)},wu.version="19.2.1",wu}var GC;function T4(){if(GC)return Zv.exports;GC=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Zv.exports=R4(),Zv.exports}var N4=T4();/**
50
- * react-router v7.13.1
51
- *
52
- * Copyright (c) Remix Software Inc.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE.md file in the root directory of this source tree.
56
- *
57
- * @license MIT
58
- */var YC="popstate";function XC(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function M4(e={}){function t(r,s){var d;let a=(d=s.state)==null?void 0:d.masked,{pathname:l,search:u,hash:h}=a||r.location;return _b("",{pathname:l,search:u,hash:h},s.state&&s.state.usr||null,s.state&&s.state.key||"default",a?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:rd(s)}return D4(t,n,null,e)}function hn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Mi(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function A4(){return Math.random().toString(36).substring(2,10)}function ZC(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function _b(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?pc(t):t,state:n,key:t&&t.key||r||A4(),unstable_mask:s}}function rd({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function pc(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function D4(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:a=!1}=r,l=s.history,u="POP",h=null,d=g();d==null&&(d=0,l.replaceState({...l.state,idx:d},""));function g(){return(l.state||{idx:null}).idx}function p(){u="POP";let C=g(),k=C==null?null:C-d;d=C,h&&h({action:u,location:S.location,delta:k})}function v(C,k){u="PUSH";let R=XC(C)?C:_b(S.location,C,k);d=g()+1;let E=ZC(R,d),N=S.createHref(R.unstable_mask||R);try{l.pushState(E,"",N)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;s.location.assign(N)}a&&h&&h({action:u,location:S.location,delta:1})}function y(C,k){u="REPLACE";let R=XC(C)?C:_b(S.location,C,k);d=g();let E=ZC(R,d),N=S.createHref(R.unstable_mask||R);l.replaceState(E,"",N),a&&h&&h({action:u,location:S.location,delta:0})}function w(C){return j4(C)}let S={get action(){return u},get location(){return e(s,l)},listen(C){if(h)throw new Error("A history only accepts one active listener");return s.addEventListener(YC,p),h=C,()=>{s.removeEventListener(YC,p),h=null}},createHref(C){return t(s,C)},createURL:w,encodeLocation(C){let k=w(C);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:v,replace:y,go(C){return l.go(C)}};return S}function j4(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),hn(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:rd(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function iT(e,t,n="/"){return O4(e,t,n,!1)}function O4(e,t,n,r){let s=typeof t=="string"?pc(t):t,a=Ys(s.pathname||"/",n);if(a==null)return null;let l=sT(e);L4(l);let u=null;for(let h=0;u==null&&h<l.length;++h){let d=q4(a);u=W4(l[h],d,r)}return u}function sT(e,t=[],n=[],r="",s=!1){let a=(l,u,h=s,d)=>{let g={relativePath:d===void 0?l.path||"":d,caseSensitive:l.caseSensitive===!0,childrenIndex:u,route:l};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(r)&&h)return;hn(g.relativePath.startsWith(r),`Absolute route path "${g.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(r.length)}let p=ps([r,g.relativePath]),v=n.concat(g);l.children&&l.children.length>0&&(hn(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),sT(l.children,t,v,p,h)),!(l.path==null&&!l.index)&&t.push({path:p,score:U4(p,l.index),routesMeta:v})};return e.forEach((l,u)=>{var h;if(l.path===""||!((h=l.path)!=null&&h.includes("?")))a(l,u);else for(let d of oT(l.path))a(l,u,!0,d)}),t}function oT(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return s?[a,""]:[a];let l=oT(r.join("/")),u=[];return u.push(...l.map(h=>h===""?a:[a,h].join("/"))),s&&u.push(...l),u.map(h=>e.startsWith("/")&&h===""?"/":h)}function L4(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:$4(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var z4=/^:[\w-]+$/,P4=3,B4=2,I4=1,H4=10,F4=-2,QC=e=>e==="*";function U4(e,t){let n=e.split("/"),r=n.length;return n.some(QC)&&(r+=F4),t&&(r+=B4),n.filter(s=>!QC(s)).reduce((s,a)=>s+(z4.test(a)?P4:a===""?I4:H4),r)}function $4(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function W4(e,t,n=!1){let{routesMeta:r}=e,s={},a="/",l=[];for(let u=0;u<r.length;++u){let h=r[u],d=u===r.length-1,g=a==="/"?t:t.slice(a.length)||"/",p=dm({path:h.relativePath,caseSensitive:h.caseSensitive,end:d},g),v=h.route;if(!p&&d&&n&&!r[r.length-1].route.index&&(p=dm({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},g)),!p)return null;Object.assign(s,p.params),l.push({params:s,pathname:ps([a,p.pathname]),pathnameBase:X4(ps([a,p.pathnameBase])),route:v}),p.pathnameBase!=="/"&&(a=ps([a,p.pathnameBase]))}return l}function dm(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=V4(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let a=s[0],l=a.replace(/(.)\/+$/,"$1"),u=s.slice(1);return{params:r.reduce((d,{paramName:g,isOptional:p},v)=>{if(g==="*"){let w=u[v]||"";l=a.slice(0,a.length-w.length).replace(/(.)\/+$/,"$1")}const y=u[v];return p&&!y?d[g]=void 0:d[g]=(y||"").replace(/%2F/g,"/"),d},{}),pathname:a,pathnameBase:l,pattern:e}}function V4(e,t=!1,n=!0){Mi(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,u,h,d,g)=>{if(r.push({paramName:u,isOptional:h!=null}),h){let p=g.charAt(d+l.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function q4(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Mi(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ys(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var K4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function G4(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?pc(e):e,a;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?a=JC(n.substring(1),"/"):a=JC(n,t)):a=t,{pathname:a,search:Z4(r),hash:Q4(s)}}function JC(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function t_(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Y4(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function s0(e){let t=Y4(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Xm(e,t,n,r=!1){let s;typeof e=="string"?s=pc(e):(s={...e},hn(!s.pathname||!s.pathname.includes("?"),t_("?","pathname","search",s)),hn(!s.pathname||!s.pathname.includes("#"),t_("#","pathname","hash",s)),hn(!s.search||!s.search.includes("#"),t_("#","search","hash",s)));let a=e===""||s.pathname==="",l=a?"/":s.pathname,u;if(l==null)u=n;else{let p=t.length-1;if(!r&&l.startsWith("..")){let v=l.split("/");for(;v[0]==="..";)v.shift(),p-=1;s.pathname=v.join("/")}u=p>=0?t[p]:"/"}let h=G4(s,u),d=l&&l!=="/"&&l.endsWith("/"),g=(a||l===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(d||g)&&(h.pathname+="/"),h}var ps=e=>e.join("/").replace(/\/\/+/g,"/"),X4=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Z4=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Q4=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,J4=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function eL(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function tL(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var aT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function lT(e,t){let n=e;if(typeof n!="string"||!K4.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(aT)try{let a=new URL(window.location.href),l=n.startsWith("//")?new URL(a.protocol+n):new URL(n),u=Ys(l.pathname,t);l.origin===a.origin&&u!=null?n=u+l.search+l.hash:s=!0}catch{Mi(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var cT=["POST","PUT","PATCH","DELETE"];new Set(cT);var nL=["GET",...cT];new Set(nL);var gc=_.createContext(null);gc.displayName="DataRouter";var Zm=_.createContext(null);Zm.displayName="DataRouterState";var rL=_.createContext(!1),uT=_.createContext({isTransitioning:!1});uT.displayName="ViewTransition";var iL=_.createContext(new Map);iL.displayName="Fetchers";var sL=_.createContext(null);sL.displayName="Await";var ai=_.createContext(null);ai.displayName="Navigation";var yd=_.createContext(null);yd.displayName="Location";var Ai=_.createContext({outlet:null,matches:[],isDataRoute:!1});Ai.displayName="Route";var o0=_.createContext(null);o0.displayName="RouteError";var dT="REACT_ROUTER_ERROR",oL="REDIRECT",aL="ROUTE_ERROR_RESPONSE";function lL(e){if(e.startsWith(`${dT}:${oL}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function cL(e){if(e.startsWith(`${dT}:${aL}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new J4(t.status,t.statusText,t.data)}catch{}}function uL(e,{relative:t}={}){hn(vc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=_.useContext(ai),{hash:s,pathname:a,search:l}=xd(e,{relative:t}),u=a;return n!=="/"&&(u=a==="/"?n:ps([n,a])),r.createHref({pathname:u,search:l,hash:s})}function vc(){return _.useContext(yd)!=null}function Di(){return hn(vc(),"useLocation() may be used only in the context of a <Router> component."),_.useContext(yd).location}var hT="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function fT(e){_.useContext(ai).static||_.useLayoutEffect(e)}function _c(){let{isDataRoute:e}=_.useContext(Ai);return e?CL():dL()}function dL(){hn(vc(),"useNavigate() may be used only in the context of a <Router> component.");let e=_.useContext(gc),{basename:t,navigator:n}=_.useContext(ai),{matches:r}=_.useContext(Ai),{pathname:s}=Di(),a=JSON.stringify(s0(r)),l=_.useRef(!1);return fT(()=>{l.current=!0}),_.useCallback((h,d={})=>{if(Mi(l.current,hT),!l.current)return;if(typeof h=="number"){n.go(h);return}let g=Xm(h,JSON.parse(a),s,d.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:ps([t,g.pathname])),(d.replace?n.replace:n.push)(g,d.state,d)},[t,n,a,s,e])}var mT=_.createContext(null);function a0(){return _.useContext(mT)}function hL(e){let t=_.useContext(Ai).outlet;return _.useMemo(()=>t&&_.createElement(mT.Provider,{value:e},t),[t,e])}function pT(){let{matches:e}=_.useContext(Ai),t=e[e.length-1];return t?t.params:{}}function xd(e,{relative:t}={}){let{matches:n}=_.useContext(Ai),{pathname:r}=Di(),s=JSON.stringify(s0(n));return _.useMemo(()=>Xm(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function fL(e,t){return gT(e,t)}function gT(e,t,n){var C;hn(vc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=_.useContext(ai),{matches:s}=_.useContext(Ai),a=s[s.length-1],l=a?a.params:{},u=a?a.pathname:"/",h=a?a.pathnameBase:"/",d=a&&a.route;{let k=d&&d.path||"";_T(u,!d||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
-
60
- Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let g=Di(),p;if(t){let k=typeof t=="string"?pc(t):t;hn(h==="/"||((C=k.pathname)==null?void 0:C.startsWith(h)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${k.pathname}" was given in the \`location\` prop.`),p=k}else p=g;let v=p.pathname||"/",y=v;if(h!=="/"){let k=h.replace(/^\//,"").split("/");y="/"+v.replace(/^\//,"").split("/").slice(k.length).join("/")}let w=iT(e,{pathname:y});Mi(d||w!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Mi(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let S=_L(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:ps([h,r.encodeLocation?r.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?h:ps([h,r.encodeLocation?r.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),s,n);return t&&S?_.createElement(yd.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...p},navigationType:"POP"}},S):S}function mL(){let e=SL(),t=eL(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=_.createElement(_.Fragment,null,_.createElement("p",null,"💿 Hey developer 👋"),_.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",_.createElement("code",{style:a},"ErrorBoundary")," or"," ",_.createElement("code",{style:a},"errorElement")," prop on your route.")),_.createElement(_.Fragment,null,_.createElement("h2",null,"Unexpected Application Error!"),_.createElement("h3",{style:{fontStyle:"italic"}},t),n?_.createElement("pre",{style:s},n):null,l)}var pL=_.createElement(mL,null),vT=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=cL(e.digest);n&&(e=n)}let t=e!==void 0?_.createElement(Ai.Provider,{value:this.props.routeContext},_.createElement(o0.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?_.createElement(gL,{error:e},t):t}};vT.contextType=rL;var n_=new WeakMap;function gL({children:e,error:t}){let{basename:n}=_.useContext(ai);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=lL(t.digest);if(r){let s=n_.get(t);if(s)throw s;let a=lT(r.location,n);if(aT&&!n_.get(t))if(a.isExternal||r.reloadDocument)window.location.href=a.absoluteURL||a.to;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:r.replace}));throw n_.set(t,l),l}return _.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return e}function vL({routeContext:e,match:t,children:n}){let r=_.useContext(gc);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),_.createElement(Ai.Provider,{value:e},n)}function _L(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,a=r==null?void 0:r.errors;if(a!=null){let g=s.findIndex(p=>p.route.id&&(a==null?void 0:a[p.route.id])!==void 0);hn(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),s=s.slice(0,Math.min(s.length,g+1))}let l=!1,u=-1;if(n&&r){l=r.renderFallback;for(let g=0;g<s.length;g++){let p=s[g];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(u=g),p.route.id){let{loaderData:v,errors:y}=r,w=p.route.loader&&!v.hasOwnProperty(p.route.id)&&(!y||y[p.route.id]===void 0);if(p.route.lazy||w){n.isStatic&&(l=!0),u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}}let h=n==null?void 0:n.onError,d=r&&h?(g,p)=>{var v,y;h(g,{location:r.location,params:((y=(v=r.matches)==null?void 0:v[0])==null?void 0:y.params)??{},unstable_pattern:tL(r.matches),errorInfo:p})}:void 0;return s.reduceRight((g,p,v)=>{let y,w=!1,S=null,C=null;r&&(y=a&&p.route.id?a[p.route.id]:void 0,S=p.route.errorElement||pL,l&&(u<0&&v===0?(_T("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,C=null):u===v&&(w=!0,C=p.route.hydrateFallbackElement||null)));let k=t.concat(s.slice(0,v+1)),R=()=>{let E;return y?E=S:w?E=C:p.route.Component?E=_.createElement(p.route.Component,null):p.route.element?E=p.route.element:E=g,_.createElement(vL,{match:p,routeContext:{outlet:g,matches:k,isDataRoute:r!=null},children:E})};return r&&(p.route.ErrorBoundary||p.route.errorElement||v===0)?_.createElement(vT,{location:r.location,revalidation:r.revalidation,component:S,error:y,children:R(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:d}):R()},null)}function l0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bL(e){let t=_.useContext(gc);return hn(t,l0(e)),t}function yL(e){let t=_.useContext(Zm);return hn(t,l0(e)),t}function xL(e){let t=_.useContext(Ai);return hn(t,l0(e)),t}function c0(e){let t=xL(e),n=t.matches[t.matches.length-1];return hn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function wL(){return c0("useRouteId")}function SL(){var r;let e=_.useContext(o0),t=yL("useRouteError"),n=c0("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function CL(){let{router:e}=bL("useNavigate"),t=c0("useNavigate"),n=_.useRef(!1);return fT(()=>{n.current=!0}),_.useCallback(async(s,a={})=>{Mi(n.current,hT),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...a}))},[e,t])}var ek={};function _T(e,t,n){!t&&!ek[e]&&(ek[e]=!0,Mi(!1,n))}_.memo(kL);function kL({routes:e,future:t,state:n,isStatic:r,onError:s}){return gT(e,void 0,{state:n,isStatic:r,onError:s})}function EL({to:e,replace:t,state:n,relative:r}){hn(vc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=_.useContext(ai);Mi(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:a}=_.useContext(Ai),{pathname:l}=Di(),u=_c(),h=Xm(e,s0(a),l,r==="path"),d=JSON.stringify(h);return _.useEffect(()=>{u(JSON.parse(d),{replace:t,state:n,relative:r})},[u,d,r,t,n]),null}function RL(e){return hL(e.context)}function Gl(e){hn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function TL({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:a=!1,unstable_useTransitions:l}){hn(!vc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),h=_.useMemo(()=>({basename:u,navigator:s,static:a,unstable_useTransitions:l,future:{}}),[u,s,a,l]);typeof n=="string"&&(n=pc(n));let{pathname:d="/",search:g="",hash:p="",state:v=null,key:y="default",unstable_mask:w}=n,S=_.useMemo(()=>{let C=Ys(d,u);return C==null?null:{location:{pathname:C,search:g,hash:p,state:v,key:y,unstable_mask:w},navigationType:r}},[u,d,g,p,v,y,r,w]);return Mi(S!=null,`<Router basename="${u}"> is not able to match the URL "${d}${g}${p}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:_.createElement(ai.Provider,{value:h},_.createElement(yd.Provider,{children:t,value:S}))}function NL({children:e,location:t}){return fL(bb(e),t)}function bb(e,t=[]){let n=[];return _.Children.forEach(e,(r,s)=>{if(!_.isValidElement(r))return;let a=[...t,s];if(r.type===_.Fragment){n.push.apply(n,bb(r.props.children,a));return}hn(r.type===Gl,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),hn(!r.props.index||!r.props.children,"An index route cannot have child routes.");let l={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=bb(r.props.children,a)),n.push(l)}),n}var Vf="get",qf="application/x-www-form-urlencoded";function Qm(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function ML(e){return Qm(e)&&e.tagName.toLowerCase()==="button"}function AL(e){return Qm(e)&&e.tagName.toLowerCase()==="form"}function DL(e){return Qm(e)&&e.tagName.toLowerCase()==="input"}function jL(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function OL(e,t){return e.button===0&&(!t||t==="_self")&&!jL(e)}function yb(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function LL(e,t){let n=yb(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(a=>{n.append(s,a)})}),n}var uf=null;function zL(){if(uf===null)try{new FormData(document.createElement("form"),0),uf=!1}catch{uf=!0}return uf}var PL=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function r_(e){return e!=null&&!PL.has(e)?(Mi(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${qf}"`),null):e}function BL(e,t){let n,r,s,a,l;if(AL(e)){let u=e.getAttribute("action");r=u?Ys(u,t):null,n=e.getAttribute("method")||Vf,s=r_(e.getAttribute("enctype"))||qf,a=new FormData(e)}else if(ML(e)||DL(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=e.getAttribute("formaction")||u.getAttribute("action");if(r=h?Ys(h,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||Vf,s=r_(e.getAttribute("formenctype"))||r_(u.getAttribute("enctype"))||qf,a=new FormData(u,e),!zL()){let{name:d,type:g,value:p}=e;if(g==="image"){let v=d?`${d}.`:"";a.append(`${v}x`,"0"),a.append(`${v}y`,"0")}else d&&a.append(d,p)}}else{if(Qm(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Vf,r=null,s=qf,l=e}return a&&s==="text/plain"&&(l=a,a=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:a,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function u0(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function IL(e,t,n,r){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:t&&Ys(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${r}`,s}async function HL(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function FL(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function UL(e,t,n){let r=await Promise.all(e.map(async s=>{let a=t.routes[s.route.id];if(a){let l=await HL(a,n);return l.links?l.links():[]}return[]}));return qL(r.flat(1).filter(FL).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function tk(e,t,n,r,s,a){let l=(h,d)=>n[d]?h.route.id!==n[d].route.id:!0,u=(h,d)=>{var g;return n[d].pathname!==h.pathname||((g=n[d].route.path)==null?void 0:g.endsWith("*"))&&n[d].params["*"]!==h.params["*"]};return a==="assets"?t.filter((h,d)=>l(h,d)||u(h,d)):a==="data"?t.filter((h,d)=>{var p;let g=r.routes[h.route.id];if(!g||!g.hasLoader)return!1;if(l(h,d)||u(h,d))return!0;if(h.route.shouldRevalidate){let v=h.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((p=n[0])==null?void 0:p.params)||{},nextUrl:new URL(e,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function $L(e,t,{includeHydrateFallback:n}={}){return WL(e.map(r=>{let s=t.routes[r.route.id];if(!s)return[];let a=[s.module];return s.clientActionModule&&(a=a.concat(s.clientActionModule)),s.clientLoaderModule&&(a=a.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(a=a.concat(s.hydrateFallbackModule)),s.imports&&(a=a.concat(s.imports)),a}).flat(1))}function WL(e){return[...new Set(e)]}function VL(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function qL(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let a=JSON.stringify(VL(s));return n.has(a)||(n.add(a),r.push({key:a,link:s})),r},[])}function bT(){let e=_.useContext(gc);return u0(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function KL(){let e=_.useContext(Zm);return u0(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var d0=_.createContext(void 0);d0.displayName="FrameworkContext";function yT(){let e=_.useContext(d0);return u0(e,"You must render this element inside a <HydratedRouter> element"),e}function GL(e,t){let n=_.useContext(d0),[r,s]=_.useState(!1),[a,l]=_.useState(!1),{onFocus:u,onBlur:h,onMouseEnter:d,onMouseLeave:g,onTouchStart:p}=t,v=_.useRef(null);_.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let S=k=>{k.forEach(R=>{l(R.isIntersecting)})},C=new IntersectionObserver(S,{threshold:.5});return v.current&&C.observe(v.current),()=>{C.disconnect()}}},[e]),_.useEffect(()=>{if(r){let S=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(S)}}},[r]);let y=()=>{s(!0)},w=()=>{s(!1),l(!1)};return n?e!=="intent"?[a,v,{}]:[a,v,{onFocus:Su(u,y),onBlur:Su(h,w),onMouseEnter:Su(d,y),onMouseLeave:Su(g,w),onTouchStart:Su(p,y)}]:[!1,v,{}]}function Su(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function YL({page:e,...t}){let{router:n}=bT(),r=_.useMemo(()=>iT(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?_.createElement(ZL,{page:e,matches:r,...t}):null}function XL(e){let{manifest:t,routeModules:n}=yT(),[r,s]=_.useState([]);return _.useEffect(()=>{let a=!1;return UL(e,t,n).then(l=>{a||s(l)}),()=>{a=!0}},[e,t,n]),r}function ZL({page:e,matches:t,...n}){let r=Di(),{future:s,manifest:a,routeModules:l}=yT(),{basename:u}=bT(),{loaderData:h,matches:d}=KL(),g=_.useMemo(()=>tk(e,t,d,a,r,"data"),[e,t,d,a,r]),p=_.useMemo(()=>tk(e,t,d,a,r,"assets"),[e,t,d,a,r]),v=_.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let S=new Set,C=!1;if(t.forEach(R=>{var N;let E=a.routes[R.route.id];!E||!E.hasLoader||(!g.some(j=>j.route.id===R.route.id)&&R.route.id in h&&((N=l[R.route.id])!=null&&N.shouldRevalidate)||E.hasClientLoader?C=!0:S.add(R.route.id))}),S.size===0)return[];let k=IL(e,u,s.unstable_trailingSlashAwareDataRequests,"data");return C&&S.size>0&&k.searchParams.set("_routes",t.filter(R=>S.has(R.route.id)).map(R=>R.route.id).join(",")),[k.pathname+k.search]},[u,s.unstable_trailingSlashAwareDataRequests,h,r,a,g,t,e,l]),y=_.useMemo(()=>$L(p,a),[p,a]),w=XL(p);return _.createElement(_.Fragment,null,v.map(S=>_.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...n})),y.map(S=>_.createElement("link",{key:S,rel:"modulepreload",href:S,...n})),w.map(({key:S,link:C})=>_.createElement("link",{key:S,nonce:n.nonce,...C,crossOrigin:C.crossOrigin??n.crossOrigin})))}function QL(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var JL=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{JL&&(window.__reactRouterVersion="7.13.1")}catch{}function ez({basename:e,children:t,unstable_useTransitions:n,window:r}){let s=_.useRef();s.current==null&&(s.current=M4({window:r,v5Compat:!0}));let a=s.current,[l,u]=_.useState({action:a.action,location:a.location}),h=_.useCallback(d=>{n===!1?u(d):_.startTransition(()=>u(d))},[n]);return _.useLayoutEffect(()=>a.listen(h),[a,h]),_.createElement(TL,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:a,unstable_useTransitions:n})}var xT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,wT=_.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:s,reloadDocument:a,replace:l,unstable_mask:u,state:h,target:d,to:g,preventScrollReset:p,viewTransition:v,unstable_defaultShouldRevalidate:y,...w},S){let{basename:C,navigator:k,unstable_useTransitions:R}=_.useContext(ai),E=typeof g=="string"&&xT.test(g),N=lT(g,C);g=N.to;let j=uL(g,{relative:s}),D=Di(),L=null;if(u){let q=Xm(u,[],D.unstable_mask?D.unstable_mask.pathname:"/",!0);C!=="/"&&(q.pathname=q.pathname==="/"?C:ps([C,q.pathname])),L=k.createHref(q)}let[U,Y,P]=GL(r,w),V=iz(g,{replace:l,unstable_mask:u,state:h,target:d,preventScrollReset:p,relative:s,viewTransition:v,unstable_defaultShouldRevalidate:y,unstable_useTransitions:R});function I(q){t&&t(q),q.defaultPrevented||V(q)}let W=!(N.isExternal||a),K=_.createElement("a",{...w,...P,href:(W?L:void 0)||N.absoluteURL||j,onClick:W?I:t,ref:QL(S,Y),target:d,"data-discover":!E&&n==="render"?"true":void 0});return U&&!E?_.createElement(_.Fragment,null,K,_.createElement(YL,{page:j})):K});wT.displayName="Link";var tz=_.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:a,to:l,viewTransition:u,children:h,...d},g){let p=xd(l,{relative:d.relative}),v=Di(),y=_.useContext(Zm),{navigator:w,basename:S}=_.useContext(ai),C=y!=null&&uz(p)&&u===!0,k=w.encodeLocation?w.encodeLocation(p).pathname:p.pathname,R=v.pathname,E=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(R=R.toLowerCase(),E=E?E.toLowerCase():null,k=k.toLowerCase()),E&&S&&(E=Ys(E,S)||E);const N=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let j=R===k||!s&&R.startsWith(k)&&R.charAt(N)==="/",D=E!=null&&(E===k||!s&&E.startsWith(k)&&E.charAt(k.length)==="/"),L={isActive:j,isPending:D,isTransitioning:C},U=j?t:void 0,Y;typeof r=="function"?Y=r(L):Y=[r,j?"active":null,D?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let P=typeof a=="function"?a(L):a;return _.createElement(wT,{...d,"aria-current":U,className:Y,ref:g,style:P,to:l,viewTransition:u},typeof h=="function"?h(L):h)});tz.displayName="NavLink";var nz=_.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:s,state:a,method:l=Vf,action:u,onSubmit:h,relative:d,preventScrollReset:g,viewTransition:p,unstable_defaultShouldRevalidate:v,...y},w)=>{let{unstable_useTransitions:S}=_.useContext(ai),C=lz(),k=cz(u,{relative:d}),R=l.toLowerCase()==="get"?"get":"post",E=typeof u=="string"&&xT.test(u),N=j=>{if(h&&h(j),j.defaultPrevented)return;j.preventDefault();let D=j.nativeEvent.submitter,L=(D==null?void 0:D.getAttribute("formmethod"))||l,U=()=>C(D||j.currentTarget,{fetcherKey:t,method:L,navigate:n,replace:s,state:a,relative:d,preventScrollReset:g,viewTransition:p,unstable_defaultShouldRevalidate:v});S&&n!==!1?_.startTransition(()=>U()):U()};return _.createElement("form",{ref:w,method:R,action:k,onSubmit:r?h:N,...y,"data-discover":!E&&e==="render"?"true":void 0})});nz.displayName="Form";function rz(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ST(e){let t=_.useContext(gc);return hn(t,rz(e)),t}function iz(e,{target:t,replace:n,unstable_mask:r,state:s,preventScrollReset:a,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:h,unstable_useTransitions:d}={}){let g=_c(),p=Di(),v=xd(e,{relative:l});return _.useCallback(y=>{if(OL(y,t)){y.preventDefault();let w=n!==void 0?n:rd(p)===rd(v),S=()=>g(e,{replace:w,unstable_mask:r,state:s,preventScrollReset:a,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:h});d?_.startTransition(()=>S()):S()}},[p,g,v,n,r,s,t,e,a,l,u,h,d])}function sz(e){Mi(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=_.useRef(yb(e)),n=_.useRef(!1),r=Di(),s=_.useMemo(()=>LL(r.search,n.current?null:t.current),[r.search]),a=_c(),l=_.useCallback((u,h)=>{const d=yb(typeof u=="function"?u(new URLSearchParams(s)):u);n.current=!0,a("?"+d,h)},[a,s]);return[s,l]}var oz=0,az=()=>`__${String(++oz)}__`;function lz(){let{router:e}=ST("useSubmit"),{basename:t}=_.useContext(ai),n=wL(),r=e.fetch,s=e.navigate;return _.useCallback(async(a,l={})=>{let{action:u,method:h,encType:d,formData:g,body:p}=BL(a,t);if(l.navigate===!1){let v=l.fetcherKey||az();await r(v,n,l.action||u,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:g,body:p,formMethod:l.method||h,formEncType:l.encType||d,flushSync:l.flushSync})}else await s(l.action||u,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:g,body:p,formMethod:l.method||h,formEncType:l.encType||d,replace:l.replace,state:l.state,fromRouteId:n,flushSync:l.flushSync,viewTransition:l.viewTransition})},[r,s,t,n])}function cz(e,{relative:t}={}){let{basename:n}=_.useContext(ai),r=_.useContext(Ai);hn(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),a={...xd(e||".",{relative:t})},l=Di();if(e==null){a.search=l.search;let u=new URLSearchParams(a.search),h=u.getAll("index");if(h.some(g=>g==="")){u.delete("index"),h.filter(p=>p).forEach(p=>u.append("index",p));let g=u.toString();a.search=g?`?${g}`:""}}return(!e||e===".")&&s.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:ps([n,a.pathname])),rd(a)}function uz(e,{relative:t}={}){let n=_.useContext(uT);hn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=ST("useViewTransitionState"),s=xd(e,{relative:t});if(!n.isTransitioning)return!1;let a=Ys(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=Ys(n.nextLocation.pathname,r)||n.nextLocation.pathname;return dm(s.pathname,l)!=null||dm(s.pathname,a)!=null}var Hi=rT();const CT=Ym(Hi);function dz(e){if(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))}const hz=e=>{switch(e){case"success":return pz;case"info":return vz;case"warning":return gz;case"error":return _z;default:return null}},fz=Array(12).fill(0),mz=({visible:e,className:t})=>ye.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ye.createElement("div",{className:"sonner-spinner"},fz.map((n,r)=>ye.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),pz=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.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"})),gz=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ye.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"})),vz=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.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"})),_z=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.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"})),bz=ye.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"},ye.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ye.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),yz=()=>{const[e,t]=ye.useState(document.hidden);return ye.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let xb=1;class xz{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,a=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:xb++,l=this.toasts.find(h=>h.id===a),u=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),l?this.toasts=this.toasts.map(h=>h.id===a?(this.publish({...h,...t,id:a,title:r}),{...h,...t,id:a,dismissible:u,title:r}):h):this.addToast({title:r,...s,dismissible:u,id:a}),a},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let a=r!==void 0,l;const u=s.then(async d=>{if(l=["resolve",d],ye.isValidElement(d))a=!1,this.create({id:r,type:"default",message:d});else if(Sz(d)&&!d.ok){a=!1;const p=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,v=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,w=typeof p=="object"&&!ye.isValidElement(p)?p:{message:p};this.create({id:r,type:"error",description:v,...w})}else if(d instanceof Error){a=!1;const p=typeof n.error=="function"?await n.error(d):n.error,v=typeof n.description=="function"?await n.description(d):n.description,w=typeof p=="object"&&!ye.isValidElement(p)?p:{message:p};this.create({id:r,type:"error",description:v,...w})}else if(n.success!==void 0){a=!1;const p=typeof n.success=="function"?await n.success(d):n.success,v=typeof n.description=="function"?await n.description(d):n.description,w=typeof p=="object"&&!ye.isValidElement(p)?p:{message:p};this.create({id:r,type:"success",description:v,...w})}}).catch(async d=>{if(l=["reject",d],n.error!==void 0){a=!1;const g=typeof n.error=="function"?await n.error(d):n.error,p=typeof n.description=="function"?await n.description(d):n.description,y=typeof g=="object"&&!ye.isValidElement(g)?g:{message:g};this.create({id:r,type:"error",description:p,...y})}}).finally(()=>{a&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),h=()=>new Promise((d,g)=>u.then(()=>l[0]==="reject"?g(l[1]):d(l[1])).catch(g));return typeof r!="string"&&typeof r!="number"?{unwrap:h}:Object.assign(r,{unwrap:h})},this.custom=(t,n)=>{const r=(n==null?void 0:n.id)||xb++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Ur=new xz,wz=(e,t)=>{const n=(t==null?void 0:t.id)||xb++;return Ur.addToast({title:e,...t,id:n}),n},Sz=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Cz=wz,kz=()=>Ur.toasts,Ez=()=>Ur.getActiveToasts(),df=Object.assign(Cz,{success:Ur.success,info:Ur.info,warning:Ur.warning,error:Ur.error,custom:Ur.custom,message:Ur.message,promise:Ur.promise,dismiss:Ur.dismiss,loading:Ur.loading},{getHistory:kz,getToasts:Ez});dz("[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 hf(e){return e.label!==void 0}const Rz=3,Tz="24px",Nz="16px",nk=4e3,Mz=356,Az=14,Dz=45,jz=200;function ts(...e){return e.filter(Boolean).join(" ")}function Oz(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const Lz=e=>{var t,n,r,s,a,l,u,h,d;const{invert:g,toast:p,unstyled:v,interacting:y,setHeights:w,visibleToasts:S,heights:C,index:k,toasts:R,expanded:E,removeToast:N,defaultRichColors:j,closeButton:D,style:L,cancelButtonStyle:U,actionButtonStyle:Y,className:P="",descriptionClassName:V="",duration:I,position:W,gap:K,expandByDefault:q,classNames:O,icons:F,closeButtonAriaLabel:H="Close toast"}=e,[$,M]=ye.useState(null),[B,X]=ye.useState(null),[A,re]=ye.useState(!1),[se,Z]=ye.useState(!1),[te,le]=ye.useState(!1),[pe,xe]=ye.useState(!1),[Me,Re]=ye.useState(!1),[je,Xe]=ye.useState(0),[ft,pt]=ye.useState(0),he=ye.useRef(p.duration||I||nk),Le=ye.useRef(null),Ae=ye.useRef(null),nt=k===0,gt=k+1<=S,qe=p.type,vt=p.dismissible!==!1,Se=p.className||"",De=p.descriptionClassName||"",ce=ye.useMemo(()=>C.findIndex(He=>He.toastId===p.id)||0,[C,p.id]),be=ye.useMemo(()=>{var He;return(He=p.closeButton)!=null?He:D},[p.closeButton,D]),Oe=ye.useMemo(()=>p.duration||I||nk,[p.duration,I]),We=ye.useRef(0),we=ye.useRef(0),Ie=ye.useRef(0),ot=ye.useRef(null),[rt,ze]=W.split("-"),St=ye.useMemo(()=>C.reduce((He,ct,st)=>st>=ce?He:He+ct.height,0),[C,ce]),at=yz(),vn=p.invert||g,tn=qe==="loading";we.current=ye.useMemo(()=>ce*K+St,[ce,St]),ye.useEffect(()=>{he.current=Oe},[Oe]),ye.useEffect(()=>{re(!0)},[]),ye.useEffect(()=>{const He=Ae.current;if(He){const ct=He.getBoundingClientRect().height;return pt(ct),w(st=>[{toastId:p.id,height:ct,position:p.position},...st]),()=>w(st=>st.filter(mt=>mt.toastId!==p.id))}},[w,p.id]),ye.useLayoutEffect(()=>{if(!A)return;const He=Ae.current,ct=He.style.height;He.style.height="auto";const st=He.getBoundingClientRect().height;He.style.height=ct,pt(st),w(mt=>mt.find(Ce=>Ce.toastId===p.id)?mt.map(Ce=>Ce.toastId===p.id?{...Ce,height:st}:Ce):[{toastId:p.id,height:st,position:p.position},...mt])},[A,p.title,p.description,w,p.id,p.jsx,p.action,p.cancel]);const Nn=ye.useCallback(()=>{Z(!0),Xe(we.current),w(He=>He.filter(ct=>ct.toastId!==p.id)),setTimeout(()=>{N(p)},jz)},[p,N,w,we]);ye.useEffect(()=>{if(p.promise&&qe==="loading"||p.duration===1/0||p.type==="loading")return;let He;return E||y||at?(()=>{if(Ie.current<We.current){const mt=new Date().getTime()-We.current;he.current=he.current-mt}Ie.current=new Date().getTime()})():(()=>{he.current!==1/0&&(We.current=new Date().getTime(),He=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),Nn()},he.current))})(),()=>clearTimeout(He)},[E,y,p,qe,at,Nn]),ye.useEffect(()=>{p.delete&&(Nn(),p.onDismiss==null||p.onDismiss.call(p,p))},[Nn,p.delete]);function xr(){var He;if(F!=null&&F.loading){var ct;return ye.createElement("div",{className:ts(O==null?void 0:O.loader,p==null||(ct=p.classNames)==null?void 0:ct.loader,"sonner-loader"),"data-visible":qe==="loading"},F.loading)}return ye.createElement(mz,{className:ts(O==null?void 0:O.loader,p==null||(He=p.classNames)==null?void 0:He.loader),visible:qe==="loading"})}const rr=p.icon||(F==null?void 0:F[qe])||hz(qe);var jt,zt;return ye.createElement("li",{tabIndex:0,ref:Ae,className:ts(P,Se,O==null?void 0:O.toast,p==null||(t=p.classNames)==null?void 0:t.toast,O==null?void 0:O.default,O==null?void 0:O[qe],p==null||(n=p.classNames)==null?void 0:n[qe]),"data-sonner-toast":"","data-rich-colors":(jt=p.richColors)!=null?jt:j,"data-styled":!(p.jsx||p.unstyled||v),"data-mounted":A,"data-promise":!!p.promise,"data-swiped":Me,"data-removed":se,"data-visible":gt,"data-y-position":rt,"data-x-position":ze,"data-index":k,"data-front":nt,"data-swiping":te,"data-dismissible":vt,"data-type":qe,"data-invert":vn,"data-swipe-out":pe,"data-swipe-direction":B,"data-expanded":!!(E||q&&A),"data-testid":p.testId,style:{"--index":k,"--toasts-before":k,"--z-index":R.length-k,"--offset":`${se?je:we.current}px`,"--initial-height":q?"auto":`${ft}px`,...L,...p.style},onDragEnd:()=>{le(!1),M(null),ot.current=null},onPointerDown:He=>{He.button!==2&&(tn||!vt||(Le.current=new Date,Xe(we.current),He.target.setPointerCapture(He.pointerId),He.target.tagName!=="BUTTON"&&(le(!0),ot.current={x:He.clientX,y:He.clientY})))},onPointerUp:()=>{var He,ct,st;if(pe||!vt)return;ot.current=null;const mt=Number(((He=Ae.current)==null?void 0:He.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),an=Number(((ct=Ae.current)==null?void 0:ct.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ce=new Date().getTime()-((st=Le.current)==null?void 0:st.getTime()),Te=$==="x"?mt:an,_t=Math.abs(Te)/Ce;if(Math.abs(Te)>=Dz||_t>.11){Xe(we.current),p.onDismiss==null||p.onDismiss.call(p,p),X($==="x"?mt>0?"right":"left":an>0?"down":"up"),Nn(),xe(!0);return}else{var Qe,bt;(Qe=Ae.current)==null||Qe.style.setProperty("--swipe-amount-x","0px"),(bt=Ae.current)==null||bt.style.setProperty("--swipe-amount-y","0px")}Re(!1),le(!1),M(null)},onPointerMove:He=>{var ct,st,mt;if(!ot.current||!vt||((ct=window.getSelection())==null?void 0:ct.toString().length)>0)return;const Ce=He.clientY-ot.current.y,Te=He.clientX-ot.current.x;var _t;const Qe=(_t=e.swipeDirections)!=null?_t:Oz(W);!$&&(Math.abs(Te)>1||Math.abs(Ce)>1)&&M(Math.abs(Te)>Math.abs(Ce)?"x":"y");let bt={x:0,y:0};const qt=Ot=>1/(1.5+Math.abs(Ot)/20);if($==="y"){if(Qe.includes("top")||Qe.includes("bottom"))if(Qe.includes("top")&&Ce<0||Qe.includes("bottom")&&Ce>0)bt.y=Ce;else{const Ot=Ce*qt(Ce);bt.y=Math.abs(Ot)<Math.abs(Ce)?Ot:Ce}}else if($==="x"&&(Qe.includes("left")||Qe.includes("right")))if(Qe.includes("left")&&Te<0||Qe.includes("right")&&Te>0)bt.x=Te;else{const Ot=Te*qt(Te);bt.x=Math.abs(Ot)<Math.abs(Te)?Ot:Te}(Math.abs(bt.x)>0||Math.abs(bt.y)>0)&&Re(!0),(st=Ae.current)==null||st.style.setProperty("--swipe-amount-x",`${bt.x}px`),(mt=Ae.current)==null||mt.style.setProperty("--swipe-amount-y",`${bt.y}px`)}},be&&!p.jsx&&qe!=="loading"?ye.createElement("button",{"aria-label":H,"data-disabled":tn,"data-close-button":!0,onClick:tn||!vt?()=>{}:()=>{Nn(),p.onDismiss==null||p.onDismiss.call(p,p)},className:ts(O==null?void 0:O.closeButton,p==null||(r=p.classNames)==null?void 0:r.closeButton)},(zt=F==null?void 0:F.close)!=null?zt:bz):null,(qe||p.icon||p.promise)&&p.icon!==null&&((F==null?void 0:F[qe])!==null||p.icon)?ye.createElement("div",{"data-icon":"",className:ts(O==null?void 0:O.icon,p==null||(s=p.classNames)==null?void 0:s.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||xr():null,p.type!=="loading"?rr:null):null,ye.createElement("div",{"data-content":"",className:ts(O==null?void 0:O.content,p==null||(a=p.classNames)==null?void 0:a.content)},ye.createElement("div",{"data-title":"",className:ts(O==null?void 0:O.title,p==null||(l=p.classNames)==null?void 0:l.title)},p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title),p.description?ye.createElement("div",{"data-description":"",className:ts(V,De,O==null?void 0:O.description,p==null||(u=p.classNames)==null?void 0:u.description)},typeof p.description=="function"?p.description():p.description):null),ye.isValidElement(p.cancel)?p.cancel:p.cancel&&hf(p.cancel)?ye.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||U,onClick:He=>{hf(p.cancel)&&vt&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,He),Nn())},className:ts(O==null?void 0:O.cancelButton,p==null||(h=p.classNames)==null?void 0:h.cancelButton)},p.cancel.label):null,ye.isValidElement(p.action)?p.action:p.action&&hf(p.action)?ye.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||Y,onClick:He=>{hf(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,He),!He.defaultPrevented&&Nn())},className:ts(O==null?void 0:O.actionButton,p==null||(d=p.classNames)==null?void 0:d.actionButton)},p.action.label):null)};function rk(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function zz(e,t){const n={};return[e,t].forEach((r,s)=>{const a=s===1,l=a?"--mobile-offset":"--offset",u=a?Nz:Tz;function h(d){["top","right","bottom","left"].forEach(g=>{n[`${l}-${g}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?h(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?n[`${l}-${d}`]=u:n[`${l}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):h(u)}),n}const Pz=ye.forwardRef(function(t,n){const{id:r,invert:s,position:a="bottom-right",hotkey:l=["altKey","KeyT"],expand:u,closeButton:h,className:d,offset:g,mobileOffset:p,theme:v="light",richColors:y,duration:w,style:S,visibleToasts:C=Rz,toastOptions:k,dir:R=rk(),gap:E=Az,icons:N,containerAriaLabel:j="Notifications"}=t,[D,L]=ye.useState([]),U=ye.useMemo(()=>r?D.filter(A=>A.toasterId===r):D.filter(A=>!A.toasterId),[D,r]),Y=ye.useMemo(()=>Array.from(new Set([a].concat(U.filter(A=>A.position).map(A=>A.position)))),[U,a]),[P,V]=ye.useState([]),[I,W]=ye.useState(!1),[K,q]=ye.useState(!1),[O,F]=ye.useState(v!=="system"?v:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=ye.useRef(null),$=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=ye.useRef(null),B=ye.useRef(!1),X=ye.useCallback(A=>{L(re=>{var se;return(se=re.find(Z=>Z.id===A.id))!=null&&se.delete||Ur.dismiss(A.id),re.filter(({id:Z})=>Z!==A.id)})},[]);return ye.useEffect(()=>Ur.subscribe(A=>{if(A.dismiss){requestAnimationFrame(()=>{L(re=>re.map(se=>se.id===A.id?{...se,delete:!0}:se))});return}setTimeout(()=>{CT.flushSync(()=>{L(re=>{const se=re.findIndex(Z=>Z.id===A.id);return se!==-1?[...re.slice(0,se),{...re[se],...A},...re.slice(se+1)]:[A,...re]})})})}),[D]),ye.useEffect(()=>{if(v!=="system"){F(v);return}if(v==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?F("dark"):F("light")),typeof window>"u")return;const A=window.matchMedia("(prefers-color-scheme: dark)");try{A.addEventListener("change",({matches:re})=>{F(re?"dark":"light")})}catch{A.addListener(({matches:se})=>{try{F(se?"dark":"light")}catch(Z){console.error(Z)}})}},[v]),ye.useEffect(()=>{D.length<=1&&W(!1)},[D]),ye.useEffect(()=>{const A=re=>{var se;if(l.every(le=>re[le]||re.code===le)){var te;W(!0),(te=H.current)==null||te.focus()}re.code==="Escape"&&(document.activeElement===H.current||(se=H.current)!=null&&se.contains(document.activeElement))&&W(!1)};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[l]),ye.useEffect(()=>{if(H.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,B.current=!1)}},[H.current]),ye.createElement("section",{ref:n,"aria-label":`${j} ${$}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},Y.map((A,re)=>{var se;const[Z,te]=A.split("-");return U.length?ye.createElement("ol",{key:A,dir:R==="auto"?rk():R,tabIndex:-1,ref:H,className:d,"data-sonner-toaster":!0,"data-sonner-theme":O,"data-y-position":Z,"data-x-position":te,style:{"--front-toast-height":`${((se=P[0])==null?void 0:se.height)||0}px`,"--width":`${Mz}px`,"--gap":`${E}px`,...S,...zz(g,p)},onBlur:le=>{B.current&&!le.currentTarget.contains(le.relatedTarget)&&(B.current=!1,M.current&&(M.current.focus({preventScroll:!0}),M.current=null))},onFocus:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||B.current||(B.current=!0,M.current=le.relatedTarget)},onMouseEnter:()=>W(!0),onMouseMove:()=>W(!0),onMouseLeave:()=>{K||W(!1)},onDragEnd:()=>W(!1),onPointerDown:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||q(!0)},onPointerUp:()=>q(!1)},U.filter(le=>!le.position&&re===0||le.position===A).map((le,pe)=>{var xe,Me;return ye.createElement(Lz,{key:le.id,icons:N,index:pe,toast:le,defaultRichColors:y,duration:(xe=k==null?void 0:k.duration)!=null?xe:w,className:k==null?void 0:k.className,descriptionClassName:k==null?void 0:k.descriptionClassName,invert:s,visibleToasts:C,closeButton:(Me=k==null?void 0:k.closeButton)!=null?Me:h,interacting:K,position:A,style:k==null?void 0:k.style,unstyled:k==null?void 0:k.unstyled,classNames:k==null?void 0:k.classNames,cancelButtonStyle:k==null?void 0:k.cancelButtonStyle,actionButtonStyle:k==null?void 0:k.actionButtonStyle,closeButtonAriaLabel:k==null?void 0:k.closeButtonAriaLabel,removeToast:X,toasts:U.filter(Re=>Re.position==le.position),heights:P.filter(Re=>Re.position==le.position),setHeights:V,expandByDefault:u,gap:E,expanded:I,swipeDirections:t.swipeDirections})})):null}))});function kT(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=kT(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ET(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=kT(e))&&(r&&(r+=" "),r+=t);return r}const ik=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,sk=ET,Bz=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return sk(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:a}=t,l=Object.keys(s).map(d=>{const g=n==null?void 0:n[d],p=a==null?void 0:a[d];if(g===null)return null;const v=ik(g)||ik(p);return s[d][v]}),u=n&&Object.entries(n).reduce((d,g)=>{let[p,v]=g;return v===void 0||(d[p]=v),d},{}),h=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,g)=>{let{class:p,className:v,...y}=g;return Object.entries(y).every(w=>{let[S,C]=w;return Array.isArray(C)?C.includes({...a,...u}[S]):{...a,...u}[S]===C})?[...d,p,v]:d},[]);return sk(e,l,h,n==null?void 0:n.class,n==null?void 0:n.className)},Iz=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Hz=(e,t)=>({classGroupId:e,validator:t}),RT=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),hm="-",ok=[],Fz="arbitrary..",Uz=e=>{const t=Wz(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return $z(l);const u=l.split(hm),h=u[0]===""&&u.length>1?1:0;return TT(u,h,t)},getConflictingClassGroupIds:(l,u)=>{if(u){const h=r[l],d=n[l];return h?d?Iz(d,h):h:d||ok}return n[l]||ok}}},TT=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],a=n.nextPart.get(s);if(a){const d=TT(e,t+1,a);if(d)return d}const l=n.validators;if(l===null)return;const u=t===0?e.join(hm):e.slice(t).join(hm),h=l.length;for(let d=0;d<h;d++){const g=l[d];if(g.validator(u))return g.classGroupId}},$z=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?Fz+r:void 0})(),Wz=e=>{const{theme:t,classGroups:n}=e;return Vz(n,t)},Vz=(e,t)=>{const n=RT();for(const r in e){const s=e[r];h0(s,n,r,t)}return n},h0=(e,t,n,r)=>{const s=e.length;for(let a=0;a<s;a++){const l=e[a];qz(l,t,n,r)}},qz=(e,t,n,r)=>{if(typeof e=="string"){Kz(e,t,n);return}if(typeof e=="function"){Gz(e,t,n,r);return}Yz(e,t,n,r)},Kz=(e,t,n)=>{const r=e===""?t:NT(t,e);r.classGroupId=n},Gz=(e,t,n,r)=>{if(Xz(e)){h0(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Hz(n,e))},Yz=(e,t,n,r)=>{const s=Object.entries(e),a=s.length;for(let l=0;l<a;l++){const[u,h]=s[l];h0(h,NT(t,u),n,r)}},NT=(e,t)=>{let n=e;const r=t.split(hm),s=r.length;for(let a=0;a<s;a++){const l=r[a];let u=n.nextPart.get(l);u||(u=RT(),n.nextPart.set(l,u)),n=u}return n},Xz=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Zz=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(a,l)=>{n[a]=l,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(a){let l=n[a];if(l!==void 0)return l;if((l=r[a])!==void 0)return s(a,l),l},set(a,l){a in n?n[a]=l:s(a,l)}}},wb="!",ak=":",Qz=[],lk=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),Jz=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const a=[];let l=0,u=0,h=0,d;const g=s.length;for(let S=0;S<g;S++){const C=s[S];if(l===0&&u===0){if(C===ak){a.push(s.slice(h,S)),h=S+1;continue}if(C==="/"){d=S;continue}}C==="["?l++:C==="]"?l--:C==="("?u++:C===")"&&u--}const p=a.length===0?s:s.slice(h);let v=p,y=!1;p.endsWith(wb)?(v=p.slice(0,-1),y=!0):p.startsWith(wb)&&(v=p.slice(1),y=!0);const w=d&&d>h?d-h:void 0;return lk(a,y,v,w)};if(t){const s=t+ak,a=r;r=l=>l.startsWith(s)?a(l.slice(s.length)):lk(Qz,!1,l,void 0,!0)}if(n){const s=r;r=a=>n({className:a,parseClassName:s})}return r},eP=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let a=0;a<n.length;a++){const l=n[a],u=l[0]==="[",h=t.has(l);u||h?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(l)):s.push(l)}return s.length>0&&(s.sort(),r.push(...s)),r}},tP=e=>({cache:Zz(e.cacheSize),parseClassName:Jz(e),sortModifiers:eP(e),...Uz(e)}),nP=/\s+/,rP=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a}=t,l=[],u=e.trim().split(nP);let h="";for(let d=u.length-1;d>=0;d-=1){const g=u[d],{isExternal:p,modifiers:v,hasImportantModifier:y,baseClassName:w,maybePostfixModifierPosition:S}=n(g);if(p){h=g+(h.length>0?" "+h:h);continue}let C=!!S,k=r(C?w.substring(0,S):w);if(!k){if(!C){h=g+(h.length>0?" "+h:h);continue}if(k=r(w),!k){h=g+(h.length>0?" "+h:h);continue}C=!1}const R=v.length===0?"":v.length===1?v[0]:a(v).join(":"),E=y?R+wb:R,N=E+k;if(l.indexOf(N)>-1)continue;l.push(N);const j=s(k,C);for(let D=0;D<j.length;++D){const L=j[D];l.push(E+L)}h=g+(h.length>0?" "+h:h)}return h},iP=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=MT(n))&&(s&&(s+=" "),s+=r);return s},MT=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=MT(e[r]))&&(n&&(n+=" "),n+=t);return n},sP=(e,...t)=>{let n,r,s,a;const l=h=>{const d=t.reduce((g,p)=>p(g),e());return n=tP(d),r=n.cache.get,s=n.cache.set,a=u,u(h)},u=h=>{const d=r(h);if(d)return d;const g=rP(h,n);return s(h,g),g};return a=l,(...h)=>a(iP(...h))},oP=[],Fn=e=>{const t=n=>n[e]||oP;return t.isThemeGetter=!0,t},AT=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,DT=/^\((?:(\w[\w-]*):)?(.+)\)$/i,aP=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,lP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,cP=/\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$/,uP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Oo=e=>aP.test(e),xt=e=>!!e&&!Number.isNaN(Number(e)),Lo=e=>!!e&&Number.isInteger(Number(e)),i_=e=>e.endsWith("%")&&xt(e.slice(0,-1)),Hs=e=>lP.test(e),jT=()=>!0,fP=e=>cP.test(e)&&!uP.test(e),f0=()=>!1,mP=e=>dP.test(e),pP=e=>hP.test(e),gP=e=>!Ve(e)&&!Ke(e),vP=e=>Jo(e,zT,f0),Ve=e=>AT.test(e),Sa=e=>Jo(e,PT,fP),ck=e=>Jo(e,kP,xt),_P=e=>Jo(e,IT,jT),bP=e=>Jo(e,BT,f0),uk=e=>Jo(e,OT,f0),yP=e=>Jo(e,LT,pP),ff=e=>Jo(e,HT,mP),Ke=e=>DT.test(e),Cu=e=>Qa(e,PT),xP=e=>Qa(e,BT),dk=e=>Qa(e,OT),wP=e=>Qa(e,zT),SP=e=>Qa(e,LT),mf=e=>Qa(e,HT,!0),CP=e=>Qa(e,IT,!0),Jo=(e,t,n)=>{const r=AT.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Qa=(e,t,n=!1)=>{const r=DT.exec(e);return r?r[1]?t(r[1]):n:!1},OT=e=>e==="position"||e==="percentage",LT=e=>e==="image"||e==="url",zT=e=>e==="length"||e==="size"||e==="bg-size",PT=e=>e==="length",kP=e=>e==="number",BT=e=>e==="family-name",IT=e=>e==="number"||e==="weight",HT=e=>e==="shadow",EP=()=>{const e=Fn("color"),t=Fn("font"),n=Fn("text"),r=Fn("font-weight"),s=Fn("tracking"),a=Fn("leading"),l=Fn("breakpoint"),u=Fn("container"),h=Fn("spacing"),d=Fn("radius"),g=Fn("shadow"),p=Fn("inset-shadow"),v=Fn("text-shadow"),y=Fn("drop-shadow"),w=Fn("blur"),S=Fn("perspective"),C=Fn("aspect"),k=Fn("ease"),R=Fn("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...N(),Ke,Ve],D=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],U=()=>[Ke,Ve,h],Y=()=>[Oo,"full","auto",...U()],P=()=>[Lo,"none","subgrid",Ke,Ve],V=()=>["auto",{span:["full",Lo,Ke,Ve]},Lo,Ke,Ve],I=()=>[Lo,"auto",Ke,Ve],W=()=>["auto","min","max","fr",Ke,Ve],K=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],q=()=>["start","end","center","stretch","center-safe","end-safe"],O=()=>["auto",...U()],F=()=>[Oo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...U()],H=()=>[Oo,"screen","full","dvw","lvw","svw","min","max","fit",...U()],$=()=>[Oo,"screen","full","lh","dvh","lvh","svh","min","max","fit",...U()],M=()=>[e,Ke,Ve],B=()=>[...N(),dk,uk,{position:[Ke,Ve]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",wP,vP,{size:[Ke,Ve]}],re=()=>[i_,Cu,Sa],se=()=>["","none","full",d,Ke,Ve],Z=()=>["",xt,Cu,Sa],te=()=>["solid","dashed","dotted","double"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],pe=()=>[xt,i_,dk,uk],xe=()=>["","none",w,Ke,Ve],Me=()=>["none",xt,Ke,Ve],Re=()=>["none",xt,Ke,Ve],je=()=>[xt,Ke,Ve],Xe=()=>[Oo,"full",...U()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Hs],breakpoint:[Hs],color:[jT],container:[Hs],"drop-shadow":[Hs],ease:["in","out","in-out"],font:[gP],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Hs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Hs],shadow:[Hs],spacing:["px",xt],text:[Hs],"text-shadow":[Hs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Oo,Ve,Ke,C]}],container:["container"],columns:[{columns:[xt,Ve,Ke,u]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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:j()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Y()}],"inset-x":[{"inset-x":Y()}],"inset-y":[{"inset-y":Y()}],start:[{"inset-s":Y(),start:Y()}],end:[{"inset-e":Y(),end:Y()}],"inset-bs":[{"inset-bs":Y()}],"inset-be":[{"inset-be":Y()}],top:[{top:Y()}],right:[{right:Y()}],bottom:[{bottom:Y()}],left:[{left:Y()}],visibility:["visible","invisible","collapse"],z:[{z:[Lo,"auto",Ke,Ve]}],basis:[{basis:[Oo,"full","auto",u,...U()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[xt,Oo,"auto","initial","none",Ve]}],grow:[{grow:["",xt,Ke,Ve]}],shrink:[{shrink:["",xt,Ke,Ve]}],order:[{order:[Lo,"first","last","none",Ke,Ve]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":W()}],"auto-rows":[{"auto-rows":W()}],gap:[{gap:U()}],"gap-x":[{"gap-x":U()}],"gap-y":[{"gap-y":U()}],"justify-content":[{justify:[...K(),"normal"]}],"justify-items":[{"justify-items":[...q(),"normal"]}],"justify-self":[{"justify-self":["auto",...q()]}],"align-content":[{content:["normal",...K()]}],"align-items":[{items:[...q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...q(),{baseline:["","last"]}]}],"place-content":[{"place-content":K()}],"place-items":[{"place-items":[...q(),"baseline"]}],"place-self":[{"place-self":["auto",...q()]}],p:[{p:U()}],px:[{px:U()}],py:[{py:U()}],ps:[{ps:U()}],pe:[{pe:U()}],pbs:[{pbs:U()}],pbe:[{pbe:U()}],pt:[{pt:U()}],pr:[{pr:U()}],pb:[{pb:U()}],pl:[{pl:U()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mbs:[{mbs:O()}],mbe:[{mbe:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":U()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":U()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...$()]}],"min-block-size":[{"min-block":["auto",...$()]}],"max-block-size":[{"max-block":["none",...$()]}],w:[{w:[u,"screen",...F()]}],"min-w":[{"min-w":[u,"screen","none",...F()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[l]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",n,Cu,Sa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,CP,_P]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",i_,Ve]}],"font-family":[{font:[xP,bP,t]}],"font-features":[{"font-features":[Ve]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ke,Ve]}],"line-clamp":[{"line-clamp":[xt,"none",Ke,ck]}],leading:[{leading:[a,...U()]}],"list-image":[{"list-image":["none",Ke,Ve]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ke,Ve]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[xt,"from-font","auto",Ke,Sa]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[xt,"auto",Ke,Ve]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:U()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ke,Ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ke,Ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:B()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Lo,Ke,Ve],radial:["",Ke,Ve],conic:[Lo,Ke,Ve]},SP,yP]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:se()}],"rounded-s":[{"rounded-s":se()}],"rounded-e":[{"rounded-e":se()}],"rounded-t":[{"rounded-t":se()}],"rounded-r":[{"rounded-r":se()}],"rounded-b":[{"rounded-b":se()}],"rounded-l":[{"rounded-l":se()}],"rounded-ss":[{"rounded-ss":se()}],"rounded-se":[{"rounded-se":se()}],"rounded-ee":[{"rounded-ee":se()}],"rounded-es":[{"rounded-es":se()}],"rounded-tl":[{"rounded-tl":se()}],"rounded-tr":[{"rounded-tr":se()}],"rounded-br":[{"rounded-br":se()}],"rounded-bl":[{"rounded-bl":se()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-bs":[{"border-bs":Z()}],"border-w-be":[{"border-be":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[xt,Ke,Ve]}],"outline-w":[{outline:["",xt,Cu,Sa]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",g,mf,ff]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",p,mf,ff]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[xt,Sa]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",v,mf,ff]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[xt,Ke,Ve]}],"mix-blend":[{"mix-blend":[...le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":le()}],"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":[xt]}],"mask-image-linear-from-pos":[{"mask-linear-from":pe()}],"mask-image-linear-to-pos":[{"mask-linear-to":pe()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":pe()}],"mask-image-t-to-pos":[{"mask-t-to":pe()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":pe()}],"mask-image-r-to-pos":[{"mask-r-to":pe()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":pe()}],"mask-image-b-to-pos":[{"mask-b-to":pe()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":pe()}],"mask-image-l-to-pos":[{"mask-l-to":pe()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":pe()}],"mask-image-x-to-pos":[{"mask-x-to":pe()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":pe()}],"mask-image-y-to-pos":[{"mask-y-to":pe()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Ke,Ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":pe()}],"mask-image-radial-to-pos":[{"mask-radial-to":pe()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":N()}],"mask-image-conic-pos":[{"mask-conic":[xt]}],"mask-image-conic-from-pos":[{"mask-conic-from":pe()}],"mask-image-conic-to-pos":[{"mask-conic-to":pe()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:B()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ke,Ve]}],filter:[{filter:["","none",Ke,Ve]}],blur:[{blur:xe()}],brightness:[{brightness:[xt,Ke,Ve]}],contrast:[{contrast:[xt,Ke,Ve]}],"drop-shadow":[{"drop-shadow":["","none",y,mf,ff]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",xt,Ke,Ve]}],"hue-rotate":[{"hue-rotate":[xt,Ke,Ve]}],invert:[{invert:["",xt,Ke,Ve]}],saturate:[{saturate:[xt,Ke,Ve]}],sepia:[{sepia:["",xt,Ke,Ve]}],"backdrop-filter":[{"backdrop-filter":["","none",Ke,Ve]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[xt,Ke,Ve]}],"backdrop-contrast":[{"backdrop-contrast":[xt,Ke,Ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",xt,Ke,Ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[xt,Ke,Ve]}],"backdrop-invert":[{"backdrop-invert":["",xt,Ke,Ve]}],"backdrop-opacity":[{"backdrop-opacity":[xt,Ke,Ve]}],"backdrop-saturate":[{"backdrop-saturate":[xt,Ke,Ve]}],"backdrop-sepia":[{"backdrop-sepia":["",xt,Ke,Ve]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":U()}],"border-spacing-x":[{"border-spacing-x":U()}],"border-spacing-y":[{"border-spacing-y":U()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ke,Ve]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[xt,"initial",Ke,Ve]}],ease:[{ease:["linear","initial",k,Ke,Ve]}],delay:[{delay:[xt,Ke,Ve]}],animate:[{animate:["none",R,Ke,Ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,Ke,Ve]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:Me()}],"rotate-x":[{"rotate-x":Me()}],"rotate-y":[{"rotate-y":Me()}],"rotate-z":[{"rotate-z":Me()}],scale:[{scale:Re()}],"scale-x":[{"scale-x":Re()}],"scale-y":[{"scale-y":Re()}],"scale-z":[{"scale-z":Re()}],"scale-3d":["scale-3d"],skew:[{skew:je()}],"skew-x":[{"skew-x":je()}],"skew-y":[{"skew-y":je()}],transform:[{transform:[Ke,Ve,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Xe()}],"translate-x":[{"translate-x":Xe()}],"translate-y":[{"translate-y":Xe()}],"translate-z":[{"translate-z":Xe()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"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",Ke,Ve]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":U()}],"scroll-mx":[{"scroll-mx":U()}],"scroll-my":[{"scroll-my":U()}],"scroll-ms":[{"scroll-ms":U()}],"scroll-me":[{"scroll-me":U()}],"scroll-mbs":[{"scroll-mbs":U()}],"scroll-mbe":[{"scroll-mbe":U()}],"scroll-mt":[{"scroll-mt":U()}],"scroll-mr":[{"scroll-mr":U()}],"scroll-mb":[{"scroll-mb":U()}],"scroll-ml":[{"scroll-ml":U()}],"scroll-p":[{"scroll-p":U()}],"scroll-px":[{"scroll-px":U()}],"scroll-py":[{"scroll-py":U()}],"scroll-ps":[{"scroll-ps":U()}],"scroll-pe":[{"scroll-pe":U()}],"scroll-pbs":[{"scroll-pbs":U()}],"scroll-pbe":[{"scroll-pbe":U()}],"scroll-pt":[{"scroll-pt":U()}],"scroll-pr":[{"scroll-pr":U()}],"scroll-pb":[{"scroll-pb":U()}],"scroll-pl":[{"scroll-pl":U()}],"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",Ke,Ve]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[xt,Cu,Sa,ck]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},RP=sP(EP);function me(...e){return RP(ET(e))}function Kf(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function hk(e){return e.startsWith("chatId:")?e.slice(7):e}const FT=Bz("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none",{variants:{variant:{default:"bg-primary text-primary-foreground disabled:bg-primary/50 disabled:text-primary-foreground/90 hover:bg-primary/90",juicy:"bg-logo text-primary-foreground disabled:text-primary-foreground/50 hover:bg-logo/90",destructive:"bg-destructive/80 dark:text-white",outline:"border border-input disabled:bg-transparent disabled:text-foreground/50 disabled:border-input/90 bg-card hover:bg-muted hover:text-accent-foreground",secondary:"bg-transparent border border-border text-secondary-foreground hover:text-secondary-foreground/60 disabled:text-secondary-foreground/50",ghost:"hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground disabled:text-muted-foreground/50 border border-border/0 hover:border-border",link:"text-primary disabled:text-primary/50 underline-offset-4 hover:underline",none:""},size:{default:"h-10 px-4 rounded-full py-2",sm:"h-9 rounded-full px-3",lg:"h-11 rounded-full px-8",icon:"h-9 w-9 rounded-full","icon-sm":"h-5.5 w-5.5 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),tt=_.forwardRef(({className:e,variant:t,size:n,...r},s)=>f.jsx("button",{className:me(FT({variant:t,size:n,className:e})),ref:s,...r}));tt.displayName="Button";function Be(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function fk(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function m0(...e){return t=>{let n=!1;const r=e.map(s=>{const a=fk(s,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<r.length;s++){const a=r[s];typeof a=="function"?a():fk(e[s],null)}}}}function Ut(...e){return _.useCallback(m0(...e),e)}function TP(e,t){const n=_.createContext(t),r=a=>{const{children:l,...u}=a,h=_.useMemo(()=>u,Object.values(u));return f.jsx(n.Provider,{value:h,children:l})};r.displayName=e+"Provider";function s(a){const l=_.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[r,s]}function eo(e,t=[]){let n=[];function r(a,l){const u=_.createContext(l),h=n.length;n=[...n,l];const d=p=>{var k;const{scope:v,children:y,...w}=p,S=((k=v==null?void 0:v[e])==null?void 0:k[h])||u,C=_.useMemo(()=>w,Object.values(w));return f.jsx(S.Provider,{value:C,children:y})};d.displayName=a+"Provider";function g(p,v){var S;const y=((S=v==null?void 0:v[e])==null?void 0:S[h])||u,w=_.useContext(y);if(w)return w;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${a}\``)}return[d,g]}const s=()=>{const a=n.map(l=>_.createContext(l));return function(u){const h=(u==null?void 0:u[e])||a;return _.useMemo(()=>({[`__scope${e}`]:{...u,[e]:h}}),[u,h])}};return s.scopeName=e,[r,NP(s,...t)]}function NP(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const l=r.reduce((u,{useScope:h,scopeName:d})=>{const p=h(a)[`__scope${d}`];return{...u,...p}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var br=globalThis!=null&&globalThis.document?_.useLayoutEffect:()=>{},MP=nT[" useId ".trim().toString()]||(()=>{}),AP=0;function Gs(e){const[t,n]=_.useState(MP());return br(()=>{n(r=>r??String(AP++))},[e]),t?`radix-${t}`:""}var DP=nT[" useInsertionEffect ".trim().toString()]||br;function lc({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,a,l]=jP({defaultProp:t,onChange:n}),u=e!==void 0,h=u?e:s;{const g=_.useRef(e!==void 0);_.useEffect(()=>{const p=g.current;p!==u&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${u?"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.`),g.current=u},[u,r])}const d=_.useCallback(g=>{var p;if(u){const v=OP(g)?g(e):g;v!==e&&((p=l.current)==null||p.call(l,v))}else a(g)},[u,e,a,l]);return[h,d]}function jP({defaultProp:e,onChange:t}){const[n,r]=_.useState(e),s=_.useRef(n),a=_.useRef(t);return DP(()=>{a.current=t},[t]),_.useEffect(()=>{var l;s.current!==n&&((l=a.current)==null||l.call(a,n),s.current=n)},[n,s]),[n,r,a]}function OP(e){return typeof e=="function"}function Fa(e){const t=LP(e),n=_.forwardRef((r,s)=>{const{children:a,...l}=r,u=_.Children.toArray(a),h=u.find(PP);if(h){const d=h.props.children,g=u.map(p=>p===h?_.Children.count(d)>1?_.Children.only(null):_.isValidElement(d)?d.props.children:null:p);return f.jsx(t,{...l,ref:s,children:_.isValidElement(d)?_.cloneElement(d,void 0,g):null})}return f.jsx(t,{...l,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function LP(e){const t=_.forwardRef((n,r)=>{const{children:s,...a}=n;if(_.isValidElement(s)){const l=IP(s),u=BP(a,s.props);return s.type!==_.Fragment&&(u.ref=r?m0(r,l):l),_.cloneElement(s,u)}return _.Children.count(s)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var UT=Symbol("radix.slottable");function zP(e){const t=({children:n})=>f.jsx(f.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=UT,t}function PP(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===UT}function BP(e,t){const n={...t};for(const r in t){const s=e[r],a=t[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...u)=>{const h=a(...u);return s(...u),h}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function IP(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var HP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Tt=HP.reduce((e,t)=>{const n=Fa(`Primitive.${t}`),r=_.forwardRef((s,a)=>{const{asChild:l,...u}=s,h=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(h,{...u,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function $T(e,t){e&&Hi.flushSync(()=>e.dispatchEvent(t))}function $i(e){const t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function FP(e,t=globalThis==null?void 0:globalThis.document){const n=$i(e);_.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var UP="DismissableLayer",Sb="dismissableLayer.update",$P="dismissableLayer.pointerDownOutside",WP="dismissableLayer.focusOutside",mk,WT=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),bc=_.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:l,onDismiss:u,...h}=e,d=_.useContext(WT),[g,p]=_.useState(null),v=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=_.useState({}),w=Ut(t,L=>p(L)),S=Array.from(d.layers),[C]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),k=S.indexOf(C),R=g?S.indexOf(g):-1,E=d.layersWithOutsidePointerEventsDisabled.size>0,N=R>=k,j=KP(L=>{const U=L.target,Y=[...d.branches].some(P=>P.contains(U));!N||Y||(s==null||s(L),l==null||l(L),L.defaultPrevented||u==null||u())},v),D=GP(L=>{const U=L.target;[...d.branches].some(P=>P.contains(U))||(a==null||a(L),l==null||l(L),L.defaultPrevented||u==null||u())},v);return FP(L=>{R===d.layers.size-1&&(r==null||r(L),!L.defaultPrevented&&u&&(L.preventDefault(),u()))},v),_.useEffect(()=>{if(g)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(mk=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(g)),d.layers.add(g),pk(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=mk)}},[g,v,n,d]),_.useEffect(()=>()=>{g&&(d.layers.delete(g),d.layersWithOutsidePointerEventsDisabled.delete(g),pk())},[g,d]),_.useEffect(()=>{const L=()=>y({});return document.addEventListener(Sb,L),()=>document.removeEventListener(Sb,L)},[]),f.jsx(Tt.div,{...h,ref:w,style:{pointerEvents:E?N?"auto":"none":void 0,...e.style},onFocusCapture:Be(e.onFocusCapture,D.onFocusCapture),onBlurCapture:Be(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:Be(e.onPointerDownCapture,j.onPointerDownCapture)})});bc.displayName=UP;var VP="DismissableLayerBranch",qP=_.forwardRef((e,t)=>{const n=_.useContext(WT),r=_.useRef(null),s=Ut(t,r);return _.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),f.jsx(Tt.div,{...e,ref:s})});qP.displayName=VP;function KP(e,t=globalThis==null?void 0:globalThis.document){const n=$i(e),r=_.useRef(!1),s=_.useRef(()=>{});return _.useEffect(()=>{const a=u=>{if(u.target&&!r.current){let h=function(){VT($P,n,d,{discrete:!0})};const d={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=h,t.addEventListener("click",s.current,{once:!0})):h()}else t.removeEventListener("click",s.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function GP(e,t=globalThis==null?void 0:globalThis.document){const n=$i(e),r=_.useRef(!1);return _.useEffect(()=>{const s=a=>{a.target&&!r.current&&VT(WP,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function pk(){const e=new CustomEvent(Sb);document.dispatchEvent(e)}function VT(e,t,n,{discrete:r}){const s=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?$T(s,a):s.dispatchEvent(a)}var s_="focusScope.autoFocusOnMount",o_="focusScope.autoFocusOnUnmount",gk={bubbles:!1,cancelable:!0},YP="FocusScope",wd=_.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=e,[u,h]=_.useState(null),d=$i(s),g=$i(a),p=_.useRef(null),v=Ut(t,S=>h(S)),y=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let S=function(E){if(y.paused||!u)return;const N=E.target;u.contains(N)?p.current=N:Fo(p.current,{select:!0})},C=function(E){if(y.paused||!u)return;const N=E.relatedTarget;N!==null&&(u.contains(N)||Fo(p.current,{select:!0}))},k=function(E){if(document.activeElement===document.body)for(const j of E)j.removedNodes.length>0&&Fo(u)};document.addEventListener("focusin",S),document.addEventListener("focusout",C);const R=new MutationObserver(k);return u&&R.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",C),R.disconnect()}}},[r,u,y.paused]),_.useEffect(()=>{if(u){_k.add(y);const S=document.activeElement;if(!u.contains(S)){const k=new CustomEvent(s_,gk);u.addEventListener(s_,d),u.dispatchEvent(k),k.defaultPrevented||(XP(tB(qT(u)),{select:!0}),document.activeElement===S&&Fo(u))}return()=>{u.removeEventListener(s_,d),setTimeout(()=>{const k=new CustomEvent(o_,gk);u.addEventListener(o_,g),u.dispatchEvent(k),k.defaultPrevented||Fo(S??document.body,{select:!0}),u.removeEventListener(o_,g),_k.remove(y)},0)}}},[u,d,g,y]);const w=_.useCallback(S=>{if(!n&&!r||y.paused)return;const C=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,k=document.activeElement;if(C&&k){const R=S.currentTarget,[E,N]=ZP(R);E&&N?!S.shiftKey&&k===N?(S.preventDefault(),n&&Fo(E,{select:!0})):S.shiftKey&&k===E&&(S.preventDefault(),n&&Fo(N,{select:!0})):k===R&&S.preventDefault()}},[n,r,y.paused]);return f.jsx(Tt.div,{tabIndex:-1,...l,ref:v,onKeyDown:w})});wd.displayName=YP;function XP(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Fo(r,{select:t}),document.activeElement!==n)return}function ZP(e){const t=qT(e),n=vk(t,e),r=vk(t.reverse(),e);return[n,r]}function qT(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function vk(e,t){for(const n of e)if(!QP(n,{upTo:t}))return n}function QP(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 JP(e){return e instanceof HTMLInputElement&&"select"in e}function Fo(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&JP(e)&&t&&e.select()}}var _k=eB();function eB(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=bk(e,t),e.unshift(t)},remove(t){var n;e=bk(e,t),(n=e[0])==null||n.resume()}}}function bk(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function tB(e){return e.filter(t=>t.tagName!=="A")}var nB="Portal",yc=_.forwardRef((e,t)=>{var u;const{container:n,...r}=e,[s,a]=_.useState(!1);br(()=>a(!0),[]);const l=n||s&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return l?CT.createPortal(f.jsx(Tt.div,{...r,ref:t}),l):null});yc.displayName=nB;function rB(e,t){return _.useReducer((n,r)=>t[n][r]??n,e)}var ji=e=>{const{present:t,children:n}=e,r=iB(t),s=typeof n=="function"?n({present:r.isPresent}):_.Children.only(n),a=Ut(r.ref,sB(s));return typeof n=="function"||r.isPresent?_.cloneElement(s,{ref:a}):null};ji.displayName="Presence";function iB(e){const[t,n]=_.useState(),r=_.useRef(null),s=_.useRef(e),a=_.useRef("none"),l=e?"mounted":"unmounted",[u,h]=rB(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const d=pf(r.current);a.current=u==="mounted"?d:"none"},[u]),br(()=>{const d=r.current,g=s.current;if(g!==e){const v=a.current,y=pf(d);e?h("MOUNT"):y==="none"||(d==null?void 0:d.display)==="none"?h("UNMOUNT"):h(g&&v!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,h]),br(()=>{if(t){let d;const g=t.ownerDocument.defaultView??window,p=y=>{const S=pf(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&S&&(h("ANIMATION_END"),!s.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",d=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},v=y=>{y.target===t&&(a.current=pf(r.current))};return t.addEventListener("animationstart",v),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{g.clearTimeout(d),t.removeEventListener("animationstart",v),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:_.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function pf(e){return(e==null?void 0:e.animationName)||"none"}function sB(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var a_=0;function Jm(){_.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??yk()),document.body.insertAdjacentElement("beforeend",e[1]??yk()),a_++,()=>{a_===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),a_--}},[])}function yk(){const 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 cs=function(){return cs=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},cs.apply(this,arguments)};function KT(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 s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function oB(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,a;r<s;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Gf="right-scroll-bar-position",Yf="width-before-scroll-bar",aB="with-scroll-bars-hidden",lB="--removed-body-scroll-bar-size";function l_(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function cB(e,t){var n=_.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var uB=typeof window<"u"?_.useLayoutEffect:_.useEffect,xk=new WeakMap;function dB(e,t){var n=cB(null,function(r){return e.forEach(function(s){return l_(s,r)})});return uB(function(){var r=xk.get(n);if(r){var s=new Set(r),a=new Set(e),l=n.current;s.forEach(function(u){a.has(u)||l_(u,null)}),a.forEach(function(u){s.has(u)||l_(u,l)})}xk.set(n,e)},[e]),n}function hB(e){return e}function fB(e,t){t===void 0&&(t=hB);var n=[],r=!1,s={read:function(){if(r)throw new 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(a){var l=t(a,r);return n.push(l),function(){n=n.filter(function(u){return u!==l})}},assignSyncMedium:function(a){for(r=!0;n.length;){var l=n;n=[],l.forEach(a)}n={push:function(u){return a(u)},filter:function(){return n}}},assignMedium:function(a){r=!0;var l=[];if(n.length){var u=n;n=[],u.forEach(a),l=n}var h=function(){var g=l;l=[],g.forEach(a)},d=function(){return Promise.resolve().then(h)};d(),n={push:function(g){l.push(g),d()},filter:function(g){return l=l.filter(g),n}}}};return s}function mB(e){e===void 0&&(e={});var t=fB(null);return t.options=cs({async:!0,ssr:!1},e),t}var GT=function(e){var t=e.sideCar,n=KT(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return _.createElement(r,cs({},n))};GT.isSideCarExport=!0;function pB(e,t){return e.useMedium(t),GT}var YT=mB(),c_=function(){},ep=_.forwardRef(function(e,t){var n=_.useRef(null),r=_.useState({onScrollCapture:c_,onWheelCapture:c_,onTouchMoveCapture:c_}),s=r[0],a=r[1],l=e.forwardProps,u=e.children,h=e.className,d=e.removeScrollBar,g=e.enabled,p=e.shards,v=e.sideCar,y=e.noRelative,w=e.noIsolation,S=e.inert,C=e.allowPinchZoom,k=e.as,R=k===void 0?"div":k,E=e.gapMode,N=KT(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=v,D=dB([n,t]),L=cs(cs({},N),s);return _.createElement(_.Fragment,null,g&&_.createElement(j,{sideCar:YT,removeScrollBar:d,shards:p,noRelative:y,noIsolation:w,inert:S,setCallbacks:a,allowPinchZoom:!!C,lockRef:n,gapMode:E}),l?_.cloneElement(_.Children.only(u),cs(cs({},L),{ref:D})):_.createElement(R,cs({},L,{className:h,ref:D}),u))});ep.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ep.classNames={fullWidth:Yf,zeroRight:Gf};var gB=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function vB(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=gB();return t&&e.setAttribute("nonce",t),e}function _B(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function bB(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var yB=function(){var e=0,t=null;return{add:function(n){e==0&&(t=vB())&&(_B(t,n),bB(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},xB=function(){var e=yB();return function(t,n){_.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},XT=function(){var e=xB(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},wB={left:0,top:0,right:0,gap:0},u_=function(e){return parseInt(e||"",10)||0},SB=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[u_(n),u_(r),u_(s)]},CB=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return wB;var t=SB(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])}},kB=XT(),nc="data-scroll-locked",EB=function(e,t,n,r){var s=e.left,a=e.top,l=e.right,u=e.gap;return n===void 0&&(n="margin"),`
61
- .`.concat(aB,` {
62
- overflow: hidden `).concat(r,`;
63
- padding-right: `).concat(u,"px ").concat(r,`;
64
- }
65
- body[`).concat(nc,`] {
66
- overflow: hidden `).concat(r,`;
67
- overscroll-behavior: contain;
68
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
69
- padding-left: `.concat(s,`px;
70
- padding-top: `).concat(a,`px;
71
- padding-right: `).concat(l,`px;
72
- margin-left:0;
73
- margin-top:0;
74
- margin-right: `).concat(u,"px ").concat(r,`;
75
- `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),`
76
- }
77
-
78
- .`).concat(Gf,` {
79
- right: `).concat(u,"px ").concat(r,`;
80
- }
81
-
82
- .`).concat(Yf,` {
83
- margin-right: `).concat(u,"px ").concat(r,`;
84
- }
85
-
86
- .`).concat(Gf," .").concat(Gf,` {
87
- right: 0 `).concat(r,`;
88
- }
89
-
90
- .`).concat(Yf," .").concat(Yf,` {
91
- margin-right: 0 `).concat(r,`;
92
- }
93
-
94
- body[`).concat(nc,`] {
95
- `).concat(lB,": ").concat(u,`px;
96
- }
97
- `)},wk=function(){var e=parseInt(document.body.getAttribute(nc)||"0",10);return isFinite(e)?e:0},RB=function(){_.useEffect(function(){return document.body.setAttribute(nc,(wk()+1).toString()),function(){var e=wk()-1;e<=0?document.body.removeAttribute(nc):document.body.setAttribute(nc,e.toString())}},[])},TB=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;RB();var a=_.useMemo(function(){return CB(s)},[s]);return _.createElement(kB,{styles:EB(a,!t,s,n?"":"!important")})},Cb=!1;if(typeof window<"u")try{var gf=Object.defineProperty({},"passive",{get:function(){return Cb=!0,!0}});window.addEventListener("test",gf,gf),window.removeEventListener("test",gf,gf)}catch{Cb=!1}var Il=Cb?{passive:!1}:!1,NB=function(e){return e.tagName==="TEXTAREA"},ZT=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!NB(e)&&n[t]==="visible")},MB=function(e){return ZT(e,"overflowY")},AB=function(e){return ZT(e,"overflowX")},Sk=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=QT(e,r);if(s){var a=JT(e,r),l=a[1],u=a[2];if(l>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},DB=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},jB=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},QT=function(e,t){return e==="v"?MB(t):AB(t)},JT=function(e,t){return e==="v"?DB(t):jB(t)},OB=function(e,t){return e==="h"&&t==="rtl"?-1:1},LB=function(e,t,n,r,s){var a=OB(e,window.getComputedStyle(t).direction),l=a*r,u=n.target,h=t.contains(u),d=!1,g=l>0,p=0,v=0;do{if(!u)break;var y=JT(e,u),w=y[0],S=y[1],C=y[2],k=S-C-a*w;(w||k)&&QT(e,u)&&(p+=k,v+=w);var R=u.parentNode;u=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!h&&u!==document.body||h&&(t.contains(u)||t===u));return(g&&Math.abs(p)<1||!g&&Math.abs(v)<1)&&(d=!0),d},vf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ck=function(e){return[e.deltaX,e.deltaY]},kk=function(e){return e&&"current"in e?e.current:e},zB=function(e,t){return e[0]===t[0]&&e[1]===t[1]},PB=function(e){return`
98
- .block-interactivity-`.concat(e,` {pointer-events: none;}
99
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
100
- `)},BB=0,Hl=[];function IB(e){var t=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),s=_.useState(BB++)[0],a=_.useState(XT)[0],l=_.useRef(e);_.useEffect(function(){l.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var S=oB([e.lockRef.current],(e.shards||[]).map(kk),!0).filter(Boolean);return S.forEach(function(C){return C.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),S.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var u=_.useCallback(function(S,C){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!l.current.allowPinchZoom;var k=vf(S),R=n.current,E="deltaX"in S?S.deltaX:R[0]-k[0],N="deltaY"in S?S.deltaY:R[1]-k[1],j,D=S.target,L=Math.abs(E)>Math.abs(N)?"h":"v";if("touches"in S&&L==="h"&&D.type==="range")return!1;var U=window.getSelection(),Y=U&&U.anchorNode,P=Y?Y===D||Y.contains(D):!1;if(P)return!1;var V=Sk(L,D);if(!V)return!0;if(V?j=L:(j=L==="v"?"h":"v",V=Sk(L,D)),!V)return!1;if(!r.current&&"changedTouches"in S&&(E||N)&&(r.current=j),!j)return!0;var I=r.current||j;return LB(I,C,S,I==="h"?E:N)},[]),h=_.useCallback(function(S){var C=S;if(!(!Hl.length||Hl[Hl.length-1]!==a)){var k="deltaY"in C?Ck(C):vf(C),R=t.current.filter(function(j){return j.name===C.type&&(j.target===C.target||C.target===j.shadowParent)&&zB(j.delta,k)})[0];if(R&&R.should){C.cancelable&&C.preventDefault();return}if(!R){var E=(l.current.shards||[]).map(kk).filter(Boolean).filter(function(j){return j.contains(C.target)}),N=E.length>0?u(C,E[0]):!l.current.noIsolation;N&&C.cancelable&&C.preventDefault()}}},[]),d=_.useCallback(function(S,C,k,R){var E={name:S,delta:C,target:k,should:R,shadowParent:HB(k)};t.current.push(E),setTimeout(function(){t.current=t.current.filter(function(N){return N!==E})},1)},[]),g=_.useCallback(function(S){n.current=vf(S),r.current=void 0},[]),p=_.useCallback(function(S){d(S.type,Ck(S),S.target,u(S,e.lockRef.current))},[]),v=_.useCallback(function(S){d(S.type,vf(S),S.target,u(S,e.lockRef.current))},[]);_.useEffect(function(){return Hl.push(a),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:v}),document.addEventListener("wheel",h,Il),document.addEventListener("touchmove",h,Il),document.addEventListener("touchstart",g,Il),function(){Hl=Hl.filter(function(S){return S!==a}),document.removeEventListener("wheel",h,Il),document.removeEventListener("touchmove",h,Il),document.removeEventListener("touchstart",g,Il)}},[]);var y=e.removeScrollBar,w=e.inert;return _.createElement(_.Fragment,null,w?_.createElement(a,{styles:PB(s)}):null,y?_.createElement(TB,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function HB(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const FB=pB(YT,IB);var Sd=_.forwardRef(function(e,t){return _.createElement(ep,cs({},e,{ref:t,sideCar:FB}))});Sd.classNames=ep.classNames;var UB=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Fl=new WeakMap,_f=new WeakMap,bf={},d_=0,eN=function(e){return e&&(e.host||eN(e.parentNode))},$B=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=eN(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},WB=function(e,t,n,r){var s=$B(t,Array.isArray(e)?e:[e]);bf[n]||(bf[n]=new WeakMap);var a=bf[n],l=[],u=new Set,h=new Set(s),d=function(p){!p||u.has(p)||(u.add(p),d(p.parentNode))};s.forEach(d);var g=function(p){!p||h.has(p)||Array.prototype.forEach.call(p.children,function(v){if(u.has(v))g(v);else try{var y=v.getAttribute(r),w=y!==null&&y!=="false",S=(Fl.get(v)||0)+1,C=(a.get(v)||0)+1;Fl.set(v,S),a.set(v,C),l.push(v),S===1&&w&&_f.set(v,!0),C===1&&v.setAttribute(n,"true"),w||v.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",v,k)}})};return g(t),u.clear(),d_++,function(){l.forEach(function(p){var v=Fl.get(p)-1,y=a.get(p)-1;Fl.set(p,v),a.set(p,y),v||(_f.has(p)||p.removeAttribute(r),_f.delete(p)),y||p.removeAttribute(n)}),d_--,d_||(Fl=new WeakMap,Fl=new WeakMap,_f=new WeakMap,bf={})}},tp=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=UB(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),WB(r,s,n,"aria-hidden")):function(){return null}},np="Dialog",[tN]=eo(np),[VB,Gi]=tN(np),nN=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:l=!0}=e,u=_.useRef(null),h=_.useRef(null),[d,g]=lc({prop:r,defaultProp:s??!1,onChange:a,caller:np});return f.jsx(VB,{scope:t,triggerRef:u,contentRef:h,contentId:Gs(),titleId:Gs(),descriptionId:Gs(),open:d,onOpenChange:g,onOpenToggle:_.useCallback(()=>g(p=>!p),[g]),modal:l,children:n})};nN.displayName=np;var rN="DialogTrigger",qB=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Gi(rN,n),a=Ut(t,s.triggerRef);return f.jsx(Tt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":v0(s.open),...r,ref:a,onClick:Be(e.onClick,s.onOpenToggle)})});qB.displayName=rN;var p0="DialogPortal",[KB,iN]=tN(p0,{forceMount:void 0}),sN=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,a=Gi(p0,t);return f.jsx(KB,{scope:t,forceMount:n,children:_.Children.map(r,l=>f.jsx(ji,{present:n||a.open,children:f.jsx(yc,{asChild:!0,container:s,children:l})}))})};sN.displayName=p0;var fm="DialogOverlay",oN=_.forwardRef((e,t)=>{const n=iN(fm,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,a=Gi(fm,e.__scopeDialog);return a.modal?f.jsx(ji,{present:r||a.open,children:f.jsx(YB,{...s,ref:t})}):null});oN.displayName=fm;var GB=Fa("DialogOverlay.RemoveScroll"),YB=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Gi(fm,n);return f.jsx(Sd,{as:GB,allowPinchZoom:!0,shards:[s.contentRef],children:f.jsx(Tt.div,{"data-state":v0(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Ua="DialogContent",aN=_.forwardRef((e,t)=>{const n=iN(Ua,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,a=Gi(Ua,e.__scopeDialog);return f.jsx(ji,{present:r||a.open,children:a.modal?f.jsx(XB,{...s,ref:t}):f.jsx(ZB,{...s,ref:t})})});aN.displayName=Ua;var XB=_.forwardRef((e,t)=>{const n=Gi(Ua,e.__scopeDialog),r=_.useRef(null),s=Ut(t,n.contentRef,r);return _.useEffect(()=>{const a=r.current;if(a)return tp(a)},[]),f.jsx(lN,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Be(e.onCloseAutoFocus,a=>{var l;a.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Be(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&a.preventDefault()}),onFocusOutside:Be(e.onFocusOutside,a=>a.preventDefault())})}),ZB=_.forwardRef((e,t)=>{const n=Gi(Ua,e.__scopeDialog),r=_.useRef(!1),s=_.useRef(!1);return f.jsx(lN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,a),a.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{var h,d;(h=e.onInteractOutside)==null||h.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=a.target;((d=n.triggerRef.current)==null?void 0:d.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),lN=_.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,...l}=e,u=Gi(Ua,n),h=_.useRef(null),d=Ut(t,h);return Jm(),f.jsxs(f.Fragment,{children:[f.jsx(wd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:f.jsx(bc,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":v0(u.open),...l,ref:d,onDismiss:()=>u.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(QB,{titleId:u.titleId}),f.jsx(e6,{contentRef:h,descriptionId:u.descriptionId})]})]})}),g0="DialogTitle",cN=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Gi(g0,n);return f.jsx(Tt.h2,{id:s.titleId,...r,ref:t})});cN.displayName=g0;var uN="DialogDescription",dN=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Gi(uN,n);return f.jsx(Tt.p,{id:s.descriptionId,...r,ref:t})});dN.displayName=uN;var hN="DialogClose",fN=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Gi(hN,n);return f.jsx(Tt.button,{type:"button",...r,ref:t,onClick:Be(e.onClick,()=>s.onOpenChange(!1))})});fN.displayName=hN;function v0(e){return e?"open":"closed"}var mN="DialogTitleWarning",[pre,pN]=TP(mN,{contentName:Ua,titleName:g0,docsSlug:"dialog"}),QB=({titleId:e})=>{const t=pN(mN),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
101
-
102
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
103
-
104
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},JB="DialogDescriptionWarning",e6=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${pN(JB).contentName}}.`;return _.useEffect(()=>{var a;const s=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},t6=nN,n6=sN,gN=oN,vN=aN,r6=cN,i6=dN,s6=fN;/**
105
- * @license lucide-react v0.562.0 - ISC
106
- *
107
- * This source code is licensed under the ISC license.
108
- * See the LICENSE file in the root directory of this source tree.
109
- */const o6=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a6=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Ek=e=>{const t=a6(e);return t.charAt(0).toUpperCase()+t.slice(1)},_N=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),l6=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
110
- * @license lucide-react v0.562.0 - ISC
111
- *
112
- * This source code is licensed under the ISC license.
113
- * See the LICENSE file in the root directory of this source tree.
114
- */var c6={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"};/**
115
- * @license lucide-react v0.562.0 - ISC
116
- *
117
- * This source code is licensed under the ISC license.
118
- * See the LICENSE file in the root directory of this source tree.
119
- */const u6=_.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:a,iconNode:l,...u},h)=>_.createElement("svg",{ref:h,...c6,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:_N("lucide",s),...!a&&!l6(u)&&{"aria-hidden":"true"},...u},[...l.map(([d,g])=>_.createElement(d,g)),...Array.isArray(a)?a:[a]]));/**
120
- * @license lucide-react v0.562.0 - ISC
121
- *
122
- * This source code is licensed under the ISC license.
123
- * See the LICENSE file in the root directory of this source tree.
124
- */const Ue=(e,t)=>{const n=_.forwardRef(({className:r,...s},a)=>_.createElement(u6,{ref:a,iconNode:t,className:_N(`lucide-${o6(Ek(e))}`,`lucide-${e}`,r),...s}));return n.displayName=Ek(e),n};/**
125
- * @license lucide-react v0.562.0 - ISC
126
- *
127
- * This source code is licensed under the ISC license.
128
- * See the LICENSE file in the root directory of this source tree.
129
- */const d6=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],h6=Ue("archive",d6);/**
130
- * @license lucide-react v0.562.0 - ISC
131
- *
132
- * This source code is licensed under the ISC license.
133
- * See the LICENSE file in the root directory of this source tree.
134
- */const f6=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],m6=Ue("arrow-down-to-line",f6);/**
135
- * @license lucide-react v0.562.0 - ISC
136
- *
137
- * This source code is licensed under the ISC license.
138
- * See the LICENSE file in the root directory of this source tree.
139
- */const p6=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],g6=Ue("arrow-down",p6);/**
140
- * @license lucide-react v0.562.0 - ISC
141
- *
142
- * This source code is licensed under the ISC license.
143
- * See the LICENSE file in the root directory of this source tree.
144
- */const v6=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],_6=Ue("arrow-left-right",v6);/**
145
- * @license lucide-react v0.562.0 - ISC
146
- *
147
- * This source code is licensed under the ISC license.
148
- * See the LICENSE file in the root directory of this source tree.
149
- */const b6=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],y6=Ue("arrow-up",b6);/**
150
- * @license lucide-react v0.562.0 - ISC
151
- *
152
- * This source code is licensed under the ISC license.
153
- * See the LICENSE file in the root directory of this source tree.
154
- */const x6=[["path",{d:"M12 6v12",key:"1vza4d"}],["path",{d:"M17.196 9 6.804 15",key:"1ah31z"}],["path",{d:"m6.804 9 10.392 6",key:"1b6pxd"}]],w6=Ue("asterisk",x6);/**
155
- * @license lucide-react v0.562.0 - ISC
156
- *
157
- * This source code is licensed under the ISC license.
158
- * See the LICENSE file in the root directory of this source tree.
159
- */const S6=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],ti=Ue("brain",S6);/**
160
- * @license lucide-react v0.562.0 - ISC
161
- *
162
- * This source code is licensed under the ISC license.
163
- * See the LICENSE file in the root directory of this source tree.
164
- */const C6=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],k6=Ue("check-check",C6);/**
165
- * @license lucide-react v0.562.0 - ISC
166
- *
167
- * This source code is licensed under the ISC license.
168
- * See the LICENSE file in the root directory of this source tree.
169
- */const E6=[["path",{d:"M20 4L9 15",key:"1qkx8z"}],["path",{d:"M21 19L3 19",key:"100sma"}],["path",{d:"M9 15L4 10",key:"9zxff7"}]],R6=Ue("check-line",E6);/**
170
- * @license lucide-react v0.562.0 - ISC
171
- *
172
- * This source code is licensed under the ISC license.
173
- * See the LICENSE file in the root directory of this source tree.
174
- */const T6=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Wi=Ue("check",T6);/**
175
- * @license lucide-react v0.562.0 - ISC
176
- *
177
- * This source code is licensed under the ISC license.
178
- * See the LICENSE file in the root directory of this source tree.
179
- */const N6=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],rp=Ue("chevron-down",N6);/**
180
- * @license lucide-react v0.562.0 - ISC
181
- *
182
- * This source code is licensed under the ISC license.
183
- * See the LICENSE file in the root directory of this source tree.
184
- */const M6=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],bN=Ue("chevron-left",M6);/**
185
- * @license lucide-react v0.562.0 - ISC
186
- *
187
- * This source code is licensed under the ISC license.
188
- * See the LICENSE file in the root directory of this source tree.
189
- */const A6=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Tr=Ue("chevron-right",A6);/**
190
- * @license lucide-react v0.562.0 - ISC
191
- *
192
- * This source code is licensed under the ISC license.
193
- * See the LICENSE file in the root directory of this source tree.
194
- */const D6=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],j6=Ue("chevron-up",D6);/**
195
- * @license lucide-react v0.562.0 - ISC
196
- *
197
- * This source code is licensed under the ISC license.
198
- * See the LICENSE file in the root directory of this source tree.
199
- */const O6=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],L6=Ue("chevrons-up",O6);/**
200
- * @license lucide-react v0.562.0 - ISC
201
- *
202
- * This source code is licensed under the ISC license.
203
- * See the LICENSE file in the root directory of this source tree.
204
- */const z6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],P6=Ue("circle-slash",z6);/**
205
- * @license lucide-react v0.562.0 - ISC
206
- *
207
- * This source code is licensed under the ISC license.
208
- * See the LICENSE file in the root directory of this source tree.
209
- */const B6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],I6=Ue("circle",B6);/**
210
- * @license lucide-react v0.562.0 - ISC
211
- *
212
- * This source code is licensed under the ISC license.
213
- * See the LICENSE file in the root directory of this source tree.
214
- */const H6=[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]],F6=Ue("cloud-download",H6);/**
215
- * @license lucide-react v0.562.0 - ISC
216
- *
217
- * This source code is licensed under the ISC license.
218
- * See the LICENSE file in the root directory of this source tree.
219
- */const U6=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Rk=Ue("code-xml",U6);/**
220
- * @license lucide-react v0.562.0 - ISC
221
- *
222
- * This source code is licensed under the ISC license.
223
- * See the LICENSE file in the root directory of this source tree.
224
- */const $6=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],yN=Ue("code",$6);/**
225
- * @license lucide-react v0.562.0 - ISC
226
- *
227
- * This source code is licensed under the ISC license.
228
- * See the LICENSE file in the root directory of this source tree.
229
- */const W6=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],V6=Ue("command",W6);/**
230
- * @license lucide-react v0.562.0 - ISC
231
- *
232
- * This source code is licensed under the ISC license.
233
- * See the LICENSE file in the root directory of this source tree.
234
- */const q6=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Cd=Ue("copy",q6);/**
235
- * @license lucide-react v0.562.0 - ISC
236
- *
237
- * This source code is licensed under the ISC license.
238
- * See the LICENSE file in the root directory of this source tree.
239
- */const K6=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],G6=Ue("corner-down-left",K6);/**
240
- * @license lucide-react v0.562.0 - ISC
241
- *
242
- * This source code is licensed under the ISC license.
243
- * See the LICENSE file in the root directory of this source tree.
244
- */const Y6=[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]],X6=Ue("eraser",Y6);/**
245
- * @license lucide-react v0.562.0 - ISC
246
- *
247
- * This source code is licensed under the ISC license.
248
- * See the LICENSE file in the root directory of this source tree.
249
- */const Z6=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],Q6=Ue("file-pen",Z6);/**
250
- * @license lucide-react v0.562.0 - ISC
251
- *
252
- * This source code is licensed under the ISC license.
253
- * See the LICENSE file in the root directory of this source tree.
254
- */const J6=[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]],eI=Ue("file-plus-corner",J6);/**
255
- * @license lucide-react v0.562.0 - ISC
256
- *
257
- * This source code is licensed under the ISC license.
258
- * See the LICENSE file in the root directory of this source tree.
259
- */const tI=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],nI=Ue("file",tI);/**
260
- * @license lucide-react v0.562.0 - ISC
261
- *
262
- * This source code is licensed under the ISC license.
263
- * See the LICENSE file in the root directory of this source tree.
264
- */const rI=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],h_=Ue("folder-git-2",rI);/**
265
- * @license lucide-react v0.562.0 - ISC
266
- *
267
- * This source code is licensed under the ISC license.
268
- * See the LICENSE file in the root directory of this source tree.
269
- */const iI=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],xN=Ue("folder-open",iI);/**
270
- * @license lucide-react v0.562.0 - ISC
271
- *
272
- * This source code is licensed under the ISC license.
273
- * See the LICENSE file in the root directory of this source tree.
274
- */const sI=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],wN=Ue("folder-plus",sI);/**
275
- * @license lucide-react v0.562.0 - ISC
276
- *
277
- * This source code is licensed under the ISC license.
278
- * See the LICENSE file in the root directory of this source tree.
279
- */const oI=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],SN=Ue("folder",oI);/**
280
- * @license lucide-react v0.562.0 - ISC
281
- *
282
- * This source code is licensed under the ISC license.
283
- * See the LICENSE file in the root directory of this source tree.
284
- */const aI=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Fs=Ue("gauge",aI);/**
285
- * @license lucide-react v0.562.0 - ISC
286
- *
287
- * This source code is licensed under the ISC license.
288
- * See the LICENSE file in the root directory of this source tree.
289
- */const lI=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],cI=Ue("git-branch",lI);/**
290
- * @license lucide-react v0.562.0 - ISC
291
- *
292
- * This source code is licensed under the ISC license.
293
- * See the LICENSE file in the root directory of this source tree.
294
- */const uI=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],dI=Ue("info",uI);/**
295
- * @license lucide-react v0.562.0 - ISC
296
- *
297
- * This source code is licensed under the ISC license.
298
- * See the LICENSE file in the root directory of this source tree.
299
- */const hI=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],fI=Ue("list-checks",hI);/**
300
- * @license lucide-react v0.562.0 - ISC
301
- *
302
- * This source code is licensed under the ISC license.
303
- * See the LICENSE file in the root directory of this source tree.
304
- */const mI=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],mm=Ue("list-todo",mI);/**
305
- * @license lucide-react v0.562.0 - ISC
306
- *
307
- * This source code is licensed under the ISC license.
308
- * See the LICENSE file in the root directory of this source tree.
309
- */const pI=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],oi=Ue("loader-circle",pI);/**
310
- * @license lucide-react v0.562.0 - ISC
311
- *
312
- * This source code is licensed under the ISC license.
313
- * See the LICENSE file in the root directory of this source tree.
314
- */const gI=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],Tk=Ue("lock-open",gI);/**
315
- * @license lucide-react v0.562.0 - ISC
316
- *
317
- * This source code is licensed under the ISC license.
318
- * See the LICENSE file in the root directory of this source tree.
319
- */const vI=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],Nk=Ue("map",vI);/**
320
- * @license lucide-react v0.562.0 - ISC
321
- *
322
- * This source code is licensed under the ISC license.
323
- * See the LICENSE file in the root directory of this source tree.
324
- */const _I=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],CN=Ue("menu",_I);/**
325
- * @license lucide-react v0.562.0 - ISC
326
- *
327
- * This source code is licensed under the ISC license.
328
- * See the LICENSE file in the root directory of this source tree.
329
- */const bI=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],kN=Ue("message-circle-question-mark",bI);/**
330
- * @license lucide-react v0.562.0 - ISC
331
- *
332
- * This source code is licensed under the ISC license.
333
- * See the LICENSE file in the root directory of this source tree.
334
- */const yI=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],xI=Ue("message-square-quote",yI);/**
335
- * @license lucide-react v0.562.0 - ISC
336
- *
337
- * This source code is licensed under the ISC license.
338
- * See the LICENSE file in the root directory of this source tree.
339
- */const wI=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],EN=Ue("minimize",wI);/**
340
- * @license lucide-react v0.562.0 - ISC
341
- *
342
- * This source code is licensed under the ISC license.
343
- * See the LICENSE file in the root directory of this source tree.
344
- */const SI=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],RN=Ue("monitor",SI);/**
345
- * @license lucide-react v0.562.0 - ISC
346
- *
347
- * This source code is licensed under the ISC license.
348
- * See the LICENSE file in the root directory of this source tree.
349
- */const CI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],kb=Ue("panel-left",CI);/**
350
- * @license lucide-react v0.562.0 - ISC
351
- *
352
- * This source code is licensed under the ISC license.
353
- * See the LICENSE file in the root directory of this source tree.
354
- */const kI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],EI=Ue("panel-right",kI);/**
355
- * @license lucide-react v0.562.0 - ISC
356
- *
357
- * This source code is licensed under the ISC license.
358
- * See the LICENSE file in the root directory of this source tree.
359
- */const RI=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],TI=Ue("paperclip",RI);/**
360
- * @license lucide-react v0.562.0 - ISC
361
- *
362
- * This source code is licensed under the ISC license.
363
- * See the LICENSE file in the root directory of this source tree.
364
- */const NI=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],pm=Ue("pencil",NI);/**
365
- * @license lucide-react v0.562.0 - ISC
366
- *
367
- * This source code is licensed under the ISC license.
368
- * See the LICENSE file in the root directory of this source tree.
369
- */const MI=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],_0=Ue("plus",MI);/**
370
- * @license lucide-react v0.562.0 - ISC
371
- *
372
- * This source code is licensed under the ISC license.
373
- * See the LICENSE file in the root directory of this source tree.
374
- */const AI=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],b0=Ue("refresh-cw",AI);/**
375
- * @license lucide-react v0.562.0 - ISC
376
- *
377
- * This source code is licensed under the ISC license.
378
- * See the LICENSE file in the root directory of this source tree.
379
- */const DI=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],f_=Ue("search",DI);/**
380
- * @license lucide-react v0.562.0 - ISC
381
- *
382
- * This source code is licensed under the ISC license.
383
- * See the LICENSE file in the root directory of this source tree.
384
- */const jI=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],OI=Ue("send",jI);/**
385
- * @license lucide-react v0.562.0 - ISC
386
- *
387
- * This source code is licensed under the ISC license.
388
- * See the LICENSE file in the root directory of this source tree.
389
- */const LI=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],zI=Ue("settings",LI);/**
390
- * @license lucide-react v0.562.0 - ISC
391
- *
392
- * This source code is licensed under the ISC license.
393
- * See the LICENSE file in the root directory of this source tree.
394
- */const PI=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],BI=Ue("settings-2",PI);/**
395
- * @license lucide-react v0.562.0 - ISC
396
- *
397
- * This source code is licensed under the ISC license.
398
- * See the LICENSE file in the root directory of this source tree.
399
- */const II=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],HI=Ue("slash",II);/**
400
- * @license lucide-react v0.562.0 - ISC
401
- *
402
- * This source code is licensed under the ISC license.
403
- * See the LICENSE file in the root directory of this source tree.
404
- */const FI=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Tn=Ue("sparkles",FI);/**
405
- * @license lucide-react v0.562.0 - ISC
406
- *
407
- * This source code is licensed under the ISC license.
408
- * See the LICENSE file in the root directory of this source tree.
409
- */const UI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 8h10",key:"1jw688"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h10",key:"wp8him"}]],Mk=Ue("square-menu",UI);/**
410
- * @license lucide-react v0.562.0 - ISC
411
- *
412
- * This source code is licensed under the ISC license.
413
- * See the LICENSE file in the root directory of this source tree.
414
- */const $I=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]],Ak=Ue("square-minus",$I);/**
415
- * @license lucide-react v0.562.0 - ISC
416
- *
417
- * This source code is licensed under the ISC license.
418
- * See the LICENSE file in the root directory of this source tree.
419
- */const WI=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],TN=Ue("square-pen",WI);/**
420
- * @license lucide-react v0.562.0 - ISC
421
- *
422
- * This source code is licensed under the ISC license.
423
- * See the LICENSE file in the root directory of this source tree.
424
- */const VI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],qI=Ue("square-x",VI);/**
425
- * @license lucide-react v0.562.0 - ISC
426
- *
427
- * This source code is licensed under the ISC license.
428
- * See the LICENSE file in the root directory of this source tree.
429
- */const KI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],GI=Ue("square",KI);/**
430
- * @license lucide-react v0.562.0 - ISC
431
- *
432
- * This source code is licensed under the ISC license.
433
- * See the LICENSE file in the root directory of this source tree.
434
- */const YI=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],y0=Ue("terminal",YI);/**
435
- * @license lucide-react v0.562.0 - ISC
436
- *
437
- * This source code is licensed under the ISC license.
438
- * See the LICENSE file in the root directory of this source tree.
439
- */const XI=[["rect",{width:"18",height:"12",x:"3",y:"8",rx:"1",key:"158fvp"}],["path",{d:"M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3",key:"s0042v"}],["path",{d:"M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3",key:"9wmeh2"}]],ZI=Ue("toy-brick",XI);/**
440
- * @license lucide-react v0.562.0 - ISC
441
- *
442
- * This source code is licensed under the ISC license.
443
- * See the LICENSE file in the root directory of this source tree.
444
- */const QI=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],id=Ue("trash-2",QI);/**
445
- * @license lucide-react v0.562.0 - ISC
446
- *
447
- * This source code is licensed under the ISC license.
448
- * See the LICENSE file in the root directory of this source tree.
449
- */const JI=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],x0=Ue("user-round",JI);/**
450
- * @license lucide-react v0.562.0 - ISC
451
- *
452
- * This source code is licensed under the ISC license.
453
- * See the LICENSE file in the root directory of this source tree.
454
- */const e8=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xo=Ue("x",e8);/**
455
- * @license lucide-react v0.562.0 - ISC
456
- *
457
- * This source code is licensed under the ISC license.
458
- * See the LICENSE file in the root directory of this source tree.
459
- */const t8=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ls=Ue("zap",t8),sd="data-focus-fallback-ignore",NN="data-allow-focus-retain",gm="kaizen:restore-chat-input-focus",w0="data-chat-input",vm="data-chat-selection-zone";function ja(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function Eb(e){var n;const t=e;return t!=null&&t.matches?t.matches("input:not([type='checkbox']):not([type='radio']):not([type='button']):not([type='submit']):not([type='reset']), textarea, select")||t.isContentEditable||((n=t.getAttribute)==null?void 0:n.call(t,"role"))==="textbox"?!0:ja(e,NN):!1}function n8(e){const t=e;return t!=null&&t.matches?Eb(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:ja(e,NN):!1}function Dk(e){return!!e.querySelector(`[${sd}][data-state='open']`)}function r8(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function i8(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${w0}]`)).filter(l=>!l.disabled);if(n.length===0)return!1;const r=n.indexOf(e),s=r>=0?(r+1)%n.length:0,a=n[s];return a?(a.focus({preventScroll:!0}),!0):!1}function jk(e){const{activeElement:t,fallback:n,hasActiveOverlay:r}=e;if(!n||n.disabled||r||t===n)return"none";if(e.trigger==="escape")return e.defaultPrevented||ja(t,w0)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:s,pointerEndTarget:a,root:l,hasActiveSelection:u}=e,h=a??s;return!l||!h||!l.contains(h)||ja(h,sd)||ja(t,sd)||Eb(h)||u&&(ja(s,vm)||ja(h,vm))||Eb(t)?"none":t&&t===h?"restore":n8(t)?"none":"restore"}const ip=t6,s8=n6,MN=_.forwardRef(({className:e,...t},n)=>f.jsx(gN,{ref:n,className:me("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));MN.displayName=gN.displayName;const o8={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},kd=_.forwardRef(({className:e,children:t,size:n="md",...r},s)=>f.jsxs(s8,{children:[f.jsx(MN,{}),f.jsxs(vN,{ref:s,[sd]:"",onCloseAutoFocus:a=>{var l;a.preventDefault(),window.dispatchEvent(new Event(gm)),(l=r.onCloseAutoFocus)==null||l.call(r,a)},className:me("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl backdrop-blur-md duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","max-h-[85vh] flex flex-col",o8[n],e),...r,children:[t,f.jsxs(s6,{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-accent data-[state=open]:text-muted-foreground",children:[f.jsx(Xo,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));kd.displayName=vN.displayName;function sp({className:e,...t}){return f.jsx(r6,{className:me("text-lg font-medium leading-none tracking-tight",e),...t})}function S0({className:e,...t}){return f.jsx(i6,{className:me("text-sm text-muted-foreground",e),...t})}function op({className:e,...t}){return f.jsx("div",{className:me("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function ap({className:e,...t}){return f.jsx("div",{className:me("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}const Si=_.forwardRef(({className:e,type:t,...n},r)=>f.jsx("input",{ref:r,type:t,className:me("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n}));Si.displayName="Input";const AN=_.createContext(null);function a8({children:e}){const[t,n]=_.useState(null),[r,s]=_.useState(""),a=_.useRef(null);_.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(s(t.options.initialValue??""),setTimeout(()=>{var y,w;(y=a.current)==null||y.focus(),(w=a.current)==null||w.select()},0))},[t]);const l=_.useCallback(()=>{n(null),s("")},[]),u=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.kind==="prompt"?t.resolve(null):t.resolve(),l())},[l,t]),h=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!0):t.kind==="prompt"?t.resolve(r.trim()||null):t.resolve(),l())},[l,t,r]),d=_.useCallback(y=>new Promise(w=>{n({kind:"confirm",options:y,resolve:w})}),[]),g=_.useCallback(y=>new Promise(w=>{n({kind:"prompt",options:y,resolve:w})}),[]),p=_.useCallback(y=>new Promise(w=>{n({kind:"alert",options:y,resolve:w})}),[]),v=_.useMemo(()=>({confirm:d,prompt:g,alert:p}),[p,d,g]);return f.jsxs(AN.Provider,{value:v,children:[e,f.jsx(ip,{open:t!==null,onOpenChange:y=>{y||!t||u()},children:f.jsx(kd,{size:"sm",onKeyDown:y=>{y.key!=="Enter"||y.shiftKey||!t||t.kind!=="confirm"||(y.preventDefault(),h())},children:t?f.jsxs(f.Fragment,{children:[f.jsxs(op,{className:"space-y-4",children:[f.jsx(sp,{children:t.options.title}),t.options.description?f.jsx(S0,{children:t.options.description}):null,t.kind==="prompt"?f.jsx(Si,{ref:a,type:"text",value:r,onChange:y=>s(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),h())},placeholder:t.options.placeholder}):null]}),f.jsxs(ap,{children:[f.jsx(tt,{variant:"ghost",size:"sm",onClick:u,className:t.kind==="alert"?"hidden":void 0,children:"cancelLabel"in t.options?t.options.cancelLabel??"Cancel":"Cancel"}),f.jsx(tt,{variant:t.kind==="confirm"?t.options.confirmVariant??"default":"secondary",size:"sm",onClick:h,disabled:t.kind==="prompt"&&!r.trim(),children:t.kind==="alert"?t.options.closeLabel??"OK":"confirmLabel"in t.options?t.options.confirmLabel??"Confirm":"Confirm"})]})]}):null})})]})}function l8(){const e=_.useContext(AN);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const lp=_.forwardRef(({className:e,...t},n)=>f.jsx("textarea",{"data-gramm":"false","data-gramm_editor":"false","data-enable-grammarly":"false","data-1p-ignore":!0,autoComplete:"off",className:me("flex w-full rounded-lg border border-border bg-background px-2.5 py-2 text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));lp.displayName="Textarea";function c8(e){return e.trim().length>0}function u8({open:e,onOpenChange:t,onConfirm:n}){const[r,s]=_.useState(""),[a,l]=_.useState(""),u=_.useRef(null);_.useEffect(()=>{e&&(s(""),l(""),setTimeout(()=>{var g;return(g=u.current)==null?void 0:g.focus()},0))},[e]);const h=c8(r),d=()=>{h&&n({title:r.trim(),description:a.trim()})};return f.jsx(ip,{open:e,onOpenChange:t,children:f.jsx(kd,{size:"sm",onKeyDown:g=>{(g.metaKey||g.ctrlKey)&&g.key==="Enter"&&(g.preventDefault(),d())},children:f.jsxs("form",{onSubmit:g=>{g.preventDefault(),d()},children:[f.jsxs(op,{className:"space-y-4",children:[f.jsx(sp,{children:"Create Feature"}),f.jsx(S0,{children:"Name the feature folder and optionally add a short description for the initial `overview.md`."}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("label",{htmlFor:"feature-title",className:"text-sm font-medium",children:"Feature name"}),f.jsx(Si,{id:"feature-title",ref:u,type:"text",value:r,onChange:g=>s(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),d())},placeholder:"Feature name"})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("label",{htmlFor:"feature-description",className:"text-sm font-medium",children:["Description ",f.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),f.jsx(lp,{id:"feature-description",value:a,onChange:g=>l(g.target.value),rows:5,placeholder:"Leave blank to add it later"})]})]}),f.jsxs(ap,{children:[f.jsx(tt,{type:"button",variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),f.jsx(tt,{type:"submit",variant:"secondary",size:"sm",disabled:!h,children:"Create"})]})]})})})}const Ok=`1. Sign in on the opened Cursor spending page.
460
- 2. Open DevTools > Network.
461
- 3. Refresh the page.
462
- 4. Right-click the get-current-period-usage request.
463
- 5. Copy > Copy as cURL.
464
- 6. Paste it here.`;function d8({open:e,onOpenChange:t,onSubmit:n}){const r=_.useRef(null),[s,a]=_.useState(""),[l,u]=_.useState(!1);_.useEffect(()=>{e&&(a(""),setTimeout(()=>{var p;return(p=r.current)==null?void 0:p.focus()},0))},[e]);async function h(){const p=await navigator.clipboard.readText();a(p)}async function d(){await navigator.clipboard.writeText(Ok),u(!0),setTimeout(()=>u(!1),2e3)}const g=s.trim().length>0;return f.jsx(ip,{open:e,onOpenChange:t,children:f.jsx(kd,{size:"lg",children:f.jsxs("form",{onSubmit:p=>{p.preventDefault(),g&&n(s.trim())},children:[f.jsxs(op,{className:"space-y-4",children:[f.jsx(sp,{children:"Import Cursor Session"}),f.jsxs(S0,{children:["Paste the copied ",f.jsx("code",{children:"get-current-period-usage"})," curl command and Kaizen will import the session for you."]}),f.jsx("div",{className:"rounded-xl border border-border bg-card px-3 py-3 text-sm text-muted-foreground whitespace-pre-line",children:Ok}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(tt,{type:"button",variant:"ghost",size:"sm",onClick:()=>void h(),children:"Paste Clipboard"}),f.jsxs(tt,{type:"button",variant:"ghost",size:"sm",onClick:()=>void d(),children:[l?f.jsx(Wi,{className:"h-4 w-4"}):f.jsx(Cd,{className:"h-4 w-4"}),f.jsx("span",{className:"ml-1",children:l?"Copied":"Copy Steps"})]})]}),f.jsx(lp,{ref:r,value:s,onChange:p=>a(p.target.value),rows:10,placeholder:"Paste the copied curl command here",className:"font-mono text-xs"})]}),f.jsxs(ap,{children:[f.jsx(tt,{type:"button",variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),f.jsx(tt,{type:"submit",variant:"secondary",size:"sm",disabled:!g,children:"Import Session"})]})]})})})}const h8=["top","right","bottom","left"],Zo=Math.min,ri=Math.max,_m=Math.round,yf=Math.floor,gs=e=>({x:e,y:e}),f8={left:"right",right:"left",bottom:"top",top:"bottom"};function Rb(e,t,n){return ri(e,Zo(t,n))}function Xs(e,t){return typeof e=="function"?e(t):e}function Zs(e){return e.split("-")[0]}function xc(e){return e.split("-")[1]}function C0(e){return e==="x"?"y":"x"}function k0(e){return e==="y"?"height":"width"}function us(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function E0(e){return C0(us(e))}function m8(e,t,n){n===void 0&&(n=!1);const r=xc(e),s=E0(e),a=k0(s);let l=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(l=bm(l)),[l,bm(l)]}function p8(e){const t=bm(e);return[Tb(e),t,Tb(t)]}function Tb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Lk=["left","right"],zk=["right","left"],g8=["top","bottom"],v8=["bottom","top"];function _8(e,t,n){switch(e){case"top":case"bottom":return n?t?zk:Lk:t?Lk:zk;case"left":case"right":return t?g8:v8;default:return[]}}function b8(e,t,n,r){const s=xc(e);let a=_8(Zs(e),n==="start",r);return s&&(a=a.map(l=>l+"-"+s),t&&(a=a.concat(a.map(Tb)))),a}function bm(e){const t=Zs(e);return f8[t]+e.slice(t.length)}function y8(e){return{top:0,right:0,bottom:0,left:0,...e}}function DN(e){return typeof e!="number"?y8(e):{top:e,right:e,bottom:e,left:e}}function ym(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function Pk(e,t,n){let{reference:r,floating:s}=e;const a=us(t),l=E0(t),u=k0(l),h=Zs(t),d=a==="y",g=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,v=r[u]/2-s[u]/2;let y;switch(h){case"top":y={x:g,y:r.y-s.height};break;case"bottom":y={x:g,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:p};break;case"left":y={x:r.x-s.width,y:p};break;default:y={x:r.x,y:r.y}}switch(xc(t)){case"start":y[l]-=v*(n&&d?-1:1);break;case"end":y[l]+=v*(n&&d?-1:1);break}return y}async function x8(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:a,rects:l,elements:u,strategy:h}=e,{boundary:d="clippingAncestors",rootBoundary:g="viewport",elementContext:p="floating",altBoundary:v=!1,padding:y=0}=Xs(t,e),w=DN(y),C=u[v?p==="floating"?"reference":"floating":p],k=ym(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(C)))==null||n?C:C.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(u.floating)),boundary:d,rootBoundary:g,strategy:h})),R=p==="floating"?{x:r,y:s,width:l.floating.width,height:l.floating.height}:l.reference,E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u.floating)),N=await(a.isElement==null?void 0:a.isElement(E))?await(a.getScale==null?void 0:a.getScale(E))||{x:1,y:1}:{x:1,y:1},j=ym(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:R,offsetParent:E,strategy:h}):R);return{top:(k.top-j.top+w.top)/N.y,bottom:(j.bottom-k.bottom+w.bottom)/N.y,left:(k.left-j.left+w.left)/N.x,right:(j.right-k.right+w.right)/N.x}}const w8=50,S8=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:a=[],platform:l}=n,u=l.detectOverflow?l:{...l,detectOverflow:x8},h=await(l.isRTL==null?void 0:l.isRTL(t));let d=await l.getElementRects({reference:e,floating:t,strategy:s}),{x:g,y:p}=Pk(d,r,h),v=r,y=0;const w={};for(let S=0;S<a.length;S++){const C=a[S];if(!C)continue;const{name:k,fn:R}=C,{x:E,y:N,data:j,reset:D}=await R({x:g,y:p,initialPlacement:r,placement:v,strategy:s,middlewareData:w,rects:d,platform:u,elements:{reference:e,floating:t}});g=E??g,p=N??p,w[k]={...w[k],...j},D&&y<w8&&(y++,typeof D=="object"&&(D.placement&&(v=D.placement),D.rects&&(d=D.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:s}):D.rects),{x:g,y:p}=Pk(d,v,h)),S=-1)}return{x:g,y:p,placement:v,strategy:s,middlewareData:w}},C8=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:a,platform:l,elements:u,middlewareData:h}=t,{element:d,padding:g=0}=Xs(e,t)||{};if(d==null)return{};const p=DN(g),v={x:n,y:r},y=E0(s),w=k0(y),S=await l.getDimensions(d),C=y==="y",k=C?"top":"left",R=C?"bottom":"right",E=C?"clientHeight":"clientWidth",N=a.reference[w]+a.reference[y]-v[y]-a.floating[w],j=v[y]-a.reference[y],D=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d));let L=D?D[E]:0;(!L||!await(l.isElement==null?void 0:l.isElement(D)))&&(L=u.floating[E]||a.floating[w]);const U=N/2-j/2,Y=L/2-S[w]/2-1,P=Zo(p[k],Y),V=Zo(p[R],Y),I=P,W=L-S[w]-V,K=L/2-S[w]/2+U,q=Rb(I,K,W),O=!h.arrow&&xc(s)!=null&&K!==q&&a.reference[w]/2-(K<I?P:V)-S[w]/2<0,F=O?K<I?K-I:K-W:0;return{[y]:v[y]+F,data:{[y]:q,centerOffset:K-q-F,...O&&{alignmentOffset:F}},reset:O}}}),k8=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:a,rects:l,initialPlacement:u,platform:h,elements:d}=t,{mainAxis:g=!0,crossAxis:p=!0,fallbackPlacements:v,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:S=!0,...C}=Xs(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const k=Zs(s),R=us(u),E=Zs(u)===u,N=await(h.isRTL==null?void 0:h.isRTL(d.floating)),j=v||(E||!S?[bm(u)]:p8(u)),D=w!=="none";!v&&D&&j.push(...b8(u,S,w,N));const L=[u,...j],U=await h.detectOverflow(t,C),Y=[];let P=((r=a.flip)==null?void 0:r.overflows)||[];if(g&&Y.push(U[k]),p){const K=m8(s,l,N);Y.push(U[K[0]],U[K[1]])}if(P=[...P,{placement:s,overflows:Y}],!Y.every(K=>K<=0)){var V,I;const K=(((V=a.flip)==null?void 0:V.index)||0)+1,q=L[K];if(q&&(!(p==="alignment"?R!==us(q):!1)||P.every(H=>us(H.placement)===R?H.overflows[0]>0:!0)))return{data:{index:K,overflows:P},reset:{placement:q}};let O=(I=P.filter(F=>F.overflows[0]<=0).sort((F,H)=>F.overflows[1]-H.overflows[1])[0])==null?void 0:I.placement;if(!O)switch(y){case"bestFit":{var W;const F=(W=P.filter(H=>{if(D){const $=us(H.placement);return $===R||$==="y"}return!0}).map(H=>[H.placement,H.overflows.filter($=>$>0).reduce(($,M)=>$+M,0)]).sort((H,$)=>H[1]-$[1])[0])==null?void 0:W[0];F&&(O=F);break}case"initialPlacement":O=u;break}if(s!==O)return{reset:{placement:O}}}return{}}}};function Bk(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ik(e){return h8.some(t=>e[t]>=0)}const E8=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...a}=Xs(e,t);switch(s){case"referenceHidden":{const l=await r.detectOverflow(t,{...a,elementContext:"reference"}),u=Bk(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Ik(u)}}}case"escaped":{const l=await r.detectOverflow(t,{...a,altBoundary:!0}),u=Bk(l,n.floating);return{data:{escapedOffsets:u,escaped:Ik(u)}}}default:return{}}}}},jN=new Set(["left","top"]);async function R8(e,t){const{placement:n,platform:r,elements:s}=e,a=await(r.isRTL==null?void 0:r.isRTL(s.floating)),l=Zs(n),u=xc(n),h=us(n)==="y",d=jN.has(l)?-1:1,g=a&&h?-1:1,p=Xs(t,e);let{mainAxis:v,crossAxis:y,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof w=="number"&&(y=u==="end"?w*-1:w),h?{x:y*g,y:v*d}:{x:v*d,y:y*g}}const T8=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:a,placement:l,middlewareData:u}=t,h=await R8(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+h.x,y:a+h.y,data:{...h,placement:l}}}}},N8=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:a}=t,{mainAxis:l=!0,crossAxis:u=!1,limiter:h={fn:k=>{let{x:R,y:E}=k;return{x:R,y:E}}},...d}=Xs(e,t),g={x:n,y:r},p=await a.detectOverflow(t,d),v=us(Zs(s)),y=C0(v);let w=g[y],S=g[v];if(l){const k=y==="y"?"top":"left",R=y==="y"?"bottom":"right",E=w+p[k],N=w-p[R];w=Rb(E,w,N)}if(u){const k=v==="y"?"top":"left",R=v==="y"?"bottom":"right",E=S+p[k],N=S-p[R];S=Rb(E,S,N)}const C=h.fn({...t,[y]:w,[v]:S});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[y]:l,[v]:u}}}}}},M8=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:a,middlewareData:l}=t,{offset:u=0,mainAxis:h=!0,crossAxis:d=!0}=Xs(e,t),g={x:n,y:r},p=us(s),v=C0(p);let y=g[v],w=g[p];const S=Xs(u,t),C=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const E=v==="y"?"height":"width",N=a.reference[v]-a.floating[E]+C.mainAxis,j=a.reference[v]+a.reference[E]-C.mainAxis;y<N?y=N:y>j&&(y=j)}if(d){var k,R;const E=v==="y"?"width":"height",N=jN.has(Zs(s)),j=a.reference[p]-a.floating[E]+(N&&((k=l.offset)==null?void 0:k[p])||0)+(N?0:C.crossAxis),D=a.reference[p]+a.reference[E]+(N?0:((R=l.offset)==null?void 0:R[p])||0)-(N?C.crossAxis:0);w<j?w=j:w>D&&(w=D)}return{[v]:y,[p]:w}}}},A8=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:a,platform:l,elements:u}=t,{apply:h=()=>{},...d}=Xs(e,t),g=await l.detectOverflow(t,d),p=Zs(s),v=xc(s),y=us(s)==="y",{width:w,height:S}=a.floating;let C,k;p==="top"||p==="bottom"?(C=p,k=v===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(k=p,C=v==="end"?"top":"bottom");const R=S-g.top-g.bottom,E=w-g.left-g.right,N=Zo(S-g[C],R),j=Zo(w-g[k],E),D=!t.middlewareData.shift;let L=N,U=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(U=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=R),D&&!v){const P=ri(g.left,0),V=ri(g.right,0),I=ri(g.top,0),W=ri(g.bottom,0);y?U=w-2*(P!==0||V!==0?P+V:ri(g.left,g.right)):L=S-2*(I!==0||W!==0?I+W:ri(g.top,g.bottom))}await h({...t,availableWidth:U,availableHeight:L});const Y=await l.getDimensions(u.floating);return w!==Y.width||S!==Y.height?{reset:{rects:!0}}:{}}}};function cp(){return typeof window<"u"}function wc(e){return ON(e)?(e.nodeName||"").toLowerCase():"#document"}function ii(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ys(e){var t;return(t=(ON(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ON(e){return cp()?e instanceof Node||e instanceof ii(e).Node:!1}function Vi(e){return cp()?e instanceof Element||e instanceof ii(e).Element:!1}function to(e){return cp()?e instanceof HTMLElement||e instanceof ii(e).HTMLElement:!1}function Hk(e){return!cp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ii(e).ShadowRoot}function Ed(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=qi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function D8(e){return/^(table|td|th)$/.test(wc(e))}function up(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const j8=/transform|translate|scale|rotate|perspective|filter/,O8=/paint|layout|strict|content/,Ca=e=>!!e&&e!=="none";let m_;function R0(e){const t=Vi(e)?qi(e):e;return Ca(t.transform)||Ca(t.translate)||Ca(t.scale)||Ca(t.rotate)||Ca(t.perspective)||!T0()&&(Ca(t.backdropFilter)||Ca(t.filter))||j8.test(t.willChange||"")||O8.test(t.contain||"")}function L8(e){let t=Qo(e);for(;to(t)&&!cc(t);){if(R0(t))return t;if(up(t))return null;t=Qo(t)}return null}function T0(){return m_==null&&(m_=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),m_}function cc(e){return/^(html|body|#document)$/.test(wc(e))}function qi(e){return ii(e).getComputedStyle(e)}function dp(e){return Vi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qo(e){if(wc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Hk(e)&&e.host||ys(e);return Hk(t)?t.host:t}function LN(e){const t=Qo(e);return cc(t)?e.ownerDocument?e.ownerDocument.body:e.body:to(t)&&Ed(t)?t:LN(t)}function od(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=LN(e),a=s===((r=e.ownerDocument)==null?void 0:r.body),l=ii(s);if(a){const u=Nb(l);return t.concat(l,l.visualViewport||[],Ed(s)?s:[],u&&n?od(u):[])}else return t.concat(s,od(s,[],n))}function Nb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function zN(e){const t=qi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=to(e),a=s?e.offsetWidth:n,l=s?e.offsetHeight:r,u=_m(n)!==a||_m(r)!==l;return u&&(n=a,r=l),{width:n,height:r,$:u}}function N0(e){return Vi(e)?e:e.contextElement}function rc(e){const t=N0(e);if(!to(t))return gs(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:a}=zN(t);let l=(a?_m(n.width):n.width)/r,u=(a?_m(n.height):n.height)/s;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const z8=gs(0);function PN(e){const t=ii(e);return!T0()||!t.visualViewport?z8:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function P8(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ii(e)?!1:t}function $a(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),a=N0(e);let l=gs(1);t&&(r?Vi(r)&&(l=rc(r)):l=rc(e));const u=P8(a,n,r)?PN(a):gs(0);let h=(s.left+u.x)/l.x,d=(s.top+u.y)/l.y,g=s.width/l.x,p=s.height/l.y;if(a){const v=ii(a),y=r&&Vi(r)?ii(r):r;let w=v,S=Nb(w);for(;S&&r&&y!==w;){const C=rc(S),k=S.getBoundingClientRect(),R=qi(S),E=k.left+(S.clientLeft+parseFloat(R.paddingLeft))*C.x,N=k.top+(S.clientTop+parseFloat(R.paddingTop))*C.y;h*=C.x,d*=C.y,g*=C.x,p*=C.y,h+=E,d+=N,w=ii(S),S=Nb(w)}}return ym({width:g,height:p,x:h,y:d})}function hp(e,t){const n=dp(e).scrollLeft;return t?t.left+n:$a(ys(e)).left+n}function BN(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-hp(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function B8(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const a=s==="fixed",l=ys(r),u=t?up(t.floating):!1;if(r===l||u&&a)return n;let h={scrollLeft:0,scrollTop:0},d=gs(1);const g=gs(0),p=to(r);if((p||!p&&!a)&&((wc(r)!=="body"||Ed(l))&&(h=dp(r)),p)){const y=$a(r);d=rc(r),g.x=y.x+r.clientLeft,g.y=y.y+r.clientTop}const v=l&&!p&&!a?BN(l,h):gs(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-h.scrollLeft*d.x+g.x+v.x,y:n.y*d.y-h.scrollTop*d.y+g.y+v.y}}function I8(e){return Array.from(e.getClientRects())}function H8(e){const t=ys(e),n=dp(e),r=e.ownerDocument.body,s=ri(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=ri(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+hp(e);const u=-n.scrollTop;return qi(r).direction==="rtl"&&(l+=ri(t.clientWidth,r.clientWidth)-s),{width:s,height:a,x:l,y:u}}const Fk=25;function F8(e,t){const n=ii(e),r=ys(e),s=n.visualViewport;let a=r.clientWidth,l=r.clientHeight,u=0,h=0;if(s){a=s.width,l=s.height;const g=T0();(!g||g&&t==="fixed")&&(u=s.offsetLeft,h=s.offsetTop)}const d=hp(r);if(d<=0){const g=r.ownerDocument,p=g.body,v=getComputedStyle(p),y=g.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,w=Math.abs(r.clientWidth-p.clientWidth-y);w<=Fk&&(a-=w)}else d<=Fk&&(a+=d);return{width:a,height:l,x:u,y:h}}function U8(e,t){const n=$a(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,a=to(e)?rc(e):gs(1),l=e.clientWidth*a.x,u=e.clientHeight*a.y,h=s*a.x,d=r*a.y;return{width:l,height:u,x:h,y:d}}function Uk(e,t,n){let r;if(t==="viewport")r=F8(e,n);else if(t==="document")r=H8(ys(e));else if(Vi(t))r=U8(t,n);else{const s=PN(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return ym(r)}function IN(e,t){const n=Qo(e);return n===t||!Vi(n)||cc(n)?!1:qi(n).position==="fixed"||IN(n,t)}function $8(e,t){const n=t.get(e);if(n)return n;let r=od(e,[],!1).filter(u=>Vi(u)&&wc(u)!=="body"),s=null;const a=qi(e).position==="fixed";let l=a?Qo(e):e;for(;Vi(l)&&!cc(l);){const u=qi(l),h=R0(l);!h&&u.position==="fixed"&&(s=null),(a?!h&&!s:!h&&u.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Ed(l)&&!h&&IN(e,l))?r=r.filter(g=>g!==l):s=u,l=Qo(l)}return t.set(e,r),r}function W8(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const l=[...n==="clippingAncestors"?up(t)?[]:$8(t,this._c):[].concat(n),r],u=Uk(t,l[0],s);let h=u.top,d=u.right,g=u.bottom,p=u.left;for(let v=1;v<l.length;v++){const y=Uk(t,l[v],s);h=ri(y.top,h),d=Zo(y.right,d),g=Zo(y.bottom,g),p=ri(y.left,p)}return{width:d-p,height:g-h,x:p,y:h}}function V8(e){const{width:t,height:n}=zN(e);return{width:t,height:n}}function q8(e,t,n){const r=to(t),s=ys(t),a=n==="fixed",l=$a(e,!0,a,t);let u={scrollLeft:0,scrollTop:0};const h=gs(0);function d(){h.x=hp(s)}if(r||!r&&!a)if((wc(t)!=="body"||Ed(s))&&(u=dp(t)),r){const y=$a(t,!0,a,t);h.x=y.x+t.clientLeft,h.y=y.y+t.clientTop}else s&&d();a&&!r&&s&&d();const g=s&&!r&&!a?BN(s,u):gs(0),p=l.left+u.scrollLeft-h.x-g.x,v=l.top+u.scrollTop-h.y-g.y;return{x:p,y:v,width:l.width,height:l.height}}function p_(e){return qi(e).position==="static"}function $k(e,t){if(!to(e)||qi(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ys(e)===n&&(n=n.ownerDocument.body),n}function HN(e,t){const n=ii(e);if(up(e))return n;if(!to(e)){let s=Qo(e);for(;s&&!cc(s);){if(Vi(s)&&!p_(s))return s;s=Qo(s)}return n}let r=$k(e,t);for(;r&&D8(r)&&p_(r);)r=$k(r,t);return r&&cc(r)&&p_(r)&&!R0(r)?n:r||L8(e)||n}const K8=async function(e){const t=this.getOffsetParent||HN,n=this.getDimensions,r=await n(e.floating);return{reference:q8(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function G8(e){return qi(e).direction==="rtl"}const Y8={convertOffsetParentRelativeRectToViewportRelativeRect:B8,getDocumentElement:ys,getClippingRect:W8,getOffsetParent:HN,getElementRects:K8,getClientRects:I8,getDimensions:V8,getScale:rc,isElement:Vi,isRTL:G8};function FN(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function X8(e,t){let n=null,r;const s=ys(e);function a(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,h){u===void 0&&(u=!1),h===void 0&&(h=1),a();const d=e.getBoundingClientRect(),{left:g,top:p,width:v,height:y}=d;if(u||t(),!v||!y)return;const w=yf(p),S=yf(s.clientWidth-(g+v)),C=yf(s.clientHeight-(p+y)),k=yf(g),E={rootMargin:-w+"px "+-S+"px "+-C+"px "+-k+"px",threshold:ri(0,Zo(1,h))||1};let N=!0;function j(D){const L=D[0].intersectionRatio;if(L!==h){if(!N)return l();L?l(!1,L):r=setTimeout(()=>{l(!1,1e-7)},1e3)}L===1&&!FN(d,e.getBoundingClientRect())&&l(),N=!1}try{n=new IntersectionObserver(j,{...E,root:s.ownerDocument})}catch{n=new IntersectionObserver(j,E)}n.observe(e)}return l(!0),a}function Z8(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,d=N0(e),g=s||a?[...d?od(d):[],...t?od(t):[]]:[];g.forEach(k=>{s&&k.addEventListener("scroll",n,{passive:!0}),a&&k.addEventListener("resize",n)});const p=d&&u?X8(d,n):null;let v=-1,y=null;l&&(y=new ResizeObserver(k=>{let[R]=k;R&&R.target===d&&y&&t&&(y.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var E;(E=y)==null||E.observe(t)})),n()}),d&&!h&&y.observe(d),t&&y.observe(t));let w,S=h?$a(e):null;h&&C();function C(){const k=$a(e);S&&!FN(S,k)&&n(),S=k,w=requestAnimationFrame(C)}return n(),()=>{var k;g.forEach(R=>{s&&R.removeEventListener("scroll",n),a&&R.removeEventListener("resize",n)}),p==null||p(),(k=y)==null||k.disconnect(),y=null,h&&cancelAnimationFrame(w)}}const Q8=T8,J8=N8,e9=k8,t9=A8,n9=E8,Wk=C8,r9=M8,i9=(e,t,n)=>{const r=new Map,s={platform:Y8,...n},a={...s.platform,_c:r};return S8(e,t,{...s,platform:a})};var s9=typeof document<"u",o9=function(){},Xf=s9?_.useLayoutEffect:o9;function xm(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,s;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(!xm(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(!(a==="_owner"&&e.$$typeof)&&!xm(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function UN(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Vk(e,t){const n=UN(e);return Math.round(t*n)/n}function g_(e){const t=_.useRef(e);return Xf(()=>{t.current=e}),t}function a9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:a,floating:l}={},transform:u=!0,whileElementsMounted:h,open:d}=e,[g,p]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,y]=_.useState(r);xm(v,r)||y(r);const[w,S]=_.useState(null),[C,k]=_.useState(null),R=_.useCallback(H=>{H!==D.current&&(D.current=H,S(H))},[]),E=_.useCallback(H=>{H!==L.current&&(L.current=H,k(H))},[]),N=a||w,j=l||C,D=_.useRef(null),L=_.useRef(null),U=_.useRef(g),Y=h!=null,P=g_(h),V=g_(s),I=g_(d),W=_.useCallback(()=>{if(!D.current||!L.current)return;const H={placement:t,strategy:n,middleware:v};V.current&&(H.platform=V.current),i9(D.current,L.current,H).then($=>{const M={...$,isPositioned:I.current!==!1};K.current&&!xm(U.current,M)&&(U.current=M,Hi.flushSync(()=>{p(M)}))})},[v,t,n,V,I]);Xf(()=>{d===!1&&U.current.isPositioned&&(U.current.isPositioned=!1,p(H=>({...H,isPositioned:!1})))},[d]);const K=_.useRef(!1);Xf(()=>(K.current=!0,()=>{K.current=!1}),[]),Xf(()=>{if(N&&(D.current=N),j&&(L.current=j),N&&j){if(P.current)return P.current(N,j,W);W()}},[N,j,W,P,Y]);const q=_.useMemo(()=>({reference:D,floating:L,setReference:R,setFloating:E}),[R,E]),O=_.useMemo(()=>({reference:N,floating:j}),[N,j]),F=_.useMemo(()=>{const H={position:n,left:0,top:0};if(!O.floating)return H;const $=Vk(O.floating,g.x),M=Vk(O.floating,g.y);return u?{...H,transform:"translate("+$+"px, "+M+"px)",...UN(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:M}},[n,u,O.floating,g.x,g.y]);return _.useMemo(()=>({...g,update:W,refs:q,elements:O,floatingStyles:F}),[g,W,q,O,F])}const l9=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Wk({element:r.current,padding:s}).fn(n):{}:r?Wk({element:r,padding:s}).fn(n):{}}}},c9=(e,t)=>{const n=Q8(e);return{name:n.name,fn:n.fn,options:[e,t]}},u9=(e,t)=>{const n=J8(e);return{name:n.name,fn:n.fn,options:[e,t]}},d9=(e,t)=>({fn:r9(e).fn,options:[e,t]}),h9=(e,t)=>{const n=e9(e);return{name:n.name,fn:n.fn,options:[e,t]}},f9=(e,t)=>{const n=t9(e);return{name:n.name,fn:n.fn,options:[e,t]}},m9=(e,t)=>{const n=n9(e);return{name:n.name,fn:n.fn,options:[e,t]}},p9=(e,t)=>{const n=l9(e);return{name:n.name,fn:n.fn,options:[e,t]}};var g9="Arrow",$N=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...a}=e;return f.jsx(Tt.svg,{...a,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});$N.displayName=g9;var v9=$N;function _9(e){const[t,n]=_.useState(void 0);return br(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let l,u;if("borderBoxSize"in a){const h=a.borderBoxSize,d=Array.isArray(h)?h[0]:h;l=d.inlineSize,u=d.blockSize}else l=e.offsetWidth,u=e.offsetHeight;n({width:l,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var M0="Popper",[WN,ea]=eo(M0),[b9,VN]=WN(M0),qN=e=>{const{__scopePopper:t,children:n}=e,[r,s]=_.useState(null);return f.jsx(b9,{scope:t,anchor:r,onAnchorChange:s,children:n})};qN.displayName=M0;var KN="PopperAnchor",GN=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,a=VN(KN,n),l=_.useRef(null),u=Ut(t,l),h=_.useRef(null);return _.useEffect(()=>{const d=h.current;h.current=(r==null?void 0:r.current)||l.current,d!==h.current&&a.onAnchorChange(h.current)}),r?null:f.jsx(Tt.div,{...s,ref:u})});GN.displayName=KN;var A0="PopperContent",[y9,x9]=WN(A0),YN=_.forwardRef((e,t)=>{var te,le,pe,xe,Me,Re;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:a="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:h=!0,collisionBoundary:d=[],collisionPadding:g=0,sticky:p="partial",hideWhenDetached:v=!1,updatePositionStrategy:y="optimized",onPlaced:w,...S}=e,C=VN(A0,n),[k,R]=_.useState(null),E=Ut(t,je=>R(je)),[N,j]=_.useState(null),D=_9(N),L=(D==null?void 0:D.width)??0,U=(D==null?void 0:D.height)??0,Y=r+(a!=="center"?"-"+a:""),P=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},V=Array.isArray(d)?d:[d],I=V.length>0,W={padding:P,boundary:V.filter(S9),altBoundary:I},{refs:K,floatingStyles:q,placement:O,isPositioned:F,middlewareData:H}=a9({strategy:"fixed",placement:Y,whileElementsMounted:(...je)=>Z8(...je,{animationFrame:y==="always"}),elements:{reference:C.anchor},middleware:[c9({mainAxis:s+U,alignmentAxis:l}),h&&u9({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?d9():void 0,...W}),h&&h9({...W}),f9({...W,apply:({elements:je,rects:Xe,availableWidth:ft,availableHeight:pt})=>{const{width:he,height:Le}=Xe.reference,Ae=je.floating.style;Ae.setProperty("--radix-popper-available-width",`${ft}px`),Ae.setProperty("--radix-popper-available-height",`${pt}px`),Ae.setProperty("--radix-popper-anchor-width",`${he}px`),Ae.setProperty("--radix-popper-anchor-height",`${Le}px`)}}),N&&p9({element:N,padding:u}),C9({arrowWidth:L,arrowHeight:U}),v&&m9({strategy:"referenceHidden",...W})]}),[$,M]=QN(O),B=$i(w);br(()=>{F&&(B==null||B())},[F,B]);const X=(te=H.arrow)==null?void 0:te.x,A=(le=H.arrow)==null?void 0:le.y,re=((pe=H.arrow)==null?void 0:pe.centerOffset)!==0,[se,Z]=_.useState();return br(()=>{k&&Z(window.getComputedStyle(k).zIndex)},[k]),f.jsx("div",{ref:K.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:F?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[(xe=H.transformOrigin)==null?void 0:xe.x,(Me=H.transformOrigin)==null?void 0:Me.y].join(" "),...((Re=H.hide)==null?void 0:Re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(y9,{scope:n,placedSide:$,onArrowChange:j,arrowX:X,arrowY:A,shouldHideArrow:re,children:f.jsx(Tt.div,{"data-side":$,"data-align":M,...S,ref:E,style:{...S.style,animation:F?void 0:"none"}})})})});YN.displayName=A0;var XN="PopperArrow",w9={top:"bottom",right:"left",bottom:"top",left:"right"},ZN=_.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,a=x9(XN,r),l=w9[a.placedSide];return f.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:f.jsx(v9,{...s,ref:n,style:{...s.style,display:"block"}})})});ZN.displayName=XN;function S9(e){return e!==null}var C9=e=>({name:"transformOrigin",options:e,fn(t){var C,k,R;const{placement:n,rects:r,middlewareData:s}=t,l=((C=s.arrow)==null?void 0:C.centerOffset)!==0,u=l?0:e.arrowWidth,h=l?0:e.arrowHeight,[d,g]=QN(n),p={start:"0%",center:"50%",end:"100%"}[g],v=(((k=s.arrow)==null?void 0:k.x)??0)+u/2,y=(((R=s.arrow)==null?void 0:R.y)??0)+h/2;let w="",S="";return d==="bottom"?(w=l?p:`${v}px`,S=`${-h}px`):d==="top"?(w=l?p:`${v}px`,S=`${r.floating.height+h}px`):d==="right"?(w=`${-h}px`,S=l?p:`${y}px`):d==="left"&&(w=`${r.floating.width+h}px`,S=l?p:`${y}px`),{data:{x:w,y:S}}}});function QN(e){const[t,n="center"]=e.split("-");return[t,n]}var fp=qN,Rd=GN,mp=YN,pp=ZN,JN=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"}),k9="VisuallyHidden",eM=_.forwardRef((e,t)=>f.jsx(Tt.span,{...e,ref:t,style:{...JN,...e.style}}));eM.displayName=k9;var E9=eM,[gp]=eo("Tooltip",[ea]),vp=ea(),tM="TooltipProvider",R9=700,Mb="tooltip.open",[T9,D0]=gp(tM),nM=e=>{const{__scopeTooltip:t,delayDuration:n=R9,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:a}=e,l=_.useRef(!0),u=_.useRef(!1),h=_.useRef(0);return _.useEffect(()=>{const d=h.current;return()=>window.clearTimeout(d)},[]),f.jsx(T9,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(h.current),l.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:_.useCallback(d=>{u.current=d},[]),disableHoverableContent:s,children:a})};nM.displayName=tM;var ad="Tooltip",[N9,Td]=gp(ad),rM=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:a,disableHoverableContent:l,delayDuration:u}=e,h=D0(ad,e.__scopeTooltip),d=vp(t),[g,p]=_.useState(null),v=Gs(),y=_.useRef(0),w=l??h.disableHoverableContent,S=u??h.delayDuration,C=_.useRef(!1),[k,R]=lc({prop:r,defaultProp:s??!1,onChange:L=>{L?(h.onOpen(),document.dispatchEvent(new CustomEvent(Mb))):h.onClose(),a==null||a(L)},caller:ad}),E=_.useMemo(()=>k?C.current?"delayed-open":"instant-open":"closed",[k]),N=_.useCallback(()=>{window.clearTimeout(y.current),y.current=0,C.current=!1,R(!0)},[R]),j=_.useCallback(()=>{window.clearTimeout(y.current),y.current=0,R(!1)},[R]),D=_.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{C.current=!0,R(!0),y.current=0},S)},[S,R]);return _.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),f.jsx(fp,{...d,children:f.jsx(N9,{scope:t,contentId:v,open:k,stateAttribute:E,trigger:g,onTriggerChange:p,onTriggerEnter:_.useCallback(()=>{h.isOpenDelayedRef.current?D():N()},[h.isOpenDelayedRef,D,N]),onTriggerLeave:_.useCallback(()=>{w?j():(window.clearTimeout(y.current),y.current=0)},[j,w]),onOpen:N,onClose:j,disableHoverableContent:w,children:n})})};rM.displayName=ad;var Ab="TooltipTrigger",iM=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Td(Ab,n),a=D0(Ab,n),l=vp(n),u=_.useRef(null),h=Ut(t,u,s.onTriggerChange),d=_.useRef(!1),g=_.useRef(!1),p=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),f.jsx(Rd,{asChild:!0,...l,children:f.jsx(Tt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:h,onPointerMove:Be(e.onPointerMove,v=>{v.pointerType!=="touch"&&!g.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),g.current=!0)}),onPointerLeave:Be(e.onPointerLeave,()=>{s.onTriggerLeave(),g.current=!1}),onPointerDown:Be(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Be(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:Be(e.onBlur,s.onClose),onClick:Be(e.onClick,s.onClose)})})});iM.displayName=Ab;var j0="TooltipPortal",[M9,A9]=gp(j0,{forceMount:void 0}),sM=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,a=Td(j0,t);return f.jsx(M9,{scope:t,forceMount:n,children:f.jsx(ji,{present:n||a.open,children:f.jsx(yc,{asChild:!0,container:s,children:r})})})};sM.displayName=j0;var uc="TooltipContent",oM=_.forwardRef((e,t)=>{const n=A9(uc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...a}=e,l=Td(uc,e.__scopeTooltip);return f.jsx(ji,{present:r||l.open,children:l.disableHoverableContent?f.jsx(aM,{side:s,...a,ref:t}):f.jsx(D9,{side:s,...a,ref:t})})}),D9=_.forwardRef((e,t)=>{const n=Td(uc,e.__scopeTooltip),r=D0(uc,e.__scopeTooltip),s=_.useRef(null),a=Ut(t,s),[l,u]=_.useState(null),{trigger:h,onClose:d}=n,g=s.current,{onPointerInTransitChange:p}=r,v=_.useCallback(()=>{u(null),p(!1)},[p]),y=_.useCallback((w,S)=>{const C=w.currentTarget,k={x:w.clientX,y:w.clientY},R=P9(k,C.getBoundingClientRect()),E=B9(k,R),N=I9(S.getBoundingClientRect()),j=F9([...E,...N]);u(j),p(!0)},[p]);return _.useEffect(()=>()=>v(),[v]),_.useEffect(()=>{if(h&&g){const w=C=>y(C,g),S=C=>y(C,h);return h.addEventListener("pointerleave",w),g.addEventListener("pointerleave",S),()=>{h.removeEventListener("pointerleave",w),g.removeEventListener("pointerleave",S)}}},[h,g,y,v]),_.useEffect(()=>{if(l){const w=S=>{const C=S.target,k={x:S.clientX,y:S.clientY},R=(h==null?void 0:h.contains(C))||(g==null?void 0:g.contains(C)),E=!H9(k,l);R?v():E&&(v(),d())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[h,g,l,d,v]),f.jsx(aM,{...e,ref:a})}),[j9,O9]=gp(ad,{isInside:!1}),L9=zP("TooltipContent"),aM=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:a,onPointerDownOutside:l,...u}=e,h=Td(uc,n),d=vp(n),{onClose:g}=h;return _.useEffect(()=>(document.addEventListener(Mb,g),()=>document.removeEventListener(Mb,g)),[g]),_.useEffect(()=>{if(h.trigger){const p=v=>{const y=v.target;y!=null&&y.contains(h.trigger)&&g()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[h.trigger,g]),f.jsx(bc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:g,children:f.jsxs(mp,{"data-state":h.stateAttribute,...d,...u,ref:t,style:{...u.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:[f.jsx(L9,{children:r}),f.jsx(j9,{scope:n,isInside:!0,children:f.jsx(E9,{id:h.contentId,role:"tooltip",children:s||r})})]})})});oM.displayName=uc;var lM="TooltipArrow",z9=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=vp(n);return O9(lM,n).isInside?null:f.jsx(pp,{...s,...r,ref:t})});z9.displayName=lM;function P9(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,s,a)){case a:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function B9(e,t,n=5){const 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 I9(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function H9(e,t){const{x:n,y:r}=e;let s=!1;for(let a=0,l=t.length-1;a<t.length;l=a++){const u=t[a],h=t[l],d=u.x,g=u.y,p=h.x,v=h.y;g>r!=v>r&&n<(p-d)*(r-g)/(v-g)+d&&(s=!s)}return s}function F9(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),U9(t)}function U9(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const a=t[t.length-1],l=t[t.length-2];if((a.x-l.x)*(s.y-l.y)>=(a.y-l.y)*(s.x-l.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const a=n[n.length-1],l=n[n.length-2];if((a.x-l.x)*(s.y-l.y)>=(a.y-l.y)*(s.x-l.x))n.pop();else break}n.push(s)}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 $9=nM,cM=rM,uM=iM,dM=sM,O0=oM;function W9({className:e,...t}){return f.jsx("kbd",{className:me("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center rounded border border-border/60 bg-muted/50 px-1.5 font-mono text-[11px] font-medium text-current select-none",e),...t})}function V9({className:e,...t}){return f.jsx("span",{className:me("inline-flex items-center gap-0.5",e),...t})}const q9="z-50 overflow-hidden rounded-md border border-border backdrop-blur-md p-0.5 text-[11px] font-medium text-card-foreground shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",K9=$9,ds=cM,hs=uM,Fi=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>f.jsx(dM,{children:f.jsx(O0,{ref:r,sideOffset:t,className:me("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border backdrop-blur-md px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Fi.displayName=O0.displayName;const Lu=cM,zu=uM;function hM(e){return e.toUpperCase()}function G9(e){const t=e.split("+");return f.jsx(V9,{children:t.map((n,r)=>f.jsx(W9,{children:hM(n)},`${n}-${r}`))})}const Zl=_.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...s},a)=>{const l=r===void 0?null:Array.isArray(r)?r[0]??null:r;return f.jsx(dM,{children:f.jsx(O0,{ref:a,sideOffset:t,className:me(q9,e),...s,children:l?G9(l):f.jsx("span",{children:typeof n=="string"?hM(n):n})})})});Zl.displayName="HotkeyTooltipContent";const Y9="0.2.1",X9={version:Y9},Pn="Kaizen",qk="kaizen",Z9=".kaizen",Q9=".kaizen-dev",v_=".kaizen",J9="KAIZEN_RUNTIME_PROFILE",L0=`kaizen/${X9.version}`,e7="[kaizen]",t7=`~/${Pn}`,_p="kaizen:";function bp(){var t;return(t=globalThis.process)==null?void 0:t.env}function n7(e=bp()){const t=e==null?void 0:e[J9];return(t==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function r7(e=bp()){return n7(e)==="dev"?Q9:Z9}function i7(e=bp()){return`~/${r7(e)}`}function s7(e=bp()){return`${i7(e)}/keybindings.json`}function xf(e){return e?`${qk} ${e}`:qk}const wm=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"max",label:"Max"}],Db=[{id:"minimal",label:"Minimal"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"XHigh"}],jb=[{id:"off",label:"Off"},{id:"standard",label:"Standard"},{id:"high",label:"High"}],Ob="claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]",fM=[{id:"composer-2[fast=true]",label:"Composer 2",supportsEffort:!1},{id:"composer-1.5[]",label:"Composer 1.5",supportsEffort:!1},{id:"gpt-5.3-codex[reasoning=medium,fast=false]",label:"Codex 5.3",supportsEffort:!1},{id:"gpt-5.4[reasoning=medium,context=272k,fast=false]",label:"GPT-5.4",supportsEffort:!1},{id:"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]",label:"Sonnet 4.6",supportsEffort:!1},{id:"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]",label:"Opus 4.6",supportsEffort:!1},{id:"claude-opus-4-5[thinking=true]",label:"Opus 4.5",supportsEffort:!1},{id:"gpt-5.2[reasoning=medium,fast=false]",label:"GPT-5.2",supportsEffort:!1},{id:"gemini-3.1-pro[]",label:"Gemini 3.1 Pro",supportsEffort:!1},{id:"gpt-5.4-mini[reasoning=medium]",label:"GPT-5.4 Mini",supportsEffort:!1},{id:"gpt-5.4-nano[reasoning=medium]",label:"GPT-5.4 Nano",supportsEffort:!1},{id:"claude-haiku-4-5[thinking=true]",label:"Haiku 4.5",supportsEffort:!1},{id:"gpt-5.3-codex-spark[reasoning=medium]",label:"Codex 5.3 Spark",supportsEffort:!1},{id:"grok-4-20[thinking=true]",label:"Grok 4.20",supportsEffort:!1},{id:"claude-sonnet-4-5[thinking=true,context=200k]",label:"Sonnet 4.5",supportsEffort:!1},{id:"gpt-5.2-codex[reasoning=medium,fast=false]",label:"Codex 5.2",supportsEffort:!1},{id:"gemini-3-flash[]",label:"Gemini 3 Flash",supportsEffort:!1},{id:"claude-sonnet-4[thinking=false,context=200k]",label:"Sonnet 4",supportsEffort:!1},{id:"kimi-k2.5[]",label:"Kimi K2.5",supportsEffort:!1}],o7={"composer-2-fast":"composer-2[fast=true]","composer-1.5":"composer-1.5[]","gpt-5.3-codex":"gpt-5.3-codex[reasoning=medium,fast=false]","gpt-5.4":"gpt-5.4[reasoning=medium,context=272k,fast=false]","gpt-5.4-medium":"gpt-5.4[reasoning=medium,context=272k,fast=false]","claude-4.6-sonnet-medium-thinking":"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]","claude-4.6-opus-high-thinking":"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]","claude-4.5-opus-high-thinking":"claude-opus-4-5[thinking=true]","gpt-5.2":"gpt-5.2[reasoning=medium,fast=false]","gemini-3.1-pro":"gemini-3.1-pro[]","gpt-5.4-mini":"gpt-5.4-mini[reasoning=medium]","gpt-5.4-mini-medium":"gpt-5.4-mini[reasoning=medium]","gpt-5.4-nano":"gpt-5.4-nano[reasoning=medium]","gpt-5.4-nano-medium":"gpt-5.4-nano[reasoning=medium]","claude-haiku-4.5":"claude-haiku-4-5[thinking=true]","gpt-5.3-codex-spark-preview":"gpt-5.3-codex-spark[reasoning=medium]","grok-4-20":"grok-4-20[thinking=true]","grok-4-20-thinking":"grok-4-20[thinking=true]","claude-4.5-sonnet-thinking":"claude-sonnet-4-5[thinking=true,context=200k]","gpt-5.2-codex":"gpt-5.2-codex[reasoning=medium,fast=false]","gemini-3-flash":"gemini-3-flash[]","claude-4-sonnet":"claude-sonnet-4[thinking=false,context=200k]","kimi-k2.5":"kimi-k2.5[]"};function a7(e){return e?fM.some(t=>t.id===e)?e:o7[e]??Ob:Ob}function Kk(e){const t=e.indexOf("[");return t>=0?e.slice(0,t):e}function Yl(e){const t=e.match(/\bfast=(true|false)\b/);return t?t[1]==="true"?"fast":"standard":null}function Gk(e){return wm.some(t=>t.id===e)}function Yk(e){return Db.some(t=>t.id===e)}const Lb=[{id:"200k",label:"200k"},{id:"1m",label:"1M"}];function l7(e){return jb.some(t=>t.id===e)}const qo=[{id:"claude",label:"Claude",systemActive:!0,defaultModel:"sonnet",defaultEffort:"high",defaultModelOptions:{reasoningEffort:"high",contextWindow:"200k"},supportsPlanMode:!0,models:[{id:"opus",label:"Opus",supportsEffort:!0,contextWindowOptions:[...Lb]},{id:"sonnet",label:"Sonnet",supportsEffort:!0,contextWindowOptions:[...Lb]},{id:"haiku",label:"Haiku",supportsEffort:!0}],efforts:[...wm]},{id:"codex",label:"Codex",systemActive:!0,defaultModel:"gpt-5.4",defaultModelOptions:{reasoningEffort:"high",fastMode:!1},supportsPlanMode:!0,models:[{id:"gpt-5.4",label:"GPT-5.4",supportsEffort:!1},{id:"gpt-5.3-codex",label:"GPT-5.3 Codex",supportsEffort:!1},{id:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark",supportsEffort:!1}],efforts:[]},{id:"gemini",label:"Gemini",systemActive:!1,defaultModel:"auto-gemini-2.5",defaultModelOptions:{thinkingMode:"standard"},supportsPlanMode:!0,models:[{id:"auto-gemini-3",label:"Auto (Gemini 3)",supportsEffort:!1},{id:"auto-gemini-2.5",label:"Auto (Gemini 2.5)",supportsEffort:!1},{id:"gemini-3.1-pro-preview",label:"3.1 Pro Preview",supportsEffort:!1},{id:"gemini-3-pro-preview",label:"3 Pro Preview",supportsEffort:!1},{id:"gemini-3-flash-preview",label:"3 Flash Preview",supportsEffort:!1},{id:"gemini-2.5-pro",label:"2.5 Pro",supportsEffort:!1},{id:"gemini-2.5-flash",label:"2.5 Flash",supportsEffort:!1},{id:"gemini-2.5-flash-lite",label:"2.5 Flash Lite",supportsEffort:!1}],efforts:[]},{id:"cursor",label:"Cursor",systemActive:!0,defaultModel:Ob,defaultModelOptions:{},supportsPlanMode:!0,models:[...fM],efforts:[]}],Wn={claude:{active:!0},codex:{active:!0},gemini:{active:!0},cursor:{active:!0}};function Jt(e){const t=qo.find(n=>n.id===e);if(!t)throw new Error(`Unknown provider: ${e}`);return t}function z0(e,t){const n=Wn[t],r=e==null?void 0:e[t];return{active:(r==null?void 0:r.active)??n.active}}function c7(e,t){const n=Jt(e),r=z0(t,e);return n.systemActive&&r.active?null:`Provider ${n.label} is currently not active.`}function Xk(e,t){const n=Jt(e),r=z0(t,e);return n.systemActive&&r.active}function u7(e){return qo.map(t=>{const n=z0(e,t.id),r=t.systemActive&&n.active;return{...t,active:n.active,isSelectable:r,isUsageEnabled:r,isInactive:!r,inactiveMessage:c7(t.id,e)}})}function P0(e){return u7(e).filter(t=>t.isSelectable).map(({active:t,isSelectable:n,isUsageEnabled:r,isInactive:s,inactiveMessage:a,...l})=>l)}function Ri(e){return Jt(e).defaultModelOptions}const mM=Ri("claude");Ri("codex");Ri("gemini");Ri("cursor");function d7(e){return Jt("claude").models.find(t=>t.id===e)}function h7(e){var t;return((t=d7(e))==null?void 0:t.contextWindowOptions)??[]}function f7(e,t){const n=h7(e);if(n.length!==0)return n.some(r=>r.id===t)?t:mM.contextWindow}const m7=["idea","todo","progress","testing","done"],Zk={idea:"IDEA",todo:"TODO",progress:"PROGRESS",testing:"TESTING",done:"DONE"},os={submitChatMessage:["enter"],toggleProjectsSidebar:["ctrl+a"],toggleEmbeddedTerminal:["cmd+j","ctrl+`"],toggleRightSidebar:["cmd+b","ctrl+b"],openInFinder:["cmd+alt+f","ctrl+alt+f"],openInEditor:["cmd+shift+o","ctrl+shift+o"],addSplitTerminal:["cmd+/","ctrl+/"]},Qk=8,p7=10*1024*1024,Jk=["image/png","image/jpeg","image/webp","image/gif"],g7="/assets/icon-4rSnra9R.svg";function Sm({alt:e="",className:t,...n}){return f.jsx("img",{alt:e,src:g7,className:me("shrink-0 object-contain",t),...n})}var yp="Popover",[pM]=eo(yp,[ea]),Nd=ea(),[v7,ta]=pM(yp),gM=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:l=!1}=e,u=Nd(t),h=_.useRef(null),[d,g]=_.useState(!1),[p,v]=lc({prop:r,defaultProp:s??!1,onChange:a,caller:yp});return f.jsx(fp,{...u,children:f.jsx(v7,{scope:t,contentId:Gs(),triggerRef:h,open:p,onOpenChange:v,onOpenToggle:_.useCallback(()=>v(y=>!y),[v]),hasCustomAnchor:d,onCustomAnchorAdd:_.useCallback(()=>g(!0),[]),onCustomAnchorRemove:_.useCallback(()=>g(!1),[]),modal:l,children:n})})};gM.displayName=yp;var vM="PopoverAnchor",_M=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ta(vM,n),a=Nd(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:u}=s;return _.useEffect(()=>(l(),()=>u()),[l,u]),f.jsx(Rd,{...a,...r,ref:t})});_M.displayName=vM;var bM="PopoverTrigger",yM=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ta(bM,n),a=Nd(n),l=Ut(t,s.triggerRef),u=f.jsx(Tt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":kM(s.open),...r,ref:l,onClick:Be(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?u:f.jsx(Rd,{asChild:!0,...a,children:u})});yM.displayName=bM;var B0="PopoverPortal",[_7,b7]=pM(B0,{forceMount:void 0}),xM=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,a=ta(B0,t);return f.jsx(_7,{scope:t,forceMount:n,children:f.jsx(ji,{present:n||a.open,children:f.jsx(yc,{asChild:!0,container:s,children:r})})})};xM.displayName=B0;var dc="PopoverContent",wM=_.forwardRef((e,t)=>{const n=b7(dc,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,a=ta(dc,e.__scopePopover);return f.jsx(ji,{present:r||a.open,children:a.modal?f.jsx(x7,{...s,ref:t}):f.jsx(w7,{...s,ref:t})})});wM.displayName=dc;var y7=Fa("PopoverContent.RemoveScroll"),x7=_.forwardRef((e,t)=>{const n=ta(dc,e.__scopePopover),r=_.useRef(null),s=Ut(t,r),a=_.useRef(!1);return _.useEffect(()=>{const l=r.current;if(l)return tp(l)},[]),f.jsx(Sd,{as:y7,allowPinchZoom:!0,children:f.jsx(SM,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Be(e.onCloseAutoFocus,l=>{var u;l.preventDefault(),a.current||(u=n.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Be(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,h=u.button===0&&u.ctrlKey===!0,d=u.button===2||h;a.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:Be(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),w7=_.forwardRef((e,t)=>{const n=ta(dc,e.__scopePopover),r=_.useRef(!1),s=_.useRef(!1);return f.jsx(SM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,a),a.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{var h,d;(h=e.onInteractOutside)==null||h.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=a.target;((d=n.triggerRef.current)==null?void 0:d.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),SM=_.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:d,onInteractOutside:g,...p}=e,v=ta(dc,n),y=Nd(n);return Jm(),f.jsx(wd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:f.jsx(bc,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:g,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:d,onDismiss:()=>v.onOpenChange(!1),children:f.jsx(mp,{"data-state":kM(v.open),role:"dialog",id:v.contentId,...y,...p,ref:t,style:{...p.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)"}})})})}),CM="PopoverClose",S7=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ta(CM,n);return f.jsx(Tt.button,{type:"button",...r,ref:t,onClick:Be(e.onClick,()=>s.onOpenChange(!1))})});S7.displayName=CM;var C7="PopoverArrow",k7=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Nd(n);return f.jsx(pp,{...s,...r,ref:t})});k7.displayName=C7;function kM(e){return e?"open":"closed"}var EM=gM,E7=_M,R7=yM,RM=xM,I0=wM;const TM=EM,NM=R7,H0=_.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>f.jsx(RM,{children:f.jsx(I0,{ref:s,align:t,sideOffset:n,[sd]:"",onCloseAutoFocus:a=>{var l;a.preventDefault(),window.dispatchEvent(new Event(gm)),(l=r.onCloseAutoFocus)==null||l.call(r,a)},className:me("z-50 w-72 rounded-xl border border-border bg-background p-4 shadow-lg backdrop-blur-md outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));H0.displayName=I0.displayName;function T7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:me("shrink-0",e),...t,children:f.jsx("path",{d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})})}function N7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 158.7128 157.296",fill:"currentColor","aria-hidden":"true",className:me("shrink-0",e),...t,children:f.jsx("path",{d:"M60.8734 57.2556V42.3124c0-1.2586.4722-2.2029 1.5728-2.8314l30.0443-17.3023c4.0899-2.3593 8.9662-3.4599 13.9988-3.4599 18.8759 0 30.8307 14.6289 30.8307 30.2006 0 1.1007 0 2.3593-.158 3.6178l-31.1446-18.2467c-1.8872-1.1006-3.7754-1.1006-5.6629 0L60.8734 57.2556Zm70.1542 58.2005V79.7487c0-2.2028-.9446-3.7756-2.8318-4.8763l-39.481-22.9651 12.8982-7.3934c1.1007-.6285 2.0453-.6285 3.1458 0l30.0441 17.3024c8.6523 5.0341 14.4708 15.7296 14.4708 26.1107 0 11.9539-7.0769 22.965-18.2461 27.527ZM51.593 83.9964l-12.8982-7.5497c-1.1007-.6285-1.5728-1.5728-1.5728-2.8314V39.0105c0-16.8303 12.8982-29.5722 30.3585-29.5722 6.607 0 12.7403 2.2029 17.9324 6.1349l-30.987 17.9324c-1.8871 1.1007-2.8314 2.6735-2.8314 4.8764v45.6159ZM79.3562 100.0403 60.8733 89.6592V67.6383l18.4829-10.3811 18.4812 10.3811v22.0209l-18.4812 10.3811Zm11.8757 47.8188c-6.607 0-12.7403-2.2031-17.9324-6.1344l30.9866-17.9333c1.8872-1.1005 2.8318-2.6728 2.8318-4.8759v-45.616l13.0564 7.5498c1.1005.6285 1.5723 1.5728 1.5723 2.8314v34.6051c0 16.8297-13.0564 29.5723-30.5147 29.5723ZM53.9522 112.7822 23.9079 95.4798c-8.652-5.0343-14.471-15.7296-14.471-26.1107 0-12.1119 7.2356-22.9652 18.403-27.5272v35.8634c0 2.2028.9443 3.7756 2.8314 4.8763l39.3248 22.8068-12.8982 7.3938c-1.1007.6287-2.045.6287-3.1456 0ZM52.2229 138.5791c-17.7745 0-30.8306-13.3713-30.8306-29.8871 0-1.2585.1578-2.5169.3143-3.7754l30.987 17.9323c1.8871 1.1005 3.7757 1.1005 5.6628 0l39.4811-22.807v14.9435c0 1.2585-.4721 2.2021-1.5728 2.8308l-30.0443 17.3025c-4.0898 2.359-8.9662 3.4605-13.9989 3.4605h.0014ZM91.2319 157.296c19.0327 0 34.9188-13.5272 38.5383-31.4594 17.6164-4.562 28.9425-21.0779 28.9425-37.908 0-11.0112-4.719-21.7066-13.2133-29.4143.7867-3.3035 1.2595-6.607 1.2595-9.909 0-22.4929-18.2471-39.3247-39.3251-39.3247-4.2461 0-8.3363.6285-12.4262 2.045-7.0792-6.9213-16.8318-11.3254-27.5271-11.3254-19.0331 0-34.9191 13.5268-38.5384 31.4591C11.3255 36.0212 0 52.5373 0 69.3675c0 11.0112 4.7184 21.7065 13.2125 29.4142-.7865 3.3035-1.2586 6.6067-1.2586 9.9092 0 22.4923 18.2466 39.3241 39.3248 39.3241 4.2462 0 8.3362-.6277 12.426-2.0441 7.0776 6.921 16.8302 11.3251 27.5271 11.3251Z"})})}function M7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:me("shrink-0",e),...t,children:f.jsx("path",{d:"M12 0C12 0 12 8 8 12C4 16 0 12 0 12C0 12 4 12 8 12C12 12 12 16 12 24C12 24 12 16 16 12C20 8 24 12 24 12C24 12 16 12 16 12C12 12 12 4 12 0Z"})})}function A7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:me("shrink-0",e),...t,children:f.jsx("path",{d:"M12 0 2.4 5.5v13L12 24l9.6-5.5v-13Zm0 3.1 6.8 3.9v5.1L15 14.3V9.7L12 8l-3 1.7v4.6l-3.8-2.2V7Zm-6.8 9.8 3.8 2.2v4.5l3 1.8 3-1.8v-4.5l3.8-2.2v3.8L12 20.9l-6.8-3.9Z"})})}function D7(e){return!(e.startsWith("gemini-3")||e==="auto-gemini-3")}const j7=["Composer","GPT","Claude","Gemini","Grok","Kimi"];function O7(e){return e.startsWith("composer-")?"Composer":e.startsWith("gpt-")?"GPT":e.startsWith("claude-")?"Claude":e.startsWith("gemini-")?"Gemini":e.startsWith("grok-")?"Grok":"Kimi"}function __(e,t){const n=Yl(t);return!n||n==="standard"?e:`${e} (${n==="fast"?"Fast":"Standard"})`}const Cm={claude:T7,codex:N7,gemini:M7,cursor:A7},wf={auto:Tn,opus:ti,sonnet:Tn,haiku:ls,"gpt-5.4":ti,"gpt-5.4[reasoning=medium,context=272k,fast=false]":ti,"gpt-5.4-mini[reasoning=medium]":Tn,"gpt-5.4-nano[reasoning=medium]":ls,"gpt-5.3-codex":Tn,"gpt-5.3-codex[reasoning=medium,fast=false]":Tn,"gpt-5.3-codex-spark[reasoning=medium]":ls,"gpt-5.2[reasoning=medium,fast=false]":Tn,"gpt-5.2-codex[reasoning=medium,fast=false]":Tn,"gpt-5.3-codex-spark":ls,"gemini-2.5-pro":ti,"gemini-2.5-flash":Tn,"gemini-2.5-flash-lite":ls,"auto-gemini-3":ti,"auto-gemini-2.5":Tn,"gemini-3.1-pro-preview":ti,"gemini-3.1-pro[]":ti,"gemini-3-flash[]":Tn,"gemini-3-pro-preview":ti,"gemini-3-flash-preview":Tn,"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]":ti,"claude-opus-4-5[thinking=true]":ti,"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]":Tn,"claude-sonnet-4-5[thinking=true,context=200k]":Tn,"claude-sonnet-4[thinking=false,context=200k]":Tn,"claude-haiku-4-5[thinking=true]":ls,"grok-4-20[thinking=true]":ti,"kimi-k2.5[]":Tn,"composer-2[fast=true]":ti,"composer-1.5[]":Tn};function Ir({onClick:e,selected:t,icon:n,label:r,description:s,disabled:a}){return f.jsxs("button",{onClick:e,disabled:a,className:me("w-full flex items-center gap-2 p-2 border border-border/0 rounded-lg text-left transition-opacity",t?"bg-muted border-border":"hover:opacity-60",a&&"opacity-40 cursor-not-allowed"),children:[n,f.jsxs("div",{children:[f.jsx("div",{className:"text-sm font-medium",children:r}),s?f.jsx("div",{className:"text-xs text-muted-foreground",children:s}):null]})]})}function zo({trigger:e,triggerClassName:t,disabled:n=!1,children:r}){const[s,a]=_.useState(!1);return n?f.jsx("button",{disabled:!0,className:me("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md text-muted-foreground [&>svg]:shrink-0 opacity-70 cursor-default",t),children:e}):f.jsxs(TM,{open:s,onOpenChange:a,children:[f.jsx(NM,{asChild:!0,children:f.jsx("button",{className:me("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md transition-colors text-muted-foreground [&>svg]:shrink-0","hover:bg-muted/50",t),children:e})}),f.jsx(H0,{align:"center",className:"w-64 p-1",children:f.jsx("div",{className:"max-h-[min(24rem,60vh)] space-y-1 overflow-y-auto pr-1",children:typeof r=="function"?r(()=>a(!1)):r})})]})}function Pu({availableProviders:e,selectedProvider:t,disabled:n=!1,showProviderPicker:r=!0,providerLocked:s=!1,model:a,modelOptions:l,onProviderChange:u,onModelChange:h,onClaudeReasoningEffortChange:d,onClaudeContextWindowChange:g,onCodexReasoningEffortChange:p,onGeminiThinkingModeChange:v,onCodexFastModeChange:y,planMode:w=!1,onPlanModeChange:S,includePlanMode:C=!0,className:k}){var $,M,B,X,A,re,se;const[R,E]=_.useState(null),N=e.find(Z=>Z.id===t)??Jt(t),j=Cm[t],D=wf[a]??Tn,L=C&&(N==null?void 0:N.supportsPlanMode)&&S,U=t==="claude"?l:null,Y=t==="codex"?l:null,P=t==="gemini"?l:null,V=(($=N.models.find(Z=>Z.id===a))==null?void 0:$.contextWindowOptions)??[],I=(U==null?void 0:U.contextWindow)??Lb[0].id,W=I==="1m"?Mk:Ak,K=t==="claude"||t==="codex",q=t==="cursor"?Yl(a):null,O=N.id==="cursor"?N.models.filter(Z=>Kk(Z.id)===Kk(a)):[],F=t==="cursor"&&O.some(Z=>Yl(Z.id)==="fast")&&O.some(Z=>Yl(Z.id)==="standard"),H=N.id==="cursor"?j7.map(Z=>({family:Z,models:N.models.filter(te=>O7(te.id)===Z)})).filter(Z=>Z.models.length>0):[];return _.useEffect(()=>{E(null)},[t]),f.jsx("div",{className:me("max-w-full overflow-x-auto scrollbar-hide",n&&"pointer-events-none opacity-60",k),children:f.jsxs("div",{className:"flex w-max items-center justify-center gap-0.5 mx-auto",children:[r?f.jsx(zo,{disabled:s||!u,trigger:f.jsxs(f.Fragment,{children:[f.jsx(j,{className:"h-3.5 w-3.5"}),f.jsx("span",{className:"hidden md:inline",children:(N==null?void 0:N.label)??t})]}),children:Z=>e.map(te=>{const le=Cm[te.id];return f.jsx(Ir,{onClick:()=>{u==null||u(te.id),Z()},selected:t===te.id,icon:f.jsx(le,{className:"h-4 w-4 text-muted-foreground"}),label:te.label},te.id)})}):null,f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(D,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:N.id==="cursor"?__(((M=N.models.find(Z=>Z.id===a))==null?void 0:M.label)??a,a):((B=N.models.find(Z=>Z.id===a))==null?void 0:B.label)??a})]}),children:Z=>{var te;return N.id==="cursor"?R?f.jsxs(f.Fragment,{children:[f.jsxs("button",{onClick:()=>E(null),className:"flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm text-muted-foreground transition-opacity hover:opacity-70",children:[f.jsx(bN,{className:"h-4 w-4"}),f.jsx("span",{children:R})]}),(te=H.find(le=>le.family===R))==null?void 0:te.models.map(le=>{const pe=wf[le.id]??Tn;return f.jsx(Ir,{onClick:()=>{h(t,le.id),E(null),Z()},selected:a===le.id,icon:f.jsx(pe,{className:"h-4 w-4 text-muted-foreground"}),label:__(le.label,le.id)},le.id)})]}):H.map(le=>{var Me;const pe=le.models.some(Re=>Re.id===a),xe=wf[((Me=le.models[0])==null?void 0:Me.id)??""]??Tn;return f.jsxs("div",{className:"relative",children:[f.jsx(Ir,{onClick:()=>E(le.family),selected:pe,icon:f.jsx(xe,{className:"h-4 w-4 text-muted-foreground"}),label:le.family,description:`${le.models.length} model${le.models.length===1?"":"s"}`}),f.jsx(Tr,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"})]},le.family)}):N.models.map(le=>{const pe=wf[le.id]??Tn;return f.jsx(Ir,{onClick:()=>{h(t,le.id),Z()},selected:a===le.id,icon:f.jsx(pe,{className:"h-4 w-4 text-muted-foreground"}),label:N.id==="cursor"?__(le.label,le.id):le.label},le.id)})}}),F?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[q==="fast"?f.jsx(ls,{className:"h-3.5 w-3.5"}):f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:q==="fast"?"Fast":"Standard"})]}),triggerClassName:q==="fast"?"text-emerald-500 dark:text-emerald-400":void 0,children:Z=>f.jsxs(f.Fragment,{children:[O.filter(te=>Yl(te.id)==="standard").map(te=>f.jsx(Ir,{onClick:()=>{h(t,te.id),Z()},selected:a===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"},te.id)),O.filter(te=>Yl(te.id)==="fast").map(te=>f.jsx(Ir,{onClick:()=>{h(t,te.id),Z()},selected:a===te.id,icon:f.jsx(ls,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast"},te.id))]})}):null,K?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:t==="claude"?((X=wm.find(Z=>Z.id===l.reasoningEffort))==null?void 0:X.label)??l.reasoningEffort:((A=Db.find(Z=>Z.id===l.reasoningEffort))==null?void 0:A.label)??l.reasoningEffort})]}),children:Z=>t==="claude"?wm.map(te=>f.jsx(Ir,{onClick:()=>{d(te.id),Z()},selected:l.reasoningEffort===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:te.label,disabled:te.id==="max"&&a!=="opus"},te.id)):Db.map(te=>f.jsx(Ir,{onClick:()=>{p(te.id),Z()},selected:l.reasoningEffort===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:te.label},te.id))}):null,t==="claude"&&V.length>1?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(W,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:((re=V.find(Z=>Z.id===I))==null?void 0:re.label)??I})]}),children:Z=>V.map(te=>f.jsx(Ir,{onClick:()=>{g(te.id),Z()},selected:I===te.id,icon:te.id==="1m"?f.jsx(Mk,{className:"h-4 w-4 text-muted-foreground"}):f.jsx(Ak,{className:"h-4 w-4 text-muted-foreground"}),label:te.label,description:te.id==="1m"?"Expanded context window":"Standard context window"},te.id))}):null,t==="gemini"?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:((se=jb.find(Z=>Z.id===(P==null?void 0:P.thinkingMode)))==null?void 0:se.label)??(P==null?void 0:P.thinkingMode)??"Standard"})]}),children:Z=>jb.map(te=>f.jsx(Ir,{onClick:()=>{v(te.id),Z()},selected:(P==null?void 0:P.thinkingMode)===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:te.label,disabled:te.id==="off"&&!D7(a)},te.id))}):null,t==="codex"?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[Y!=null&&Y.fastMode?f.jsx(ls,{className:"h-3.5 w-3.5"}):f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:Y!=null&&Y.fastMode?"Fast Mode":"Standard"})]}),triggerClassName:Y!=null&&Y.fastMode?"text-emerald-500 dark:text-emerald-400":void 0,children:Z=>f.jsxs(f.Fragment,{children:[f.jsx(Ir,{onClick:()=>{y(!1),Z()},selected:!(Y!=null&&Y.fastMode),icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"}),f.jsx(Ir,{onClick:()=>{y(!0),Z()},selected:!!(Y!=null&&Y.fastMode),icon:f.jsx(ls,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast Mode"})]})}):null,L?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[w?f.jsx(mm,{className:"h-3.5 w-3.5"}):f.jsx(Tk,{className:"h-3.5 w-3.5"}),f.jsx("span",{className:"hidden md:inline",children:w?"Plan":"Implement"}),f.jsx("span",{className:"md:hidden",children:w?"Plan":"Impl"})]}),triggerClassName:w?"text-blue-400 dark:text-blue-300":void 0,children:Z=>f.jsxs(f.Fragment,{children:[f.jsx(Ir,{onClick:()=>{S(!1),Z()},selected:!w,icon:f.jsx(Tk,{className:"h-4 w-4 text-muted-foreground"}),label:"Implement",description:"Start execution"}),f.jsx(Ir,{onClick:()=>{S(!0),Z()},selected:w,icon:f.jsx(mm,{className:"h-4 w-4 text-muted-foreground"}),label:"Plan",description:"Review a plan before execution"})]})}):null]})})}const xp=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...s})=>f.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:me("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...s,children:e});function zb(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const L7=[/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(['"])([\s\S]*)\1$/,/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(.+)$/,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(.+)$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(.+)$/i];function z7(e){const t=e.trim();for(const n of L7){const r=t.match(n);if(!r)continue;const s=(r[2]??r[1]??"").trim();if(s)return s}return t}function km(e){return e.split("/").pop()||e}function P7(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,s=60*r,a=24*s,l=7*a;return n<r?"now":n<s?`${Math.floor(n/r)}m`:n<a?`${Math.floor(n/s)}h`:n<l?`${Math.floor(n/a)}d`:`${Math.floor(n/l)}w`}const B7='button, select, input, textarea, [role="combobox"], [role="listbox"], [data-no-touch-drag]';function e2(e){var t;try{(t=navigator.vibrate)==null||t.call(navigator,e)}catch{}}function F0({enabled:e,visualElementRef:t,onTap:n,onContextMenu:r,onDragStart:s,onDragMove:a,onDragEnd:l,holdDelay:u=300,contextMenuDelay:h=2500,scrollThreshold:d=8,dragMoveThreshold:g=5}){const[p,v]=_.useState(!1),[y,w]=_.useState(!1),[S,C]=_.useState(null),[k,R]=_.useState(null),E=_.useCallback(O=>{R(O)},[]),N=_.useRef("idle"),j=_.useRef({x:0,y:0}),D=_.useRef(null),L=_.useRef(null),U=_.useRef(n),Y=_.useRef(r),P=_.useRef(s),V=_.useRef(a),I=_.useRef(l);U.current=n,Y.current=r,P.current=s,V.current=a,I.current=l;const W=_.useCallback((O,F)=>{const H=(t==null?void 0:t.current)??k;if(!H)return document.elementFromPoint(O,F);const $=H.style.pointerEvents;H.style.pointerEvents="none";const M=document.elementFromPoint(O,F);return H.style.pointerEvents=$,M},[t,k]),K=_.useCallback(()=>{D.current&&(clearTimeout(D.current),D.current=null),L.current&&(clearTimeout(L.current),L.current=null)},[]),q=_.useCallback(()=>{K(),N.current="idle",w(!1),v(!1),C(null)},[K]);return _.useEffect(()=>{if(!k||!e)return;const O=M=>{if(M.target.closest(B7))return;const B=M.touches[0];B&&(j.current={x:B.clientX,y:B.clientY},N.current="holding",D.current=setTimeout(()=>{D.current=null,N.current==="holding"&&(N.current="armed",w(!0),e2(30),L.current=setTimeout(()=>{var A;if(L.current=null,N.current!=="armed")return;e2(100);const X={...j.current};N.current="idle",w(!1),(A=Y.current)==null||A.call(Y,X)},h))},u))},F=M=>{var Z,te;const B=N.current;if(B==="idle")return;const X=M.touches[0];if(!X)return;const A=X.clientX-j.current.x,re=X.clientY-j.current.y,se=Math.sqrt(A*A+re*re);if(B==="holding"){se>d&&(K(),N.current="idle");return}if(B==="armed"){se>g&&(L.current&&(clearTimeout(L.current),L.current=null),N.current="dragging",w(!1),v(!0),C({x:X.clientX,y:X.clientY}),M.preventDefault(),(Z=P.current)==null||Z.call(P,{x:X.clientX,y:X.clientY}));return}if(B==="dragging"){M.preventDefault(),C({x:X.clientX,y:X.clientY});const le=W(X.clientX,X.clientY);(te=V.current)==null||te.call(V,{x:X.clientX,y:X.clientY,elementBelow:le})}},H=M=>{var X,A;const B=N.current;if(B==="holding"){K(),N.current="idle",w(!1),v(!1),M.preventDefault(),(X=U.current)==null||X.call(U);return}if(B==="armed"){q();return}if(B==="dragging"){const re=M.changedTouches[0];if(re){const se=W(re.clientX,re.clientY);(A=I.current)==null||A.call(I,{x:re.clientX,y:re.clientY,elementBelow:se})}q()}},$=()=>{var M;N.current==="dragging"&&((M=I.current)==null||M.call(I,{x:0,y:0,elementBelow:null})),q()};return k.addEventListener("touchstart",O,{passive:!1}),k.addEventListener("touchmove",F,{passive:!1}),k.addEventListener("touchend",H),k.addEventListener("touchcancel",$),()=>{k.removeEventListener("touchstart",O),k.removeEventListener("touchmove",F),k.removeEventListener("touchend",H),k.removeEventListener("touchcancel",$),K(),N.current="idle"}},[k,e,u,h,d,g,K,q,W]),{touchRef:E,isDragging:p,isArmed:y,dragPosition:S}}function MM({position:e,children:t,className:n}){return e?Hi.createPortal(f.jsx("div",{style:{position:"fixed",left:e.x,top:e.y,transform:"translate(-50%, calc(-100% - 14px))",zIndex:9999,pointerEvents:"none",willChange:"transform"},className:me("flex items-center gap-2 rounded-xl border-2 border-primary/60 bg-card px-3 py-2","shadow-[0_8px_32px_rgba(0,0,0,0.25)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.5)]","min-w-[120px] max-w-[240px]","scale-[1.04]",n),children:t}),document.body):null}const I7=new Set(["starting","running"]);function H7({chat:e,activeChatId:t,nowMs:n,showProviderIcon:r=!1,isCompleted:s=!1,onSelectChat:a,onDeleteChat:l,draggable:u=!1,onDragStart:h,onDragEnd:d,isTouchDevice:g=!1,onTouchDragMove:p,onTouchDragEnd:v}){const y=P7(e.lastMessageAt,n),w=g&&u,S=e.provider?Cm[e.provider]:null,{touchRef:C,isArmed:k,isDragging:R,dragPosition:E}=F0({enabled:w,onTap:()=>a(e.chatId),onDragStart:()=>h==null?void 0:h(e),onDragMove:({x:N,y:j,elementBelow:D})=>p==null?void 0:p(N,j,D),onDragEnd:({x:N,y:j,elementBelow:D})=>{v==null||v(N,j,D),d==null||d()}});return f.jsxs(f.Fragment,{children:[f.jsxs("div",{ref:w?C:void 0,"data-chat-id":hk(e.chatId),className:me("group flex items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-lg cursor-pointer border transition-all duration-150 select-none",t===hk(e.chatId)?"bg-muted hover:bg-muted border-border":"border-border/0 hover:border-border hover:bg-muted/20 dark:hover:border-slate-400/10",k&&"scale-[1.03] shadow-md ring-2 ring-primary/50 bg-card border-primary/40",R&&!k&&"opacity-20 scale-[0.98]"),draggable:u&&!g,onDragStart:u&&!g?()=>h==null?void 0:h(e):void 0,onDragEnd:u&&!g?d:void 0,onClick:g?void 0:()=>a(e.chatId),children:[I7.has(e.status)?f.jsx(oi,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):e.status==="waiting_for_user"?f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"rounded-full z-0 size-3.5 flex items-center justify-center",children:[f.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),f.jsx("div",{className:"rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):s?f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"rounded-full z-0 size-3.5 flex items-center justify-center",children:[f.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),f.jsx("div",{className:"rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,r&&S?f.jsx(S,{className:"size-3.5 flex-shrink-0 text-muted-foreground/80","aria-label":`${e.provider} provider`}):null,f.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?f.jsx(xp,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),f.jsxs("div",{className:"relative h-7 w-7 mr-[2px] shrink-0",children:[y?f.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-1 text-[11px] text-muted-foreground opacity-50 transition-opacity group-hover:opacity-0",children:y}):null,f.jsx(tt,{variant:"ghost",size:"icon",className:me("absolute inset-0 h-7 w-7 opacity-100 cursor-pointer rounded-sm hover:!bg-transparent !border-0",y?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),"data-no-touch-drag":!0,onClick:N=>{N.stopPropagation(),l(e.chatId)},title:"Delete chat",children:f.jsx(h6,{className:"size-3.5"})})]})]},e._id),f.jsx(MM,{position:E,children:f.jsx("span",{className:"text-sm font-medium truncate",children:e.title})})]})}function F7(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const wp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Sc(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function U0(e){return"nodeType"in e}function Wr(e){var t,n;return e?Sc(e)?e:U0(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function $0(e){const{Document:t}=Wr(e);return e instanceof t}function Md(e){return Sc(e)?!1:e instanceof Wr(e).HTMLElement}function AM(e){return e instanceof Wr(e).SVGElement}function Cc(e){return e?Sc(e)?e.document:U0(e)?$0(e)?e:Md(e)||AM(e)?e.ownerDocument:document:document:document}const _s=wp?_.useLayoutEffect:_.useEffect;function W0(e){const t=_.useRef(e);return _s(()=>{t.current=e}),_.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function U7(){const e=_.useRef(null),t=_.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=_.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ld(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return _s(()=>{n.current!==e&&(n.current=e)},t),n}function Ad(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Em(e){const t=W0(e),n=_.useRef(null),r=_.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function Pb(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let b_={};function Dd(e,t){return _.useMemo(()=>{if(t)return t;const n=b_[e]==null?0:b_[e]+1;return b_[e]=n,e+"-"+n},[e,t])}function DM(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((a,l)=>{const u=Object.entries(l);for(const[h,d]of u){const g=a[h];g!=null&&(a[h]=g+e*d)}return a},{...t})}}const ic=DM(1),Rm=DM(-1);function $7(e){return"clientX"in e&&"clientY"in e}function V0(e){if(!e)return!1;const{KeyboardEvent:t}=Wr(e.target);return t&&e instanceof t}function W7(e){if(!e)return!1;const{TouchEvent:t}=Wr(e.target);return t&&e instanceof t}function Bb(e){if(W7(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return $7(e)?{x:e.clientX,y:e.clientY}:null}const cd=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[cd.Translate.toString(e),cd.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),t2="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function V7(e){return e.matches(t2)?e:e.querySelector(t2)}const q7={display:"none"};function K7(e){let{id:t,value:n}=e;return ye.createElement("div",{id:t,style:q7},n)}function G7(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ye.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function Y7(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const jM=_.createContext(null);function X7(e){const t=_.useContext(jM);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Z7(){const[e]=_.useState(()=>new Set),t=_.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[_.useCallback(r=>{let{type:s,event:a}=r;e.forEach(l=>{var u;return(u=l[s])==null?void 0:u.call(l,a)})},[e]),t]}const Q7={draggable:`
465
- To pick up a draggable item, press the space bar.
466
- While dragging, use the arrow keys to move the item.
467
- Press space again to drop the item in its new position, or press escape to cancel.
468
- `},J7={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function eH(e){let{announcements:t=J7,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=Q7}=e;const{announce:a,announcement:l}=Y7(),u=Dd("DndLiveRegion"),[h,d]=_.useState(!1);if(_.useEffect(()=>{d(!0)},[]),X7(_.useMemo(()=>({onDragStart(p){let{active:v}=p;a(t.onDragStart({active:v}))},onDragMove(p){let{active:v,over:y}=p;t.onDragMove&&a(t.onDragMove({active:v,over:y}))},onDragOver(p){let{active:v,over:y}=p;a(t.onDragOver({active:v,over:y}))},onDragEnd(p){let{active:v,over:y}=p;a(t.onDragEnd({active:v,over:y}))},onDragCancel(p){let{active:v,over:y}=p;a(t.onDragCancel({active:v,over:y}))}}),[a,t])),!h)return null;const g=ye.createElement(ye.Fragment,null,ye.createElement(K7,{id:r,value:s.draggable}),ye.createElement(G7,{id:u,announcement:l}));return n?Hi.createPortal(g,n):g}var Vn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Vn||(Vn={}));function Tm(){}function y_(e,t){return _.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function tH(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Ki=Object.freeze({x:0,y:0});function nH(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function rH(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function iH(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function sH(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function n2(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const oH=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=n2(t,t.left,t.top),a=[];for(const l of r){const{id:u}=l,h=n.get(u);if(h){const d=nH(n2(h),s);a.push({id:u,data:{droppableContainer:l,value:d}})}}return a.sort(rH)};function aH(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),l=s-r,u=a-n;if(r<s&&n<a){const h=t.width*t.height,d=e.width*e.height,g=l*u,p=g/(h+d-g);return Number(p.toFixed(4))}return 0}const lH=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const a of r){const{id:l}=a,u=n.get(l);if(u){const h=aH(u,t);h>0&&s.push({id:l,data:{droppableContainer:a,value:h}})}}return s.sort(iH)};function cH(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function OM(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ki}function uH(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];return s.reduce((l,u)=>({...l,top:l.top+e*u.y,bottom:l.bottom+e*u.y,left:l.left+e*u.x,right:l.right+e*u.x}),{...n})}}const dH=uH(1);function hH(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function fH(e,t,n){const r=hH(t);if(!r)return e;const{scaleX:s,scaleY:a,x:l,y:u}=r,h=e.left-l-(1-s)*parseFloat(n),d=e.top-u-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),g=s?e.width/s:e.width,p=a?e.height/a:e.height;return{width:g,height:p,top:d,right:h+g,bottom:d+p,left:h}}const mH={ignoreTransform:!1};function kc(e,t){t===void 0&&(t=mH);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=Wr(e).getComputedStyle(e);d&&(n=fH(n,d,g))}const{top:r,left:s,width:a,height:l,bottom:u,right:h}=n;return{top:r,left:s,width:a,height:l,bottom:u,right:h}}function r2(e){return kc(e,{ignoreTransform:!0})}function pH(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function gH(e,t){return t===void 0&&(t=Wr(e).getComputedStyle(e)),t.position==="fixed"}function vH(e,t){t===void 0&&(t=Wr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const a=t[s];return typeof a=="string"?n.test(a):!1})}function q0(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if($0(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!Md(s)||AM(s)||n.includes(s))return n;const a=Wr(e).getComputedStyle(s);return s!==e&&vH(s,a)&&n.push(s),gH(s,a)?n:r(s.parentNode)}return e?r(e):n}function LM(e){const[t]=q0(e,1);return t??null}function x_(e){return!wp||!e?null:Sc(e)?e:U0(e)?$0(e)||e===Cc(e).scrollingElement?window:Md(e)?e:null:null}function zM(e){return Sc(e)?e.scrollX:e.scrollLeft}function PM(e){return Sc(e)?e.scrollY:e.scrollTop}function Ib(e){return{x:zM(e),y:PM(e)}}var Yn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Yn||(Yn={}));function BM(e){return!wp||!e?!1:e===document.scrollingElement}function IM(e){const t={x:0,y:0},n=BM(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,l=e.scrollTop>=r.y,u=e.scrollLeft>=r.x;return{isTop:s,isLeft:a,isBottom:l,isRight:u,maxScroll:r,minScroll:t}}const _H={x:.2,y:.2};function bH(e,t,n,r,s){let{top:a,left:l,right:u,bottom:h}=n;r===void 0&&(r=10),s===void 0&&(s=_H);const{isTop:d,isBottom:g,isLeft:p,isRight:v}=IM(e),y={x:0,y:0},w={x:0,y:0},S={height:t.height*s.y,width:t.width*s.x};return!d&&a<=t.top+S.height?(y.y=Yn.Backward,w.y=r*Math.abs((t.top+S.height-a)/S.height)):!g&&h>=t.bottom-S.height&&(y.y=Yn.Forward,w.y=r*Math.abs((t.bottom-S.height-h)/S.height)),!v&&u>=t.right-S.width?(y.x=Yn.Forward,w.x=r*Math.abs((t.right-S.width-u)/S.width)):!p&&l<=t.left+S.width&&(y.x=Yn.Backward,w.x=r*Math.abs((t.left+S.width-l)/S.width)),{direction:y,speed:w}}function yH(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:l}=window;return{top:0,left:0,right:a,bottom:l,width:a,height:l}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function HM(e){return e.reduce((t,n)=>ic(t,Ib(n)),Ki)}function xH(e){return e.reduce((t,n)=>t+zM(n),0)}function wH(e){return e.reduce((t,n)=>t+PM(n),0)}function SH(e,t){if(t===void 0&&(t=kc),!e)return;const{top:n,left:r,bottom:s,right:a}=t(e);LM(e)&&(s<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const CH=[["x",["left","right"],xH],["y",["top","bottom"],wH]];class K0{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=q0(n),s=HM(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,l,u]of CH)for(const h of l)Object.defineProperty(this,h,{get:()=>{const d=u(r),g=s[a]-d;return this.rect[h]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Gu{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function kH(e){const{EventTarget:t}=Wr(e);return e instanceof t?e:Cc(e)}function w_(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Ci;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ci||(Ci={}));function i2(e){e.preventDefault()}function EH(e){e.stopPropagation()}var Ft;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ft||(Ft={}));const FM={start:[Ft.Space,Ft.Enter],cancel:[Ft.Esc],end:[Ft.Space,Ft.Enter,Ft.Tab]},RH=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ft.Right:return{...n,x:n.x+25};case Ft.Left:return{...n,x:n.x-25};case Ft.Down:return{...n,y:n.y+25};case Ft.Up:return{...n,y:n.y-25}}};class G0{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Gu(Cc(n)),this.windowListeners=new Gu(Wr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ci.Resize,this.handleCancel),this.windowListeners.add(Ci.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ci.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&SH(r),n(Ki)}handleKeyDown(t){if(V0(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:a=FM,coordinateGetter:l=RH,scrollBehavior:u="smooth"}=s,{code:h}=t;if(a.end.includes(h)){this.handleEnd(t);return}if(a.cancel.includes(h)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:Ki;this.referenceCoordinates||(this.referenceCoordinates=g);const p=l(t,{active:n,context:r.current,currentCoordinates:g});if(p){const v=Rm(p,g),y={x:0,y:0},{scrollableAncestors:w}=r.current;for(const S of w){const C=t.code,{isTop:k,isRight:R,isLeft:E,isBottom:N,maxScroll:j,minScroll:D}=IM(S),L=yH(S),U={x:Math.min(C===Ft.Right?L.right-L.width/2:L.right,Math.max(C===Ft.Right?L.left:L.left+L.width/2,p.x)),y:Math.min(C===Ft.Down?L.bottom-L.height/2:L.bottom,Math.max(C===Ft.Down?L.top:L.top+L.height/2,p.y))},Y=C===Ft.Right&&!R||C===Ft.Left&&!E,P=C===Ft.Down&&!N||C===Ft.Up&&!k;if(Y&&U.x!==p.x){const V=S.scrollLeft+v.x,I=C===Ft.Right&&V<=j.x||C===Ft.Left&&V>=D.x;if(I&&!v.y){S.scrollTo({left:V,behavior:u});return}I?y.x=S.scrollLeft-V:y.x=C===Ft.Right?S.scrollLeft-j.x:S.scrollLeft-D.x,y.x&&S.scrollBy({left:-y.x,behavior:u});break}else if(P&&U.y!==p.y){const V=S.scrollTop+v.y,I=C===Ft.Down&&V<=j.y||C===Ft.Up&&V>=D.y;if(I&&!v.x){S.scrollTo({top:V,behavior:u});return}I?y.y=S.scrollTop-V:y.y=C===Ft.Down?S.scrollTop-j.y:S.scrollTop-D.y,y.y&&S.scrollBy({top:-y.y,behavior:u});break}}this.handleMove(t,ic(Rm(p,this.referenceCoordinates),y))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}G0.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=FM,onActivation:s}=t,{active:a}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const u=a.activatorNode.current;return u&&e.target!==u?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function s2(e){return!!(e&&"distance"in e)}function o2(e){return!!(e&&"delay"in e)}class Y0{constructor(t,n,r){var s;r===void 0&&(r=kH(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:a}=t,{target:l}=a;this.props=t,this.events=n,this.document=Cc(l),this.documentListeners=new Gu(this.document),this.listeners=new Gu(r),this.windowListeners=new Gu(Wr(l)),this.initialCoordinates=(s=Bb(a))!=null?s:Ki,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Ci.Resize,this.handleCancel),this.windowListeners.add(Ci.DragStart,i2),this.windowListeners.add(Ci.VisibilityChange,this.handleCancel),this.windowListeners.add(Ci.ContextMenu,i2),this.documentListeners.add(Ci.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(o2(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(s2(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ci.Click,EH,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ci.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:a}=this,{onMove:l,options:{activationConstraint:u}}=a;if(!s)return;const h=(n=Bb(t))!=null?n:Ki,d=Rm(s,h);if(!r&&u){if(s2(u)){if(u.tolerance!=null&&w_(d,u.tolerance))return this.handleCancel();if(w_(d,u.distance))return this.handleStart()}if(o2(u)&&w_(d,u.tolerance))return this.handleCancel();this.handlePending(u,d);return}t.cancelable&&t.preventDefault(),l(h)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ft.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const TH={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class X0 extends Y0{constructor(t){const{event:n}=t,r=Cc(n.target);super(t,TH,r)}}X0.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const NH={move:{name:"mousemove"},end:{name:"mouseup"}};var Hb;(function(e){e[e.RightClick=2]="RightClick"})(Hb||(Hb={}));class MH extends Y0{constructor(t){super(t,NH,Cc(t.event.target))}}MH.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Hb.RightClick?!1:(r==null||r({event:n}),!0)}}];const S_={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class UM extends Y0{constructor(t){super(t,S_)}static setup(){return window.addEventListener(S_.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(S_.move.name,t)};function t(){}}}UM.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r==null||r({event:n}),!0)}}];var Yu;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Yu||(Yu={}));var Nm;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Nm||(Nm={}));function AH(e){let{acceleration:t,activator:n=Yu.Pointer,canScroll:r,draggingRect:s,enabled:a,interval:l=5,order:u=Nm.TreeOrder,pointerCoordinates:h,scrollableAncestors:d,scrollableAncestorRects:g,delta:p,threshold:v}=e;const y=jH({delta:p,disabled:!a}),[w,S]=U7(),C=_.useRef({x:0,y:0}),k=_.useRef({x:0,y:0}),R=_.useMemo(()=>{switch(n){case Yu.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case Yu.DraggableRect:return s}},[n,s,h]),E=_.useRef(null),N=_.useCallback(()=>{const D=E.current;if(!D)return;const L=C.current.x*k.current.x,U=C.current.y*k.current.y;D.scrollBy(L,U)},[]),j=_.useMemo(()=>u===Nm.TreeOrder?[...d].reverse():d,[u,d]);_.useEffect(()=>{if(!a||!d.length||!R){S();return}for(const D of j){if((r==null?void 0:r(D))===!1)continue;const L=d.indexOf(D),U=g[L];if(!U)continue;const{direction:Y,speed:P}=bH(D,U,R,t,v);for(const V of["x","y"])y[V][Y[V]]||(P[V]=0,Y[V]=0);if(P.x>0||P.y>0){S(),E.current=D,w(N,l),C.current=P,k.current=Y;return}}C.current={x:0,y:0},k.current={x:0,y:0},S()},[t,N,r,S,a,l,JSON.stringify(R),JSON.stringify(y),w,d,j,g,JSON.stringify(v)])}const DH={x:{[Yn.Backward]:!1,[Yn.Forward]:!1},y:{[Yn.Backward]:!1,[Yn.Forward]:!1}};function jH(e){let{delta:t,disabled:n}=e;const r=Pb(t);return Ad(s=>{if(n||!r||!s)return DH;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Yn.Backward]:s.x[Yn.Backward]||a.x===-1,[Yn.Forward]:s.x[Yn.Forward]||a.x===1},y:{[Yn.Backward]:s.y[Yn.Backward]||a.y===-1,[Yn.Forward]:s.y[Yn.Forward]||a.y===1}}},[n,t,r])}function OH(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Ad(s=>{var a;return t==null?null:(a=r??s)!=null?a:null},[r,t])}function LH(e,t){return _.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,a=s.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,r)}));return[...n,...a]},[]),[e,t])}var ud;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ud||(ud={}));var Fb;(function(e){e.Optimized="optimized"})(Fb||(Fb={}));const a2=new Map;function zH(e,t){let{dragging:n,dependencies:r,config:s}=t;const[a,l]=_.useState(null),{frequency:u,measure:h,strategy:d}=s,g=_.useRef(e),p=C(),v=ld(p),y=_.useCallback(function(k){k===void 0&&(k=[]),!v.current&&l(R=>R===null?k:R.concat(k.filter(E=>!R.includes(E))))},[v]),w=_.useRef(null),S=Ad(k=>{if(p&&!n)return a2;if(!k||k===a2||g.current!==e||a!=null){const R=new Map;for(let E of e){if(!E)continue;if(a&&a.length>0&&!a.includes(E.id)&&E.rect.current){R.set(E.id,E.rect.current);continue}const N=E.node.current,j=N?new K0(h(N),N):null;E.rect.current=j,j&&R.set(E.id,j)}return R}return k},[e,a,n,p,h]);return _.useEffect(()=>{g.current=e},[e]),_.useEffect(()=>{p||y()},[n,p]),_.useEffect(()=>{a&&a.length>0&&l(null)},[JSON.stringify(a)]),_.useEffect(()=>{p||typeof u!="number"||w.current!==null||(w.current=setTimeout(()=>{y(),w.current=null},u))},[u,p,y,...r]),{droppableRects:S,measureDroppableContainers:y,measuringScheduled:a!=null};function C(){switch(d){case ud.Always:return!1;case ud.BeforeDragging:return n;default:return!n}}}function $M(e,t){return Ad(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function PH(e,t){return $M(e,t)}function BH(e){let{callback:t,disabled:n}=e;const r=W0(t),s=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(r)},[r,n]);return _.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Sp(e){let{callback:t,disabled:n}=e;const r=W0(t),s=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(r)},[n]);return _.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function IH(e){return new K0(kc(e),e)}function l2(e,t,n){t===void 0&&(t=IH);const[r,s]=_.useState(null);function a(){s(h=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=h??n)!=null?d:null}const g=t(e);return JSON.stringify(h)===JSON.stringify(g)?h:g})}const l=BH({callback(h){if(e)for(const d of h){const{type:g,target:p}=d;if(g==="childList"&&p instanceof HTMLElement&&p.contains(e)){a();break}}}}),u=Sp({callback:a});return _s(()=>{a(),e?(u==null||u.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(u==null||u.disconnect(),l==null||l.disconnect())},[e]),r}function HH(e){const t=$M(e);return OM(e,t)}const c2=[];function FH(e){const t=_.useRef(e),n=Ad(r=>e?r&&r!==c2&&e&&t.current&&e.parentNode===t.current.parentNode?r:q0(e):c2,[e]);return _.useEffect(()=>{t.current=e},[e]),n}function UH(e){const[t,n]=_.useState(null),r=_.useRef(e),s=_.useCallback(a=>{const l=x_(a.target);l&&n(u=>u?(u.set(l,Ib(l)),new Map(u)):null)},[]);return _.useEffect(()=>{const a=r.current;if(e!==a){l(a);const u=e.map(h=>{const d=x_(h);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,Ib(d)]):null}).filter(h=>h!=null);n(u.length?new Map(u):null),r.current=e}return()=>{l(e),l(a)};function l(u){u.forEach(h=>{const d=x_(h);d==null||d.removeEventListener("scroll",s)})}},[s,e]),_.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,l)=>ic(a,l),Ki):HM(e):Ki,[e,t])}function u2(e,t){t===void 0&&(t=[]);const n=_.useRef(null);return _.useEffect(()=>{n.current=null},t),_.useEffect(()=>{const r=e!==Ki;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Rm(e,n.current):Ki}function $H(e){_.useEffect(()=>{if(!wp)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function WH(e,t){return _.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:a}=r;return n[s]=l=>{a(l,t)},n},{}),[e,t])}function WM(e){return _.useMemo(()=>e?pH(e):null,[e])}const d2=[];function VH(e,t){t===void 0&&(t=kc);const[n]=e,r=WM(n?Wr(n):null),[s,a]=_.useState(d2);function l(){a(()=>e.length?e.map(h=>BM(h)?r:new K0(t(h),h)):d2)}const u=Sp({callback:l});return _s(()=>{u==null||u.disconnect(),l(),e.forEach(h=>u==null?void 0:u.observe(h))},[e]),s}function qH(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Md(t)?t:e}function KH(e){let{measure:t}=e;const[n,r]=_.useState(null),s=_.useCallback(d=>{for(const{target:g}of d)if(Md(g)){r(p=>{const v=t(g);return p?{...p,width:v.width,height:v.height}:v});break}},[t]),a=Sp({callback:s}),l=_.useCallback(d=>{const g=qH(d);a==null||a.disconnect(),g&&(a==null||a.observe(g)),r(g?t(g):null)},[t,a]),[u,h]=Em(l);return _.useMemo(()=>({nodeRef:u,rect:n,setRef:h}),[n,u,h])}const GH=[{sensor:X0,options:{}},{sensor:G0,options:{}}],YH={current:{}},Zf={draggable:{measure:r2},droppable:{measure:r2,strategy:ud.WhileDragging,frequency:Fb.Optimized},dragOverlay:{measure:kc}};class Xu extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const XH={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Xu,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Tm},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Zf,measureDroppableContainers:Tm,windowRect:null,measuringScheduled:!1},ZH={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Tm,draggableNodes:new Map,over:null,measureDroppableContainers:Tm},Cp=_.createContext(ZH),VM=_.createContext(XH);function QH(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Xu}}}function JH(e,t){switch(t.type){case Vn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Vn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Vn.DragEnd:case Vn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Vn.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new Xu(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case Vn.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const l=new Xu(e.droppable.containers);return l.set(n,{...a,disabled:s}),{...e,droppable:{...e.droppable,containers:l}}}case Vn.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new Xu(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function eF(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=_.useContext(Cp),a=Pb(r),l=Pb(n==null?void 0:n.id);return _.useEffect(()=>{if(!t&&!r&&a&&l!=null){if(!V0(a)||document.activeElement===a.target)return;const u=s.get(l);if(!u)return;const{activatorNode:h,node:d}=u;if(!h.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[h.current,d.current]){if(!g)continue;const p=V7(g);if(p){p.focus();break}}})}},[r,t,s,l,a]),null}function tF(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,a)=>a({transform:s,...r}),n):n}function nF(e){return _.useMemo(()=>({draggable:{...Zf.draggable,...e==null?void 0:e.draggable},droppable:{...Zf.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Zf.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function rF(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const a=_.useRef(!1),{x:l,y:u}=typeof s=="boolean"?{x:s,y:s}:s;_s(()=>{if(!l&&!u||!t){a.current=!1;return}if(a.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const g=n(d),p=OM(g,r);if(l||(p.x=0),u||(p.y=0),a.current=!0,Math.abs(p.x)>0||Math.abs(p.y)>0){const v=LM(d);v&&v.scrollBy({top:p.y,left:p.x})}},[t,l,u,r,n])}const qM=_.createContext({...Ki,scaleX:1,scaleY:1});var $o;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})($o||($o={}));const iF=_.memo(function(t){var n,r,s,a;let{id:l,accessibility:u,autoScroll:h=!0,children:d,sensors:g=GH,collisionDetection:p=lH,measuring:v,modifiers:y,...w}=t;const S=_.useReducer(JH,void 0,QH),[C,k]=S,[R,E]=Z7(),[N,j]=_.useState($o.Uninitialized),D=N===$o.Initialized,{draggable:{active:L,nodes:U,translate:Y},droppable:{containers:P}}=C,V=L!=null?U.get(L):null,I=_.useRef({initial:null,translated:null}),W=_.useMemo(()=>{var jt;return L!=null?{id:L,data:(jt=V==null?void 0:V.data)!=null?jt:YH,rect:I}:null},[L,V]),K=_.useRef(null),[q,O]=_.useState(null),[F,H]=_.useState(null),$=ld(w,Object.values(w)),M=Dd("DndDescribedBy",l),B=_.useMemo(()=>P.getEnabled(),[P]),X=nF(v),{droppableRects:A,measureDroppableContainers:re,measuringScheduled:se}=zH(B,{dragging:D,dependencies:[Y.x,Y.y],config:X.droppable}),Z=OH(U,L),te=_.useMemo(()=>F?Bb(F):null,[F]),le=rr(),pe=PH(Z,X.draggable.measure);rF({activeNode:L!=null?U.get(L):null,config:le.layoutShiftCompensation,initialRect:pe,measure:X.draggable.measure});const xe=l2(Z,X.draggable.measure,pe),Me=l2(Z?Z.parentElement:null),Re=_.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:A,draggableNodes:U,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),je=P.getNodeFor((n=Re.current.over)==null?void 0:n.id),Xe=KH({measure:X.dragOverlay.measure}),ft=(r=Xe.nodeRef.current)!=null?r:Z,pt=D?(s=Xe.rect)!=null?s:xe:null,he=!!(Xe.nodeRef.current&&Xe.rect),Le=HH(he?null:xe),Ae=WM(ft?Wr(ft):null),nt=FH(D?je??Z:null),gt=VH(nt),qe=tF(y,{transform:{x:Y.x-Le.x,y:Y.y-Le.y,scaleX:1,scaleY:1},activatorEvent:F,active:W,activeNodeRect:xe,containerNodeRect:Me,draggingNodeRect:pt,over:Re.current.over,overlayNodeRect:Xe.rect,scrollableAncestors:nt,scrollableAncestorRects:gt,windowRect:Ae}),vt=te?ic(te,Y):null,Se=UH(nt),De=u2(Se),ce=u2(Se,[xe]),be=ic(qe,De),Oe=pt?dH(pt,qe):null,We=W&&Oe?p({active:W,collisionRect:Oe,droppableRects:A,droppableContainers:B,pointerCoordinates:vt}):null,we=sH(We,"id"),[Ie,ot]=_.useState(null),rt=he?qe:ic(qe,ce),ze=cH(rt,(a=Ie==null?void 0:Ie.rect)!=null?a:null,xe),St=_.useRef(null),at=_.useCallback((jt,zt)=>{let{sensor:He,options:ct}=zt;if(K.current==null)return;const st=U.get(K.current);if(!st)return;const mt=jt.nativeEvent,an=new He({active:K.current,activeNode:st,event:mt,options:ct,context:Re,onAbort(Te){if(!U.get(Te))return;const{onDragAbort:Qe}=$.current,bt={id:Te};Qe==null||Qe(bt),R({type:"onDragAbort",event:bt})},onPending(Te,_t,Qe,bt){if(!U.get(Te))return;const{onDragPending:Ot}=$.current,sn={id:Te,constraint:_t,initialCoordinates:Qe,offset:bt};Ot==null||Ot(sn),R({type:"onDragPending",event:sn})},onStart(Te){const _t=K.current;if(_t==null)return;const Qe=U.get(_t);if(!Qe)return;const{onDragStart:bt}=$.current,qt={activatorEvent:mt,active:{id:_t,data:Qe.data,rect:I}};Hi.unstable_batchedUpdates(()=>{bt==null||bt(qt),j($o.Initializing),k({type:Vn.DragStart,initialCoordinates:Te,active:_t}),R({type:"onDragStart",event:qt}),O(St.current),H(mt)})},onMove(Te){k({type:Vn.DragMove,coordinates:Te})},onEnd:Ce(Vn.DragEnd),onCancel:Ce(Vn.DragCancel)});St.current=an;function Ce(Te){return async function(){const{active:Qe,collisions:bt,over:qt,scrollAdjustedTranslate:Ot}=Re.current;let sn=null;if(Qe&&Ot){const{cancelDrop:G}=$.current;sn={activatorEvent:mt,active:Qe,collisions:bt,delta:Ot,over:qt},Te===Vn.DragEnd&&typeof G=="function"&&await Promise.resolve(G(sn))&&(Te=Vn.DragCancel)}K.current=null,Hi.unstable_batchedUpdates(()=>{k({type:Te}),j($o.Uninitialized),ot(null),O(null),H(null),St.current=null;const G=Te===Vn.DragEnd?"onDragEnd":"onDragCancel";if(sn){const Ye=$.current[G];Ye==null||Ye(sn),R({type:G,event:sn})}})}}},[U]),vn=_.useCallback((jt,zt)=>(He,ct)=>{const st=He.nativeEvent,mt=U.get(ct);if(K.current!==null||!mt||st.dndKit||st.defaultPrevented)return;const an={active:mt};jt(He,zt.options,an)===!0&&(st.dndKit={capturedBy:zt.sensor},K.current=ct,at(He,zt))},[U,at]),tn=LH(g,vn);$H(g),_s(()=>{xe&&N===$o.Initializing&&j($o.Initialized)},[xe,N]),_.useEffect(()=>{const{onDragMove:jt}=$.current,{active:zt,activatorEvent:He,collisions:ct,over:st}=Re.current;if(!zt||!He)return;const mt={active:zt,activatorEvent:He,collisions:ct,delta:{x:be.x,y:be.y},over:st};Hi.unstable_batchedUpdates(()=>{jt==null||jt(mt),R({type:"onDragMove",event:mt})})},[be.x,be.y]),_.useEffect(()=>{const{active:jt,activatorEvent:zt,collisions:He,droppableContainers:ct,scrollAdjustedTranslate:st}=Re.current;if(!jt||K.current==null||!zt||!st)return;const{onDragOver:mt}=$.current,an=ct.get(we),Ce=an&&an.rect.current?{id:an.id,rect:an.rect.current,data:an.data,disabled:an.disabled}:null,Te={active:jt,activatorEvent:zt,collisions:He,delta:{x:st.x,y:st.y},over:Ce};Hi.unstable_batchedUpdates(()=>{ot(Ce),mt==null||mt(Te),R({type:"onDragOver",event:Te})})},[we]),_s(()=>{Re.current={activatorEvent:F,active:W,activeNode:Z,collisionRect:Oe,collisions:We,droppableRects:A,draggableNodes:U,draggingNode:ft,draggingNodeRect:pt,droppableContainers:P,over:Ie,scrollableAncestors:nt,scrollAdjustedTranslate:be},I.current={initial:pt,translated:Oe}},[W,Z,We,Oe,U,ft,pt,A,P,Ie,nt,be]),AH({...le,delta:Y,draggingRect:Oe,pointerCoordinates:vt,scrollableAncestors:nt,scrollableAncestorRects:gt});const Nn=_.useMemo(()=>({active:W,activeNode:Z,activeNodeRect:xe,activatorEvent:F,collisions:We,containerNodeRect:Me,dragOverlay:Xe,draggableNodes:U,droppableContainers:P,droppableRects:A,over:Ie,measureDroppableContainers:re,scrollableAncestors:nt,scrollableAncestorRects:gt,measuringConfiguration:X,measuringScheduled:se,windowRect:Ae}),[W,Z,xe,F,We,Me,Xe,U,P,A,Ie,re,nt,gt,X,se,Ae]),xr=_.useMemo(()=>({activatorEvent:F,activators:tn,active:W,activeNodeRect:xe,ariaDescribedById:{draggable:M},dispatch:k,draggableNodes:U,over:Ie,measureDroppableContainers:re}),[F,tn,W,xe,k,M,U,Ie,re]);return ye.createElement(jM.Provider,{value:E},ye.createElement(Cp.Provider,{value:xr},ye.createElement(VM.Provider,{value:Nn},ye.createElement(qM.Provider,{value:ze},d)),ye.createElement(eF,{disabled:(u==null?void 0:u.restoreFocus)===!1})),ye.createElement(eH,{...u,hiddenTextDescribedById:M}));function rr(){const jt=(q==null?void 0:q.autoScrollEnabled)===!1,zt=typeof h=="object"?h.enabled===!1:h===!1,He=D&&!jt&&!zt;return typeof h=="object"?{...h,enabled:He}:{enabled:He}}}),sF=_.createContext(null),h2="button",oF="Draggable";function aF(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const a=Dd(oF),{activators:l,activatorEvent:u,active:h,activeNodeRect:d,ariaDescribedById:g,draggableNodes:p,over:v}=_.useContext(Cp),{role:y=h2,roleDescription:w="draggable",tabIndex:S=0}=s??{},C=(h==null?void 0:h.id)===t,k=_.useContext(C?qM:sF),[R,E]=Em(),[N,j]=Em(),D=WH(l,t),L=ld(n);_s(()=>(p.set(t,{id:t,key:a,node:R,activatorNode:N,data:L}),()=>{const Y=p.get(t);Y&&Y.key===a&&p.delete(t)}),[p,t]);const U=_.useMemo(()=>({role:y,tabIndex:S,"aria-disabled":r,"aria-pressed":C&&y===h2?!0:void 0,"aria-roledescription":w,"aria-describedby":g.draggable}),[r,y,S,C,w,g.draggable]);return{active:h,activatorEvent:u,activeNodeRect:d,attributes:U,isDragging:C,listeners:r?void 0:D,node:R,over:v,setNodeRef:E,setActivatorNodeRef:j,transform:k}}function lF(){return _.useContext(VM)}const cF="Droppable",uF={timeout:25};function dF(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const a=Dd(cF),{active:l,dispatch:u,over:h,measureDroppableContainers:d}=_.useContext(Cp),g=_.useRef({disabled:n}),p=_.useRef(!1),v=_.useRef(null),y=_.useRef(null),{disabled:w,updateMeasurementsFor:S,timeout:C}={...uF,...s},k=ld(S??r),R=_.useCallback(()=>{if(!p.current){p.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{d(Array.isArray(k.current)?k.current:[k.current]),y.current=null},C)},[C]),E=Sp({callback:R,disabled:w||!l}),N=_.useCallback((U,Y)=>{E&&(Y&&(E.unobserve(Y),p.current=!1),U&&E.observe(U))},[E]),[j,D]=Em(N),L=ld(t);return _.useEffect(()=>{!E||!j.current||(E.disconnect(),p.current=!1,E.observe(j.current))},[j,E]),_.useEffect(()=>(u({type:Vn.RegisterDroppable,element:{id:r,key:a,disabled:n,node:j,rect:v,data:L}}),()=>u({type:Vn.UnregisterDroppable,key:a,id:r})),[r]),_.useEffect(()=>{n!==g.current.disabled&&(u({type:Vn.SetDroppableDisabled,id:r,key:a,disabled:n}),g.current.disabled=n)},[r,a,n,u]),{active:l,rect:v,isOver:(h==null?void 0:h.id)===r,node:j,over:h,setNodeRef:D}}function kp(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function hF(e,t){return e.reduce((n,r,s)=>{const a=t.get(r);return a&&(n[s]=a),n},Array(e.length))}function Sf(e){return e!==null&&e>=0}function fF(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 mF(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const KM=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const a=kp(t,r,n),l=t[s],u=a[s];return!u||!l?null:{x:u.left-l.left,y:u.top-l.top,scaleX:u.width/l.width,scaleY:u.height/l.height}},Cf={scaleX:1,scaleY:1},pF=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:a,overIndex:l}=e;const u=(t=a[n])!=null?t:r;if(!u)return null;if(s===n){const d=a[l];return d?{x:0,y:n<l?d.top+d.height-(u.top+u.height):d.top-u.top,...Cf}:null}const h=gF(a,s,n);return s>n&&s<=l?{x:0,y:-u.height-h,...Cf}:s<n&&s>=l?{x:0,y:u.height+h,...Cf}:{x:0,y:0,...Cf}};function gF(e,t,n){const r=e[t],s=e[t-1],a=e[t+1];return r?n<t?s?r.top-(s.top+s.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const GM="Sortable",YM=ye.createContext({activeIndex:-1,containerId:GM,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:KM,disabled:{draggable:!1,droppable:!1}});function vF(e){let{children:t,id:n,items:r,strategy:s=KM,disabled:a=!1}=e;const{active:l,dragOverlay:u,droppableRects:h,over:d,measureDroppableContainers:g}=lF(),p=Dd(GM,n),v=u.rect!==null,y=_.useMemo(()=>r.map(D=>typeof D=="object"&&"id"in D?D.id:D),[r]),w=l!=null,S=l?y.indexOf(l.id):-1,C=d?y.indexOf(d.id):-1,k=_.useRef(y),R=!fF(y,k.current),E=C!==-1&&S===-1||R,N=mF(a);_s(()=>{R&&w&&g(y)},[R,y,w,g]),_.useEffect(()=>{k.current=y},[y]);const j=_.useMemo(()=>({activeIndex:S,containerId:p,disabled:N,disableTransforms:E,items:y,overIndex:C,useDragOverlay:v,sortedRects:hF(y,h),strategy:s}),[S,p,N.draggable,N.droppable,E,y,C,h,v,s]);return ye.createElement(YM.Provider,{value:j},t)}const _F=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return kp(n,r,s).indexOf(t)},bF=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:a,newIndex:l,previousItems:u,previousContainerId:h,transition:d}=e;return!d||!r||u!==a&&s===l?!1:n?!0:l!==s&&t===h},yF={duration:200,easing:"ease"},XM="transform",xF=cd.Transition.toString({property:XM,duration:0,easing:"linear"}),wF={roleDescription:"sortable"};function SF(e){let{disabled:t,index:n,node:r,rect:s}=e;const[a,l]=_.useState(null),u=_.useRef(n);return _s(()=>{if(!t&&n!==u.current&&r.current){const h=s.current;if(h){const d=kc(r.current,{ignoreTransform:!0}),g={x:h.left-d.left,y:h.top-d.top,scaleX:h.width/d.width,scaleY:h.height/d.height};(g.x||g.y)&&l(g)}}n!==u.current&&(u.current=n)},[t,n,r,s]),_.useEffect(()=>{a&&l(null)},[a]),a}function CF(e){let{animateLayoutChanges:t=bF,attributes:n,disabled:r,data:s,getNewIndex:a=_F,id:l,strategy:u,resizeObserverConfig:h,transition:d=yF}=e;const{items:g,containerId:p,activeIndex:v,disabled:y,disableTransforms:w,sortedRects:S,overIndex:C,useDragOverlay:k,strategy:R}=_.useContext(YM),E=kF(r,y),N=g.indexOf(l),j=_.useMemo(()=>({sortable:{containerId:p,index:N,items:g},...s}),[p,s,N,g]),D=_.useMemo(()=>g.slice(g.indexOf(l)),[g,l]),{rect:L,node:U,isOver:Y,setNodeRef:P}=dF({id:l,data:j,disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...h}}),{active:V,activatorEvent:I,activeNodeRect:W,attributes:K,setNodeRef:q,listeners:O,isDragging:F,over:H,setActivatorNodeRef:$,transform:M}=aF({id:l,data:j,attributes:{...wF,...n},disabled:E.draggable}),B=F7(P,q),X=!!V,A=X&&!w&&Sf(v)&&Sf(C),re=!k&&F,se=re&&A?M:null,te=A?se??(u??R)({rects:S,activeNodeRect:W,activeIndex:v,overIndex:C,index:N}):null,le=Sf(v)&&Sf(C)?a({id:l,items:g,activeIndex:v,overIndex:C}):N,pe=V==null?void 0:V.id,xe=_.useRef({activeId:pe,items:g,newIndex:le,containerId:p}),Me=g!==xe.current.items,Re=t({active:V,containerId:p,isDragging:F,isSorting:X,id:l,index:N,items:g,newIndex:xe.current.newIndex,previousItems:xe.current.items,previousContainerId:xe.current.containerId,transition:d,wasDragging:xe.current.activeId!=null}),je=SF({disabled:!Re,index:N,node:U,rect:L});return _.useEffect(()=>{X&&xe.current.newIndex!==le&&(xe.current.newIndex=le),p!==xe.current.containerId&&(xe.current.containerId=p),g!==xe.current.items&&(xe.current.items=g)},[X,le,p,g]),_.useEffect(()=>{if(pe===xe.current.activeId)return;if(pe!=null&&xe.current.activeId==null){xe.current.activeId=pe;return}const ft=setTimeout(()=>{xe.current.activeId=pe},50);return()=>clearTimeout(ft)},[pe]),{active:V,activeIndex:v,attributes:K,data:j,rect:L,index:N,newIndex:le,items:g,isOver:Y,isSorting:X,isDragging:F,listeners:O,node:U,overIndex:C,over:H,setNodeRef:B,setActivatorNodeRef:$,setDroppableNodeRef:P,setDraggableNodeRef:q,transform:je??te,transition:Xe()};function Xe(){if(je||Me&&xe.current.newIndex===N)return xF;if(!(re&&!V0(I)||!d)&&(X||Re))return cd.Transition.toString({...d,property:XM})}}function kF(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}Ft.Down,Ft.Right,Ft.Up,Ft.Left;const f2={idea:"border-amber-500/30 bg-amber-500/15 text-amber-700 dark:border-amber-500/40 dark:bg-amber-500/12 dark:text-amber-200",todo:"border-sky-500/30 bg-sky-500/15 text-sky-700 dark:border-sky-500/40 dark:bg-sky-500/12 dark:text-sky-200",progress:"border-indigo-500/30 bg-indigo-500/15 text-indigo-700 dark:border-indigo-500/40 dark:bg-indigo-500/12 dark:text-indigo-200",testing:"border-cyan-500/30 bg-cyan-500/15 text-cyan-700 dark:border-cyan-500/40 dark:bg-cyan-500/12 dark:text-cyan-200",done:"border-emerald-500/30 bg-emerald-500/15 text-emerald-700 dark:border-emerald-500/40 dark:bg-emerald-500/12 dark:text-emerald-200"};function m2(e,[t,n]){return Math.min(n,Math.max(t,e))}function Z0(e){const t=e+"CollectionProvider",[n,r]=eo(t),[s,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=S=>{const{scope:C,children:k}=S,R=ye.useRef(null),E=ye.useRef(new Map).current;return f.jsx(s,{scope:C,itemMap:E,collectionRef:R,children:k})};l.displayName=t;const u=e+"CollectionSlot",h=Fa(u),d=ye.forwardRef((S,C)=>{const{scope:k,children:R}=S,E=a(u,k),N=Ut(C,E.collectionRef);return f.jsx(h,{ref:N,children:R})});d.displayName=u;const g=e+"CollectionItemSlot",p="data-radix-collection-item",v=Fa(g),y=ye.forwardRef((S,C)=>{const{scope:k,children:R,...E}=S,N=ye.useRef(null),j=Ut(C,N),D=a(g,k);return ye.useEffect(()=>(D.itemMap.set(N,{ref:N,...E}),()=>void D.itemMap.delete(N))),f.jsx(v,{[p]:"",ref:j,children:R})});y.displayName=g;function w(S){const C=a(e+"CollectionConsumer",S);return ye.useCallback(()=>{const R=C.collectionRef.current;if(!R)return[];const E=Array.from(R.querySelectorAll(`[${p}]`));return Array.from(C.itemMap.values()).sort((D,L)=>E.indexOf(D.ref.current)-E.indexOf(L.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:l,Slot:d,ItemSlot:y},w,r]}var EF=_.createContext(void 0);function Q0(e){const t=_.useContext(EF);return e||t||"ltr"}function RF(e){const t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var TF=[" ","Enter","ArrowUp","ArrowDown"],NF=[" ","Enter"],Wa="Select",[Ep,Rp,MF]=Z0(Wa),[Ec]=eo(Wa,[MF,ea]),Tp=ea(),[AF,na]=Ec(Wa),[DF,jF]=Ec(Wa),ZM=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:a,value:l,defaultValue:u,onValueChange:h,dir:d,name:g,autoComplete:p,disabled:v,required:y,form:w}=e,S=Tp(t),[C,k]=_.useState(null),[R,E]=_.useState(null),[N,j]=_.useState(!1),D=Q0(d),[L,U]=lc({prop:r,defaultProp:s??!1,onChange:a,caller:Wa}),[Y,P]=lc({prop:l,defaultProp:u,onChange:h,caller:Wa}),V=_.useRef(null),I=C?w||!!C.closest("form"):!0,[W,K]=_.useState(new Set),q=Array.from(W).map(O=>O.props.value).join(";");return f.jsx(fp,{...S,children:f.jsxs(AF,{required:y,scope:t,trigger:C,onTriggerChange:k,valueNode:R,onValueNodeChange:E,valueNodeHasChildren:N,onValueNodeHasChildrenChange:j,contentId:Gs(),value:Y,onValueChange:P,open:L,onOpenChange:U,dir:D,triggerPointerDownPosRef:V,disabled:v,children:[f.jsx(Ep.Provider,{scope:t,children:f.jsx(DF,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(O=>{K(F=>new Set(F).add(O))},[]),onNativeOptionRemove:_.useCallback(O=>{K(F=>{const H=new Set(F);return H.delete(O),H})},[]),children:n})}),I?f.jsxs(w5,{"aria-hidden":!0,required:y,tabIndex:-1,name:g,autoComplete:p,value:Y,onChange:O=>P(O.target.value),disabled:v,form:w,children:[Y===void 0?f.jsx("option",{value:""}):null,Array.from(W)]},q):null]})})};ZM.displayName=Wa;var QM="SelectTrigger",JM=_.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,a=Tp(n),l=na(QM,n),u=l.disabled||r,h=Ut(t,l.onTriggerChange),d=Rp(n),g=_.useRef("touch"),[p,v,y]=C5(S=>{const C=d().filter(E=>!E.disabled),k=C.find(E=>E.value===l.value),R=k5(C,S,k);R!==void 0&&l.onValueChange(R.value)}),w=S=>{u||(l.onOpenChange(!0),y()),S&&(l.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return f.jsx(Rd,{asChild:!0,...a,children:f.jsx(Tt.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":S5(l.value)?"":void 0,...s,ref:h,onClick:Be(s.onClick,S=>{S.currentTarget.focus(),g.current!=="mouse"&&w(S)}),onPointerDown:Be(s.onPointerDown,S=>{g.current=S.pointerType;const C=S.target;C.hasPointerCapture(S.pointerId)&&C.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(w(S),S.preventDefault())}),onKeyDown:Be(s.onKeyDown,S=>{const C=p.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&v(S.key),!(C&&S.key===" ")&&TF.includes(S.key)&&(w(),S.preventDefault())})})})});JM.displayName=QM;var e5="SelectValue",t5=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:a,placeholder:l="",...u}=e,h=na(e5,n),{onValueNodeHasChildrenChange:d}=h,g=a!==void 0,p=Ut(t,h.onValueNodeChange);return br(()=>{d(g)},[d,g]),f.jsx(Tt.span,{...u,ref:p,style:{pointerEvents:"none"},children:S5(h.value)?f.jsx(f.Fragment,{children:l}):a})});t5.displayName=e5;var OF="SelectIcon",n5=_.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return f.jsx(Tt.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});n5.displayName=OF;var LF="SelectPortal",r5=e=>f.jsx(yc,{asChild:!0,...e});r5.displayName=LF;var Va="SelectContent",i5=_.forwardRef((e,t)=>{const n=na(Va,e.__scopeSelect),[r,s]=_.useState();if(br(()=>{s(new DocumentFragment)},[]),!n.open){const a=r;return a?Hi.createPortal(f.jsx(s5,{scope:e.__scopeSelect,children:f.jsx(Ep.Slot,{scope:e.__scopeSelect,children:f.jsx("div",{children:e.children})})}),a):null}return f.jsx(o5,{...e,ref:t})});i5.displayName=Va;var Ii=10,[s5,ra]=Ec(Va),zF="SelectContentImpl",PF=Fa("SelectContent.RemoveScroll"),o5=_.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:l,side:u,sideOffset:h,align:d,alignOffset:g,arrowPadding:p,collisionBoundary:v,collisionPadding:y,sticky:w,hideWhenDetached:S,avoidCollisions:C,...k}=e,R=na(Va,n),[E,N]=_.useState(null),[j,D]=_.useState(null),L=Ut(t,te=>N(te)),[U,Y]=_.useState(null),[P,V]=_.useState(null),I=Rp(n),[W,K]=_.useState(!1),q=_.useRef(!1);_.useEffect(()=>{if(E)return tp(E)},[E]),Jm();const O=_.useCallback(te=>{const[le,...pe]=I().map(Re=>Re.ref.current),[xe]=pe.slice(-1),Me=document.activeElement;for(const Re of te)if(Re===Me||(Re==null||Re.scrollIntoView({block:"nearest"}),Re===le&&j&&(j.scrollTop=0),Re===xe&&j&&(j.scrollTop=j.scrollHeight),Re==null||Re.focus(),document.activeElement!==Me))return},[I,j]),F=_.useCallback(()=>O([U,E]),[O,U,E]);_.useEffect(()=>{W&&F()},[W,F]);const{onOpenChange:H,triggerPointerDownPosRef:$}=R;_.useEffect(()=>{if(E){let te={x:0,y:0};const le=xe=>{var Me,Re;te={x:Math.abs(Math.round(xe.pageX)-(((Me=$.current)==null?void 0:Me.x)??0)),y:Math.abs(Math.round(xe.pageY)-(((Re=$.current)==null?void 0:Re.y)??0))}},pe=xe=>{te.x<=10&&te.y<=10?xe.preventDefault():E.contains(xe.target)||H(!1),document.removeEventListener("pointermove",le),$.current=null};return $.current!==null&&(document.addEventListener("pointermove",le),document.addEventListener("pointerup",pe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",le),document.removeEventListener("pointerup",pe,{capture:!0})}}},[E,H,$]),_.useEffect(()=>{const te=()=>H(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[H]);const[M,B]=C5(te=>{const le=I().filter(Me=>!Me.disabled),pe=le.find(Me=>Me.ref.current===document.activeElement),xe=k5(le,te,pe);xe&&setTimeout(()=>xe.ref.current.focus())}),X=_.useCallback((te,le,pe)=>{const xe=!q.current&&!pe;(R.value!==void 0&&R.value===le||xe)&&(Y(te),xe&&(q.current=!0))},[R.value]),A=_.useCallback(()=>E==null?void 0:E.focus(),[E]),re=_.useCallback((te,le,pe)=>{const xe=!q.current&&!pe;(R.value!==void 0&&R.value===le||xe)&&V(te)},[R.value]),se=r==="popper"?Ub:a5,Z=se===Ub?{side:u,sideOffset:h,align:d,alignOffset:g,arrowPadding:p,collisionBoundary:v,collisionPadding:y,sticky:w,hideWhenDetached:S,avoidCollisions:C}:{};return f.jsx(s5,{scope:n,content:E,viewport:j,onViewportChange:D,itemRefCallback:X,selectedItem:U,onItemLeave:A,itemTextRefCallback:re,focusSelectedItem:F,selectedItemText:P,position:r,isPositioned:W,searchRef:M,children:f.jsx(Sd,{as:PF,allowPinchZoom:!0,children:f.jsx(wd,{asChild:!0,trapped:R.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:Be(s,te=>{var le;(le=R.trigger)==null||le.focus({preventScroll:!0}),te.preventDefault()}),children:f.jsx(bc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:f.jsx(se,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:te=>te.preventDefault(),...k,...Z,onPlaced:()=>K(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:Be(k.onKeyDown,te=>{const le=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!le&&te.key.length===1&&B(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let xe=I().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);if(["ArrowUp","End"].includes(te.key)&&(xe=xe.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const Me=te.target,Re=xe.indexOf(Me);xe=xe.slice(Re+1)}setTimeout(()=>O(xe)),te.preventDefault()}})})})})})})});o5.displayName=zF;var BF="SelectItemAlignedPosition",a5=_.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,a=na(Va,n),l=ra(Va,n),[u,h]=_.useState(null),[d,g]=_.useState(null),p=Ut(t,L=>g(L)),v=Rp(n),y=_.useRef(!1),w=_.useRef(!0),{viewport:S,selectedItem:C,selectedItemText:k,focusSelectedItem:R}=l,E=_.useCallback(()=>{if(a.trigger&&a.valueNode&&u&&d&&S&&C&&k){const L=a.trigger.getBoundingClientRect(),U=d.getBoundingClientRect(),Y=a.valueNode.getBoundingClientRect(),P=k.getBoundingClientRect();if(a.dir!=="rtl"){const Me=P.left-U.left,Re=Y.left-Me,je=L.left-Re,Xe=L.width+je,ft=Math.max(Xe,U.width),pt=window.innerWidth-Ii,he=m2(Re,[Ii,Math.max(Ii,pt-ft)]);u.style.minWidth=Xe+"px",u.style.left=he+"px"}else{const Me=U.right-P.right,Re=window.innerWidth-Y.right-Me,je=window.innerWidth-L.right-Re,Xe=L.width+je,ft=Math.max(Xe,U.width),pt=window.innerWidth-Ii,he=m2(Re,[Ii,Math.max(Ii,pt-ft)]);u.style.minWidth=Xe+"px",u.style.right=he+"px"}const V=v(),I=window.innerHeight-Ii*2,W=S.scrollHeight,K=window.getComputedStyle(d),q=parseInt(K.borderTopWidth,10),O=parseInt(K.paddingTop,10),F=parseInt(K.borderBottomWidth,10),H=parseInt(K.paddingBottom,10),$=q+O+W+H+F,M=Math.min(C.offsetHeight*5,$),B=window.getComputedStyle(S),X=parseInt(B.paddingTop,10),A=parseInt(B.paddingBottom,10),re=L.top+L.height/2-Ii,se=I-re,Z=C.offsetHeight/2,te=C.offsetTop+Z,le=q+O+te,pe=$-le;if(le<=re){const Me=V.length>0&&C===V[V.length-1].ref.current;u.style.bottom="0px";const Re=d.clientHeight-S.offsetTop-S.offsetHeight,je=Math.max(se,Z+(Me?A:0)+Re+F),Xe=le+je;u.style.height=Xe+"px"}else{const Me=V.length>0&&C===V[0].ref.current;u.style.top="0px";const je=Math.max(re,q+S.offsetTop+(Me?X:0)+Z)+pe;u.style.height=je+"px",S.scrollTop=le-re+S.offsetTop}u.style.margin=`${Ii}px 0`,u.style.minHeight=M+"px",u.style.maxHeight=I+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[v,a.trigger,a.valueNode,u,d,S,C,k,a.dir,r]);br(()=>E(),[E]);const[N,j]=_.useState();br(()=>{d&&j(window.getComputedStyle(d).zIndex)},[d]);const D=_.useCallback(L=>{L&&w.current===!0&&(E(),R==null||R(),w.current=!1)},[E,R]);return f.jsx(HF,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:y,onScrollButtonChange:D,children:f.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:f.jsx(Tt.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});a5.displayName=BF;var IF="SelectPopperPosition",Ub=_.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Ii,...a}=e,l=Tp(n);return f.jsx(mp,{...l,...a,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Ub.displayName=IF;var[HF,J0]=Ec(Va,{}),$b="SelectViewport",l5=_.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,a=ra($b,n),l=J0($b,n),u=Ut(t,a.onViewportChange),h=_.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),f.jsx(Ep.Slot,{scope:n,children:f.jsx(Tt.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Be(s.onScroll,d=>{const g=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:v}=l;if(v!=null&&v.current&&p){const y=Math.abs(h.current-g.scrollTop);if(y>0){const w=window.innerHeight-Ii*2,S=parseFloat(p.style.minHeight),C=parseFloat(p.style.height),k=Math.max(S,C);if(k<w){const R=k+y,E=Math.min(w,R),N=R-E;p.style.height=E+"px",p.style.bottom==="0px"&&(g.scrollTop=N>0?N:0,p.style.justifyContent="flex-end")}}}h.current=g.scrollTop})})})]})});l5.displayName=$b;var c5="SelectGroup",[FF,UF]=Ec(c5),u5=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Gs();return f.jsx(FF,{scope:n,id:s,children:f.jsx(Tt.div,{role:"group","aria-labelledby":s,...r,ref:t})})});u5.displayName=c5;var d5="SelectLabel",h5=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=UF(d5,n);return f.jsx(Tt.div,{id:s.id,...r,ref:t})});h5.displayName=d5;var Mm="SelectItem",[$F,f5]=Ec(Mm),m5=_.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:a,...l}=e,u=na(Mm,n),h=ra(Mm,n),d=u.value===r,[g,p]=_.useState(a??""),[v,y]=_.useState(!1),w=Ut(t,R=>{var E;return(E=h.itemRefCallback)==null?void 0:E.call(h,R,r,s)}),S=Gs(),C=_.useRef("touch"),k=()=>{s||(u.onValueChange(r),u.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx($F,{scope:n,value:r,disabled:s,textId:S,isSelected:d,onItemTextChange:_.useCallback(R=>{p(E=>E||((R==null?void 0:R.textContent)??"").trim())},[]),children:f.jsx(Ep.ItemSlot,{scope:n,value:r,disabled:s,textValue:g,children:f.jsx(Tt.div,{role:"option","aria-labelledby":S,"data-highlighted":v?"":void 0,"aria-selected":d&&v,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...l,ref:w,onFocus:Be(l.onFocus,()=>y(!0)),onBlur:Be(l.onBlur,()=>y(!1)),onClick:Be(l.onClick,()=>{C.current!=="mouse"&&k()}),onPointerUp:Be(l.onPointerUp,()=>{C.current==="mouse"&&k()}),onPointerDown:Be(l.onPointerDown,R=>{C.current=R.pointerType}),onPointerMove:Be(l.onPointerMove,R=>{var E;C.current=R.pointerType,s?(E=h.onItemLeave)==null||E.call(h):C.current==="mouse"&&R.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Be(l.onPointerLeave,R=>{var E;R.currentTarget===document.activeElement&&((E=h.onItemLeave)==null||E.call(h))}),onKeyDown:Be(l.onKeyDown,R=>{var N;((N=h.searchRef)==null?void 0:N.current)!==""&&R.key===" "||(NF.includes(R.key)&&k(),R.key===" "&&R.preventDefault())})})})})});m5.displayName=Mm;var Bu="SelectItemText",p5=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...a}=e,l=na(Bu,n),u=ra(Bu,n),h=f5(Bu,n),d=jF(Bu,n),[g,p]=_.useState(null),v=Ut(t,k=>p(k),h.onItemTextChange,k=>{var R;return(R=u.itemTextRefCallback)==null?void 0:R.call(u,k,h.value,h.disabled)}),y=g==null?void 0:g.textContent,w=_.useMemo(()=>f.jsx("option",{value:h.value,disabled:h.disabled,children:y},h.value),[h.disabled,h.value,y]),{onNativeOptionAdd:S,onNativeOptionRemove:C}=d;return br(()=>(S(w),()=>C(w)),[S,C,w]),f.jsxs(f.Fragment,{children:[f.jsx(Tt.span,{id:h.textId,...a,ref:v}),h.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Hi.createPortal(a.children,l.valueNode):null]})});p5.displayName=Bu;var g5="SelectItemIndicator",v5=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return f5(g5,n).isSelected?f.jsx(Tt.span,{"aria-hidden":!0,...r,ref:t}):null});v5.displayName=g5;var Wb="SelectScrollUpButton",_5=_.forwardRef((e,t)=>{const n=ra(Wb,e.__scopeSelect),r=J0(Wb,e.__scopeSelect),[s,a]=_.useState(!1),l=Ut(t,r.onScrollButtonChange);return br(()=>{if(n.viewport&&n.isPositioned){let u=function(){const d=h.scrollTop>0;a(d)};const h=n.viewport;return u(),h.addEventListener("scroll",u),()=>h.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),s?f.jsx(y5,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:h}=n;u&&h&&(u.scrollTop=u.scrollTop-h.offsetHeight)}}):null});_5.displayName=Wb;var Vb="SelectScrollDownButton",b5=_.forwardRef((e,t)=>{const n=ra(Vb,e.__scopeSelect),r=J0(Vb,e.__scopeSelect),[s,a]=_.useState(!1),l=Ut(t,r.onScrollButtonChange);return br(()=>{if(n.viewport&&n.isPositioned){let u=function(){const d=h.scrollHeight-h.clientHeight,g=Math.ceil(h.scrollTop)<d;a(g)};const h=n.viewport;return u(),h.addEventListener("scroll",u),()=>h.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),s?f.jsx(y5,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:h}=n;u&&h&&(u.scrollTop=u.scrollTop+h.offsetHeight)}}):null});b5.displayName=Vb;var y5=_.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,a=ra("SelectScrollButton",n),l=_.useRef(null),u=Rp(n),h=_.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return _.useEffect(()=>()=>h(),[h]),br(()=>{var g;const d=u().find(p=>p.ref.current===document.activeElement);(g=d==null?void 0:d.ref.current)==null||g.scrollIntoView({block:"nearest"})},[u]),f.jsx(Tt.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Be(s.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:Be(s.onPointerMove,()=>{var d;(d=a.onItemLeave)==null||d.call(a),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:Be(s.onPointerLeave,()=>{h()})})}),WF="SelectSeparator",x5=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return f.jsx(Tt.div,{"aria-hidden":!0,...r,ref:t})});x5.displayName=WF;var qb="SelectArrow",VF=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Tp(n),a=na(qb,n),l=ra(qb,n);return a.open&&l.position==="popper"?f.jsx(pp,{...s,...r,ref:t}):null});VF.displayName=qb;var qF="SelectBubbleInput",w5=_.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=_.useRef(null),a=Ut(r,s),l=RF(t);return _.useEffect(()=>{const u=s.current;if(!u)return;const h=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(h,"value").set;if(l!==t&&g){const p=new Event("change",{bubbles:!0});g.call(u,t),u.dispatchEvent(p)}},[l,t]),f.jsx(Tt.select,{...n,style:{...JN,...n.style},ref:a,defaultValue:t})});w5.displayName=qF;function S5(e){return e===""||e===void 0}function C5(e){const t=$i(e),n=_.useRef(""),r=_.useRef(0),s=_.useCallback(l=>{const u=n.current+l;t(u),(function h(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>h(""),1e3))})(u)},[t]),a=_.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,a]}function k5(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let l=KF(e,Math.max(a,0));s.length===1&&(l=l.filter(d=>d!==n));const h=l.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return h!==n?h:void 0}function KF(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var GF=ZM,E5=JM,YF=t5,XF=n5,ZF=r5,R5=i5,QF=l5,JF=u5,T5=h5,ex=m5,N5=p5,M5=v5,A5=_5,D5=b5,j5=x5;const pr=GF,C_=JF,Sr=YF,ur=_.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(E5,{ref:r,className:me("flex h-9 w-full items-center justify-between gap-2 rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none transition-colors","placeholder:text-muted-foreground","focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50","[&>span]:line-clamp-1",e),...n,children:[t,f.jsx(XF,{asChild:!0,children:f.jsx(rp,{className:"h-4 w-4 shrink-0 opacity-50"})})]}));ur.displayName=E5.displayName;const O5=_.forwardRef(({className:e,...t},n)=>f.jsx(A5,{ref:n,className:me("flex cursor-default items-center justify-center py-1",e),...t,children:f.jsx(j6,{className:"h-4 w-4"})}));O5.displayName=A5.displayName;const L5=_.forwardRef(({className:e,...t},n)=>f.jsx(D5,{ref:n,className:me("flex cursor-default items-center justify-center py-1",e),...t,children:f.jsx(rp,{className:"h-4 w-4"})}));L5.displayName=D5.displayName;const dr=_.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>f.jsx(ZF,{children:f.jsxs(R5,{ref:s,className:me("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-border bg-background text-foreground shadow-md backdrop-blur-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[f.jsx(O5,{}),f.jsx(QF,{className:me("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),f.jsx(L5,{})]})}));dr.displayName=R5.displayName;const eU=_.forwardRef(({className:e,...t},n)=>f.jsx(T5,{ref:n,className:me("px-2 py-1.5 text-sm font-semibold",e),...t}));eU.displayName=T5.displayName;const Et=_.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(ex,{ref:r,className:me("relative flex w-full cursor-default select-none items-center rounded-md py-1.5 pl-2 pr-8 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(M5,{children:f.jsx(Wi,{className:"h-4 w-4"})})}),f.jsx(N5,{children:t})]}));Et.displayName=ex.displayName;const Qf=_.forwardRef(({className:e,children:t,thumbnail:n,thumbnailAlt:r="",...s},a)=>f.jsxs(ex,{ref:a,className:me("flex w-full cursor-default select-none items-center gap-2 rounded-md py-1.5 pl-2 pr-2 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[f.jsx("div",{className:"min-w-0 flex-1 truncate",children:f.jsx(N5,{children:t})}),f.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n?f.jsx("img",{src:n,alt:r,className:"h-5 w-9 rounded object-cover opacity-90"}):null,f.jsx("span",{className:"flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(M5,{children:f.jsx(Wi,{className:"h-4 w-4"})})})]})]}));Qf.displayName="SelectItemWithThumbnail";const tU=_.forwardRef(({className:e,...t},n)=>f.jsx(j5,{ref:n,className:me("-mx-1 my-1 h-px bg-border",e),...t}));tU.displayName=j5.displayName;var k_="rovingFocusGroup.onEntryFocus",nU={bubbles:!1,cancelable:!0},jd="RovingFocusGroup",[Kb,z5,rU]=Z0(jd),[iU,P5]=eo(jd,[rU]),[sU,oU]=iU(jd),B5=_.forwardRef((e,t)=>f.jsx(Kb.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(Kb.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(aU,{...e,ref:t})})}));B5.displayName=jd;var aU=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:h,onEntryFocus:d,preventScrollOnEntryFocus:g=!1,...p}=e,v=_.useRef(null),y=Ut(t,v),w=Q0(a),[S,C]=lc({prop:l,defaultProp:u??null,onChange:h,caller:jd}),[k,R]=_.useState(!1),E=$i(d),N=z5(n),j=_.useRef(!1),[D,L]=_.useState(0);return _.useEffect(()=>{const U=v.current;if(U)return U.addEventListener(k_,E),()=>U.removeEventListener(k_,E)},[E]),f.jsx(sU,{scope:n,orientation:r,dir:w,loop:s,currentTabStopId:S,onItemFocus:_.useCallback(U=>C(U),[C]),onItemShiftTab:_.useCallback(()=>R(!0),[]),onFocusableItemAdd:_.useCallback(()=>L(U=>U+1),[]),onFocusableItemRemove:_.useCallback(()=>L(U=>U-1),[]),children:f.jsx(Tt.div,{tabIndex:k||D===0?-1:0,"data-orientation":r,...p,ref:y,style:{outline:"none",...e.style},onMouseDown:Be(e.onMouseDown,()=>{j.current=!0}),onFocus:Be(e.onFocus,U=>{const Y=!j.current;if(U.target===U.currentTarget&&Y&&!k){const P=new CustomEvent(k_,nU);if(U.currentTarget.dispatchEvent(P),!P.defaultPrevented){const V=N().filter(O=>O.focusable),I=V.find(O=>O.active),W=V.find(O=>O.id===S),q=[I,W,...V].filter(Boolean).map(O=>O.ref.current);F5(q,g)}}j.current=!1}),onBlur:Be(e.onBlur,()=>R(!1))})})}),I5="RovingFocusGroupItem",H5=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:a,children:l,...u}=e,h=Gs(),d=a||h,g=oU(I5,n),p=g.currentTabStopId===d,v=z5(n),{onFocusableItemAdd:y,onFocusableItemRemove:w,currentTabStopId:S}=g;return _.useEffect(()=>{if(r)return y(),()=>w()},[r,y,w]),f.jsx(Kb.ItemSlot,{scope:n,id:d,focusable:r,active:s,children:f.jsx(Tt.span,{tabIndex:p?0:-1,"data-orientation":g.orientation,...u,ref:t,onMouseDown:Be(e.onMouseDown,C=>{r?g.onItemFocus(d):C.preventDefault()}),onFocus:Be(e.onFocus,()=>g.onItemFocus(d)),onKeyDown:Be(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){g.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const k=uU(C,g.orientation,g.dir);if(k!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let E=v().filter(N=>N.focusable).map(N=>N.ref.current);if(k==="last")E.reverse();else if(k==="prev"||k==="next"){k==="prev"&&E.reverse();const N=E.indexOf(C.currentTarget);E=g.loop?dU(E,N+1):E.slice(N+1)}setTimeout(()=>F5(E))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:S!=null}):l})})});H5.displayName=I5;var lU={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function cU(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function uU(e,t,n){const r=cU(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return lU[r]}function F5(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function dU(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var hU=B5,fU=H5,Gb=["Enter"," "],mU=["ArrowDown","PageUp","Home"],U5=["ArrowUp","PageDown","End"],pU=[...mU,...U5],gU={ltr:[...Gb,"ArrowRight"],rtl:[...Gb,"ArrowLeft"]},vU={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Od="Menu",[dd,_U,bU]=Z0(Od),[Ja,$5]=eo(Od,[bU,ea,P5]),Np=ea(),W5=P5(),[yU,el]=Ja(Od),[xU,Ld]=Ja(Od),V5=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:a,modal:l=!0}=e,u=Np(t),[h,d]=_.useState(null),g=_.useRef(!1),p=$i(a),v=Q0(s);return _.useEffect(()=>{const y=()=>{g.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>g.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),f.jsx(fp,{...u,children:f.jsx(yU,{scope:t,open:n,onOpenChange:p,content:h,onContentChange:d,children:f.jsx(xU,{scope:t,onClose:_.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:g,dir:v,modal:l,children:r})})})};V5.displayName=Od;var wU="MenuAnchor",tx=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Np(n);return f.jsx(Rd,{...s,...r,ref:t})});tx.displayName=wU;var nx="MenuPortal",[SU,q5]=Ja(nx,{forceMount:void 0}),K5=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,a=el(nx,t);return f.jsx(SU,{scope:t,forceMount:n,children:f.jsx(ji,{present:n||a.open,children:f.jsx(yc,{asChild:!0,container:s,children:r})})})};K5.displayName=nx;var Ti="MenuContent",[CU,rx]=Ja(Ti),G5=_.forwardRef((e,t)=>{const n=q5(Ti,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,a=el(Ti,e.__scopeMenu),l=Ld(Ti,e.__scopeMenu);return f.jsx(dd.Provider,{scope:e.__scopeMenu,children:f.jsx(ji,{present:r||a.open,children:f.jsx(dd.Slot,{scope:e.__scopeMenu,children:l.modal?f.jsx(kU,{...s,ref:t}):f.jsx(EU,{...s,ref:t})})})})}),kU=_.forwardRef((e,t)=>{const n=el(Ti,e.__scopeMenu),r=_.useRef(null),s=Ut(t,r);return _.useEffect(()=>{const a=r.current;if(a)return tp(a)},[]),f.jsx(ix,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Be(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),EU=_.forwardRef((e,t)=>{const n=el(Ti,e.__scopeMenu);return f.jsx(ix,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),RU=Fa("MenuContent.ScrollLock"),ix=_.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEntryFocus:h,onEscapeKeyDown:d,onPointerDownOutside:g,onFocusOutside:p,onInteractOutside:v,onDismiss:y,disableOutsideScroll:w,...S}=e,C=el(Ti,n),k=Ld(Ti,n),R=Np(n),E=W5(n),N=_U(n),[j,D]=_.useState(null),L=_.useRef(null),U=Ut(t,L,C.onContentChange),Y=_.useRef(0),P=_.useRef(""),V=_.useRef(0),I=_.useRef(null),W=_.useRef("right"),K=_.useRef(0),q=w?Sd:_.Fragment,O=w?{as:RU,allowPinchZoom:!0}:void 0,F=$=>{var te,le;const M=P.current+$,B=N().filter(pe=>!pe.disabled),X=document.activeElement,A=(te=B.find(pe=>pe.ref.current===X))==null?void 0:te.textValue,re=B.map(pe=>pe.textValue),se=IU(re,M,A),Z=(le=B.find(pe=>pe.textValue===se))==null?void 0:le.ref.current;(function pe(xe){P.current=xe,window.clearTimeout(Y.current),xe!==""&&(Y.current=window.setTimeout(()=>pe(""),1e3))})(M),Z&&setTimeout(()=>Z.focus())};_.useEffect(()=>()=>window.clearTimeout(Y.current),[]),Jm();const H=_.useCallback($=>{var B,X;return W.current===((B=I.current)==null?void 0:B.side)&&FU($,(X=I.current)==null?void 0:X.area)},[]);return f.jsx(CU,{scope:n,searchRef:P,onItemEnter:_.useCallback($=>{H($)&&$.preventDefault()},[H]),onItemLeave:_.useCallback($=>{var M;H($)||((M=L.current)==null||M.focus(),D(null))},[H]),onTriggerLeave:_.useCallback($=>{H($)&&$.preventDefault()},[H]),pointerGraceTimerRef:V,onPointerGraceIntentChange:_.useCallback($=>{I.current=$},[]),children:f.jsx(q,{...O,children:f.jsx(wd,{asChild:!0,trapped:s,onMountAutoFocus:Be(a,$=>{var M;$.preventDefault(),(M=L.current)==null||M.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:f.jsx(bc,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:d,onPointerDownOutside:g,onFocusOutside:p,onInteractOutside:v,onDismiss:y,children:f.jsx(hU,{asChild:!0,...E,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:j,onCurrentTabStopIdChange:D,onEntryFocus:Be(h,$=>{k.isUsingKeyboardRef.current||$.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(mp,{role:"menu","aria-orientation":"vertical","data-state":uA(C.open),"data-radix-menu-content":"",dir:k.dir,...R,...S,ref:U,style:{outline:"none",...S.style},onKeyDown:Be(S.onKeyDown,$=>{const B=$.target.closest("[data-radix-menu-content]")===$.currentTarget,X=$.ctrlKey||$.altKey||$.metaKey,A=$.key.length===1;B&&($.key==="Tab"&&$.preventDefault(),!X&&A&&F($.key));const re=L.current;if($.target!==re||!pU.includes($.key))return;$.preventDefault();const Z=N().filter(te=>!te.disabled).map(te=>te.ref.current);U5.includes($.key)&&Z.reverse(),PU(Z)}),onBlur:Be(e.onBlur,$=>{$.currentTarget.contains($.target)||(window.clearTimeout(Y.current),P.current="")}),onPointerMove:Be(e.onPointerMove,hd($=>{const M=$.target,B=K.current!==$.clientX;if($.currentTarget.contains(M)&&B){const X=$.clientX>K.current?"right":"left";W.current=X,K.current=$.clientX}}))})})})})})})});G5.displayName=Ti;var TU="MenuGroup",sx=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Tt.div,{role:"group",...r,ref:t})});sx.displayName=TU;var NU="MenuLabel",Y5=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Tt.div,{...r,ref:t})});Y5.displayName=NU;var Am="MenuItem",p2="menu.itemSelect",Mp=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,a=_.useRef(null),l=Ld(Am,e.__scopeMenu),u=rx(Am,e.__scopeMenu),h=Ut(t,a),d=_.useRef(!1),g=()=>{const p=a.current;if(!n&&p){const v=new CustomEvent(p2,{bubbles:!0,cancelable:!0});p.addEventListener(p2,y=>r==null?void 0:r(y),{once:!0}),$T(p,v),v.defaultPrevented?d.current=!1:l.onClose()}};return f.jsx(X5,{...s,ref:h,disabled:n,onClick:Be(e.onClick,g),onPointerDown:p=>{var v;(v=e.onPointerDown)==null||v.call(e,p),d.current=!0},onPointerUp:Be(e.onPointerUp,p=>{var v;d.current||(v=p.currentTarget)==null||v.click()}),onKeyDown:Be(e.onKeyDown,p=>{const v=u.searchRef.current!=="";n||v&&p.key===" "||Gb.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Mp.displayName=Am;var X5=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...a}=e,l=rx(Am,n),u=W5(n),h=_.useRef(null),d=Ut(t,h),[g,p]=_.useState(!1),[v,y]=_.useState("");return _.useEffect(()=>{const w=h.current;w&&y((w.textContent??"").trim())},[a.children]),f.jsx(dd.ItemSlot,{scope:n,disabled:r,textValue:s??v,children:f.jsx(fU,{asChild:!0,...u,focusable:!r,children:f.jsx(Tt.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:d,onPointerMove:Be(e.onPointerMove,hd(w=>{r?l.onItemLeave(w):(l.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Be(e.onPointerLeave,hd(w=>l.onItemLeave(w))),onFocus:Be(e.onFocus,()=>p(!0)),onBlur:Be(e.onBlur,()=>p(!1))})})})}),MU="MenuCheckboxItem",Z5=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return f.jsx(nA,{scope:e.__scopeMenu,checked:n,children:f.jsx(Mp,{role:"menuitemcheckbox","aria-checked":Dm(n)?"mixed":n,...s,ref:t,"data-state":ax(n),onSelect:Be(s.onSelect,()=>r==null?void 0:r(Dm(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Z5.displayName=MU;var Q5="MenuRadioGroup",[AU,DU]=Ja(Q5,{value:void 0,onValueChange:()=>{}}),J5=_.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,a=$i(r);return f.jsx(AU,{scope:e.__scopeMenu,value:n,onValueChange:a,children:f.jsx(sx,{...s,ref:t})})});J5.displayName=Q5;var eA="MenuRadioItem",tA=_.forwardRef((e,t)=>{const{value:n,...r}=e,s=DU(eA,e.__scopeMenu),a=n===s.value;return f.jsx(nA,{scope:e.__scopeMenu,checked:a,children:f.jsx(Mp,{role:"menuitemradio","aria-checked":a,...r,ref:t,"data-state":ax(a),onSelect:Be(r.onSelect,()=>{var l;return(l=s.onValueChange)==null?void 0:l.call(s,n)},{checkForDefaultPrevented:!1})})})});tA.displayName=eA;var ox="MenuItemIndicator",[nA,jU]=Ja(ox,{checked:!1}),rA=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,a=jU(ox,n);return f.jsx(ji,{present:r||Dm(a.checked)||a.checked===!0,children:f.jsx(Tt.span,{...s,ref:t,"data-state":ax(a.checked)})})});rA.displayName=ox;var OU="MenuSeparator",iA=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Tt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});iA.displayName=OU;var LU="MenuArrow",sA=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Np(n);return f.jsx(pp,{...s,...r,ref:t})});sA.displayName=LU;var zU="MenuSub",[gre,oA]=Ja(zU),Iu="MenuSubTrigger",aA=_.forwardRef((e,t)=>{const n=el(Iu,e.__scopeMenu),r=Ld(Iu,e.__scopeMenu),s=oA(Iu,e.__scopeMenu),a=rx(Iu,e.__scopeMenu),l=_.useRef(null),{pointerGraceTimerRef:u,onPointerGraceIntentChange:h}=a,d={__scopeMenu:e.__scopeMenu},g=_.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return _.useEffect(()=>g,[g]),_.useEffect(()=>{const p=u.current;return()=>{window.clearTimeout(p),h(null)}},[u,h]),f.jsx(tx,{asChild:!0,...d,children:f.jsx(X5,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":uA(n.open),...e,ref:m0(t,s.onTriggerChange),onClick:p=>{var v;(v=e.onClick)==null||v.call(e,p),!(e.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Be(e.onPointerMove,hd(p=>{a.onItemEnter(p),!p.defaultPrevented&&!e.disabled&&!n.open&&!l.current&&(a.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),g()},100))})),onPointerLeave:Be(e.onPointerLeave,hd(p=>{var y,w;g();const v=(y=n.content)==null?void 0:y.getBoundingClientRect();if(v){const S=(w=n.content)==null?void 0:w.dataset.side,C=S==="right",k=C?-5:5,R=v[C?"left":"right"],E=v[C?"right":"left"];a.onPointerGraceIntentChange({area:[{x:p.clientX+k,y:p.clientY},{x:R,y:v.top},{x:E,y:v.top},{x:E,y:v.bottom},{x:R,y:v.bottom}],side:S}),window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(p),p.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:Be(e.onKeyDown,p=>{var y;const v=a.searchRef.current!=="";e.disabled||v&&p.key===" "||gU[r.dir].includes(p.key)&&(n.onOpenChange(!0),(y=n.content)==null||y.focus(),p.preventDefault())})})})});aA.displayName=Iu;var lA="MenuSubContent",cA=_.forwardRef((e,t)=>{const n=q5(Ti,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,a=el(Ti,e.__scopeMenu),l=Ld(Ti,e.__scopeMenu),u=oA(lA,e.__scopeMenu),h=_.useRef(null),d=Ut(t,h);return f.jsx(dd.Provider,{scope:e.__scopeMenu,children:f.jsx(ji,{present:r||a.open,children:f.jsx(dd.Slot,{scope:e.__scopeMenu,children:f.jsx(ix,{id:u.contentId,"aria-labelledby":u.triggerId,...s,ref:d,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:g=>{var p;l.isUsingKeyboardRef.current&&((p=h.current)==null||p.focus()),g.preventDefault()},onCloseAutoFocus:g=>g.preventDefault(),onFocusOutside:Be(e.onFocusOutside,g=>{g.target!==u.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Be(e.onEscapeKeyDown,g=>{l.onClose(),g.preventDefault()}),onKeyDown:Be(e.onKeyDown,g=>{var y;const p=g.currentTarget.contains(g.target),v=vU[l.dir].includes(g.key);p&&v&&(a.onOpenChange(!1),(y=u.trigger)==null||y.focus(),g.preventDefault())})})})})})});cA.displayName=lA;function uA(e){return e?"open":"closed"}function Dm(e){return e==="indeterminate"}function ax(e){return Dm(e)?"indeterminate":e?"checked":"unchecked"}function PU(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function BU(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function IU(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let l=BU(e,Math.max(a,0));s.length===1&&(l=l.filter(d=>d!==n));const h=l.find(d=>d.toLowerCase().startsWith(s.toLowerCase()));return h!==n?h:void 0}function HU(e,t){const{x:n,y:r}=e;let s=!1;for(let a=0,l=t.length-1;a<t.length;l=a++){const u=t[a],h=t[l],d=u.x,g=u.y,p=h.x,v=h.y;g>r!=v>r&&n<(p-d)*(r-g)/(v-g)+d&&(s=!s)}return s}function FU(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return HU(n,t)}function hd(e){return t=>t.pointerType==="mouse"?e(t):void 0}var UU=V5,$U=tx,WU=K5,VU=G5,qU=sx,KU=Y5,GU=Mp,YU=Z5,XU=J5,ZU=tA,QU=rA,JU=iA,e$=sA,t$=aA,n$=cA,lx="ContextMenu",[r$]=eo(lx,[$5]),Nr=$5(),[i$,dA]=r$(lx),hA=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:s,modal:a=!0}=e,[l,u]=_.useState(!1),h=Nr(t),d=$i(r),g=_.useCallback(p=>{u(p),d(p)},[d]);return f.jsx(i$,{scope:t,open:l,onOpenChange:g,modal:a,children:f.jsx(UU,{...h,dir:s,open:l,onOpenChange:g,modal:a,children:n})})};hA.displayName=lx;var fA="ContextMenuTrigger",mA=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=e,a=dA(fA,n),l=Nr(n),u=_.useRef({x:0,y:0}),h=_.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...u.current})}),d=_.useRef(0),g=_.useCallback(()=>window.clearTimeout(d.current),[]),p=v=>{u.current={x:v.clientX,y:v.clientY},a.onOpenChange(!0)};return _.useEffect(()=>g,[g]),_.useEffect(()=>void(r&&g()),[r,g]),f.jsxs(f.Fragment,{children:[f.jsx($U,{...l,virtualRef:h}),f.jsx(Tt.span,{"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Be(e.onContextMenu,v=>{g(),p(v),v.preventDefault()}),onPointerDown:r?e.onPointerDown:Be(e.onPointerDown,kf(v=>{g(),d.current=window.setTimeout(()=>p(v),700)})),onPointerMove:r?e.onPointerMove:Be(e.onPointerMove,kf(g)),onPointerCancel:r?e.onPointerCancel:Be(e.onPointerCancel,kf(g)),onPointerUp:r?e.onPointerUp:Be(e.onPointerUp,kf(g))})]})});mA.displayName=fA;var s$="ContextMenuPortal",pA=e=>{const{__scopeContextMenu:t,...n}=e,r=Nr(t);return f.jsx(WU,{...r,...n})};pA.displayName=s$;var gA="ContextMenuContent",vA=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=dA(gA,n),a=Nr(n),l=_.useRef(!1);return f.jsx(VU,{...a,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:u=>{var h;(h=e.onCloseAutoFocus)==null||h.call(e,u),!u.defaultPrevented&&l.current&&u.preventDefault(),l.current=!1},onInteractOutside:u=>{var h;(h=e.onInteractOutside)==null||h.call(e,u),!u.defaultPrevented&&!s.modal&&(l.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)"}})});vA.displayName=gA;var o$="ContextMenuGroup",a$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Nr(n);return f.jsx(qU,{...s,...r,ref:t})});a$.displayName=o$;var l$="ContextMenuLabel",c$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Nr(n);return f.jsx(KU,{...s,...r,ref:t})});c$.displayName=l$;var u$="ContextMenuItem",_A=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Nr(n);return f.jsx(GU,{...s,...r,ref:t})});_A.displayName=u$;var d$="ContextMenuCheckboxItem",h$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Nr(n);return f.jsx(YU,{...s,...r,ref:t})});h$.displayName=d$;var f$="ContextMenuRadioGroup",m$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Nr(n);return f.jsx(XU,{...s,...r,ref:t})});m$.displayName=f$;var p$="ContextMenuRadioItem",g$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Nr(n);return f.jsx(ZU,{...s,...r,ref:t})});g$.displayName=p$;var v$="ContextMenuItemIndicator",_$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Nr(n);return f.jsx(QU,{...s,...r,ref:t})});_$.displayName=v$;var b$="ContextMenuSeparator",y$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Nr(n);return f.jsx(JU,{...s,...r,ref:t})});y$.displayName=b$;var x$="ContextMenuArrow",w$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Nr(n);return f.jsx(e$,{...s,...r,ref:t})});w$.displayName=x$;var S$="ContextMenuSubTrigger",C$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Nr(n);return f.jsx(t$,{...s,...r,ref:t})});C$.displayName=S$;var k$="ContextMenuSubContent",E$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Nr(n);return f.jsx(n$,{...s,...r,ref:t,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)"}})});E$.displayName=k$;function kf(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var R$=hA,T$=mA,N$=pA,bA=vA,yA=_A;const xA=R$,wA=T$,cx=_.forwardRef(({className:e,...t},n)=>f.jsx(N$,{children:f.jsx(bA,{ref:n,className:me("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg backdrop-blur-md outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...t})}));cx.displayName=bA.displayName;const jm=_.forwardRef(({className:e,...t},n)=>f.jsx(yA,{ref:n,className:me("relative flex cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));jm.displayName=yA.displayName;function SA({open:e,onOpenChange:t,position:n,children:r}){return f.jsxs(EM,{open:e,onOpenChange:t,children:[f.jsx(E7,{style:n?{position:"fixed",left:n.x,top:n.y,width:0,height:0}:void 0}),f.jsx(RM,{children:f.jsx(I0,{side:"bottom",align:"start",sideOffset:4,onOpenAutoFocus:s=>s.preventDefault(),className:me("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg backdrop-blur-md","animate-in fade-in-0 zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95"),children:r})})]})}function Yb({onSelect:e,className:t,children:n}){return f.jsx("button",{type:"button",className:me("relative flex w-full cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium outline-hidden transition-colors","hover:bg-accent focus:bg-accent",t),onPointerDown:r=>{r.preventDefault(),e()},children:n})}function M$({onRemove:e,children:t,mobileMenuPosition:n,onMobileMenuClose:r,skipContextMenu:s}){return f.jsxs(f.Fragment,{children:[s?t:f.jsxs(xA,{children:[f.jsx(wA,{asChild:!0,children:t}),f.jsx(cx,{children:f.jsxs(jm,{onSelect:a=>{a.stopPropagation(),e()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[f.jsx(id,{className:"h-4 w-4"}),f.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})})]}),f.jsx(SA,{open:!!n,onOpenChange:a=>{a||r==null||r()},position:n??null,children:f.jsxs(Yb,{onSelect:()=>{r==null||r(),e()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[f.jsx(id,{className:"h-4 w-4"}),f.jsx("span",{children:"Hide"})]})})]})}function A$({onRename:e,onDelete:t,children:n,mobileMenuPosition:r,onMobileMenuClose:s,skipContextMenu:a}){return f.jsxs(f.Fragment,{children:[a?n:f.jsxs(xA,{children:[f.jsx(wA,{asChild:!0,children:n}),f.jsxs(cx,{children:[f.jsxs(jm,{onSelect:l=>{l.stopPropagation(),e()},children:[f.jsx(pm,{className:"h-4 w-4"}),f.jsx("span",{className:"text-xs font-medium",children:"Rename Feature"})]}),f.jsxs(jm,{onSelect:l=>{l.stopPropagation(),t()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[f.jsx(id,{className:"h-4 w-4"}),f.jsx("span",{className:"text-xs font-medium",children:"Delete Feature"})]})]})]}),f.jsxs(SA,{open:!!r,onOpenChange:l=>{l||s==null||s()},position:r??null,children:[f.jsxs(Yb,{onSelect:()=>{s==null||s(),e()},children:[f.jsx(pm,{className:"h-4 w-4"}),f.jsx("span",{children:"Rename Feature"})]}),f.jsxs(Yb,{onSelect:()=>{s==null||s(),t()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[f.jsx(id,{className:"h-4 w-4"}),f.jsx("span",{children:"Delete Feature"})]})]})]})}function Ap(e){const[t,n]=_.useState(()=>typeof window>"u"?!1:window.matchMedia(e).matches);return _.useEffect(()=>{const r=window.matchMedia(e),s=()=>n(r.matches);return s(),r.addEventListener?(r.addEventListener("change",s),()=>r.removeEventListener("change",s)):(r.addListener(s),()=>r.removeListener(s))},[e]),t}function CA({iconDataUrl:e,alt:t,className:n,fallback:r=null}){return e?f.jsx("img",{src:e,alt:t,className:me("shrink-0 object-contain",n)}):f.jsx(f.Fragment,{children:r})}const g2=e=>{let t;const n=new Set,r=(d,g)=>{const p=typeof d=="function"?d(t):d;if(!Object.is(p,t)){const v=t;t=g??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(y=>y(t,v))}},s=()=>t,u={setState:r,getState:s,getInitialState:()=>h,subscribe:d=>(n.add(d),()=>n.delete(d))},h=t=e(r,s,u);return u},D$=(e=>e?g2(e):g2),j$=e=>e;function O$(e,t=j$){const n=ye.useSyncExternalStore(e.subscribe,ye.useCallback(()=>t(e.getState()),[e,t]),ye.useCallback(()=>t(e.getInitialState()),[e,t]));return ye.useDebugValue(n),n}const L$=e=>{const t=D$(e),n=r=>O$(t,r);return Object.assign(n,t),n},no=(e=>L$);function z$(e,t){let n;try{n=e()}catch{return}return{getItem:s=>{var a;const l=h=>h===null?null:JSON.parse(h,void 0),u=(a=n.getItem(s))!=null?a:null;return u instanceof Promise?u.then(l):l(u)},setItem:(s,a)=>n.setItem(s,JSON.stringify(a,void 0)),removeItem:s=>n.removeItem(s)}}const Xb=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Xb(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Xb(r)(n)}}}},P$=(e,t)=>(n,r,s)=>{let a={storage:z$(()=>window.localStorage),partialize:C=>C,version:0,merge:(C,k)=>({...k,...C}),...t},l=!1,u=0;const h=new Set,d=new Set;let g=a.storage;if(!g)return e((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...C)},r,s);const p=()=>{const C=a.partialize({...r()});return g.setItem(a.name,{state:C,version:a.version})},v=s.setState;s.setState=(C,k)=>(v(C,k),p());const y=e((...C)=>(n(...C),p()),r,s);s.getInitialState=()=>y;let w;const S=()=>{var C,k;if(!g)return;const R=++u;l=!1,h.forEach(N=>{var j;return N((j=r())!=null?j:y)});const E=((k=a.onRehydrateStorage)==null?void 0:k.call(a,(C=r())!=null?C:y))||void 0;return Xb(g.getItem.bind(g))(a.name).then(N=>{if(N)if(typeof N.version=="number"&&N.version!==a.version){if(a.migrate){const j=a.migrate(N.state,N.version);return j instanceof Promise?j.then(D=>[!0,D]):[!0,j]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,N.state];return[!1,void 0]}).then(N=>{var j;if(R!==u)return;const[D,L]=N;if(w=a.merge(L,(j=r())!=null?j:y),n(w,!0),D)return p()}).then(()=>{R===u&&(E==null||E(w,void 0),w=r(),l=!0,d.forEach(N=>N(w)))}).catch(N=>{R===u&&(E==null||E(void 0,N))})};return s.persist={setOptions:C=>{a={...a,...C},C.storage&&(g=C.storage)},clearStorage:()=>{g==null||g.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>S(),hasHydrated:()=>l,onHydrate:C=>(h.add(C),()=>{h.delete(C)}),onFinishHydration:C=>(d.add(C),()=>{d.delete(C)})},a.skipHydration||S(),w||y},ro=P$,gn=no()(ro(e=>({themePreference:"system",colorTheme:"default",customAppearance:"system",backgroundImage:null,backgroundOpacity:1,backgroundBlur:0,showProjectIconsInSidebar:!0,setThemePreference:t=>e({themePreference:t}),setColorTheme:t=>e({colorTheme:t}),setCustomAppearance:t=>e({customAppearance:t}),setBackgroundImage:t=>e({backgroundImage:t}),setBackgroundOpacity:t=>e({backgroundOpacity:t}),setBackgroundBlur:t=>e({backgroundBlur:t}),setShowProjectIconsInSidebar:t=>e({showProjectIconsInSidebar:t})}),{name:"theme-settings"})),kA=8;function Zb(e,t){return!e.has(t)}function E_(e,t,n){const r=e.map(l=>l.featureId),s=r.indexOf(t),a=r.indexOf(n);return s===-1||a===-1||s===a?null:kp(r,s,a)}function B$(e){return{activeFeatures:e.filter(t=>t.stage!=="done"),completedFeatures:e.filter(t=>t.stage==="done")}}function I$(e,t){return t?e:e.slice(0,kA)}function H$(e,t){return e.map(n=>`feature:${n.featureId}`).filter(n=>!t.has(n))}function v2({feature:e,groupKey:t,collapsedSections:n,onToggleSection:r,renderChatRow:s,onNewLocalChat:a,onRenameFeature:l,onDeleteFeature:u,onSetFeatureBrowserState:h,onSetFeatureStage:d,kanbanStatusesEnabled:g=!0,showAllChats:p,onToggleShowAllChats:v,draggedFeatureId:y,draggedChatId:w,hoveredDropTarget:S,isTouchDevice:C,onFeatureDragStart:k,onFeatureDragEnd:R,onFeatureDrop:E,onChatDrop:N,onTouchDragMove:j,onTouchDragEnd:D,onChatDragStart:L,onChatDragEnd:U}){const Y=`feature:${e.featureId}`,P=Zb(n,Y),V=w!==null,I=I$(e.chats,p),W=Math.max(0,e.chats.length-kA),K=W>0,[q,O]=_.useState(null);function F(){r(Y),h==null||h(e.featureId,P?"CLOSED":"OPEN")}const H=_.useRef(null),{touchRef:$,isDragging:M,isArmed:B,dragPosition:X}=F0({enabled:C,visualElementRef:H,onTap:F,onContextMenu:Z=>O(Z),onDragStart:()=>k(e.featureId),onDragMove:({x:Z,y:te,elementBelow:le})=>j(Z,te,le),onDragEnd:({x:Z,y:te,elementBelow:le})=>D(Z,te,le)}),A=y===e.featureId||M,re=f.jsxs("div",{ref:H,"data-feature-drop-target":e.featureId,draggable:!C,onDragStart:C?void 0:()=>k(e.featureId),onDragEnd:C?void 0:R,onDragOver:C?void 0:Z=>{if(y&&y!==e.featureId){Z.preventDefault();return}V&&Z.preventDefault()},onDrop:C?void 0:Z=>{if(Z.preventDefault(),y&&y!==e.featureId){E(y,e.featureId);return}w&&N(w,e.featureId)},className:me("rounded-lg border border-border/60 bg-muted/10 transition-all duration-150 select-none",V&&!C&&"border-dashed hover:border-primary/60 hover:bg-primary/5",S===e.featureId&&"border-primary/60 bg-primary/5",B&&"scale-[1.03] shadow-md ring-2 ring-primary/50 bg-card",A&&!B&&"opacity-20 scale-[0.98]"),children:[f.jsxs("div",{ref:C?$:void 0,className:"flex items-center gap-2 px-2 py-1.5",children:[C?f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button","data-no-touch-drag":!0,onClick:F,className:"flex shrink-0 items-center",children:f.jsx(Tr,{className:me("size-3 transition-transform",P&&"rotate-90")})}),f.jsx(h_,{className:"size-3.5 shrink-0 text-muted-foreground"}),f.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:e.title})]}):f.jsxs("button",{type:"button",onClick:F,className:"flex min-w-0 flex-1 basis-0 items-center gap-2 text-left",children:[f.jsx(Tr,{className:me("size-3 transition-transform",P&&"rotate-90")}),f.jsx(h_,{className:"size-3.5 text-muted-foreground"}),f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:e.title})}),f.jsx(Fi,{side:"right",sideOffset:4,children:e.title})]})]}),g?f.jsxs(pr,{value:e.stage,onValueChange:Z=>d==null?void 0:d(e.featureId,Z),children:[f.jsx(ur,{"data-no-touch-drag":!0,className:me("h-7 w-auto min-w-[70px] shrink-0 items-center gap-1 rounded-full px-2 pr-1.5 text-[10px] font-semibold leading-none tracking-[0.04em] shadow-none focus:ring-0 focus:ring-offset-0 [&>span]:flex [&>span]:items-center [&>span]:leading-none [&>svg]:size-3 [&>svg]:shrink-0 [&>svg]:translate-y-0 [&>svg]:opacity-60",f2[e.stage]),children:f.jsx(Sr,{children:Zk[e.stage]})}),f.jsx(dr,{children:m7.map(Z=>f.jsx(Et,{value:Z,className:me("text-[11px] font-medium",Z===e.stage&&f2[Z]),children:Zk[Z]},Z))})]}):null,a?f.jsx(tt,{variant:"ghost",size:"icon",className:"h-6 w-6","data-no-touch-drag":!0,onClick:()=>a(t,e.featureId),title:"New chat in feature",children:f.jsx(TN,{className:"size-3.5"})}):null]}),P?f.jsxs("div",{className:"space-y-[2px] border-t border-border/50 p-1 pl-3",children:[I.map(Z=>s(Z,{draggable:!0,onDragStart:te=>L(te.chatId),onDragEnd:U,isTouchDevice:C,onTouchDragMove:j,onTouchDragEnd:D})),K?f.jsx("div",{className:"pt-1",children:f.jsx(tt,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground",onClick:v,children:p?"Show less":`Show ${W} more`})}):null]}):null]}),se=f.jsxs(MM,{position:X,children:[f.jsx(h_,{className:"size-3.5 shrink-0 text-primary"}),f.jsx("span",{className:"text-sm font-medium truncate",children:e.title})]});return u?f.jsxs(f.Fragment,{children:[f.jsx(A$,{onRename:()=>l==null?void 0:l(e.featureId),onDelete:()=>u(e.featureId),mobileMenuPosition:q,onMobileMenuClose:()=>O(null),skipContextMenu:C,children:re}),se]}):f.jsxs(f.Fragment,{children:[re,se]})}function F$({group:e,collapsedSections:t,onToggleSection:n,renderChatRow:r,onNewLocalChat:s,onCreateFeature:a,onRenameFeature:l,onDeleteFeature:u,onSetProjectBrowserState:h,onSetProjectGeneralChatsBrowserState:d,onSetFeatureBrowserState:g,onSetFeatureStage:p,onSetChatFeature:v,onReorderFeatures:y,onRemoveProject:w,isConnected:S,startingLocalPath:C,folderGroupsEnabled:k=!0,kanbanStatusesEnabled:R=!0}){const E=gn(we=>we.showProjectIconsInSidebar),{groupKey:N,localPath:j,features:D,generalChats:L}=e,{activeFeatures:U,completedFeatures:Y}=_.useMemo(()=>B$(D),[D]),P=`project:${N}`,V=`general:${N}`,I=Zb(t,P),W=D.length===0||Zb(t,V),[K,q]=_.useState(null),[O,F]=_.useState(null),[H,$]=_.useState(null),[M,B]=_.useState(!1),[X,A]=_.useState(!1),[re,se]=_.useState({}),[Z,te]=_.useState(null),le=Ap("(pointer: coarse)"),pe=k&&!M?L.slice(0,10):L,xe=k&&L.length>10,{attributes:Me,listeners:Re,setNodeRef:je,setActivatorNodeRef:Xe,transform:ft,transition:pt,isDragging:he}=CF({id:N}),Le=_.useRef(null),Ae={transform:cd.Translate.toString(ft),transition:pt};function nt(){n(P),h==null||h(N,I?"CLOSED":"OPEN")}function gt(){n(V),d==null||d(N,W?"CLOSED":"OPEN")}function qe(we){se(Ie=>({...Ie,[we]:!Ie[we]}))}function vt(we){we.stopPropagation();for(const Ie of H$(D,t))n(Ie);for(const Ie of D)g==null||g(Ie.featureId,"CLOSED")}function Se(we){if(!we)return null;const Ie=we.closest("[data-feature-drop-target]");return Ie?{type:"feature",featureId:Ie.getAttribute("data-feature-drop-target")}:we.closest(`[data-general-chats-drop-target="${N}"]`)?{type:"general"}:null}function De(we,Ie,ot){const rt=Le.current;if(rt){const St=rt.getBoundingClientRect(),at=60;Ie<St.top+at?rt.scrollBy(0,-6):Ie>St.bottom-at&&rt.scrollBy(0,6)}const ze=Se(ot);$((ze==null?void 0:ze.type)==="feature"?ze.featureId:null)}function ce(we,Ie,ot){const rt=Se(ot);if(O){if((rt==null?void 0:rt.type)==="feature"&&rt.featureId!==O&&y){const ze=E_(D,O,rt.featureId);ze&&y(N,ze)}F(null)}else K&&v&&((rt==null?void 0:rt.type)==="feature"?v(K,rt.featureId):(rt==null?void 0:rt.type)==="general"&&v(K,null),q(null));$(null)}const be=_.useRef(null),{touchRef:Oe}=F0({enabled:le&&!!w,onTap:nt,onContextMenu:we=>te(we)}),We=f.jsxs("div",{ref:we=>{Xe(we),be.current=we,le&&w&&Oe(we)},className:me("sticky top-0 bg-background dark:bg-card z-10 relative p-[10px] flex items-center justify-between cursor-grab active:cursor-grabbing select-none",he&&"cursor-grabbing"),onClick:le?void 0:nt,...Re,children:[f.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[f.jsx("span",{className:"relative size-3.5 shrink-0 cursor-pointer",children:f.jsx(Tr,{className:me("translate-y-[1px] size-3.5 shrink-0 text-slate-400 transition-transform duration-200",I&&"rotate-90")})}),E?f.jsx(CA,{iconDataUrl:e.iconDataUrl,alt:`${e.title||km(j)} icon`,className:"size-5",fallback:f.jsx("span",{className:"size-5 shrink-0","aria-hidden":"true"})}):null,f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsx("span",{className:"truncate max-w-[180px] whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:e.title||km(j)})}),f.jsx(Fi,{side:"right",sideOffset:4,children:j})]})]}),f.jsxs("div",{className:"absolute right-2 flex items-center gap-1",children:[a?f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsx(tt,{variant:"ghost",size:"icon",className:"h-5.5 w-5.5 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100","data-no-touch-drag":!0,onClick:we=>{we.stopPropagation(),a(N)},children:f.jsx(wN,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),f.jsx(Fi,{side:"right",sideOffset:4,children:"New feature"})]}):null,D.length>0?f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsx(tt,{variant:"ghost",size:"icon",className:"h-5.5 w-5.5 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100","data-no-touch-drag":!0,onClick:vt,children:f.jsx(L6,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),f.jsx(Fi,{side:"right",sideOffset:4,children:"Close all feature folders"})]}):null,s?f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsx(tt,{variant:"ghost",size:"icon",className:me("h-5.5 w-5.5 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100",(!S||C===j)&&"opacity-50 cursor-not-allowed"),disabled:!S||C===j,"data-no-touch-drag":!0,onClick:we=>{we.stopPropagation(),s(N)},children:C===j?f.jsx(oi,{className:"size-4 text-slate-500 dark:text-slate-400 animate-spin"}):f.jsx(TN,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),f.jsx(Fi,{side:"right",sideOffset:4,children:S?"New general chat":`Start ${Pn} to connect`})]}):null]})]});return f.jsxs("div",{ref:we=>{je(we),Le.current=(we==null?void 0:we.closest("[data-sidebar-scroll]"))??null},style:Ae,className:me("group/section",he&&"opacity-50 shadow-lg z-50 relative"),...Me,children:[w?f.jsx(M$,{onRemove:()=>w(N),mobileMenuPosition:Z,onMobileMenuClose:()=>te(null),skipContextMenu:le,children:We}):We,I?f.jsxs("div",{className:"mb-2 space-y-2",children:[k&&U.length>0?f.jsx("section",{className:"space-y-2 pl-6",children:U.map(we=>f.jsx(v2,{feature:we,groupKey:N,collapsedSections:t,onToggleSection:n,renderChatRow:r,onNewLocalChat:s,onRenameFeature:l,onDeleteFeature:u,onSetFeatureBrowserState:g,onSetFeatureStage:p,kanbanStatusesEnabled:R,showAllChats:!!re[we.featureId],onToggleShowAllChats:()=>qe(we.featureId),draggedFeatureId:O,draggedChatId:K,hoveredDropTarget:H,isTouchDevice:le,onFeatureDragStart:Ie=>F(Ie),onFeatureDragEnd:()=>F(null),onFeatureDrop:(Ie,ot)=>{const rt=E_(D,Ie,ot);F(null),rt&&(y==null||y(N,rt))},onChatDrop:(Ie,ot)=>{v==null||v(Ie,ot),q(null)},onTouchDragMove:De,onTouchDragEnd:ce,onChatDragStart:Ie=>q(Ie),onChatDragEnd:()=>q(null)},we.featureId))}):null,k&&Y.length>0?f.jsxs("section",{className:"pl-6",children:[f.jsxs("button",{type:"button",onClick:()=>A(we=>!we),className:"flex w-full items-center gap-2 px-2 py-1 text-left text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:[f.jsx(Tr,{className:me("size-3 transition-transform",X&&"rotate-90")}),f.jsx("span",{children:X?"Hide completed":"Show completed"}),f.jsx("span",{className:"ml-auto",children:Y.length})]}),X?f.jsx("div",{className:"space-y-2 pt-1",children:Y.map(we=>f.jsx(v2,{feature:we,groupKey:N,collapsedSections:t,onToggleSection:n,renderChatRow:r,onNewLocalChat:s,onRenameFeature:l,onDeleteFeature:u,onSetFeatureBrowserState:g,onSetFeatureStage:p,kanbanStatusesEnabled:R,showAllChats:!!re[we.featureId],onToggleShowAllChats:()=>qe(we.featureId),draggedFeatureId:O,draggedChatId:K,hoveredDropTarget:H,isTouchDevice:le,onFeatureDragStart:Ie=>F(Ie),onFeatureDragEnd:()=>F(null),onFeatureDrop:(Ie,ot)=>{const rt=E_(D,Ie,ot);F(null),rt&&(y==null||y(N,rt))},onChatDrop:(Ie,ot)=>{v==null||v(Ie,ot),q(null)},onTouchDragMove:De,onTouchDragEnd:ce,onChatDragStart:Ie=>q(Ie),onChatDragEnd:()=>q(null)},we.featureId))}):null]}):null,L.length>0?f.jsxs("section",{"data-general-chats-drop-target":N,onDragOver:K&&!le?we=>we.preventDefault():void 0,onDrop:K&&!le&&v?we=>{we.preventDefault(),v(K,null),q(null)}:void 0,children:[k?f.jsxs("button",{type:"button",onClick:gt,className:"flex w-full items-center gap-2 px-4 py-1 text-left text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:[f.jsx(Tr,{className:me("size-3 transition-transform",W&&"rotate-90")}),f.jsx("span",{children:"General Chats"}),f.jsx("span",{className:"ml-auto",children:L.length})]}):null,!k||W?f.jsxs("div",{className:me("space-y-[2px]",k?"pl-7":"pl-4"),children:[pe.map(we=>r(we,{draggable:!0,onDragStart:Ie=>q(Ie.chatId),onDragEnd:()=>q(null),isTouchDevice:le,onTouchDragMove:De,onTouchDragEnd:ce})),xe?f.jsx("div",{className:"pt-1",children:f.jsx(tt,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground",onClick:()=>B(we=>!we),children:M?"Show less":`Show ${L.length-10} more`})}):null]}):null]}):null]}):null]})}function U$({projectGroups:e,collapsedSections:t,onToggleSection:n,onSetProjectBrowserState:r,onSetProjectGeneralChatsBrowserState:s,renderChatRow:a,onNewLocalChat:l,onCreateFeature:u,onRenameFeature:h,onDeleteFeature:d,onSetFeatureBrowserState:g,onSetFeatureStage:p,onSetChatFeature:v,onReorderFeatures:y,onRemoveProject:w,onReorderGroups:S,isConnected:C,startingLocalPath:k,folderGroupsEnabled:R=!0,kanbanStatusesEnabled:E=!0}){const N=tH(y_(X0,{activationConstraint:{distance:8}}),y_(UM,{activationConstraint:{delay:250,tolerance:5}}),y_(G0)),j=_.useMemo(()=>e.map(Y=>Y.groupKey),[e]),D=_.useRef(null);function L(Y){const P=Y.active.id;t.has(P)?D.current=null:(D.current=P,n(P))}function U(Y){const{active:P,over:V}=Y;if(V&&P.id!==V.id&&S){const I=j.indexOf(P.id),W=j.indexOf(V.id);I!==-1&&W!==-1&&S(kp(j,I,W))}if(D.current){const I=D.current;D.current=null,requestAnimationFrame(()=>n(I))}}return f.jsx(iF,{sensors:N,collisionDetection:oH,onDragStart:L,onDragEnd:U,children:f.jsx(vF,{items:j,strategy:pF,children:e.map(Y=>f.jsx(F$,{group:Y,collapsedSections:t,onToggleSection:n,onSetProjectBrowserState:r,onSetProjectGeneralChatsBrowserState:s,renderChatRow:a,onNewLocalChat:l,onCreateFeature:u,onRenameFeature:h,onDeleteFeature:d,onSetFeatureBrowserState:g,onSetFeatureStage:p,onSetChatFeature:v,onReorderFeatures:y,onRemoveProject:w,onReorderGroups:S,isConnected:C,startingLocalPath:k,folderGroupsEnabled:R,kanbanStatusesEnabled:E},Y.groupKey))})})}const EA=`${_p}provider-usage-collapsed`,RA=`${_p}provider-usage-mode`,$$=qo.map(e=>e.id),W$=["claude","codex"],Qb=Object.fromEntries(qo.map(e=>[e.id,e.label]));function _2(e){return e===null?"bg-muted":e>=90?"bg-red-500":e>=75?"bg-amber-500":"bg-emerald-500"}function R_(e){return e===null?"N/A":`${e.toFixed(1)}%`}function b2(e,t){if(t!=null&&t.trim())return`Resets ${t.trim()}`;if(e===null)return null;const n=Date.now();if(e<=n)return"Limit may have reset";const r=e-n,s=Math.ceil(r/6e4);return s<60?`Resets in ${s} min`:`Resets at ${new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}function V$(){try{return localStorage.getItem(EA)==="true"}catch{return!1}}function q$(){try{return localStorage.getItem(RA)==="weekly"?"weekly":"session"}catch{return"session"}}function K$(e){try{localStorage.setItem(EA,String(e))}catch{}}function G$(e){try{localStorage.setItem(RA,e)}catch{}}function y2(e){const{entry:t,mode:n,isPending:r,onRefreshProviderUsage:s,onOpenProviderLogin:a}=e,l=Cm[t.provider],u=e.labelOverride??Qb[t.provider],h=t.availability==="unavailable",d=t.availability==="login_required",g=t.availability==="stale",p=t.provider==="cursor",v=e.percentOverride!==void 0?e.percentOverride:n==="weekly"?t.weeklyLimitUsedPercent??null:t.sessionLimitUsedPercent,y=v,w=p?null:n==="weekly"?b2(t.weeklyRateLimitResetAt??null,t.weeklyRateLimitResetLabel??null):b2(t.rateLimitResetAt,t.rateLimitResetLabel),S=[];d?S.push("Login required to fetch Cursor usage"):h?S.push("Usage data unavailable"):(e.bars?S.push("Cursor limit usage"):v!==null&&S.push(`${R_(v)} of ${n} limit used`),w&&S.push(w),g&&S.push("Data may be outdated"),S.length===0&&S.push("No usage data yet")),t.statusDetail&&S.push(t.statusDetail.replaceAll("_"," "));const C=!e.hideActions&&p&&d,k=p&&!e.hideActions&&h&&!d&&t.statusDetail!=="unsupported_platform";return f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsxs("div",{className:me("flex flex-col",g&&"opacity-50"),children:[f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded-md",children:[f.jsx(l,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),f.jsx("span",{className:"text-[11px] text-muted-foreground w-11 shrink-0",children:u}),h&&!e.bars?f.jsx("span",{className:"text-[10px] text-muted-foreground/60 ml-auto",children:"N/A"}):e.bars?f.jsx("div",{className:"flex-1"}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted overflow-hidden min-w-0",children:y!==null?f.jsx("div",{className:me("h-full rounded-full transition-all",_2(y)),style:{width:`${Math.min(100,Math.max(0,y))}%`}}):null}),f.jsx("span",{className:"text-[10px] tabular-nums text-muted-foreground w-7 text-right shrink-0",children:R_(y)})]}),C?f.jsx("button",{type:"button",disabled:r,onClick:R=>{R.stopPropagation(),a==null||a("cursor")},className:"ml-auto rounded border border-border/70 px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-50",children:"Sign In"}):null,k?f.jsxs("button",{type:"button",disabled:r,onClick:R=>{R.stopPropagation(),s==null||s("cursor")},className:"flex items-center gap-1 rounded border border-border/70 px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-50",children:[r&&f.jsx(b0,{className:"h-2 w-2 animate-spin"}),r?"Checking":"Refresh"]}):null]}),e.bars&&f.jsx("div",{className:"flex flex-col gap-1 pb-1",children:e.bars.map((R,E)=>f.jsxs("div",{className:"flex items-center gap-2 pl-7 pr-2",children:[f.jsx("span",{className:"text-[10px] text-muted-foreground w-12 shrink-0",children:R.label}),h?f.jsx("span",{className:"text-[10px] text-muted-foreground/60 ml-auto",children:"N/A"}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted overflow-hidden min-w-0",children:R.percent!==null?f.jsx("div",{className:me("h-full rounded-full transition-all",_2(R.percent)),style:{width:`${Math.min(100,Math.max(0,R.percent))}%`}}):null}),f.jsx("span",{className:"text-[10px] tabular-nums text-muted-foreground w-7 text-right shrink-0",children:R_(R.percent)})]})]},E))})]})}),f.jsx(Fi,{side:"right",className:"max-w-48",children:S.map((R,E)=>f.jsx("div",{className:"text-xs",children:R},E))})]})}function Y$({providerUsage:e,visibleProviders:t=$$,onRefreshProviderUsage:n,onOpenProviderLogin:r}){const[s,a]=_.useState(V$),[l,u]=_.useState(q$),[h,d]=_.useState(null),g=()=>{a(v=>{const y=!v;return K$(y),y})},p=async()=>{d("all");try{await(n==null?void 0:n()),df("Usage checked successfully.")}catch{df("Failed to check usage.")}finally{d(v=>v==="all"?null:v)}};return f.jsxs("div",{className:"px-1 pb-1.5",children:[f.jsxs("div",{className:"flex items-center gap-2 px-2 pb-0.5",children:[f.jsxs("button",{type:"button",onClick:g,className:"flex min-w-0 flex-1 items-center gap-1 text-left group",children:[s?f.jsx(Tr,{className:"h-3 w-3 text-muted-foreground/40 group-hover:text-muted-foreground transition-colors"}):f.jsx(rp,{className:"h-3 w-3 text-muted-foreground/40 group-hover:text-muted-foreground transition-colors"}),f.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 font-medium group-hover:text-muted-foreground transition-colors",children:"Provider Usage"})]}),!s&&f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("button",{type:"button",onClick:p,disabled:h==="all",className:"shrink-0 rounded-md border border-border/70 bg-muted/40 p-1 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors disabled:opacity-50",title:"Refresh usages",children:f.jsx(b0,{className:me("h-3 w-3",h==="all"&&"animate-spin")})}),f.jsx("button",{type:"button",onClick:()=>{u(v=>{const y=v==="session"?"weekly":"session";return G$(y),y})},className:"shrink-0 rounded-md border border-border/70 bg-muted/40 px-2 py-0.5 text-[10px] uppercase tracking-wider text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",children:l==="session"?"Session":"Weekly"})]})]}),!s&&(l==="weekly"?W$:t).flatMap(v=>{const y=(e==null?void 0:e[v])??{provider:v,sessionLimitUsedPercent:null,apiLimitUsedPercent:null,rateLimitResetAt:null,rateLimitResetLabel:null,weeklyLimitUsedPercent:null,weeklyRateLimitResetAt:null,weeklyRateLimitResetLabel:null,statusDetail:null,availability:"unavailable",lastRequestedAt:null,updatedAt:null,warnings:[]},w=async C=>{d(C);try{await(n==null?void 0:n(C)),df(`${Qb[C]??"Provider"} usage checked successfully.`)}catch{df(`Failed to check ${Qb[C]??"provider"} usage.`)}finally{d(k=>k===C?null:k)}},S=C=>{d(C),Promise.resolve(r==null?void 0:r(C)).finally(()=>{d(k=>k===C?null:k)})};return v==="cursor"&&l==="session"?[f.jsx(y2,{entry:y,mode:l,isPending:h==="cursor",bars:[{label:"API",percent:y.apiLimitUsedPercent??null},{label:"Composer",percent:y.sessionLimitUsedPercent}],onRefreshProviderUsage:w,onOpenProviderLogin:S},"cursor")]:[f.jsx(y2,{entry:y,mode:l,isPending:h===v||h==="all",onRefreshProviderUsage:w,onOpenProviderLogin:S},v)]})]})}function X$(e){return e==="gpt-5-codex"?"gpt-5.3-codex":e??"gpt-5.4"}function Z$(e){return e==="claude"||e==="codex"||e==="gemini"||e==="cursor"?e:"last_used"}function za(e){var a,l;const t=(a=e==null?void 0:e.modelOptions)==null?void 0:a.reasoningEffort,n=Gk(t)?t:Gk(e==null?void 0:e.effort)?e.effort:mM.reasoningEffort,r=(e==null?void 0:e.model)??Jt("claude").defaultModel,s=f7(r,(l=e==null?void 0:e.modelOptions)==null?void 0:l.contextWindow);return{model:r,modelOptions:{reasoningEffort:r!=="opus"&&n==="max"?"high":n,...s?{contextWindow:s}:{}},planMode:!!(e!=null&&e.planMode)}}function Pa(e){var r,s;const t=Ri("codex"),n=(r=e==null?void 0:e.modelOptions)==null?void 0:r.reasoningEffort;return{model:X$((e==null?void 0:e.model)??Jt("codex").defaultModel),modelOptions:{reasoningEffort:Yk(n)?n:Yk(e==null?void 0:e.effort)?e.effort:t.reasoningEffort,fastMode:typeof((s=e==null?void 0:e.modelOptions)==null?void 0:s.fastMode)=="boolean"?e.modelOptions.fastMode:t.fastMode},planMode:!!(e!=null&&e.planMode)}}function Ql(e){var n;const t=Ri("gemini");return{model:(e==null?void 0:e.model)??Jt("gemini").defaultModel,modelOptions:{thinkingMode:l7((n=e==null?void 0:e.modelOptions)==null?void 0:n.thinkingMode)?e.modelOptions.thinkingMode:t.thinkingMode},planMode:!!(e!=null&&e.planMode)}}function Ba(e){return e==null||e.modelOptions,{model:a7((e==null?void 0:e.model)??Jt("cursor").defaultModel),modelOptions:{...Ri("cursor")},planMode:!!(e!=null&&e.planMode)}}function Q$(){return{claude:{model:Jt("claude").defaultModel,modelOptions:{...Ri("claude")},planMode:!1},codex:{model:Jt("codex").defaultModel,modelOptions:{...Ri("codex")},planMode:!1},gemini:{model:Jt("gemini").defaultModel,modelOptions:{...Ri("gemini")},planMode:!1},cursor:{model:Jt("cursor").defaultModel,modelOptions:{...Ri("cursor")},planMode:!1}}}function J$(e){return{claude:za(e==null?void 0:e.claude),codex:Pa(e==null?void 0:e.codex),gemini:Ql(e==null?void 0:e.gemini),cursor:Ba(e==null?void 0:e.cursor)}}function x2(e,t){if(t===void 0){console.info(`[chat-preferences] ${e}`);return}console.info(`[chat-preferences] ${e}`,t)}function Jb(e,t){if(e==="claude"){const r=t.claude;return{provider:"claude",model:r.model,modelOptions:{...r.modelOptions},planMode:r.planMode}}if(e==="gemini"){const r=t.gemini;return{provider:"gemini",model:r.model,modelOptions:{...r.modelOptions},planMode:r.planMode}}if(e==="cursor"){const r=t.cursor;return{provider:"cursor",model:r.model,modelOptions:{...r.modelOptions},planMode:r.planMode}}const n=t.codex;return{provider:"codex",model:n.model,modelOptions:{...n.modelOptions},planMode:n.planMode}}function eW(e,t,n,r){if((e==null?void 0:e.provider)==="claude"){const s=za(e);return{provider:"claude",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if((e==null?void 0:e.provider)==="codex"){const s=Pa(e);return{provider:"codex",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if((e==null?void 0:e.provider)==="gemini"){const s=Ql(e);return{provider:"gemini",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if((e==null?void 0:e.provider)==="cursor"){const s=Ba(e);return{provider:"cursor",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if(n==="claude"){const s=za(r==null?void 0:r.claude);return{provider:"claude",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if(n==="codex"){const s=Pa(r==null?void 0:r.codex);return{provider:"codex",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if(n==="cursor"){const s=Ba(r==null?void 0:r.cursor);return{provider:"cursor",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}return Jb("claude",t)}function tW(e){const t=J$(e==null?void 0:e.providerDefaults);return{defaultProvider:Z$(e==null?void 0:e.defaultProvider),providerDefaults:t,showProviderIconsInSideTray:(e==null?void 0:e.showProviderIconsInSideTray)===!0,composerState:eW(e==null?void 0:e.composerState,t,e==null?void 0:e.liveProvider,e==null?void 0:e.livePreferences)}}const xi=no()(ro(e=>({defaultProvider:"last_used",providerDefaults:Q$(),showProviderIconsInSideTray:!1,composerState:{provider:"claude",model:Jt("claude").defaultModel,modelOptions:{...Ri("claude")},planMode:!1},setDefaultProvider:t=>e({defaultProvider:t}),setShowProviderIconsInSideTray:t=>e({showProviderIconsInSideTray:t}),setProviderDefaultModel:(t,n)=>e(r=>({providerDefaults:{...r.providerDefaults,[t]:t==="claude"?za({...r.providerDefaults.claude,model:n}):t==="gemini"?Ql({...r.providerDefaults.gemini,model:n}):t==="cursor"?Ba({...r.providerDefaults.cursor,model:n}):Pa({...r.providerDefaults.codex,model:n})}})),setProviderDefaultModelOptions:(t,n)=>e(r=>({providerDefaults:{...r.providerDefaults,[t]:t==="claude"?za({...r.providerDefaults.claude,modelOptions:{...r.providerDefaults.claude.modelOptions,...n}}):t==="gemini"?Ql({...r.providerDefaults.gemini,modelOptions:{...r.providerDefaults.gemini.modelOptions,...n}}):t==="cursor"?Ba({...r.providerDefaults.cursor,modelOptions:{...r.providerDefaults.cursor.modelOptions,...n}}):Pa({...r.providerDefaults.codex,modelOptions:{...r.providerDefaults.codex.modelOptions,...n}})}})),setProviderDefaultPlanMode:(t,n)=>e(r=>({providerDefaults:{...r.providerDefaults,[t]:{...r.providerDefaults[t],planMode:n}}})),setComposerProvider:t=>e(n=>({composerState:{...n.composerState,provider:t}})),setComposerModel:t=>e(n=>n.composerState.provider==="claude"?{composerState:{provider:"claude",model:t,modelOptions:za({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="gemini"?{composerState:{provider:"gemini",model:t,modelOptions:Ql({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="cursor"?{composerState:{provider:"cursor",model:t,modelOptions:Ba({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}:{composerState:{provider:"codex",model:t,modelOptions:Pa({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}),setComposerModelOptions:t=>e(n=>n.composerState.provider==="claude"?{composerState:{provider:"claude",model:n.composerState.model,modelOptions:za({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="gemini"?{composerState:{provider:"gemini",model:n.composerState.model,modelOptions:Ql({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="cursor"?{composerState:{provider:"cursor",model:n.composerState.model,modelOptions:Ba({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}:{composerState:{provider:"codex",model:n.composerState.model,modelOptions:Pa({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}),setComposerPlanMode:t=>e(n=>({composerState:{...n.composerState,planMode:t}})),resetComposerFromProvider:t=>e(n=>({composerState:Jb(t,n.providerDefaults)})),initializeComposerForNewChat:()=>e(t=>{if(t.defaultProvider==="last_used")return x2("initializeComposerForNewChat:last_used",{defaultProvider:t.defaultProvider,composerState:t.composerState,providerDefaults:t.providerDefaults}),{composerState:{...t.composerState}};const n=Jb(t.defaultProvider,t.providerDefaults);return x2("initializeComposerForNewChat:explicit_default",{defaultProvider:t.defaultProvider,composerState:n,providerDefaults:t.providerDefaults}),{composerState:n}})}),{name:"chat-preferences",version:5,migrate:e=>tW(e)})),w2=no()(ro(e=>({order:[],setOrder:t=>e({order:t})}),{name:"project-group-order"})),Om=315,nW=240,rW=520;function iW(e){return typeof e=="object"&&e!==null}function Dp(e){return Number.isFinite(e)?Math.min(rW,Math.max(nW,Math.round(e))):Om}function sW(e){return iW(e)?{widthPx:Dp(typeof e.widthPx=="number"?e.widthPx:Om)}:{widthPx:Om}}const S2=no()(ro(e=>({widthPx:Om,setWidth:t=>e({widthPx:Dp(t)})}),{name:"left-sidebar-layout",version:1,migrate:sW}));function TA(e,t){return e&&!t}function oW(e,t,n){if(TA(e,t))return{width:`${Dp(n)}px`}}function aW({data:e,completedChatIds:t,activeChatId:n,connectionStatus:r,ready:s,open:a,collapsed:l,isDesktopViewport:u,showMobileOpenButton:h,desktopWidth:d,onOpen:g,onClose:p,onToggle:v,onExpand:y,toggleShortcut:w,onResizeDesktopWidth:S,onCreateChat:C,onCreateFeature:k,onRenameFeature:R,onDeleteFeature:E,onSetProjectBrowserState:N,onSetProjectGeneralChatsBrowserState:j,onSetFeatureBrowserState:D,onSetFeatureStage:L,onSetChatFeature:U,onReorderFeatures:Y,folderGroupsEnabled:P,kanbanStatusesEnabled:V,onDeleteChat:I,onRemoveProject:W,onRefreshProviderUsage:K,onOpenProviderLogin:q,providerSettings:O,startingLocalPath:F,updateSnapshot:H,onInstallUpdate:$}){const M=Di(),B=_c(),X=_.useRef(null),A=_.useRef(null),re=_.useRef(0),se=_.useRef(null),Z=_.useRef(null),te=_.useRef({}),le=_.useRef({}),pe=_.useRef({}),[xe,Me]=_.useState(new Set),[Re,je]=_.useState(!1),[Xe,ft]=_.useState(null),[pt,he]=_.useState(()=>Date.now()),Le=w2(Ce=>Ce.order),Ae=w2(Ce=>Ce.setOrder),nt=_.useMemo(()=>P0((O==null?void 0:O.settings)??Wn).map(Ce=>Ce.id),[O==null?void 0:O.settings]),gt=_.useMemo(()=>{if(Le.length===0)return e.projectGroups;const Ce=new Map(e.projectGroups.map(Qe=>[Qe.groupKey,Qe])),Te=Le.filter(Qe=>Ce.has(Qe)).map(Qe=>Ce.get(Qe)),_t=new Set(Le);for(const Qe of e.projectGroups)_t.has(Qe.groupKey)||Te.push(Qe);return Te},[e.projectGroups,Le]),qe=_.useCallback(()=>{B({pathname:"/",search:"?newProject=1"}),p()},[B,p]),vt=_.useMemo(()=>P?gt:gt.map(Ce=>({...Ce,features:[],generalChats:C2(Ce)})),[P,gt]),Se=_.useCallback(Ce=>Ae(Ce),[Ae]),De=_.useMemo(()=>vt.reduce((Ce,Te)=>Ce+C2(Te).length,0),[vt]),ce=_.useCallback(Ce=>{Me(Te=>{const _t=new Set(Te);return _t.has(Ce)?_t.delete(Ce):_t.add(Ce),_t})},[]);_.useEffect(()=>{const Ce=te.current,Te=le.current,_t=pe.current;Me(Ot=>{const sn=new Set([...Ot].filter(G=>!G.startsWith("project:")&&!G.startsWith("general:")&&!G.startsWith("feature:")));for(const G of vt)(Ce[G.groupKey]??G.browserState)==="CLOSED"&&sn.add(`project:${G.groupKey}`),(Te[G.groupKey]??G.generalChatsBrowserState)==="CLOSED"&&sn.add(`general:${G.groupKey}`);for(const G of vt)for(const Ye of G.features)(_t[Ye.featureId]??Ye.browserState)==="CLOSED"&&sn.add(`feature:${Ye.featureId}`);return sn});const Qe={...Ce};for(const Ot of vt)Qe[Ot.groupKey]===Ot.browserState&&delete Qe[Ot.groupKey];te.current=Qe;const bt={...Te};for(const Ot of vt)bt[Ot.groupKey]===Ot.generalChatsBrowserState&&delete bt[Ot.groupKey];le.current=bt;const qt={..._t};for(const Ot of vt)for(const sn of Ot.features)qt[sn.featureId]===sn.browserState&&delete qt[sn.featureId];pe.current=qt},[vt]);const be=_.useCallback((Ce,Te)=>{te.current={...te.current,[Ce]:Te},N(Ce,Te)},[N]),Oe=_.useCallback((Ce,Te)=>{le.current={...le.current,[Ce]:Te},j(Ce,Te)},[j]),We=_.useCallback((Ce,Te)=>{pe.current={...pe.current,[Ce]:Te},D(Ce,Te)},[D]),we=_.useCallback(Ce=>{B(`/chat/${Ce}`),a&&p()},[B,p,a]),Ie=xi(Ce=>Ce.showProviderIconsInSideTray),ot=_.useCallback((Ce,Te)=>f.jsx(H7,{chat:Ce,activeChatId:n,nowMs:pt,showProviderIcon:Ie,isCompleted:t.has(Ce.chatId),onSelectChat:we,onDeleteChat:()=>I(Ce),draggable:Te==null?void 0:Te.draggable,onDragStart:Te==null?void 0:Te.onDragStart,onDragEnd:Te==null?void 0:Te.onDragEnd,isTouchDevice:Te==null?void 0:Te.isTouchDevice,onTouchDragMove:Te==null?void 0:Te.onTouchDragMove,onTouchDragEnd:Te==null?void 0:Te.onTouchDragEnd},Ce._id),[n,t,we,pt,I,Ie]);_.useEffect(()=>{const Ce=window.setInterval(()=>{he(Date.now())},3e4);return()=>window.clearInterval(Ce)},[]),_.useEffect(()=>{if(Re)return document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.body.style.cursor="",document.body.style.userSelect=""}},[Re]),_.useEffect(()=>()=>{Z.current!==null&&window.cancelAnimationFrame(Z.current)},[]),_.useEffect(()=>{!n||!A.current||requestAnimationFrame(()=>{const Ce=A.current,Te=Ce==null?void 0:Ce.querySelector(`[data-chat-id="${n}"]`);if(!Te||!Ce)return;const _t=Te.getBoundingClientRect(),Qe=Ce.getBoundingClientRect();if(_t.top<Qe.top+38){const bt=_t.top-Qe.top+Ce.scrollTop;Ce.scrollTo({top:bt-38,behavior:"smooth"})}else if(_t.bottom>Qe.bottom){const bt=_t.top+_t.height/2-Qe.top+Ce.scrollTop,qt=Ce.clientHeight/2;Ce.scrollTo({top:bt-qt,behavior:"smooth"})}})},[n,De]);const rt=De>0,ze=M.pathname==="/",St=M.pathname.startsWith("/settings"),at=ze||St,vn=r==="connecting"||!s,tn=vn?"Connecting":r==="connected"?"Connected":"Disconnected",Nn=r==="connected"?"bg-emerald-500":"bg-amber-500",xr=(H==null?void 0:H.updateAvailable)===!0,rr=H?H.latestVersion===`${H.currentVersion}-dev`:!1,jt=(H==null?void 0:H.status)==="updating"||(H==null?void 0:H.status)==="restart_pending",He=oW(u,l,Xe??d),ct=TA(u,l),st=w&&w.length>0?`Toggle sidebar (${w[0]})`:"Toggle sidebar",mt=t.size>0,an=_.useCallback(Ce=>{var bt;if(!ct)return;Ce.preventDefault(),je(!0),re.current=((bt=X.current)==null?void 0:bt.getBoundingClientRect().left)??0,ft(d);const Te=qt=>{se.current=Dp(qt-re.current),Z.current===null&&(Z.current=window.requestAnimationFrame(()=>{Z.current=null,se.current!==null&&ft(se.current)}))};Te(Ce.clientX);const _t=qt=>{Te(qt.clientX)},Qe=()=>{je(!1),Z.current!==null&&(window.cancelAnimationFrame(Z.current),Z.current=null);const qt=se.current??d;se.current=null,ft(null),S(qt),window.removeEventListener("pointermove",_t),window.removeEventListener("pointerup",Qe),window.removeEventListener("pointercancel",Qe)};window.addEventListener("pointermove",_t),window.addEventListener("pointerup",Qe),window.addEventListener("pointercancel",Qe)},[d,S,ct]);return f.jsxs(f.Fragment,{children:[!a&&h&&f.jsxs(tt,{variant:"ghost",size:"icon",className:"relative fixed top-3 left-3 z-50 md:hidden",onClick:g,children:[f.jsx(CN,{className:"h-5 w-5"}),mt&&f.jsx("span",{className:"absolute top-0.5 right-0.5 size-2.5 rounded-full bg-emerald-400 ring-2 ring-background"})]}),l&&at&&f.jsx("div",{className:"hidden md:flex fixed left-0 top-0 h-full z-40 items-start pt-4 pl-5 border-l border-border/0",children:f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs("div",{className:"relative",children:[f.jsx(Sm,{className:"size-6 text-logo"}),mt&&f.jsx("span",{className:"absolute -top-0.5 -right-0.5 size-2.5 rounded-full bg-emerald-400 ring-2 ring-background"})]}),f.jsx(tt,{variant:"ghost",size:"icon",onClick:y,title:"Expand sidebar",children:f.jsx(kb,{className:"h-5 w-5"})})]})}),f.jsxs("div",{ref:X,"data-sidebar":"open",className:me("fixed inset-0 z-50 bg-background dark:bg-card backdrop-blur-2xl flex flex-col h-[100dvh] select-none","md:relative md:inset-auto md:bg-background md:dark:bg-card md:backdrop-blur-none md:flex-none md:mr-0 md:h-[calc(100dvh-16px)] md:my-2 md:ml-2 md:border md:border-border md:rounded-2xl",a?"flex":"hidden md:flex",l&&"md:hidden"),style:He,children:[ct?f.jsx("div",{role:"separator","aria-label":"Resize sidebar","aria-orientation":"vertical",className:me("group/sidebar-resize hidden md:flex absolute top-0 right-0 z-20 h-full w-3 translate-x-1/2 cursor-col-resize items-center justify-center",Re&&"after:bg-logo/70"),onPointerDown:an,children:f.jsx("span",{className:me("h-14 w-px rounded-full bg-border/80 opacity-0 transition-opacity group-hover/sidebar-resize:opacity-100",Re&&"bg-logo/70 opacity-100")})}):null,f.jsxs("div",{className:" pl-3 pr-[7px] h-[64px] max-h-[64px] md:h-[55px] md:max-h-[55px] border-b flex items-center justify-between",children:[f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs("button",{type:"button",onClick:()=>v(u),title:st,"aria-label":st,className:"group/sidebar-collapse relative flex items-center justify-center h-5 w-5 sm:h-6 sm:w-6",children:[f.jsx(Sm,{className:"absolute inset-0.5 h-4 w-4 sm:h-5 sm:w-5 text-logo transition-all duration-200 ease-out opacity-100 scale-100 group-hover/sidebar-collapse:opacity-0 group-hover/sidebar-collapse:scale-0"}),f.jsx(kb,{className:"absolute inset-0 h-4 w-4 sm:h-6 sm:w-6 text-slate-500 dark:text-slate-400 transition-all duration-200 ease-out opacity-0 scale-0 group-hover/sidebar-collapse:opacity-100 group-hover/sidebar-collapse:scale-80 hover:opacity-50"})]})}),f.jsxs("div",{className:"flex items-center",children:[rr?f.jsx("span",{className:"mr-1 inline-flex items-center rounded-full border border-border bg-muted px-2 py-0.5 text-[11px] font-bold tracking-wider text-muted-foreground",title:"Development build",children:"DEV"}):xr?f.jsxs(tt,{variant:"outline",size:"sm",className:"rounded-full !h-auto mr-1 py-0.5 px-2 bg-logo/20 hover:bg-logo text-logo border-logo/20 hover:text-foreground hover:border-logo/20 text-[11px] font-bold tracking-wider",onClick:$,disabled:jt,title:H!=null&&H.latestVersion?`Update to ${H.latestVersion}`:"Update Kaizen",children:[jt?f.jsx(oi,{className:"mr-1.5 h-3 w-3 animate-spin"}):null,"UPDATE"]}):null,f.jsx(tt,{variant:"ghost",size:"icon",onClick:qe,className:"size-10 rounded-lg",title:"Add project",children:f.jsx(wN,{className:"size-5"})})]})]}),f.jsx("div",{ref:A,"data-sidebar-scroll":!0,className:"flex-1 min-h-0 overflow-y-auto scrollbar-hide",style:{WebkitOverflowScrolling:"touch"},children:f.jsxs("div",{className:"p-[7px]",children:[!rt&&vn?f.jsx("div",{className:"space-y-5 px-1 pt-3",children:[0,1,2].map(Ce=>f.jsxs("div",{className:"space-y-2 animate-pulse",children:[f.jsx("div",{className:"h-4 w-28 rounded bg-muted"}),f.jsx("div",{className:"space-y-1",children:[0,1,2].map(Te=>f.jsxs("div",{className:"flex items-center gap-2 rounded-md px-3 py-2",children:[f.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-muted"}),f.jsx("div",{className:me("h-3.5 rounded bg-muted",Te===0?"w-32":Te===1?"w-40":"w-28")})]},Te))})]},Ce))}):null,!rt&&!vn&&e.projectGroups.length===0?f.jsx("p",{className:"text-sm text-slate-400 p-2 mt-6 text-center",children:"No conversations yet"}):null,f.jsx(U$,{projectGroups:vt,onReorderGroups:Se,collapsedSections:xe,onToggleSection:ce,onSetProjectBrowserState:be,onSetProjectGeneralChatsBrowserState:Oe,onSetFeatureBrowserState:We,renderChatRow:ot,onNewLocalChat:C,onCreateFeature:P?k:void 0,onRenameFeature:R,onDeleteFeature:E,onSetFeatureStage:V?L:void 0,onSetChatFeature:U,onReorderFeatures:Y,onRemoveProject:W,isConnected:r==="connected",startingLocalPath:F,folderGroupsEnabled:P,kanbanStatusesEnabled:V})]})}),f.jsxs("div",{className:"border-t border-border p-2",children:[f.jsx(Y$,{providerUsage:e.providerUsage,visibleProviders:nt,onRefreshProviderUsage:K,onOpenProviderLogin:q}),f.jsx("button",{type:"button",onClick:()=>{B("/settings/general"),p()},className:me("w-full rounded-xl rounded-t-md border px-3 py-2 text-left transition-colors",St?"bg-muted border-border":"border-border/0 hover:bg-muted hover:border-border active:bg-muted/80"),children:f.jsxs("div",{className:"flex items- justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(zI,{className:"h-4 w-4 text-muted-foreground"}),f.jsx("span",{className:"text-sm",children:"Settings"})]}),f.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[f.jsx("span",{children:tn}),vn?f.jsx(oi,{className:"h-2 w-2 animate-spin"}):f.jsx("span",{className:me("h-2 w-2 rounded-full",Nn)})]})]})})]})]})]})}function C2(e){return[...e.features.flatMap(t=>t.chats),...e.generalChats]}const NA={submitChatMessage:"Submit Chat Message",toggleProjectsSidebar:"Toggle Projects Sidebar",toggleEmbeddedTerminal:"Toggle Embedded Terminal",toggleRightSidebar:"Toggle Right Sidebar",openInFinder:"Open In Finder",openInEditor:"Open In Editor",addSplitTerminal:"Add Split Terminal"};function T_(e){return(e??[]).join(", ")}function ka(e){return e.split(",").map(t=>t.trim()).map(t=>t.toLowerCase()).filter(Boolean)}const lW=new Map([["cmd","meta"],["meta","meta"],["ctrl","ctrl"],["control","ctrl"],["alt","alt"],["option","alt"],["shift","shift"]]);function cW(e,t){const n=uW(e);return n?t.key.toLowerCase()===n.key&&t.ctrlKey===n.ctrl&&t.metaKey===n.meta&&t.altKey===n.alt&&t.shiftKey===n.shift:!1}function Oa(e,t,n){return((e==null?void 0:e.bindings[t])??os[t]).some(s=>cW(s,n))}function ux(e){return{bindings:{submitChatMessage:(e==null?void 0:e.bindings.submitChatMessage)??os.submitChatMessage,toggleProjectsSidebar:(e==null?void 0:e.bindings.toggleProjectsSidebar)??os.toggleProjectsSidebar,toggleEmbeddedTerminal:(e==null?void 0:e.bindings.toggleEmbeddedTerminal)??os.toggleEmbeddedTerminal,toggleRightSidebar:(e==null?void 0:e.bindings.toggleRightSidebar)??os.toggleRightSidebar,openInFinder:(e==null?void 0:e.bindings.openInFinder)??os.openInFinder,openInEditor:(e==null?void 0:e.bindings.openInEditor)??os.openInEditor,addSplitTerminal:(e==null?void 0:e.bindings.addSplitTerminal)??os.addSplitTerminal},warning:(e==null?void 0:e.warning)??null,filePathDisplay:(e==null?void 0:e.filePathDisplay)??""}}function uW(e){const t=e.split("+").map(r=>r.trim()).filter(Boolean);if(t.length===0)return null;const n={key:"",ctrl:!1,meta:!1,alt:!1,shift:!1};for(const r of t){const s=r.toLowerCase(),a=lW.get(s);if(a==="ctrl"){n.ctrl=!0;continue}if(a==="meta"){n.meta=!0;continue}if(a==="alt"){n.alt=!0;continue}if(a==="shift"){n.shift=!0;continue}if(n.key)return null;n.key=s}return n.key?n:null}function dW(e){if(!e||typeof e!="object")return!1;const t=e;if(t.isContentEditable===!0)return!0;if(typeof t.tagName=="string"){const n=t.tagName.toLowerCase();if(n==="input"||n==="textarea"||n==="select")return!0}return typeof t.closest=="function"?!!t.closest('input, textarea, select, [contenteditable], [contenteditable="true"]'):!1}function hW(){const[e,t]=_.useState(()=>{if(typeof window>"u")return!1;const n=navigator.standalone===!0,r=window.matchMedia("(display-mode: standalone)").matches;return n||r});return _.useEffect(()=>{const n=window.matchMedia("(display-mode: standalone)"),r=s=>{t(s.matches||navigator.standalone===!0)};return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const fW=no()(ro((e,t)=>({drafts:{},setDraft:(n,r)=>e(s=>{if(!r){const{[n]:a,...l}=s.drafts;return{drafts:l}}return{drafts:{...s.drafts,[n]:r}}}),clearDraft:n=>e(r=>{const{[n]:s,...a}=r.drafts;return{drafts:a}}),getDraft:n=>t().drafts[n]??""}),{name:"chat-input-drafts"}));async function mW(e){const t=await new Promise((n,r)=>{const s=new FileReader;s.onload=()=>{if(typeof s.result=="string"){n(s.result);return}r(new Error("Failed to read image attachment"))},s.onerror=()=>r(s.error??new Error("Failed to read image attachment")),s.readAsDataURL(e)});return{type:"image",name:e.name,mimeType:e.type,sizeBytes:e.size,dataUrl:t}}function k2(e,t){if(t===void 0){console.info(`[ChatInput] ${e}`);return}console.info(`[ChatInput] ${e}`,t)}function Ws(e,t,n,r,s){return e==="claude"?t.provider==="claude"?{provider:"claude",model:r??t.model,modelOptions:{...t.modelOptions},planMode:s??t.planMode}:{provider:"claude",model:r??n.claude.model,modelOptions:{...n.claude.modelOptions},planMode:s??n.claude.planMode}:e==="gemini"?t.provider==="gemini"?{provider:"gemini",model:r??t.model,modelOptions:{...t.modelOptions},planMode:s??t.planMode}:{provider:"gemini",model:r??n.gemini.model,modelOptions:{...n.gemini.modelOptions},planMode:s??n.gemini.planMode}:e==="cursor"?t.provider==="cursor"?{provider:"cursor",model:r??t.model,modelOptions:{...t.modelOptions},planMode:s??t.planMode}:{provider:"cursor",model:r??n.cursor.model,modelOptions:{...n.cursor.modelOptions},planMode:s??n.cursor.planMode}:t.provider==="codex"?{provider:"codex",model:r??t.model,modelOptions:{...t.modelOptions},planMode:s??t.planMode}:{provider:"codex",model:r??n.codex.model,modelOptions:{...n.codex.modelOptions},planMode:s??n.codex.planMode}}function pW(e,t,n,r){return r&&e.key==="Enter"?!1:Oa(t,"submitChatMessage",e)&&!n&&!e.isComposing}function gW(e){if(!e.providerLocked)return{composerPlanMode:e.planMode,lockedComposerState:e.lockedComposerState};const t=e.lockedComposerState??Ws(e.selectedProvider,e.composerState,e.providerDefaults);return{composerPlanMode:e.composerState.planMode,lockedComposerState:{...t,planMode:e.planMode}}}const vW=_.forwardRef(function({onSubmit:t,onCancel:n,disabled:r,canCancel:s,chatId:a,activeProvider:l,activeModel:u,activePlanMode:h,availableProviders:d,keybindings:g},p){const{getDraft:v,setDraft:y,clearDraft:w}=fW(),{composerState:S,providerDefaults:C,setComposerModel:k,setComposerModelOptions:R,setComposerPlanMode:E,resetComposerFromProvider:N}=xi(),[j,D]=_.useState(()=>a?v(a):""),[L,U]=_.useState([]),[Y,P]=_.useState(null),[V,I]=_.useState(!1),W=_.useRef(null),K=_.useRef(null),q=hW(),O=Ap("(pointer: coarse)"),[F,H]=_.useState(()=>l?Ws(l,S,C,u,h):null),$=l!==null,M=!$&&d.length===0,B=$?F??Ws(l,S,C,u,h):S,X=$?l:S.provider,A=d.find(he=>he.id===X)??Jt(X),re=(A==null?void 0:A.supportsPlanMode)??!1,se=r||M,Z=_.useCallback(()=>{const he=W.current;he&&(he.style.height="auto",he.style.height=`${he.scrollHeight}px`)},[]),te=_.useCallback(he=>{if(W.current=he,!!p){if(typeof p=="function"){p(he);return}p.current=he}},[p]);_.useEffect(()=>{Z()},[j,Z]),_.useEffect(()=>(window.addEventListener("resize",Z),()=>window.removeEventListener("resize",Z)),[Z]),_.useEffect(()=>{var he;(he=W.current)==null||he.focus()},[a]),_.useEffect(()=>()=>{for(const he of L)URL.revokeObjectURL(he.previewUrl)},[L]),_.useEffect(()=>{if(l===null){H(null);return}H(Ws(l,S,C,u,h))},[u,h,l,a,S,C]),_.useEffect(()=>{$||d.length!==0&&(d.some(he=>he.id===S.provider)||N(d[0].id))},[d,S.provider,$,N]),_.useEffect(()=>{k2("resolved provider state",{chatId:a??null,activeProvider:l,composerProvider:S.provider,composerModel:S.model,effectiveProvider:B.provider,effectiveModel:B.model,selectedProvider:X,providerLocked:$,lockedComposerProvider:(F==null?void 0:F.provider)??null})},[l,a,S.model,S.provider,F==null?void 0:F.provider,$,B.model,B.provider,X]);function le(he){if($){H(Le=>{const Ae=Le??Ws(X,S,C);return Ae.provider==="claude"?{...Ae,modelOptions:{...Ae.modelOptions,reasoningEffort:he}}:Ae.provider==="gemini"?Ae:{...Ae,modelOptions:{...Ae.modelOptions,reasoningEffort:he}}});return}if(X==="claude"){R({reasoningEffort:he});return}R({reasoningEffort:he})}function pe(he){if($){H(Le=>{const Ae=Le??Ws(X,S,C);return Ae.provider!=="gemini"?Ae:{...Ae,modelOptions:{...Ae.modelOptions,thinkingMode:he}}});return}X==="gemini"&&R({thinkingMode:he})}function xe(he){if($){H(Le=>{const Ae=Le??Ws(X,S,C);return Ae.provider!=="claude"?Ae:{...Ae,modelOptions:{...Ae.modelOptions,contextWindow:he}}});return}X==="claude"&&R({contextWindow:he})}function Me(he){const Le=gW({providerLocked:$,planMode:he,selectedProvider:X,composerState:S,providerDefaults:C,lockedComposerState:F});Le.lockedComposerState!==F&&H(Le.lockedComposerState),Le.composerPlanMode!==S.planMode&&E(Le.composerPlanMode)}function Re(){Me(!B.planMode)}async function je(){if(se||!j.trim()&&L.length===0)return;const he=j,Le=L;let Ae;B.provider==="claude"?Ae={claude:{...B.modelOptions}}:B.provider==="gemini"?Ae={gemini:{...B.modelOptions}}:Ae={codex:{...B.modelOptions}};const nt={provider:X,model:B.model,modelOptions:Ae,planMode:re?B.planMode:!1};k2("submit settings",{chatId:a??null,activeProvider:l,composerProvider:B.provider,submitOptions:nt}),D(""),P(null),a&&w(a),W.current&&(W.current.style.height="auto");try{await t({text:he.trim(),attachments:Le.length?await Promise.all(Le.map(gt=>mW(gt.file))):void 0},nt);for(const gt of Le)URL.revokeObjectURL(gt.previewUrl);U([])}catch(gt){console.error("[ChatInput] Submit failed:",gt),D(he),a&&y(a,he)}}const Xe=_.useCallback(he=>{if(se)return;const Le=he.filter(Ae=>Ae.type.startsWith("image/"));if(Le.length===0){P("Only PNG, JPEG, WEBP, and GIF images are supported.");return}U(Ae=>{const nt=[...Ae];let gt=null;for(const qe of Le){if(!Jk.includes(qe.type)){gt=`Unsupported image type: ${qe.type||"unknown"}`;continue}if(qe.size<=0||qe.size>p7){gt=`${qe.name} is empty or larger than 10 MB.`;continue}if(nt.length>=Qk){gt=`You can attach up to ${Qk} images per message.`;break}nt.push({id:Kf(),file:qe,name:qe.name||"image",mimeType:qe.type,sizeBytes:qe.size,previewUrl:URL.createObjectURL(qe)})}return P(gt),nt})},[se]),ft=_.useCallback(he=>{U(Le=>{const Ae=Le.find(nt=>nt.id===he);return Ae&&URL.revokeObjectURL(Ae.previewUrl),Le.filter(nt=>nt.id!==he)}),P(null)},[]);function pt(he){if(he.key==="Tab"&&!he.shiftKey){he.preventDefault(),i8(W.current,document);return}if(he.key==="Tab"&&he.shiftKey&&re){he.preventDefault(),Re();return}if(he.key==="Escape"&&s){he.preventDefault(),n==null||n();return}pW(he.nativeEvent,g,s,O)&&(he.preventDefault(),je())}return f.jsxs("div",{className:me("p-3 pt-0 px-2 md:px-3 md:pb-2 flex flex-col items-center",q&&"px-3"),style:q?{paddingBottom:"var(--app-composer-bottom-padding)"}:void 0,children:[f.jsxs("div",{className:"flex flex-col items-center relative z-10 w-full max-w-[840px] mx-auto",children:[f.jsxs("div",{className:me("w-full border dark:bg-card/40 bg-background/95 backdrop-blur-lg border-border rounded-[29px] px-2 pb-2 transition-colors relative z-10",V&&"border-foreground/40 bg-muted/30"),onDragEnter:he=>{r||!he.dataTransfer.types.includes("Files")||(he.preventDefault(),I(!0))},onDragOver:he=>{r||!he.dataTransfer.types.includes("Files")||(he.preventDefault(),he.dataTransfer.dropEffect="copy",I(!0))},onDragLeave:he=>{if(!he.dataTransfer.types.includes("Files"))return;he.preventDefault();const Le=he.relatedTarget;Le instanceof Node&&he.currentTarget.contains(Le)||I(!1)},onDrop:he=>{var Le;r||!he.dataTransfer.types.includes("Files")||(he.preventDefault(),I(!1),Xe(Array.from(he.dataTransfer.files)),(Le=W.current)==null||Le.focus())},children:[f.jsx("input",{ref:K,type:"file",accept:Jk.join(","),multiple:!0,className:"hidden",onChange:he=>{Xe(Array.from(he.target.files??[])),he.target.value=""}}),L.length?f.jsx("div",{className:"grid grid-cols-2 gap-2 px-2 pt-2 sm:grid-cols-3",children:L.map(he=>f.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border/80 bg-background/80",children:[f.jsx("img",{src:he.previewUrl,alt:he.name,className:"h-28 w-full object-cover"}),f.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 px-2 py-1.5",children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:"truncate text-xs text-foreground",children:he.name}),f.jsxs("div",{className:"text-[11px] text-muted-foreground",children:[Math.max(1,Math.round(he.sizeBytes/1024))," KB"]})]}),f.jsx(tt,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:()=>ft(he.id),disabled:se,children:f.jsx(Xo,{className:"h-3.5 w-3.5"})})]})]},he.id))}):null,f.jsxs("div",{className:"flex items-end gap-2",children:[f.jsx(tt,{type:"button",variant:"ghost",size:"icon",className:"mt-1.5 md:mt-0 h-10 w-10 shrink-0 rounded-full",disabled:se||s,onClick:()=>{var he;return(he=K.current)==null?void 0:he.click()},children:f.jsx(TI,{className:"h-4.5 w-4.5"})}),f.jsx(lp,{ref:te,placeholder:"Build something...",value:j,autoFocus:!0,[w0]:"",rows:1,onChange:he=>{D(he.target.value),a&&y(a,he.target.value),Z()},onPaste:he=>{const Le=Array.from(he.clipboardData.files);Le.some(Ae=>Ae.type.startsWith("image/"))&&(he.preventDefault(),Xe(Le))},onKeyDown:pt,disabled:se,className:"flex-1 text-base py-2 md:py-3.75 px-1 md:px-2 resize-none max-h-[200px] outline-none bg-transparent border-0 shadow-none"}),f.jsx(tt,{type:"button",onPointerDown:he=>{he.preventDefault(),s?n==null||n():!se&&(j.trim()||L.length>0)&&je()},disabled:!s&&(se||!j.trim()&&L.length===0),size:"icon",className:"flex-shrink-0 bg-slate-600 text-white dark:bg-white dark:text-slate-900 rounded-full cursor-pointer h-10 w-10 md:h-11 md:w-11 md:mb-0.5 -mr-0.5 md:mr-0 touch-manipulation disabled:bg-white/60 disabled:text-slate-700",children:s?f.jsx("div",{className:"w-3 h-3 md:w-4 md:h-4 rounded-xs bg-current"}):f.jsx(y6,{className:"h-5 w-5 md:h-6 md:w-6"})})]})]}),f.jsxs("div",{className:me("border-x border-b border-t-0 border-border rounded-b-[20px] px-3 py-1.5 transition-colors relative z-20 -mt-[1px] flex-shrink-0 shadow-sm","dark:bg-card/40 bg-background/95 backdrop-blur-lg",V&&"border-foreground/40 bg-muted/30"),children:[f.jsx("div",{className:"absolute top-0 left-0 right-0 h-[1px] bg-background"}),f.jsx(Pu,{availableProviders:d,selectedProvider:X,disabled:se,providerLocked:$,model:B.model,modelOptions:B.modelOptions,onProviderChange:he=>{$||N(he)},onModelChange:(he,Le)=>{if($){H(Ae=>({...Ae??Ws(X,S,C),model:Le}));return}k(Le)},onClaudeReasoningEffortChange:he=>le(he),onClaudeContextWindowChange:he=>xe(he),onCodexReasoningEffortChange:he=>le(he),onGeminiThinkingModeChange:he=>pe(he),onCodexFastModeChange:he=>{if($){H(Le=>{const Ae=Le??Ws(X,S,C);return Ae.provider!=="codex"?Ae:{...Ae,modelOptions:{...Ae.modelOptions,fastMode:he}}});return}R({fastMode:he})},planMode:B.planMode,onPlanModeChange:Me,includePlanMode:re,className:"w-full relative z-10"}),M?f.jsx("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"No active providers are available. Re-enable one in Settings."}):null]})]}),Y?f.jsx("div",{className:"max-w-[840px] mx-auto mt-2 px-2 text-xs text-destructive relative z-10",children:Y}):null]})}),_W=_.memo(vW);function E2({label:e,isCurrent:t,icon:n,onClick:r,className:s}){return f.jsxs("button",{onClick:r,className:me("w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left text-sm transition-colors hover:bg-muted",s),children:[f.jsx("span",{className:"flex-shrink-0 w-4 flex items-center justify-center",children:n??(t?f.jsx(Wi,{className:"h-3.5 w-3.5 text-muted-foreground"}):null)}),f.jsx("span",{className:"flex-1 min-w-0 truncate",children:e}),t&&f.jsx("span",{className:"flex-shrink-0 text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded-full border border-border",children:"current"})]})}function bW({projectId:e,socket:t}){const[n,r]=_.useState({phase:"loading"}),[s,a]=_.useState(!1),[l,u]=_.useState(""),h=_.useDeferredValue(l),[d,g]=_.useTransition(),p=_.useRef(null),v=_.useCallback(async()=>{try{const R=await t.command({type:"git.getBranches",projectId:e});if(!R.isRepo){r({phase:"not-a-repo"});return}r({phase:"ready",currentBranch:R.currentBranch,branches:R.branches})}catch(R){r({phase:"error",message:R instanceof Error?R.message:String(R)})}},[e,t]);_.useEffect(()=>{v()},[v]),_.useEffect(()=>{s&&(u(""),v())},[s,v]),_.useEffect(()=>{if(s&&n.phase==="ready"){const R=setTimeout(()=>{var E;return(E=p.current)==null?void 0:E.focus()},50);return()=>clearTimeout(R)}},[s,n.phase]);function y(R){n.phase!=="ready"||R===n.currentBranch||(a(!1),g(async()=>{try{await t.command({type:"git.switchBranch",projectId:e,branchName:R}),await v()}catch(E){r({phase:"error",message:E instanceof Error?E.message:String(E)})}}))}function w(R){R.trim()&&(a(!1),g(async()=>{try{await t.command({type:"git.createBranch",projectId:e,branchName:R.trim(),checkout:!0}),await v()}catch(E){r({phase:"error",message:E instanceof Error?E.message:String(E)})}}))}if(n.phase==="not-a-repo")return null;const S=n.phase==="ready"?n.branches.filter(R=>R.toLowerCase().includes(h.toLowerCase())):[],C=n.phase==="ready"&&n.branches.some(R=>R===h.trim()),k=h.trim().length>0&&!C;return f.jsxs(TM,{open:s,onOpenChange:a,children:[f.jsx(NM,{asChild:!0,children:f.jsxs(tt,{variant:"ghost",size:"icon",className:me("h-10 w-auto max-w-[180px] gap-1.5 rounded-lg border border-border/0 px-3 text-sm text-muted-foreground",n.phase==="error"&&"text-destructive"),children:[d?f.jsx(oi,{className:"h-4.5 w-4.5 flex-shrink-0 animate-spin"}):f.jsx(cI,{className:"h-4.5 w-4.5 flex-shrink-0"}),n.phase==="ready"&&f.jsx("span",{className:"truncate",children:n.currentBranch??"HEAD detached"}),n.phase==="error"&&f.jsx("span",{className:"truncate",children:"git error"})]})}),f.jsxs(H0,{align:"end",className:"w-64 p-0 overflow-hidden",children:[f.jsx("div",{className:"border-b border-border",children:f.jsx("input",{ref:p,value:l,onChange:R=>u(R.target.value),placeholder:"Search or create branch...",className:"w-full px-3 py-2 text-sm bg-transparent outline-none placeholder:text-muted-foreground",onKeyDown:R=>{R.key==="Enter"&&k&&w(l)}})}),f.jsxs("div",{className:"max-h-[220px] overflow-y-auto p-1",children:[n.phase==="loading"&&f.jsx("div",{className:"flex items-center justify-center py-6 text-muted-foreground",children:f.jsx(oi,{className:"h-4 w-4 animate-spin"})}),n.phase==="error"&&f.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:n.message}),n.phase==="ready"&&f.jsxs(f.Fragment,{children:[S.length===0&&!k&&f.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No branches match"}),S.map(R=>f.jsx(E2,{label:R,isCurrent:R===n.currentBranch,onClick:()=>y(R)},R)),k&&f.jsx(E2,{label:`Create branch "${h.trim()}"`,icon:f.jsx(_0,{className:"h-3.5 w-3.5 text-muted-foreground"}),onClick:()=>w(l),className:"text-muted-foreground border-t border-border/50 mt-1 pt-2 rounded-none"})]})]})]})]})}const MA=_.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:me("bg-card text-card-foreground",e),...t}));MA.displayName="Card";const AA=_.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:me("flex flex-col space-y-1.5 p-2",e),...t}));AA.displayName="CardHeader";const yW=_.forwardRef(({className:e,...t},n)=>f.jsx("h3",{ref:n,className:me("text-2xl font-semibold leading-none tracking-tight",e),...t}));yW.displayName="CardTitle";const xW=_.forwardRef(({className:e,...t},n)=>f.jsx("p",{ref:n,className:me("text-sm text-muted-foreground",e),...t}));xW.displayName="CardDescription";const DA=_.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:me("p-6 pt-0",e),...t}));DA.displayName="CardContent";const wW=_.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:me("flex items-center p-6 pt-0",e),...t}));wW.displayName="CardFooter";function SW({sidebarCollapsed:e,hasCompletedChats:t=!1,onOpenSidebar:n,onExpandSidebar:r,usage:s,localPath:a,embeddedTerminalVisible:l=!1,onToggleEmbeddedTerminal:u,rightSidebarVisible:h=!1,onToggleRightSidebar:d,onOpenExternal:g,editorLabel:p="Editor",projectId:v,socket:y,finderShortcut:w,editorShortcut:S,terminalShortcut:C,rightSidebarShortcut:k}){const R=j=>j==null?"Unavailable":`${Math.round(j)}%`,E=s!=null&&s.warnings.includes("context_critical")||s!=null&&s.warnings.includes("rate_critical")?"text-amber-300 bg-amber-500/10":s!=null&&s.warnings.includes("context_warning")||s!=null&&s.warnings.includes("rate_warning")?"text-amber-100 bg-amber-500/5":"text-muted-foreground bg-background/70",N=e||t;return f.jsx(AA,{className:me("absolute top-0 md:top-2 left-0 right-0 z-10 px-2.5 border-border/0 md:pb-0 flex items-center justify-center",e?"md:px-2.5 md:pr-4":"md:px-4 md:pr-4"," bg-gradient-to-b from-background"),children:f.jsxs("div",{className:"relative flex items-center gap-2 w-full",children:[N?f.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 md:bg-background/80 md:dark:bg-card/40 md:backdrop-blur-lg md:border md:border-border md:rounded-[20px] md:p-1",children:[f.jsxs(tt,{variant:"ghost",size:"icon",className:"relative md:hidden",onClick:n,children:[f.jsx(CN,{className:"h-5 w-5"}),t&&f.jsx("span",{className:"absolute top-0.5 right-0.5 size-2.5 rounded-full bg-emerald-400 ring-2 ring-background"})]}),e&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"relative flex items-center justify-center w-[40px] h-[40px]",children:[f.jsx(Sm,{className:"h-4 w-4 sm:h-5 sm:w-5 ml-1 hidden md:block"}),t&&f.jsx("span",{className:"absolute top-1.5 right-0.5 size-2.5 rounded-full bg-emerald-400 ring-2 ring-background hidden md:block"})]}),f.jsx(tt,{variant:"ghost",size:"icon",className:"hidden md:flex",onClick:r,title:"Expand sidebar",children:f.jsx(kb,{className:"size-4.5"})})]})]}):null,f.jsx("div",{className:"flex-1 min-w-0"}),f.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 md:bg-background/80 md:dark:bg-card/40 md:backdrop-blur-lg md:border md:border-border md:rounded-[20px] md:p-1",children:[v?f.jsxs("div",{className:"hidden md:flex items-center gap-1 mr-1",children:[f.jsxs(ds,{children:[(s==null?void 0:s.contextUsedPercent)!==null&&(s==null?void 0:s.contextUsedPercent)!==void 0?f.jsx(hs,{asChild:!0,children:f.jsxs("div",{className:me("px-2.5 py-1 rounded-lg text-[14px] font-medium",E),children:["Context: ",R(s.contextUsedPercent)]})}):null,f.jsx(Fi,{side:"bottom",children:(s==null?void 0:s.contextWindowTokens)!==null&&(s==null?void 0:s.contextWindowTokens)!==void 0&&(s==null?void 0:s.threadTokens)!==null&&(s==null?void 0:s.threadTokens)!==void 0?`${Math.round(s.threadTokens).toLocaleString()} of ${Math.round(s.contextWindowTokens).toLocaleString()} tokens`:"Context window unavailable for this chat yet"})]}),((s==null?void 0:s.sessionLimitUsedPercent)??0)>=75?f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsxs("div",{className:me("px-2.5 py-1 rounded-lg border text-[11px] font-medium",E),children:["Session: ",R(s==null?void 0:s.sessionLimitUsedPercent)]})}),f.jsx(Fi,{side:"bottom",children:s!=null&&s.rateLimitResetAt?`Resets ${new Date(s.rateLimitResetAt).toLocaleString()}`:"No reset time available yet"})]}):null]}):null,v?f.jsx(bW,{projectId:v,socket:y}):null,a&&(g||u)&&f.jsxs(f.Fragment,{children:[g?f.jsxs(Lu,{children:[f.jsx(zu,{asChild:!0,children:f.jsx(tt,{variant:"ghost",size:"icon",onClick:()=>g("open_finder"),title:"Open in Finder",className:"border border-border/0",children:f.jsx(xN,{className:"h-4.5 w-4.5"})})}),f.jsx(Zl,{side:"bottom",shortcut:w})]}):null,u?f.jsxs(Lu,{children:[f.jsx(zu,{asChild:!0,children:f.jsx(tt,{variant:"ghost",size:"icon",onClick:u,className:me("border border-border/0",l&&"text-white"),children:f.jsx(y0,{className:"h-4.5 w-4.5"})})}),f.jsx(Zl,{side:"bottom",shortcut:C})]}):null,g?f.jsxs(Lu,{children:[f.jsx(zu,{asChild:!0,children:f.jsx(tt,{variant:"ghost",size:"icon",onClick:()=>g("open_editor"),title:`Open in ${p}`,className:"border border-border/0",children:f.jsx(yN,{className:"h-4.5 w-4.5"})})}),f.jsx(Zl,{side:"bottom",shortcut:S})]}):null]}),d?f.jsxs(Lu,{children:[f.jsx(zu,{asChild:!0,children:f.jsx(tt,{variant:"ghost",size:"icon",onClick:d,className:me("border border-border/0",h&&"text-white"),children:f.jsx(EI,{className:"h-4.5 w-4.5"})})}),f.jsx(Zl,{side:"bottom",shortcut:k})]}):null]})]})})}function R2({onClose:e,className:t}){return f.jsx("div",{className:me("h-full min-h-0 bg-background md:min-w-[300px] md:border-l md:border-border",t),children:f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[f.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[f.jsx("div",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:"Diffs"}),f.jsx("button",{type:"button","aria-label":"Close right sidebar",onClick:e,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:f.jsx(Xo,{className:"h-4 w-4"})})]}),f.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-center",children:f.jsx("p",{className:"text-sm text-muted-foreground",children:"diffs coming soon"})})]})})}function CW(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function kW(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function EW(e){return e/100*window.innerHeight}function RW(e){return e/100*window.innerWidth}function TW(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function Hu({groupSize:e,panelElement:t,styleProp:n}){let r;const[s,a]=TW(n);switch(a){case"%":{r=s/100*e;break}case"px":{r=s;break}case"rem":{r=kW(t,s);break}case"em":{r=CW(t,s);break}case"vh":{r=EW(s);break}case"vw":{r=RW(s);break}}return r}function $r(e){return parseFloat(e.toFixed(3))}function hc({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,s)=>(r+=t==="horizontal"?s.element.offsetWidth:s.element.offsetHeight,r),0)}function ey(e){const{panels:t}=e,n=hc({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:s,panelConstraints:a}=r;let l=0;if(a.collapsedSize!==void 0){const g=Hu({groupSize:n,panelElement:s,styleProp:a.collapsedSize});l=$r(g/n*100)}let u;if(a.defaultSize!==void 0){const g=Hu({groupSize:n,panelElement:s,styleProp:a.defaultSize});u=$r(g/n*100)}let h=0;if(a.minSize!==void 0){const g=Hu({groupSize:n,panelElement:s,styleProp:a.minSize});h=$r(g/n*100)}let d=100;if(a.maxSize!==void 0){const g=Hu({groupSize:n,panelElement:s,styleProp:a.maxSize});d=$r(g/n*100)}return{groupResizeBehavior:a.groupResizeBehavior,collapsedSize:l,collapsible:a.collapsible===!0,defaultSize:u,disabled:a.disabled,minSize:h,maxSize:d,panelId:r.id}})}function en(e,t="Assertion error"){if(!e)throw Error(t)}function ty(e,t){return Array.from(t).sort(e==="horizontal"?NW:MW)}function NW(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function MW(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function jA(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function OA(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function AW({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let s,a=Number.MAX_VALUE;for(const l of t){const{x:u,y:h}=OA(r,l),d=e==="horizontal"?u:h;d<a&&(a=d,s=l)}return en(s,"No rect found"),s}let Ef;function DW(){return Ef===void 0&&(typeof matchMedia=="function"?Ef=!!matchMedia("(pointer:coarse)").matches:Ef=!1),Ef}function LA(e){const{element:t,orientation:n,panels:r,separators:s}=e,a=ty(n,Array.from(t.children).filter(jA).map(w=>({element:w}))).map(({element:w})=>w),l=[];let u=!1,h=!1,d=-1,g=-1,p=0,v,y=[];{let w=-1;for(const S of a)S.hasAttribute("data-panel")&&(w++,S.ariaDisabled===null&&(p++,d===-1&&(d=w),g=w))}if(p>1){let w=-1;for(const S of a)if(S.hasAttribute("data-panel")){w++;const C=r.find(k=>k.element===S);if(C){if(v){const k=v.element.getBoundingClientRect(),R=S.getBoundingClientRect();let E;if(h){const N=n==="horizontal"?new DOMRect(k.right,k.top,0,k.height):new DOMRect(k.left,k.bottom,k.width,0),j=n==="horizontal"?new DOMRect(R.left,R.top,0,R.height):new DOMRect(R.left,R.top,R.width,0);switch(y.length){case 0:{E=[N,j];break}case 1:{const D=y[0],L=AW({orientation:n,rects:[k,R],targetRect:D.element.getBoundingClientRect()});E=[D,L===k?j:N];break}default:{E=y;break}}}else y.length?E=y:E=[n==="horizontal"?new DOMRect(k.right,R.top,R.left-k.right,R.height):new DOMRect(R.left,k.bottom,R.width,R.top-k.bottom)];for(const N of E){let j="width"in N?N:N.element.getBoundingClientRect();const D=DW()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(j.width<D){const U=D-j.width;j=new DOMRect(j.x-U/2,j.y,j.width+U,j.height)}if(j.height<D){const U=D-j.height;j=new DOMRect(j.x,j.y-U/2,j.width,j.height+U)}const L=w<=d||w>g;!u&&!L&&l.push({group:e,groupSize:hc({group:e}),panels:[v,C],separator:"width"in N?void 0:N,rect:j}),u=!1}}h=!1,v=C,y=[]}}else if(S.hasAttribute("data-separator")){S.ariaDisabled!==null&&(u=!0);const C=s.find(k=>k.element===S);C?y.push(C):(v=void 0,y=[])}else h=!0}return l}var Vo,QR;let zA=(QR=class{constructor(){PC(this,Vo,{})}addListener(t,n){const r=yu(this,Vo)[t];return r===void 0?yu(this,Vo)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=yu(this,Vo)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let s=!1,a=null;const l=Array.from(r);for(let u=0;u<l.length;u++){const h=l[u];try{h.call(null,n)}catch(d){a===null&&(s=!0,a=d)}}if(s)throw a}}removeAllListeners(){BC(this,Vo,{})}removeListener(t,n){const r=yu(this,Vo)[t];if(r!==void 0){const s=r.indexOf(n);s>=0&&r.splice(s,1)}}},Vo=new WeakMap,QR),fs=new Map;const PA=new zA;function jW(e){fs=new Map(fs),fs.delete(e)}function T2(e,t){for(const[n]of fs)if(n.id===e)return n}function Go(e,t){for(const[n,r]of fs)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function tl(){return fs}function dx(e,t){return PA.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function Qs(e,t){const n=fs.get(e);fs=new Map(fs),fs.set(e,t),PA.emit("groupChange",{group:e,prev:n,next:t})}function OW(e,t,n){let r,s={x:1/0,y:1/0};for(const a of t){const l=OA(n,a.rect);switch(e){case"horizontal":{l.x<=s.x&&(r=a,s=l);break}case"vertical":{l.y<=s.y&&(r=a,s=l);break}}}return r?{distance:s,hitRegion:r}:void 0}function LW(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function zW(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:A2(e),b:A2(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();en(r,"Stacking order can only be calculated for elements with a common ancestor");const s={a:M2(N2(n.a)),b:M2(N2(n.b))};if(s.a===s.b){const a=r.childNodes,l={a:n.a.at(-1),b:n.b.at(-1)};let u=a.length;for(;u--;){const h=a[u];if(h===l.a)return 1;if(h===l.b)return-1}}return Math.sign(s.a-s.b)}const PW=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function BW(e){const t=getComputedStyle(BA(e)??e).display;return t==="flex"||t==="inline-flex"}function IW(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||BW(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||PW.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function N2(e){let t=e.length;for(;t--;){const n=e[t];if(en(n,"Missing node"),IW(n))return n}return null}function M2(e){return e&&Number(getComputedStyle(e).zIndex)||0}function A2(e){const t=[];for(;e;)t.push(e),e=BA(e);return t}function BA(e){const{parentNode:t}=e;return LW(t)?t.host:t}function HW(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function FW({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!jA(n)||n.contains(e)||e.contains(n))return!0;if(zW(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(HW(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function hx(e,t){const n=[];return t.forEach((r,s)=>{if(s.disabled)return;const a=LA(s),l=OW(s.orientation,a,{x:e.clientX,y:e.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&FW({groupElement:s.element,hitRegion:l.hitRegion.rect,pointerEventTarget:e.target})&&n.push(l.hitRegion)}),n}function UW(e,t){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 Er(e,t,n=0){return Math.abs($r(e)-$r(t))<=n}function as(e,t){return Er(e,t)?0:e>t?1:-1}function Jl({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:s=0,collapsible:a,disabled:l,maxSize:u=100,minSize:h=0}=t;if(l&&!e)return n;if(as(r,h)<0)if(a){const d=(s+h)/2;as(r,d)<0?r=s:r=h}else r=h;return r=Math.min(u,r),r=$r(r),r}function fd({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:s,trigger:a}){if(Er(e,0))return t;const l=a==="imperative-api",u=Object.values(t),h=Object.values(s),d=[...u],[g,p]=r;en(g!=null,"Invalid first pivot index"),en(p!=null,"Invalid second pivot index");let v=0;switch(a){case"keyboard":{{const S=e<0?p:g,C=n[S];en(C,`Panel constraints not found for index ${S}`);const{collapsedSize:k=0,collapsible:R,minSize:E=0}=C;if(R){const N=u[S];if(en(N!=null,`Previous layout not found for panel index ${S}`),Er(N,k)){const j=E-N;as(j,Math.abs(e))>0&&(e=e<0?0-j:j)}}}{const S=e<0?g:p,C=n[S];en(C,`No panel constraints found for index ${S}`);const{collapsedSize:k=0,collapsible:R,minSize:E=0}=C;if(R){const N=u[S];if(en(N!=null,`Previous layout not found for panel index ${S}`),Er(N,E)){const j=N-k;as(j,Math.abs(e))>0&&(e=e<0?0-j:j)}}}break}default:{const S=e<0?p:g,C=n[S];en(C,`Panel constraints not found for index ${S}`);const k=u[S],{collapsible:R,collapsedSize:E,minSize:N}=C;if(R&&as(k,N)<0)if(e>0){const j=N-E,D=j/2,L=k+e;as(L,N)<0&&(e=as(e,D)<=0?0:j)}else{const j=N-E,D=100-j/2,L=k-e;as(L,N)<0&&(e=as(100+e,D)>0?0:-j)}break}}{const S=e<0?1:-1;let C=e<0?p:g,k=0;for(;;){const E=u[C];en(E!=null,`Previous layout not found for panel index ${C}`);const N=Jl({overrideDisabledPanels:l,panelConstraints:n[C],prevSize:E,size:100})-E;if(k+=N,C+=S,C<0||C>=n.length)break}const R=Math.min(Math.abs(e),Math.abs(k));e=e<0?0-R:R}{let S=e<0?g:p;for(;S>=0&&S<n.length;){const C=Math.abs(e)-Math.abs(v),k=u[S];en(k!=null,`Previous layout not found for panel index ${S}`);const R=k-C,E=Jl({overrideDisabledPanels:l,panelConstraints:n[S],prevSize:k,size:R});if(!Er(k,E)&&(v+=k-E,d[S]=E,v.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?S--:S++}}if(UW(h,d))return s;{const S=e<0?p:g,C=u[S];en(C!=null,`Previous layout not found for panel index ${S}`);const k=C+v,R=Jl({overrideDisabledPanels:l,panelConstraints:n[S],prevSize:C,size:k});if(d[S]=R,!Er(R,k)){let E=k-R,N=e<0?p:g;for(;N>=0&&N<n.length;){const j=d[N];en(j!=null,`Previous layout not found for panel index ${N}`);const D=j+E,L=Jl({overrideDisabledPanels:l,panelConstraints:n[N],prevSize:j,size:D});if(Er(j,L)||(E-=L-j,d[N]=L),Er(E,0))break;e>0?N--:N++}}}const y=Object.values(d).reduce((S,C)=>C+S,0);if(!Er(y,100,.1))return s;const w=Object.keys(s);return d.reduce((S,C,k)=>(S[w[k]]=C,S),{})}function qa(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||as(e[n],t[n])!==0)return!1;return!0}function Ka({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],s=r.reduce((u,h)=>u+h,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(u=>`${u}%`).join(", ")}`);if(!Er(s,100)&&r.length>0)for(let u=0;u<t.length;u++){const h=r[u];en(h!=null,`No layout data found for index ${u}`);const d=100/s*h;r[u]=d}let a=0;for(let u=0;u<t.length;u++){const h=n[u];en(h!=null,`No layout data found for index ${u}`);const d=r[u];en(d!=null,`No layout data found for index ${u}`);const g=Jl({overrideDisabledPanels:!0,panelConstraints:t[u],prevSize:h,size:d});d!=g&&(a+=d-g,r[u]=g)}if(!Er(a,0))for(let u=0;u<t.length;u++){const h=r[u];en(h!=null,`No layout data found for index ${u}`);const d=h+a,g=Jl({overrideDisabledPanels:!0,panelConstraints:t[u],prevSize:h,size:d});if(h!==g&&(a-=g-h,r[u]=g,Er(a,0)))break}const l=Object.keys(e);return r.reduce((u,h,d)=>(u[l[d]]=h,u),{})}function IA({groupId:e,panelId:t}){const n=()=>{const u=tl();for(const[h,{defaultLayoutDeferred:d,derivedPanelConstraints:g,layout:p,groupSize:v,separatorToPanels:y}]of u)if(h.id===e)return{defaultLayoutDeferred:d,derivedPanelConstraints:g,group:h,groupSize:v,layout:p,separatorToPanels:y};throw Error(`Group ${e} not found`)},r=()=>{const u=n().derivedPanelConstraints.find(h=>h.panelId===t);if(u!==void 0)return u;throw Error(`Panel constraints not found for Panel ${t}`)},s=()=>{const u=n().group.panels.find(h=>h.id===t);if(u!==void 0)return u;throw Error(`Layout not found for Panel ${t}`)},a=()=>{const u=n().layout[t];if(u!==void 0)return u;throw Error(`Layout not found for Panel ${t}`)},l=u=>{const h=a();if(u===h)return;const{defaultLayoutDeferred:d,derivedPanelConstraints:g,group:p,groupSize:v,layout:y,separatorToPanels:w}=n(),S=p.panels.findIndex(E=>E.id===t),C=S===p.panels.length-1,k=fd({delta:C?h-u:u-h,initialLayout:y,panelConstraints:g,pivotIndices:C?[S-1,S]:[S,S+1],prevLayout:y,trigger:"imperative-api"}),R=Ka({layout:k,panelConstraints:g});qa(y,R)||Qs(p,{defaultLayoutDeferred:d,derivedPanelConstraints:g,groupSize:v,layout:R,separatorToPanels:w})};return{collapse:()=>{const{collapsible:u,collapsedSize:h}=r(),{mutableValues:d}=s(),g=a();u&&g!==h&&(d.expandToSize=g,l(h))},expand:()=>{const{collapsible:u,collapsedSize:h,minSize:d}=r(),{mutableValues:g}=s(),p=a();if(u&&p===h){let v=g.expandToSize??d;v===0&&(v=1),l(v)}},getSize:()=>{const{group:u}=n(),h=a(),{element:d}=s(),g=u.orientation==="horizontal"?d.offsetWidth:d.offsetHeight;return{asPercentage:h,inPixels:g}},isCollapsed:()=>{const{collapsible:u,collapsedSize:h}=r(),d=a();return u&&Er(h,d)},resize:u=>{const{group:h}=n(),{element:d}=s(),g=hc({group:h}),p=Hu({groupSize:g,panelElement:d,styleProp:u}),v=$r(p/g*100);l(v)}}}function D2(e){if(e.defaultPrevented)return;const t=tl();hx(e,t).forEach(n=>{if(n.separator){const r=n.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(r){const s=r.panelConstraints.defaultSize,a=IA({groupId:n.group.id,panelId:r.id});a&&s!==void 0&&(a.resize(s),e.preventDefault())}}})}function Jf(e){const t=tl();for(const[n]of t)if(n.separators.some(r=>r.element===e))return n;throw Error("Could not find parent Group for separator element")}function HA({groupId:e}){const t=()=>{const n=tl();for(const[r,s]of n)if(r.id===e)return{group:r,...s};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:s,group:a,groupSize:l,layout:u,separatorToPanels:h}=t(),d=Ka({layout:n,panelConstraints:s});return r?u:(qa(u,d)||Qs(a,{defaultLayoutDeferred:r,derivedPanelConstraints:s,groupSize:l,layout:d,separatorToPanels:h}),d)}}}function Ea(e,t){const n=Jf(e),r=Go(n.id,!0),s=n.separators.find(g=>g.element===e);en(s,"Matching separator not found");const a=r.separatorToPanels.get(s);en(a,"Matching panels not found");const l=a.map(g=>n.panels.indexOf(g)),u=HA({groupId:n.id}).getLayout(),h=fd({delta:t,initialLayout:u,panelConstraints:r.derivedPanelConstraints,pivotIndices:l,prevLayout:u,trigger:"keyboard"}),d=Ka({layout:h,panelConstraints:r.derivedPanelConstraints});qa(u,d)||Qs(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:d,separatorToPanels:r.separatorToPanels})}function j2(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Jf(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Ea(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Ea(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Ea(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Ea(t,-5);break}case"End":{e.preventDefault(),Ea(t,100);break}case"Enter":{e.preventDefault();const r=Jf(t),s=Go(r.id,!0),{derivedPanelConstraints:a,layout:l,separatorToPanels:u}=s,h=r.separators.find(v=>v.element===t);en(h,"Matching separator not found");const d=u.get(h);en(d,"Matching panels not found");const g=d[0],p=a.find(v=>v.panelId===g.id);if(en(p,"Panel metadata not found"),p.collapsible){const v=l[g.id],y=p.collapsedSize===v?r.mutableState.expandedPanelSizes[g.id]??p.minSize:p.collapsedSize;Ea(t,y-v)}break}case"F6":{e.preventDefault();const r=Jf(t).separators.map(l=>l.element),s=Array.from(r).findIndex(l=>l===e.currentTarget);en(s!==null,"Index not found");const a=e.shiftKey?s>0?s-1:r.length-1:s+1<r.length?s+1:0;r[a].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),Ea(t,-100);break}}}let sc={cursorFlags:0,state:"inactive"};const fx=new zA;function Ga(){return sc}function $W(e){return fx.addListener("change",e)}function WW(e){const t=sc,n={...sc};n.cursorFlags=e,sc=n,fx.emit("change",{prev:t,next:n})}function oc(e){const t=sc;sc=e,fx.emit("change",{prev:t,next:e})}function O2(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=tl(),n=hx(e,t),r=new Map;let s=!1;n.forEach(a=>{a.separator&&(s||(s=!0,a.separator.element.focus({preventScroll:!0})));const l=t.get(a.group);l&&r.set(a.group,l.layout)}),oc({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const VW=e=>e,N_=()=>{},FA=1,UA=2,$A=4,WA=8,L2=3,z2=12;let Rf;function P2(){return Rf===void 0&&(Rf=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Rf=!0)),Rf}function qW({cursorFlags:e,groups:t,state:n}){let r=0,s=0;switch(n){case"active":case"hover":t.forEach(a=>{if(!a.mutableState.disableCursor)switch(a.orientation){case"horizontal":{r++;break}case"vertical":{s++;break}}})}if(!(r===0&&s===0)){switch(n){case"active":{if(e&&P2()){const a=(e&FA)!==0,l=(e&UA)!==0,u=(e&$A)!==0,h=(e&WA)!==0;if(a)return u?"se-resize":h?"ne-resize":"e-resize";if(l)return u?"sw-resize":h?"nw-resize":"w-resize";if(u)return"s-resize";if(h)return"n-resize"}break}}return P2()?r>0&&s>0?"move":r>0?"ew-resize":"ns-resize":r>0&&s>0?"grab":r>0?"col-resize":"row-resize"}}const B2=new WeakMap;function mx(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=B2.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const r=Ga();switch(r.state){case"active":case"hover":{const s=qW({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(l=>l.group),state:r.state}),a=`*, *:hover {cursor: ${s} !important; }`;if(t===a)return;t=a,s?n.cssRules.length===0?n.insertRule(a):n.replaceSync(a):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}B2.set(e,{prevStyle:t,styleSheet:n})}function VA({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:s,pointerDownAtPoint:a,prevCursorFlags:l}){let u=0;n.forEach(d=>{const{group:g,groupSize:p}=d,{orientation:v,panels:y}=g,{disableCursor:w}=g.mutableState;let S=0;a?v==="horizontal"?S=(t.clientX-a.x)/p*100:S=(t.clientY-a.y)/p*100:v==="horizontal"?S=t.clientX<0?-100:100:S=t.clientY<0?-100:100;const C=r.get(g),k=s.get(g);if(!C||!k)return;const{defaultLayoutDeferred:R,derivedPanelConstraints:E,groupSize:N,layout:j,separatorToPanels:D}=k;if(E&&j&&D){const L=fd({delta:S,initialLayout:C,panelConstraints:E,pivotIndices:d.panels.map(U=>y.indexOf(U)),prevLayout:j,trigger:"mouse-or-touch"});if(qa(L,j)){if(S!==0&&!w)switch(v){case"horizontal":{u|=S<0?FA:UA;break}case"vertical":{u|=S<0?$A:WA;break}}}else Qs(d.group,{defaultLayoutDeferred:R,derivedPanelConstraints:E,groupSize:N,layout:L,separatorToPanels:D})}});let h=0;t.movementX===0?h|=l&L2:h|=u&L2,t.movementY===0?h|=l&z2:h|=u&z2,WW(h),mx(e)}function I2(e){const t=tl(),n=Ga();switch(n.state){case"active":VA({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function H2(e){if(e.defaultPrevented)return;const t=Ga(),n=tl();switch(t.state){case"active":{if(e.buttons===0){oc({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(r=>{const s=Go(r.group.id,!0);Qs(r.group,s)});return}VA({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const r=hx(e,n);r.length===0?t.state!=="inactive"&&oc({cursorFlags:0,state:"inactive"}):oc({cursorFlags:0,hitRegions:r,state:"hover"}),mx(e.currentTarget);break}}}function F2(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Ga().state){case"hover":oc({cursorFlags:0,state:"inactive"})}}function U2(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Ga();switch(t.state){case"active":oc({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(mx(e.currentTarget),t.hitRegions.forEach(n=>{const r=Go(n.group.id,!0);Qs(n.group,r)}),e.preventDefault())}}function $2(e){let t=0,n=0;const r={};for(const a of e)if(a.defaultSize!==void 0){t++;const l=$r(a.defaultSize);n+=l,r[a.panelId]=l}else r[a.panelId]=void 0;const s=e.length-t;if(s!==0){const a=$r((100-n)/s);for(const l of e)l.defaultSize===void 0&&(r[l.panelId]=a)}return r}function KW(e,t,n){if(!n[0])return;const r=e.panels.find(h=>h.element===t);if(!r||!r.onResize)return;const s=hc({group:e}),a=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,l=r.mutableValues.prevSize,u={asPercentage:$r(a/s*100),inPixels:a};r.mutableValues.prevSize=u,r.onResize(u,r.id,l)}function GW(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function YW({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let s=0,a=0,l=!1;const u=new Map,h=[];for(const p of e.panels){const v=r[p.id]??0;switch(p.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{l=!0;const y=v/100*n,w=$r(y/t*100);u.set(p.id,w),s+=w;break}case"preserve-relative-size":default:{h.push(p.id),a+=v;break}}}if(!l||h.length===0)return r;const d=100-s,g={...r};if(u.forEach((p,v)=>{g[v]=p}),a>0)for(const p of h){const v=r[p]??0;g[p]=$r(v/a*d)}else{const p=$r(d/h.length);for(const v of h)g[v]=p}return g}function XW(e,t){const n=e.map(s=>s.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n)if(!r.includes(s))return!1;return!0}const Ul=new Map;function ZW(e){let t=!0;en(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,s=new Set,a=new n(w=>{for(const S of w){const{borderBoxSize:C,target:k}=S;if(k===e.element){if(t){const R=hc({group:e});if(R===0)return;const E=Go(e.id);if(!E)return;const N=ey(e),j=E.defaultLayoutDeferred?$2(N):E.layout,D=YW({group:e,nextGroupSize:R,prevGroupSize:E.groupSize,prevLayout:j}),L=Ka({layout:D,panelConstraints:N});if(!E.defaultLayoutDeferred&&qa(E.layout,L)&&GW(E.derivedPanelConstraints,N)&&E.groupSize===R)return;Qs(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:N,groupSize:R,layout:L,separatorToPanels:E.separatorToPanels})}}else KW(e,k,C)}});a.observe(e.element),e.panels.forEach(w=>{en(!r.has(w.id),`Panel ids must be unique; id "${w.id}" was used more than once`),r.add(w.id),w.onResize&&a.observe(w.element)});const l=hc({group:e}),u=ey(e),h=e.panels.map(({id:w})=>w).join(",");let d=e.mutableState.defaultLayout;d&&(XW(e.panels,d)||(d=void 0));const g=e.mutableState.layouts[h]??d??$2(u),p=Ka({layout:g,panelConstraints:u}),v=e.element.ownerDocument;Ul.set(v,(Ul.get(v)??0)+1);const y=new Map;return LA(e).forEach(w=>{w.separator&&y.set(w.separator,w.panels)}),Qs(e,{defaultLayoutDeferred:l===0,derivedPanelConstraints:u,groupSize:l,layout:p,separatorToPanels:y}),e.separators.forEach(w=>{en(!s.has(w.id),`Separator ids must be unique; id "${w.id}" was used more than once`),s.add(w.id),w.element.addEventListener("keydown",j2)}),Ul.get(v)===1&&(v.addEventListener("dblclick",D2,!0),v.addEventListener("pointerdown",O2,!0),v.addEventListener("pointerleave",I2),v.addEventListener("pointermove",H2),v.addEventListener("pointerout",F2),v.addEventListener("pointerup",U2,!0)),function(){t=!1,Ul.set(v,Math.max(0,(Ul.get(v)??0)-1)),jW(e),e.separators.forEach(w=>{w.element.removeEventListener("keydown",j2)}),Ul.get(v)||(v.removeEventListener("dblclick",D2,!0),v.removeEventListener("pointerdown",O2,!0),v.removeEventListener("pointerleave",I2),v.removeEventListener("pointermove",H2),v.removeEventListener("pointerout",F2),v.removeEventListener("pointerup",U2,!0)),a.disconnect()}}function QW(){const[e,t]=_.useState({}),n=_.useCallback(()=>t({}),[]);return[e,n]}function px(e){const t=_.useId();return`${e??t}`}const nl=typeof window<"u"?_.useLayoutEffect:_.useEffect;function Zu(e){const t=_.useRef(e);return nl(()=>{t.current=e},[e]),_.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function gx(...e){return Zu(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function vx(e){const t=_.useRef({...e});return nl(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const qA=_.createContext(null);function JW(e,t){const n=_.useRef({getLayout:()=>({}),setLayout:VW});_.useImperativeHandle(t,()=>n.current,[]),nl(()=>{Object.assign(n.current,HA({groupId:e}))})}function KA({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:s,elementRef:a,groupRef:l,id:u,onLayoutChange:h,onLayoutChanged:d,orientation:g="horizontal",resizeTargetMinimumSize:p={coarse:20,fine:10},style:v,...y}){const w=_.useRef({onLayoutChange:{},onLayoutChanged:{}}),S=Zu(V=>{qa(w.current.onLayoutChange,V)||(w.current.onLayoutChange=V,h==null||h(V))}),C=Zu(V=>{qa(w.current.onLayoutChanged,V)||(w.current.onLayoutChanged=V,d==null||d(V))}),k=px(u),R=_.useRef(null),[E,N]=QW(),j=_.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:p,separators:[]}),D=gx(R,a);JW(k,l);const L=Zu((V,I)=>{const W=Ga(),K=T2(V),q=Go(V);if(q){let O=!1;switch(W.state){case"active":{O=W.hitRegions.some(F=>F.group===K);break}}return{flexGrow:q.layout[I]??1,pointerEvents:O?"none":void 0}}return{flexGrow:(n==null?void 0:n[I])??1}}),U=vx({defaultLayout:n,disableCursor:r}),Y=_.useMemo(()=>({get disableCursor(){return!!U.disableCursor},getPanelStyles:L,id:k,orientation:g,registerPanel:V=>{const I=j.current;return I.panels=ty(g,[...I.panels,V]),N(),()=>{I.panels=I.panels.filter(W=>W!==V),N()}},registerSeparator:V=>{const I=j.current;return I.separators=ty(g,[...I.separators,V]),N(),()=>{I.separators=I.separators.filter(W=>W!==V),N()}},togglePanelDisabled:(V,I)=>{const W=j.current.panels.find(O=>O.id===V);W&&(W.panelConstraints.disabled=I);const K=T2(k),q=Go(k);K&&q&&Qs(K,{...q,derivedPanelConstraints:ey(K)})},toggleSeparatorDisabled:(V,I)=>{const W=j.current.separators.find(K=>K.id===V);W&&(W.disabled=I)}}),[L,k,N,g,U]),P=_.useRef(null);return nl(()=>{const V=R.current;if(V===null)return;const I=j.current;let W;if(U.defaultLayout!==void 0&&Object.keys(U.defaultLayout).length===I.panels.length){W={};for(const M of I.panels){const B=U.defaultLayout[M.id];B!==void 0&&(W[M.id]=B)}}const K={disabled:!!s,element:V,id:k,mutableState:{defaultLayout:W,disableCursor:!!U.disableCursor,expandedPanelSizes:j.current.lastExpandedPanelSizes,layouts:j.current.layouts},orientation:g,panels:I.panels,resizeTargetMinimumSize:I.resizeTargetMinimumSize,separators:I.separators};P.current=K;const q=ZW(K),{defaultLayoutDeferred:O,derivedPanelConstraints:F,layout:H}=Go(K.id,!0);!O&&F.length>0&&(S(H),C(H));const $=dx(k,M=>{const{defaultLayoutDeferred:B,derivedPanelConstraints:X,layout:A}=M.next;if(B||X.length===0)return;const re=K.panels.map(({id:Z})=>Z).join(",");K.mutableState.layouts[re]=A,X.forEach(Z=>{if(Z.collapsible){const{layout:te}=M.prev??{};if(te){const le=Er(Z.collapsedSize,A[Z.panelId]),pe=Er(Z.collapsedSize,te[Z.panelId]);le&&!pe&&(K.mutableState.expandedPanelSizes[Z.panelId]=te[Z.panelId])}}});const se=Ga().state!=="active";S(A),se&&C(A)});return()=>{P.current=null,q(),$()}},[s,k,C,S,g,E,U]),_.useEffect(()=>{const V=P.current;V&&(V.mutableState.defaultLayout=n,V.mutableState.disableCursor=!!r)}),f.jsx(qA.Provider,{value:Y,children:f.jsx("div",{...y,className:t,"data-group":!0,"data-testid":k,id:k,ref:D,style:{height:"100%",width:"100%",overflow:"hidden",...v,display:"flex",flexDirection:g==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:g==="horizontal"?"pan-y":"pan-x"},children:e})})}KA.displayName="Group";function _x(){const e=_.useContext(qA);return en(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function eV(e,t){const{id:n}=_x(),r=_.useRef({collapse:N_,expand:N_,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:N_});_.useImperativeHandle(t,()=>r.current,[]),nl(()=>{Object.assign(r.current,IA({groupId:n,panelId:e}))})}function GA({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:s,disabled:a,elementRef:l,groupResizeBehavior:u="preserve-relative-size",id:h,maxSize:d="100%",minSize:g="0%",onResize:p,panelRef:v,style:y,...w}){const S=!!h,C=px(h),k=vx({disabled:a}),R=_.useRef(null),E=gx(R,l),{getPanelStyles:N,id:j,orientation:D,registerPanel:L,togglePanelDisabled:U}=_x(),Y=p!==null,P=Zu((I,W,K)=>{p==null||p(I,h,K)});nl(()=>{const I=R.current;if(I!==null){const W={element:I,id:C,idIsStable:S,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:Y?P:void 0,panelConstraints:{groupResizeBehavior:u,collapsedSize:n,collapsible:r,defaultSize:s,disabled:k.disabled,maxSize:d,minSize:g}};return L(W)}},[u,n,r,s,Y,C,S,d,g,P,L,k]),_.useEffect(()=>{U(C,!!a)},[a,C,U]),eV(C,v);const V=_.useSyncExternalStore(I=>dx(j,I),()=>JSON.stringify(N(j,C)),()=>JSON.stringify(N(j,C)));return f.jsx("div",{...w,"aria-disabled":a||void 0,"data-panel":!0,"data-testid":C,id:C,ref:E,style:{...tV,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(V)},children:f.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...y,touchAction:D==="horizontal"?"pan-y":"pan-x"},children:e})})}GA.displayName="Panel";const tV={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function nV({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let s,a;const l=e[n],u=t.find(h=>h.panelId===n);if(u){const h=u.maxSize,d=u.collapsible?u.collapsedSize:u.minSize,g=[r,r+1];a=Ka({layout:fd({delta:d-l,initialLayout:e,panelConstraints:t,pivotIndices:g,prevLayout:e}),panelConstraints:t})[n],s=Ka({layout:fd({delta:h-l,initialLayout:e,panelConstraints:t,pivotIndices:g,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:s,valueMin:a,valueNow:l}}function YA({children:e,className:t,disabled:n,elementRef:r,id:s,style:a,...l}){const u=px(s),h=vx({disabled:n}),[d,g]=_.useState({}),[p,v]=_.useState("inactive"),y=_.useRef(null),w=gx(y,r),{disableCursor:S,id:C,orientation:k,registerSeparator:R,toggleSeparatorDisabled:E}=_x(),N=k==="horizontal"?"vertical":"horizontal";nl(()=>{const D=y.current;if(D!==null){const L={disabled:h.disabled,element:D,id:u},U=R(L),Y=$W(V=>{v(V.next.state!=="inactive"&&V.next.hitRegions.some(I=>I.separator===L)?V.next.state:"inactive")}),P=dx(C,V=>{const{derivedPanelConstraints:I,layout:W,separatorToPanels:K}=V.next,q=K.get(L);if(q){const O=q[0],F=q.indexOf(O);g(nV({layout:W,panelConstraints:I,panelId:O.id,panelIndex:F}))}});return()=>{Y(),P(),U()}}},[C,u,R,h]),_.useEffect(()=>{E(u,!!n)},[n,u,E]);let j;return n&&!S&&(j="not-allowed"),f.jsx("div",{...l,"aria-controls":d.valueControls,"aria-disabled":n||void 0,"aria-orientation":N,"aria-valuemax":d.valueMax,"aria-valuemin":d.valueMin,"aria-valuenow":d.valueNow,children:e,className:t,"data-separator":n?"disabled":p,"data-testid":u,id:u,ref:w,role:"separator",style:{flexBasis:"auto",cursor:j,...a,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}YA.displayName="Separator";const em=({className:e,...t})=>f.jsx(KA,{className:me("flex h-full w-full",e),...t}),Ma=e=>f.jsx(GA,{...e}),tm=({withHandle:e,orientation:t,disabled:n,className:r,...s})=>f.jsx(YA,{disabled:n,className:me("relative flex items-center justify-center bg-transparent focus-visible:outline-none",t==="vertical"?"h-2 w-full -my-1 cursor-row-resize before:absolute before:inset-x-0 before:top-1/2 before:h-0.5 before:-translate-y-1/2 before:bg-border":"h-full w-2 -mx-1 cursor-col-resize before:absolute before:inset-y-0 before:left-1/2 before:w-px before:-translate-x-1/2 before:bg-border",r),...s,children:f.jsx("span",{className:"sr-only",children:t==="vertical"?"Resize rows":"Resize columns"})});/**
469
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
470
- * @license MIT
471
- *
472
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
473
- * @license MIT
474
- *
475
- * Originally forked from (with the author's permission):
476
- * Fabrice Bellard's javascript vt100 for jslinux:
477
- * http://bellard.org/jslinux/
478
- * Copyright (c) 2011 Fabrice Bellard
479
- */var Xn=0,Zn=0,Qn=0,xn=0,vr;(e=>{function t(s,a,l,u){return u!==void 0?`#${Ra(s)}${Ra(a)}${Ra(l)}${Ra(u)}`:`#${Ra(s)}${Ra(a)}${Ra(l)}`}e.toCss=t;function n(s,a,l,u=255){return(s<<24|a<<16|l<<8|u)>>>0}e.toRgba=n;function r(s,a,l,u){return{css:e.toCss(s,a,l,u),rgba:e.toRgba(s,a,l,u)}}e.toColor=r})(vr||(vr={}));var rV;(e=>{function t(h,d){if(xn=(d.rgba&255)/255,xn===1)return{css:d.css,rgba:d.rgba};let g=d.rgba>>24&255,p=d.rgba>>16&255,v=d.rgba>>8&255,y=h.rgba>>24&255,w=h.rgba>>16&255,S=h.rgba>>8&255;Xn=y+Math.round((g-y)*xn),Zn=w+Math.round((p-w)*xn),Qn=S+Math.round((v-S)*xn);let C=vr.toCss(Xn,Zn,Qn),k=vr.toRgba(Xn,Zn,Qn);return{css:C,rgba:k}}e.blend=t;function n(h){return(h.rgba&255)===255}e.isOpaque=n;function r(h,d,g){let p=nm.ensureContrastRatio(h.rgba,d.rgba,g);if(p)return vr.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=r;function s(h){let d=(h.rgba|255)>>>0;return[Xn,Zn,Qn]=nm.toChannels(d),{css:vr.toCss(Xn,Zn,Qn),rgba:d}}e.opaque=s;function a(h,d){return xn=Math.round(d*255),[Xn,Zn,Qn]=nm.toChannels(h.rgba),{css:vr.toCss(Xn,Zn,Qn,xn),rgba:vr.toRgba(Xn,Zn,Qn,xn)}}e.opacity=a;function l(h,d){return xn=h.rgba&255,a(h,xn*d/255)}e.multiplyOpacity=l;function u(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=u})(rV||(rV={}));var cr;(e=>{let t,n;try{let s=document.createElement("canvas");s.width=1,s.height=1;let a=s.getContext("2d",{willReadFrequently:!0});a&&(t=a,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Xn=parseInt(s.slice(1,2).repeat(2),16),Zn=parseInt(s.slice(2,3).repeat(2),16),Qn=parseInt(s.slice(3,4).repeat(2),16),vr.toColor(Xn,Zn,Qn);case 5:return Xn=parseInt(s.slice(1,2).repeat(2),16),Zn=parseInt(s.slice(2,3).repeat(2),16),Qn=parseInt(s.slice(3,4).repeat(2),16),xn=parseInt(s.slice(4,5).repeat(2),16),vr.toColor(Xn,Zn,Qn,xn);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let a=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a)return Xn=parseInt(a[1]),Zn=parseInt(a[2]),Qn=parseInt(a[3]),xn=Math.round((a[5]===void 0?1:parseFloat(a[5]))*255),vr.toColor(Xn,Zn,Qn,xn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Xn,Zn,Qn,xn]=t.getImageData(0,0,1,1).data,xn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:vr.toRgba(Xn,Zn,Qn,xn),css:s}}e.toColor=r})(cr||(cr={}));var Cr;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,s,a){let l=r/255,u=s/255,h=a/255,d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),g=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return d*.2126+g*.7152+p*.0722}e.relativeLuminance2=n})(Cr||(Cr={}));var nm;(e=>{function t(l,u){if(xn=(u&255)/255,xn===1)return u;let h=u>>24&255,d=u>>16&255,g=u>>8&255,p=l>>24&255,v=l>>16&255,y=l>>8&255;return Xn=p+Math.round((h-p)*xn),Zn=v+Math.round((d-v)*xn),Qn=y+Math.round((g-y)*xn),vr.toRgba(Xn,Zn,Qn)}e.blend=t;function n(l,u,h){let d=Cr.relativeLuminance(l>>8),g=Cr.relativeLuminance(u>>8);if(Us(d,g)<h){if(g<d){let y=r(l,u,h),w=Us(d,Cr.relativeLuminance(y>>8));if(w<h){let S=s(l,u,h),C=Us(d,Cr.relativeLuminance(S>>8));return w>C?y:S}return y}let p=s(l,u,h),v=Us(d,Cr.relativeLuminance(p>>8));if(v<h){let y=r(l,u,h),w=Us(d,Cr.relativeLuminance(y>>8));return v>w?p:y}return p}}e.ensureContrastRatio=n;function r(l,u,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,v=u>>24&255,y=u>>16&255,w=u>>8&255,S=Us(Cr.relativeLuminance2(v,y,w),Cr.relativeLuminance2(d,g,p));for(;S<h&&(v>0||y>0||w>0);)v-=Math.max(0,Math.ceil(v*.1)),y-=Math.max(0,Math.ceil(y*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=Us(Cr.relativeLuminance2(v,y,w),Cr.relativeLuminance2(d,g,p));return(v<<24|y<<16|w<<8|255)>>>0}e.reduceLuminance=r;function s(l,u,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,v=u>>24&255,y=u>>16&255,w=u>>8&255,S=Us(Cr.relativeLuminance2(v,y,w),Cr.relativeLuminance2(d,g,p));for(;S<h&&(v<255||y<255||w<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=Us(Cr.relativeLuminance2(v,y,w),Cr.relativeLuminance2(d,g,p));return(v<<24|y<<16|w<<8|255)>>>0}e.increaseLuminance=s;function a(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=a})(nm||(nm={}));function Ra(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Us(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var iV=Object.freeze((()=>{let e=[cr.toColor("#2e3436"),cr.toColor("#cc0000"),cr.toColor("#4e9a06"),cr.toColor("#c4a000"),cr.toColor("#3465a4"),cr.toColor("#75507b"),cr.toColor("#06989a"),cr.toColor("#d3d7cf"),cr.toColor("#555753"),cr.toColor("#ef2929"),cr.toColor("#8ae234"),cr.toColor("#fce94f"),cr.toColor("#729fcf"),cr.toColor("#ad7fa8"),cr.toColor("#34e2e2"),cr.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],s=t[n/6%6|0],a=t[n%6];e.push({css:vr.toCss(r,s,a),rgba:vr.toRgba(r,s,a)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:vr.toCss(r,r,r),rgba:vr.toRgba(r,r,r)})}return e})());function W2(e,t,n){return Math.max(t,Math.min(e,n))}function sV(e){switch(e){case"&":return"&amp;";case"<":return"&lt;"}return e}var XA=class{constructor(t){this._buffer=t}serialize(t,n){let r=this._buffer.getNullCell(),s=this._buffer.getNullCell(),a=r,l=t.start.y,u=t.end.y,h=t.start.x,d=t.end.x;this._beforeSerialize(u-l,l,u);for(let g=l;g<=u;g++){let p=this._buffer.getLine(g);if(p){let v=g===t.start.y?h:0,y=g===t.end.y?d:p.length;for(let w=v;w<y;w++){let S=p.getCell(w,a===r?s:r);if(!S){console.warn(`Can't get cell at row=${g}, col=${w}`);continue}this._nextCell(S,a,g,w),a=S}}this._rowEnd(g,g===u)}return this._afterSerialize(),this._serializeString(n)}_nextCell(t,n,r,s){}_rowEnd(t,n){}_beforeSerialize(t,n,r){}_afterSerialize(){}_serializeString(t){return""}};function ZA(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Vs(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function QA(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}var oV=class extends XA{constructor(t,n){super(t),this._terminal=n,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(t,n,r){this._allRows=new Array(t),this._lastContentCursorRow=n,this._lastCursorRow=n,this._firstRow=n}_rowEnd(t,n){var s;this._nullCellCount>0&&!Vs(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let r="";if(!n){t-this._firstRow>=this._terminal.rows&&((s=this._buffer.getLine(this._cursorStyleRow))==null||s.getCell(this._cursorStyleCol,this._backgroundCell));let a=this._buffer.getLine(t),l=this._buffer.getLine(t+1);if(!l.isWrapped)r=`\r
480
- `,this._lastCursorRow=t+1,this._lastCursorCol=0;else{r="";let u=a.getCell(a.length-1,this._thisRowLastChar),h=a.getCell(a.length-2,this._thisRowLastSecondChar),d=l.getCell(0,this._nextRowFirstChar),g=d.getWidth()>1,p=!1;(d.getChars()&&g?this._nullCellCount<=1:this._nullCellCount<=0)&&((u.getChars()||u.getWidth()===0)&&Vs(u,d)&&(p=!0),g&&(h.getChars()||h.getWidth()===0)&&Vs(u,d)&&Vs(h,d)&&(p=!0)),p||(r="-".repeat(this._nullCellCount+1),r+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(r+="\x1B[A",r+=`\x1B[${a.length-this._nullCellCount}C`,r+=`\x1B[${this._nullCellCount}X`,r+=`\x1B[${a.length-this._nullCellCount}D`,r+="\x1B[B"),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=r,this._currentRow="",this._nullCellCount=0}_diffStyle(t,n){let r=[],s=!ZA(t,n),a=!Vs(t,n),l=!QA(t,n);if(s||a||l)if(t.isAttributeDefault())n.isAttributeDefault()||r.push(0);else{if(s){let u=t.getFgColor();t.isFgRGB()?r.push(38,2,u>>>16&255,u>>>8&255,u&255):t.isFgPalette()?u>=16?r.push(38,5,u):r.push(u&8?90+(u&7):30+(u&7)):r.push(39)}if(a){let u=t.getBgColor();t.isBgRGB()?r.push(48,2,u>>>16&255,u>>>8&255,u&255):t.isBgPalette()?u>=16?r.push(48,5,u):r.push(u&8?100+(u&7):40+(u&7)):r.push(49)}l&&(t.isInverse()!==n.isInverse()&&r.push(t.isInverse()?7:27),t.isBold()!==n.isBold()&&r.push(t.isBold()?1:22),t.isUnderline()!==n.isUnderline()&&r.push(t.isUnderline()?4:24),t.isOverline()!==n.isOverline()&&r.push(t.isOverline()?53:55),t.isBlink()!==n.isBlink()&&r.push(t.isBlink()?5:25),t.isInvisible()!==n.isInvisible()&&r.push(t.isInvisible()?8:28),t.isItalic()!==n.isItalic()&&r.push(t.isItalic()?3:23),t.isDim()!==n.isDim()&&r.push(t.isDim()?2:22),t.isStrikethrough()!==n.isStrikethrough()&&r.push(t.isStrikethrough()?9:29))}return r}_nextCell(t,n,r,s){if(t.getWidth()===0)return;let a=t.getChars()==="",l=this._diffStyle(t,this._cursorStyle);if(a?!Vs(this._cursorStyle,t):l.length>0){this._nullCellCount>0&&(Vs(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=s,this._currentRow+=`\x1B[${l.join(";")}m`;let u=this._buffer.getLine(r);u!==void 0&&(u.getCell(s,this._cursorStyle),this._cursorStyleRow=r,this._cursorStyleCol=s)}a?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(Vs(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=s+t.getWidth())}_serializeString(t){let n=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(n=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let r="";for(let l=0;l<n;l++)r+=this._allRows[l],l+1<n&&(r+=this._allRowSeparators[l]);if(!t){let l=this._buffer.baseY+this._buffer.cursorY,u=this._buffer.cursorX,h=l!==this._lastCursorRow||u!==this._lastCursorCol,d=g=>{g>0?r+=`\x1B[${g}C`:g<0&&(r+=`\x1B[${-g}D`)};h&&((g=>{g>0?r+=`\x1B[${g}B`:g<0&&(r+=`\x1B[${-g}A`)})(l-this._lastCursorRow),d(u-this._lastCursorCol))}let s=this._terminal._core._inputHandler._curAttrData,a=this._diffStyle(s,this._cursorStyle);return a.length>0&&(r+=`\x1B[${a.join(";")}m`),r}},aV=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,n,r){let s=n.length,a=r===void 0?s:W2(r+t.rows,0,s);return this._serializeBufferByRange(t,n,{start:s-a,end:s-1},!1)}_serializeBufferByRange(t,n,r,s){return new oV(n,t).serialize({start:{x:0,y:typeof r.start=="number"?r.start:r.start.line},end:{x:t.cols,y:typeof r.end=="number"?r.end:r.end.line}},s)}_serializeBufferAsHTML(t,n){var h;let r=t.buffer.active,s=new lV(r,t,n),a=n.onlySelection??!1,l=n.range;if(l)return s.serialize({start:{x:l.startCol,y:(l.startLine,l.startLine)},end:{x:t.cols,y:(l.endLine,l.endLine)}});if(!a){let d=r.length,g=n.scrollback,p=g===void 0?d:W2(g+t.rows,0,d);return s.serialize({start:{x:0,y:d-p},end:{x:t.cols,y:d-1}})}let u=(h=this._terminal)==null?void 0:h.getSelectionPosition();return u!==void 0?s.serialize({start:{x:u.start.x,y:u.start.y},end:{x:u.end.x,y:u.end.y}}):""}_serializeModes(t){let n="",r=t.modes;if(r.applicationCursorKeysMode&&(n+="\x1B[?1h"),r.applicationKeypadMode&&(n+="\x1B[?66h"),r.bracketedPasteMode&&(n+="\x1B[?2004h"),r.insertMode&&(n+="\x1B[4h"),r.originMode&&(n+="\x1B[?6h"),r.reverseWraparoundMode&&(n+="\x1B[?45h"),r.sendFocusMode&&(n+="\x1B[?1004h"),r.wraparoundMode===!1&&(n+="\x1B[?7l"),r.mouseTrackingMode!=="none")switch(r.mouseTrackingMode){case"x10":n+="\x1B[?9h";break;case"vt200":n+="\x1B[?1000h";break;case"drag":n+="\x1B[?1002h";break;case"any":n+="\x1B[?1003h";break}return n}serialize(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let n=t!=null&&t.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,t.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,t==null?void 0:t.scrollback);if(!(t!=null&&t.excludeAltBuffer)&&this._terminal.buffer.active.type==="alternate"){let r=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);n+=`\x1B[?1049h\x1B[H${r}`}return t!=null&&t.excludeModes||(n+=this._serializeModes(this._terminal)),n}serializeAsHTML(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,t||{})}dispose(){}},lV=class extends XA{constructor(t,n,r){super(t),this._terminal=n,this._options=r,this._currentRow="",this._htmlContent="",n._core._themeService?this._ansiColors=n._core._themeService.colors.ansi:this._ansiColors=iV}_padStart(t,n,r){return n=n>>0,r=r??" ",t.length>n?t:(n-=t.length,n>r.length&&(r+=r.repeat(n/r.length)),r.slice(0,n)+t)}_beforeSerialize(t,n,r){var u,h;this._htmlContent+="<html><body><!--StartFragment--><pre>";let s="#000000",a="#ffffff";(this._options.includeGlobalBackground??!1)&&(s=((u=this._terminal.options.theme)==null?void 0:u.foreground)??"#ffffff",a=((h=this._terminal.options.theme)==null?void 0:h.background)??"#000000");let l=[];l.push("color: "+s+";"),l.push("background-color: "+a+";"),l.push("font-family: "+this._terminal.options.fontFamily+";"),l.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+l.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(t,n){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(t,n){let r=n?t.getFgColor():t.getBgColor();if(n?t.isFgRGB():t.isBgRGB())return"#"+[r>>16&255,r>>8&255,r&255].map(s=>this._padStart(s.toString(16),2,"0")).join("");if(n?t.isFgPalette():t.isBgPalette())return this._ansiColors[r].css}_diffStyle(t,n){let r=[],s=!ZA(t,n),a=!Vs(t,n),l=!QA(t,n);if(s||a||l){let u=this._getHexColor(t,!0);u&&r.push("color: "+u+";");let h=this._getHexColor(t,!1);return h&&r.push("background-color: "+h+";"),t.isInverse()&&r.push("color: #000000; background-color: #BFBFBF;"),t.isBold()&&r.push("font-weight: bold;"),t.isUnderline()&&t.isOverline()?r.push("text-decoration: overline underline;"):t.isUnderline()?r.push("text-decoration: underline;"):t.isOverline()&&r.push("text-decoration: overline;"),t.isBlink()&&r.push("text-decoration: blink;"),t.isInvisible()&&r.push("visibility: hidden;"),t.isItalic()&&r.push("font-style: italic;"),t.isDim()&&r.push("opacity: 0.5;"),t.isStrikethrough()&&r.push("text-decoration: line-through;"),r}}_nextCell(t,n,r,s){if(t.getWidth()===0)return;let a=t.getChars()==="",l=this._diffStyle(t,n);l&&(this._currentRow+=l.length===0?"</span><span>":"</span><span style='"+l.join(" ")+"'>"),a?this._currentRow+=" ":this._currentRow+=sV(t.getChars())}_serializeString(){return this._htmlContent}};/**
481
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
482
- * @license MIT
483
- *
484
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
485
- * @license MIT
486
- *
487
- * Originally forked from (with the author's permission):
488
- * Fabrice Bellard's javascript vt100 for jslinux:
489
- * http://bellard.org/jslinux/
490
- * Copyright (c) 2011 Fabrice Bellard
491
- */var cV=class{constructor(t,n,r,s={}){this._terminal=t,this._regex=n,this._handler=r,this._options=s}provideLinks(t,n){let r=dV.computeLink(t,this._regex,this._terminal,this._handler);n(this._addCallbacks(r))}_addCallbacks(t){return t.map(n=>(n.leave=this._options.leave,n.hover=(r,s)=>{if(this._options.hover){let{range:a}=n;this._options.hover(r,s,a)}},n))}};function uV(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 dV=class rm{static computeLink(t,n,r,s){let a=new RegExp(n.source,(n.flags||"")+"g"),[l,u]=rm._getWindowedLineStrings(t-1,r),h=l.join(""),d,g=[];for(;d=a.exec(h);){let p=d[0];if(!uV(p))continue;let[v,y]=rm._mapStrIdx(r,u,0,d.index),[w,S]=rm._mapStrIdx(r,v,y,p.length);if(v===-1||y===-1||w===-1||S===-1)continue;let C={start:{x:y+1,y:v+1},end:{x:S,y:w+1}};g.push({range:C,text:p,activate:s})}return g}static _getWindowedLineStrings(t,n){let r,s=t,a=t,l=0,u="",h=[];if(r=n.buffer.active.getLine(t)){let d=r.translateToString(!0);if(r.isWrapped&&d[0]!==" "){for(l=0;(r=n.buffer.active.getLine(--s))&&l<2048&&(u=r.translateToString(!0),l+=u.length,h.push(u),!(!r.isWrapped||u.indexOf(" ")!==-1)););h.reverse()}for(h.push(d),l=0;(r=n.buffer.active.getLine(++a))&&r.isWrapped&&l<2048&&(u=r.translateToString(!0),l+=u.length,h.push(u),u.indexOf(" ")===-1););}return[h,s]}static _mapStrIdx(t,n,r,s){let a=t.buffer.active,l=a.getNullCell(),u=r;for(;s;){let h=a.getLine(n);if(!h)return[-1,-1];for(let d=u;d<h.length;++d){h.getCell(d,l);let g=l.getChars();if(l.getWidth()&&(s-=g.length||1,d===h.length-1&&g==="")){let p=a.getLine(n+1);p&&p.isWrapped&&(p.getCell(0,l),l.getWidth()===2&&(s+=1))}if(s<0)return[n,d]}n++,u=0}return[n,u]}},hV=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function fV(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 mV=class{constructor(t=fV,n={}){this._handler=t,this._options=n}activate(t){this._terminal=t;let n=this._options,r=n.urlRegex||hV;this._linkProvider=this._terminal.registerLinkProvider(new cV(this._terminal,r,this._handler,n))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};/**
492
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
493
- * @license MIT
494
- *
495
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
496
- * @license MIT
497
- *
498
- * Originally forked from (with the author's permission):
499
- * Fabrice Bellard's javascript vt100 for jslinux:
500
- * http://bellard.org/jslinux/
501
- * Copyright (c) 2011 Fabrice Bellard
502
- */var JA=Object.defineProperty,pV=Object.getOwnPropertyDescriptor,gV=(e,t)=>{for(var n in t)JA(e,n,{get:t[n],enumerable:!0})},Sn=(e,t,n,r)=>{for(var s=r>1?void 0:r?pV(t,n):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(r?l(t,n,s):l(s))||s);return r&&s&&JA(t,n,s),s},Pe=(e,t)=>(n,r)=>t(n,r,e),V2="Terminal input",ny={get:()=>V2,set:e=>V2=e},q2="Too much output to announce, navigate to rows manually to read",ry={get:()=>q2,set:e=>q2=e};function vV(e){return e.replace(/\r?\n/g,"\r")}function _V(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function bV(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function yV(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");eD(s,t,n,r)}}function eD(e,t,n,r){e=vV(e),e=_V(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function tD(e,t,n){let r=n.getBoundingClientRect(),s=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${s}px`,t.style.top=`${a}px`,t.style.zIndex="1000",t.focus()}function K2(e,t,n,r,s){tD(e,t,n),s&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Wo(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function jp(e,t=0,n=e.length){let r="";for(let s=t;s<n;++s){let a=e[s];a>65535?(a-=65536,r+=String.fromCharCode((a>>10)+55296)+String.fromCharCode(a%1024+56320)):r+=String.fromCharCode(a)}return r}var xV=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,s=0;if(this._interim){let a=e.charCodeAt(s++);56320<=a&&a<=57343?t[r++]=(this._interim-55296)*1024+a-56320+65536:(t[r++]=this._interim,t[r++]=a),this._interim=0}for(let a=s;a<n;++a){let l=e.charCodeAt(a);if(55296<=l&&l<=56319){if(++a>=n)return this._interim=l,r;let u=e.charCodeAt(a);56320<=u&&u<=57343?t[r++]=(l-55296)*1024+u-56320+65536:(t[r++]=l,t[r++]=u);continue}l!==65279&&(t[r++]=l)}return r}},wV=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,s,a,l,u,h=0,d=0;if(this.interim[0]){let v=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let w=0,S;for(;(S=this.interim[++w]&63)&&w<4;)y<<=6,y|=S;let C=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,k=C-w;for(;d<k;){if(d>=n)return 0;if(S=e[d++],(S&192)!==128){d--,v=!0;break}else this.interim[w++]=S,y<<=6,y|=S&63}v||(C===2?y<128?d--:t[r++]=y:C===3?y<2048||y>=55296&&y<=57343||y===65279||(t[r++]=y):y<65536||y>1114111||(t[r++]=y)),this.interim.fill(0)}let g=n-4,p=d;for(;p<n;){for(;p<g&&!((s=e[p])&128)&&!((a=e[p+1])&128)&&!((l=e[p+2])&128)&&!((u=e[p+3])&128);)t[r++]=s,t[r++]=a,t[r++]=l,t[r++]=u,p+=4;if(s=e[p++],s<128)t[r++]=s;else if((s&224)===192){if(p>=n)return this.interim[0]=s,r;if(a=e[p++],(a&192)!==128){p--;continue}if(h=(s&31)<<6|a&63,h<128){p--;continue}t[r++]=h}else if((s&240)===224){if(p>=n)return this.interim[0]=s,r;if(a=e[p++],(a&192)!==128){p--;continue}if(p>=n)return this.interim[0]=s,this.interim[1]=a,r;if(l=e[p++],(l&192)!==128){p--;continue}if(h=(s&15)<<12|(a&63)<<6|l&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[r++]=h}else if((s&248)===240){if(p>=n)return this.interim[0]=s,r;if(a=e[p++],(a&192)!==128){p--;continue}if(p>=n)return this.interim[0]=s,this.interim[1]=a,r;if(l=e[p++],(l&192)!==128){p--;continue}if(p>=n)return this.interim[0]=s,this.interim[1]=a,this.interim[2]=l,r;if(u=e[p++],(u&192)!==128){p--;continue}if(h=(s&7)<<18|(a&63)<<12|(l&63)<<6|u&63,h<65536||h>1114111)continue;t[r++]=h}}return r}},nD="",Ko=" ",zd=class rD{constructor(){this.fg=0,this.bg=0,this.extended=new Lm}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new rD;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}},Lm=class iD{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new iD(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ni=class sD extends zd{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Lm,this.combinedData=""}static fromCharData(t){let n=new sD;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?Wo(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},G2="di$target",iy="di$dependencies",M_=new Map;function SV(e){return e[iy]||[]}function nr(e){if(M_.has(e))return M_.get(e);let t=function(n,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");CV(t,n,s)};return t._id=e,M_.set(e,t),t}function CV(e,t,n){t[G2]===t?t[iy].push({id:e,index:n}):(t[iy]=[{id:e,index:n}],t[G2]=t)}var Mr=nr("BufferService"),oD=nr("CoreMouseService"),rl=nr("CoreService"),kV=nr("CharsetService"),bx=nr("InstantiationService"),aD=nr("LogService"),Ar=nr("OptionsService"),lD=nr("OscLinkService"),EV=nr("UnicodeService"),Pd=nr("DecorationService"),sy=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var g;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],s=this._optionsService.rawOptions.linkHandler,a=new Ni,l=n.getTrimmedLength(),u=-1,h=-1,d=!1;for(let p=0;p<l;p++)if(!(h===-1&&!n.hasContent(p))){if(n.loadCell(p,a),a.hasExtendedAttrs()&&a.extended.urlId)if(h===-1){h=p,u=a.extended.urlId;continue}else d=a.extended.urlId!==u;else h!==-1&&(d=!0);if(d||h!==-1&&p===l-1){let v=(g=this._oscLinkService.getLinkData(u))==null?void 0:g.uri;if(v){let y={start:{x:h+1,y:e},end:{x:p+(!d&&p===l-1?1:0),y:e}},w=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let S=new URL(v);["http:","https:"].includes(S.protocol)||(w=!0)}catch{w=!0}w||r.push({text:v,range:y,activate:(S,C)=>s?s.activate(S,C,y):RV(S,C),hover:(S,C)=>{var k;return(k=s==null?void 0:s.hover)==null?void 0:k.call(s,S,C,y)},leave:(S,C)=>{var k;return(k=s==null?void 0:s.leave)==null?void 0:k.call(s,S,C,y)}})}d=!1,a.hasExtendedAttrs()&&a.extended.urlId?(h=p,u=a.extended.urlId):(h=-1,u=-1)}}t(r)}};sy=Sn([Pe(0,Mr),Pe(1,Ar),Pe(2,lD)],sy);function RV(e,t){if(confirm(`Do you want to navigate to ${t}?
503
-
504
- WARNING: This link could potentially be dangerous`)){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 Op=nr("CharSizeService"),io=nr("CoreBrowserService"),yx=nr("MouseService"),so=nr("RenderService"),TV=nr("SelectionService"),cD=nr("CharacterJoinerService"),Rc=nr("ThemeService"),uD=nr("LinkProviderService"),NV=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Y2.isErrorNoTelemetry(e)?new Y2(e.message+`
505
-
506
- `+e.stack):new Error(e.message+`
507
-
508
- `+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)}},MV=new NV;function im(e){AV(e)||MV.onUnexpectedError(e)}var oy="Canceled";function AV(e){return e instanceof DV?!0:e instanceof Error&&e.name===oy&&e.message===oy}var DV=class extends Error{constructor(){super(oy),this.name=this.message}};function jV(e){return new Error(`Illegal argument: ${e}`)}var Y2=class ay extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof ay)return t;let n=new ay;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},ly=class dD extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,dD.prototype)}};function Jr(e,t=0){return e[e.length-(1+t)]}var OV;(e=>{function t(a){return a<0}e.isLessThan=t;function n(a){return a<=0}e.isLessThanOrEqual=n;function r(a){return a>0}e.isGreaterThan=r;function s(a){return a===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(OV||(OV={}));function LV(e,t){let n=this,r=!1,s;return function(){return r||(r=!0,t||(s=e.apply(n,arguments))),s}}var hD;(e=>{function t(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*s(N){yield N}e.single=s;function a(N){return t(N)?N:s(N)}e.wrap=a;function l(N){return N||n}e.from=l;function*u(N){for(let j=N.length-1;j>=0;j--)yield N[j]}e.reverse=u;function h(N){return!N||N[Symbol.iterator]().next().done===!0}e.isEmpty=h;function d(N){return N[Symbol.iterator]().next().value}e.first=d;function g(N,j){let D=0;for(let L of N)if(j(L,D++))return!0;return!1}e.some=g;function p(N,j){for(let D of N)if(j(D))return D}e.find=p;function*v(N,j){for(let D of N)j(D)&&(yield D)}e.filter=v;function*y(N,j){let D=0;for(let L of N)yield j(L,D++)}e.map=y;function*w(N,j){let D=0;for(let L of N)yield*j(L,D++)}e.flatMap=w;function*S(...N){for(let j of N)yield*j}e.concat=S;function C(N,j,D){let L=D;for(let U of N)L=j(L,U);return L}e.reduce=C;function*k(N,j,D=N.length){for(j<0&&(j+=N.length),D<0?D+=N.length:D>N.length&&(D=N.length);j<D;j++)yield N[j]}e.slice=k;function R(N,j=Number.POSITIVE_INFINITY){let D=[];if(j===0)return[D,N];let L=N[Symbol.iterator]();for(let U=0;U<j;U++){let Y=L.next();if(Y.done)return[D,e.empty()];D.push(Y.value)}return[D,{[Symbol.iterator](){return L}}]}e.consume=R;async function E(N){let j=[];for await(let D of N)j.push(D);return Promise.resolve(j)}e.asyncToArray=E})(hD||(hD={}));function Ya(e){if(hD.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function zV(...e){return fn(()=>Ya(e))}function fn(e){return{dispose:LV(()=>{e()})}}var fD=class mD{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ya(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?mD.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};fD.DISABLE_DISPOSED_WARNING=!1;var Yo=fD,wt=class{constructor(){this._store=new Yo,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};wt.None=Object.freeze({dispose(){}});var fc=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Ks=typeof window=="object"?window:globalThis,cy=class uy{constructor(t){this.element=t,this.next=uy.Undefined,this.prev=uy.Undefined}};cy.Undefined=new cy(void 0);var mn=cy,X2=class{constructor(){this._first=mn.Undefined,this._last=mn.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===mn.Undefined}clear(){let e=this._first;for(;e!==mn.Undefined;){let t=e.next;e.prev=mn.Undefined,e.next=mn.Undefined,e=t}this._first=mn.Undefined,this._last=mn.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new mn(e);if(this._first===mn.Undefined)this._first=n,this._last=n;else if(t){let s=this._last;this._last=n,n.prev=s,s.next=n}else{let s=this._first;this._first=n,n.next=s,s.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==mn.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==mn.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==mn.Undefined&&e.next!==mn.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===mn.Undefined&&e.next===mn.Undefined?(this._first=mn.Undefined,this._last=mn.Undefined):e.next===mn.Undefined?(this._last=this._last.prev,this._last.next=mn.Undefined):e.prev===mn.Undefined&&(this._first=this._first.next,this._first.prev=mn.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==mn.Undefined;)yield e.element,e=e.next}},PV=globalThis.performance&&typeof globalThis.performance.now=="function",BV=class pD{static create(t){return new pD(t)}constructor(t){this._now=PV&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},fr;(e=>{e.None=()=>wt.None;function t(I,W){return p(I,()=>{},0,void 0,!0,void 0,W)}e.defer=t;function n(I){return(W,K=null,q)=>{let O=!1,F;return F=I(H=>{if(!O)return F?F.dispose():O=!0,W.call(K,H)},null,q),O&&F.dispose(),F}}e.once=n;function r(I,W,K){return d((q,O=null,F)=>I(H=>q.call(O,W(H)),null,F),K)}e.map=r;function s(I,W,K){return d((q,O=null,F)=>I(H=>{W(H),q.call(O,H)},null,F),K)}e.forEach=s;function a(I,W,K){return d((q,O=null,F)=>I(H=>W(H)&&q.call(O,H),null,F),K)}e.filter=a;function l(I){return I}e.signal=l;function u(...I){return(W,K=null,q)=>{let O=zV(...I.map(F=>F(H=>W.call(K,H))));return g(O,q)}}e.any=u;function h(I,W,K,q){let O=K;return r(I,F=>(O=W(O,F),O),q)}e.reduce=h;function d(I,W){let K,q={onWillAddFirstListener(){K=I(O.fire,O)},onDidRemoveLastListener(){K==null||K.dispose()}},O=new Ne(q);return W==null||W.add(O),O.event}function g(I,W){return W instanceof Array?W.push(I):W&&W.add(I),I}function p(I,W,K=100,q=!1,O=!1,F,H){let $,M,B,X=0,A,re={leakWarningThreshold:F,onWillAddFirstListener(){$=I(Z=>{X++,M=W(M,Z),q&&!B&&(se.fire(M),M=void 0),A=()=>{let te=M;M=void 0,B=void 0,(!q||X>1)&&se.fire(te),X=0},typeof K=="number"?(clearTimeout(B),B=setTimeout(A,K)):B===void 0&&(B=0,queueMicrotask(A))})},onWillRemoveListener(){O&&X>0&&(A==null||A())},onDidRemoveLastListener(){A=void 0,$.dispose()}},se=new Ne(re);return H==null||H.add(se),se.event}e.debounce=p;function v(I,W=0,K){return e.debounce(I,(q,O)=>q?(q.push(O),q):[O],W,void 0,!0,void 0,K)}e.accumulate=v;function y(I,W=(q,O)=>q===O,K){let q=!0,O;return a(I,F=>{let H=q||!W(F,O);return q=!1,O=F,H},K)}e.latch=y;function w(I,W,K){return[e.filter(I,W,K),e.filter(I,q=>!W(q),K)]}e.split=w;function S(I,W=!1,K=[],q){let O=K.slice(),F=I(M=>{O?O.push(M):$.fire(M)});q&&q.add(F);let H=()=>{O==null||O.forEach(M=>$.fire(M)),O=null},$=new Ne({onWillAddFirstListener(){F||(F=I(M=>$.fire(M)),q&&q.add(F))},onDidAddFirstListener(){O&&(W?setTimeout(H):H())},onDidRemoveLastListener(){F&&F.dispose(),F=null}});return q&&q.add($),$.event}e.buffer=S;function C(I,W){return(K,q,O)=>{let F=W(new R);return I(function(H){let $=F.evaluate(H);$!==k&&K.call(q,$)},void 0,O)}}e.chain=C;let k=Symbol("HaltChainable");class R{constructor(){this.steps=[]}map(W){return this.steps.push(W),this}forEach(W){return this.steps.push(K=>(W(K),K)),this}filter(W){return this.steps.push(K=>W(K)?K:k),this}reduce(W,K){let q=K;return this.steps.push(O=>(q=W(q,O),q)),this}latch(W=(K,q)=>K===q){let K=!0,q;return this.steps.push(O=>{let F=K||!W(O,q);return K=!1,q=O,F?O:k}),this}evaluate(W){for(let K of this.steps)if(W=K(W),W===k)break;return W}}function E(I,W,K=q=>q){let q=(...$)=>H.fire(K(...$)),O=()=>I.on(W,q),F=()=>I.removeListener(W,q),H=new Ne({onWillAddFirstListener:O,onDidRemoveLastListener:F});return H.event}e.fromNodeEventEmitter=E;function N(I,W,K=q=>q){let q=(...$)=>H.fire(K(...$)),O=()=>I.addEventListener(W,q),F=()=>I.removeEventListener(W,q),H=new Ne({onWillAddFirstListener:O,onDidRemoveLastListener:F});return H.event}e.fromDOMEventEmitter=N;function j(I){return new Promise(W=>n(I)(W))}e.toPromise=j;function D(I){let W=new Ne;return I.then(K=>{W.fire(K)},()=>{W.fire(void 0)}).finally(()=>{W.dispose()}),W.event}e.fromPromise=D;function L(I,W){return I(K=>W.fire(K))}e.forward=L;function U(I,W,K){return W(K),I(q=>W(q))}e.runAndSubscribe=U;class Y{constructor(W,K){this._observable=W,this._counter=0,this._hasChanged=!1;let q={onWillAddFirstListener:()=>{W.addObserver(this)},onDidRemoveLastListener:()=>{W.removeObserver(this)}};this.emitter=new Ne(q),K&&K.add(this.emitter)}beginUpdate(W){this._counter++}handlePossibleChange(W){}handleChange(W,K){this._hasChanged=!0}endUpdate(W){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function P(I,W){return new Y(I,W).emitter.event}e.fromObservable=P;function V(I){return(W,K,q)=>{let O=0,F=!1,H={beginUpdate(){O++},endUpdate(){O--,O===0&&(I.reportChanges(),F&&(F=!1,W.call(K)))},handlePossibleChange(){},handleChange(){F=!0}};I.addObserver(H),I.reportChanges();let $={dispose(){I.removeObserver(H)}};return q instanceof Yo?q.add($):Array.isArray(q)&&q.push($),$}}e.fromObservableLight=V})(fr||(fr={}));var dy=class hy{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${hy._idPool++}`,hy.all.add(this)}start(t){this._stopWatch=new BV,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};dy.all=new Set,dy._idPool=0;var IV=dy,HV=-1,gD=class vD{constructor(t,n,r=(vD._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[a,l]=this.getMostFrequentStack(),u=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${l}):`;console.warn(u),console.warn(a);let h=new $V(u,a);this._errorHandler(h)}return()=>{let a=this._stacks.get(t.value)||0;this._stacks.set(t.value,a-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,s]of this._stacks)(!t||n<s)&&(t=[r,s],n=s);return t}};gD._idPool=1;var FV=gD,UV=class _D{constructor(t){this.value=t}static create(){let t=new Error;return new _D(t.stack??"")}print(){console.warn(this.value.split(`
509
- `).slice(2).join(`
510
- `))}},$V=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},WV=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},VV=0,A_=class{constructor(e){this.value=e,this.id=VV++}},qV=2,KV,Ne=class{constructor(e){var t,n,r,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new FV((e==null?void 0:e.onListenerError)??im,((n=this._options)==null?void 0:n.leakWarningThreshold)??HV):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new IV(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var e,t,n,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var l,u,h,d,g;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let p=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(p);let v=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],y=new WV(`${p}. HINT: Stack shows most frequent listener (${v[1]}-times)`,v[0]);return(((l=this._options)==null?void 0:l.onListenerError)||im)(y),wt.None}if(this._disposed)return wt.None;t&&(e=e.bind(t));let r=new A_(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=UV.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof A_?(this._deliveryQueue??(this._deliveryQueue=new GV),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(u=this._options)==null?void 0:u.onWillAddFirstListener)==null||h.call(u,this),this._listeners=r,(g=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||g.call(d,this)),this._size++;let a=fn(()=>{s==null||s(),this._removeListener(r)});return n instanceof Yo?n.add(a):Array.isArray(n)&&n.push(a),a}),this._event}_removeListener(e){var s,a,l,u;if((a=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||a.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(u=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||u.call(l,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)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*qV<=t.length){let h=0;for(let d=0;d<t.length;d++)t[d]?t[h++]=t[d]:r&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){var r;if(!e)return;let n=((r=this._options)==null?void 0:r.onListenerError)||im;if(!n){e.value(t);return}try{e.value(t)}catch(s){n(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,n,r,s;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof A_)this._deliver(this._listeners,e);else{let a=this._deliveryQueue;a.enqueue(this,e,this._listeners.length),this._deliverQueue(a)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},GV=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}},fy=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Ne,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Ne,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};fy.INSTANCE=new fy;var xx=fy;function YV(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}xx.INSTANCE.onDidChangeZoomLevel;function XV(e){return xx.INSTANCE.getZoomFactor(e)}xx.INSTANCE.onDidChangeFullscreen;var Tc=typeof navigator=="object"?navigator.userAgent:"",my=Tc.indexOf("Firefox")>=0,ZV=Tc.indexOf("AppleWebKit")>=0,wx=Tc.indexOf("Chrome")>=0,QV=!wx&&Tc.indexOf("Safari")>=0;Tc.indexOf("Electron/")>=0;Tc.indexOf("Android")>=0;var D_=!1;if(typeof Ks.matchMedia=="function"){let e=Ks.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ks.matchMedia("(display-mode: fullscreen)");D_=e.matches,YV(Ks,e,({matches:n})=>{D_&&t.matches||(D_=n)})}var ec="en",py=!1,gy=!1,sm=!1,bD=!1,Tf,om=ec,Z2=ec,JV,Bi,Ha=globalThis,hr,JR;typeof Ha.vscode<"u"&&typeof Ha.vscode.process<"u"?hr=Ha.vscode.process:typeof process<"u"&&typeof((JR=process==null?void 0:process.versions)==null?void 0:JR.node)=="string"&&(hr=process);var eT,eq=typeof((eT=hr==null?void 0:hr.versions)==null?void 0:eT.electron)=="string",tq=eq&&(hr==null?void 0:hr.type)==="renderer",tT;if(typeof hr=="object"){py=hr.platform==="win32",gy=hr.platform==="darwin",sm=hr.platform==="linux",sm&&hr.env.SNAP&&hr.env.SNAP_REVISION,hr.env.CI||hr.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Tf=ec,om=ec;let e=hr.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Tf=t.userLocale,Z2=t.osLocale,om=t.resolvedLanguage||ec,JV=(tT=t.languagePack)==null?void 0:tT.translationsConfigFile}catch{}bD=!0}else typeof navigator=="object"&&!tq?(Bi=navigator.userAgent,py=Bi.indexOf("Windows")>=0,gy=Bi.indexOf("Macintosh")>=0,(Bi.indexOf("Macintosh")>=0||Bi.indexOf("iPad")>=0||Bi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,sm=Bi.indexOf("Linux")>=0,(Bi==null?void 0:Bi.indexOf("Mobi"))>=0,om=globalThis._VSCODE_NLS_LANGUAGE||ec,Tf=navigator.language.toLowerCase(),Z2=Tf):console.error("Unable to resolve platform.");var yD=py,vs=gy,nq=sm,Q2=bD,bs=Bi,Po=om,rq;(e=>{function t(){return Po}e.value=t;function n(){return Po.length===2?Po==="en":Po.length>=3?Po[0]==="e"&&Po[1]==="n"&&Po[2]==="-":!1}e.isDefaultVariant=n;function r(){return Po==="en"}e.isDefault=r})(rq||(rq={}));var iq=typeof Ha.postMessage=="function"&&!Ha.importScripts;(()=>{if(iq){let e=[];Ha.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,s=e.length;r<s;r++){let a=e[r];if(a.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),a.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Ha.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var sq=!!(bs&&bs.indexOf("Chrome")>=0);bs&&bs.indexOf("Firefox")>=0;!sq&&bs&&bs.indexOf("Safari")>=0;bs&&bs.indexOf("Edg/")>=0;bs&&bs.indexOf("Android")>=0;var $l=typeof navigator=="object"?navigator:{};Q2||document.queryCommandSupported&&document.queryCommandSupported("copy")||$l&&$l.clipboard&&$l.clipboard.writeText,Q2||$l&&$l.clipboard&&$l.clipboard.readText;var Sx=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}},j_=new Sx,J2=new Sx,eE=new Sx,oq=new Array(230),xD;(e=>{function t(u){return j_.keyCodeToStr(u)}e.toString=t;function n(u){return j_.strToKeyCode(u)}e.fromString=n;function r(u){return J2.keyCodeToStr(u)}e.toUserSettingsUS=r;function s(u){return eE.keyCodeToStr(u)}e.toUserSettingsGeneral=s;function a(u){return J2.strToKeyCode(u)||eE.strToKeyCode(u)}e.fromUserSettings=a;function l(u){if(u>=98&&u<=113)return null;switch(u){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return j_.keyCodeToStr(u)}e.toElectronAccelerator=l})(xD||(xD={}));var aq=class wD{constructor(t,n,r,s,a){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=s,this.keyCode=a}equals(t){return t instanceof wD&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${t}${n}${r}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new lq([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},lq=class{constructor(e){if(e.length===0)throw jV("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 cq(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return xD.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(my)switch(t){case 59:return 85;case 60:if(nq)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(vs)return 57;break}else if(ZV&&(vs&&t===93||!vs&&t===92))return 57;return oq[t]||0}var uq=vs?256:2048,dq=512,hq=1024,fq=vs?2048:256,tE=class{constructor(e){var n;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=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=cq(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|=uq),this.altKey&&(t|=dq),this.shiftKey&&(t|=hq),this.metaKey&&(t|=fq),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new aq(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},nE=new WeakMap;function mq(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 pq=class{static getSameOriginWindowChain(e){let t=nE.get(e);if(!t){t=[],nE.set(e,t);let n=e,r;do r=mq(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,s=this.getSameOriginWindowChain(e);for(let a of s){let l=a.window.deref();if(n+=(l==null?void 0:l.scrollY)??0,r+=(l==null?void 0:l.scrollX)??0,l===t||!a.iframeElement)break;let u=a.iframeElement.getBoundingClientRect();n+=u.top,r+=u.left}return{top:n,left:r}}},Nf=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=pq.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},rE=class{constructor(e,t=0,n=0){var s;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(wx){let a=navigator.userAgent.match(/Chrome\/(\d+)/);r=(a?parseInt(a[1]):123)<=122}if(e){let a=e,l=e,u=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof a.wheelDeltaY<"u")r?this.deltaY=a.wheelDeltaY/(120*u):this.deltaY=a.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?my&&!vs?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")QV&&yD?this.deltaX=-(a.wheelDeltaX/120):r?this.deltaX=a.wheelDeltaX/(120*u):this.deltaX=a.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?my&&!vs?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*u):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},SD=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),gq;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof vq?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:fr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:SD})})(gq||(gq={}));var vq=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?SD:(this._emitter||(this._emitter=new Ne),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Cx=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 ly("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new ly("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},_q=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new ly("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=fn(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},bq;(e=>{async function t(r){let s,a=await Promise.all(r.map(l=>l.then(u=>u,u=>{s||(s=u)})));if(typeof s<"u")throw s;return a}e.settled=t;function n(r){return new Promise(async(s,a)=>{try{await r(s,a)}catch(l){a(l)}})}e.withAsyncBody=n})(bq||(bq={}));var iE=class yi{static fromArray(t){return new yi(n=>{n.emitMany(t)})}static fromPromise(t){return new yi(async n=>{n.emitMany(await t)})}static fromPromises(t){return new yi(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new yi(async n=>{await Promise.all(t.map(async r=>{for await(let s of r)n.emitOne(s)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new Ne,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await fr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new yi(async r=>{for await(let s of t)r.emitOne(n(s))})}map(t){return yi.map(this,t)}static filter(t,n){return new yi(async r=>{for await(let s of t)n(s)&&r.emitOne(s)})}filter(t){return yi.filter(this,t)}static coalesce(t){return yi.filter(t,n=>!!n)}coalesce(){return yi.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return yi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};iE.EMPTY=iE.fromArray([]);var{getWindow:ms,getWindowId:yq,onDidRegisterWindow:xq}=(function(){let e=new Map,t={window:Ks,disposables:new Yo};e.set(Ks.vscodeWindowId,t);let n=new Ne,r=new Ne,s=new Ne;function a(l,u){return(typeof l=="number"?e.get(l):void 0)??(u?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(l){if(e.has(l.vscodeWindowId))return wt.None;let u=new Yo,h={window:l,disposables:u.add(new Yo)};return e.set(l.vscodeWindowId,h),u.add(fn(()=>{e.delete(l.vscodeWindowId),r.fire(l)})),u.add(it(l,Gn.BEFORE_UNLOAD,()=>{s.fire(l)})),n.fire(h),u},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(l){return l.vscodeWindowId},hasWindow(l){return e.has(l)},getWindowById:a,getWindow(l){var d;let u=l;if((d=u==null?void 0:u.ownerDocument)!=null&&d.defaultView)return u.ownerDocument.defaultView.window;let h=l;return h!=null&&h.view?h.view.window:Ks},getDocument(l){return ms(l).document}}})(),wq=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,this._handler=null)}};function it(e,t,n,r){return new wq(e,t,n,r)}var sE=function(e,t,n,r){return it(e,t,n,r)},kx,Sq=class extends _q{constructor(e){super(),this.defaultTarget=e&&ms(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},oE=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){im(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,s=a=>{n.set(a,!1);let l=e.get(a)??[];for(t.set(a,l),e.set(a,[]),r.set(a,!0);l.length>0;)l.sort(oE.sort),l.shift().execute();r.set(a,!1)};kx=(a,l,u=0)=>{let h=yq(a),d=new oE(l,u),g=e.get(h);return g||(g=[],e.set(h,g)),g.push(d),n.get(h)||(n.set(h,!0),a.requestAnimationFrame(()=>s(h))),d}})();function Cq(e){let t=e.getBoundingClientRect(),n=ms(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Gn={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},kq=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=Hr(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Hr(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Hr(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Hr(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Hr(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Hr(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Hr(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Hr(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Hr(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Hr(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Hr(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=Hr(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=Hr(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Hr(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 Hr(e){return typeof e=="number"?`${e}px`:e}function Qu(e){return new kq(e)}var CD=class{constructor(){this._hooks=new Yo,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,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=s;let a=e;try{e.setPointerCapture(t),this._hooks.add(fn(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=ms(e)}this._hooks.add(it(a,Gn.POINTER_MOVE,l=>{if(l.buttons!==n){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(it(a,Gn.POINTER_UP,l=>this.stopMonitoring(!0)))}};function Eq(e,t,n){let r=null,s=null;if(typeof n.value=="function"?(r="value",s=n.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",s=n.get),!s)throw new Error("not supported");let a=`$memoize$${t}`;n[r]=function(...l){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,l)}),this[a]}}var is;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(is||(is={}));var Fu=class gr extends wt{constructor(){super(),this.dispatched=!1,this.targets=new X2,this.ignoreTargets=new X2,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(fr.runAndSubscribe(xq,({window:t,disposables:n})=>{n.add(it(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(it(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(it(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:Ks,disposables:this._store}))}static addTarget(t){if(!gr.isTouchDevice())return wt.None;gr.INSTANCE||(gr.INSTANCE=new gr);let n=gr.INSTANCE.targets.push(t);return fn(n)}static ignoreTarget(t){if(!gr.isTouchDevice())return wt.None;gr.INSTANCE||(gr.INSTANCE=new gr);let n=gr.INSTANCE.ignoreTargets.push(t);return fn(n)}static isTouchDevice(){return"ontouchstart"in Ks||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=t.targetTouches.length;r<s;r++){let a=t.targetTouches.item(r);this.activeTouches[a.identifier]={id:a.identifier,initialTarget:a.target,initialTimeStamp:n,initialPageX:a.pageX,initialPageY:a.pageY,rollingTimestamps:[n],rollingPageX:[a.pageX],rollingPageY:[a.pageY]};let l=this.newGestureEvent(is.Start,a.target);l.pageX=a.pageX,l.pageY=a.pageY,this.dispatchEvent(l)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let a=0,l=n.changedTouches.length;a<l;a++){let u=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(u.identifier))){console.warn("move of an UNKNOWN touch",u);continue}let h=this.activeTouches[u.identifier],d=Date.now()-h.initialTimeStamp;if(d<gr.HOLD_DELAY&&Math.abs(h.initialPageX-Jr(h.rollingPageX))<30&&Math.abs(h.initialPageY-Jr(h.rollingPageY))<30){let g=this.newGestureEvent(is.Tap,h.initialTarget);g.pageX=Jr(h.rollingPageX),g.pageY=Jr(h.rollingPageY),this.dispatchEvent(g)}else if(d>=gr.HOLD_DELAY&&Math.abs(h.initialPageX-Jr(h.rollingPageX))<30&&Math.abs(h.initialPageY-Jr(h.rollingPageY))<30){let g=this.newGestureEvent(is.Contextmenu,h.initialTarget);g.pageX=Jr(h.rollingPageX),g.pageY=Jr(h.rollingPageY),this.dispatchEvent(g)}else if(s===1){let g=Jr(h.rollingPageX),p=Jr(h.rollingPageY),v=Jr(h.rollingTimestamps)-h.rollingTimestamps[0],y=g-h.rollingPageX[0],w=p-h.rollingPageY[0],S=[...this.targets].filter(C=>h.initialTarget instanceof Node&&C.contains(h.initialTarget));this.inertia(t,S,r,Math.abs(y)/v,y>0?1:-1,g,Math.abs(w)/v,w>0?1:-1,p)}this.dispatchEvent(this.newGestureEvent(is.End,h.initialTarget)),delete this.activeTouches[u.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===is.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>gr.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===is.Change||t.type===is.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let s=0,a=t.initialTarget;for(;a&&a!==r;)s++,a=a.parentElement;n.push([s,r])}n.sort((r,s)=>r[0]-s[0]);for(let[r,s]of n)s.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,s,a,l,u,h,d){this.handle=kx(t,()=>{let g=Date.now(),p=g-r,v=0,y=0,w=!0;s+=gr.SCROLL_FRICTION*p,u+=gr.SCROLL_FRICTION*p,s>0&&(w=!1,v=a*s*p),u>0&&(w=!1,y=h*u*p);let S=this.newGestureEvent(is.Change);S.translationX=v,S.translationY=y,n.forEach(C=>C.dispatchEvent(S)),w||this.inertia(t,n,g,s,a,l+v,u,h,d+y)})}onTouchMove(t){let n=Date.now();for(let r=0,s=t.changedTouches.length;r<s;r++){let a=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("end of an UNKNOWN touch",a);continue}let l=this.activeTouches[a.identifier],u=this.newGestureEvent(is.Change,l.initialTarget);u.translationX=a.pageX-Jr(l.rollingPageX),u.translationY=a.pageY-Jr(l.rollingPageY),u.pageX=a.pageX,u.pageY=a.pageY,this.dispatchEvent(u),l.rollingPageX.length>3&&(l.rollingPageX.shift(),l.rollingPageY.shift(),l.rollingTimestamps.shift()),l.rollingPageX.push(a.pageX),l.rollingPageY.push(a.pageY),l.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Fu.SCROLL_FRICTION=-.005,Fu.HOLD_DELAY=700,Fu.CLEAR_TAP_COUNT_TIME=400,Sn([Eq],Fu,"isTouchDevice",1);var Rq=Fu,Ex=class extends wt{onclick(e,t){this._register(it(e,Gn.CLICK,n=>t(new Nf(ms(e),n))))}onmousedown(e,t){this._register(it(e,Gn.MOUSE_DOWN,n=>t(new Nf(ms(e),n))))}onmouseover(e,t){this._register(it(e,Gn.MOUSE_OVER,n=>t(new Nf(ms(e),n))))}onmouseleave(e,t){this._register(it(e,Gn.MOUSE_LEAVE,n=>t(new Nf(ms(e),n))))}onkeydown(e,t){this._register(it(e,Gn.KEY_DOWN,n=>t(new tE(n))))}onkeyup(e,t){this._register(it(e,Gn.KEY_UP,n=>t(new tE(n))))}oninput(e,t){this._register(it(e,Gn.INPUT,t))}onblur(e,t){this._register(it(e,Gn.BLUR,t))}onfocus(e,t){this._register(it(e,Gn.FOCUS,t))}onchange(e,t){this._register(it(e,Gn.CHANGE,t))}ignoreGesture(e){return Rq.ignoreTarget(e)}},aE=11,Tq=class extends Ex{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=aE+"px",this.domNode.style.height=aE+"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 CD),this._register(sE(this.bgDomNode,Gn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(sE(this.domNode,Gn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Sq),this._pointerdownScheduleRepeatTimer=this._register(new Cx)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,ms(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Nq=class vy{constructor(t,n,r,s,a,l,u){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,s=s|0,a=a|0,l=l|0,u=u|0),this.rawScrollLeft=s,this.rawScrollTop=u,n<0&&(n=0),s+n>r&&(s=r-n),s<0&&(s=0),a<0&&(a=0),u+a>l&&(u=l-a),u<0&&(u=0),this.width=n,this.scrollWidth=r,this.scrollLeft=s,this.height=a,this.scrollHeight=l,this.scrollTop=u}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new vy(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 vy(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let r=this.width!==t.width,s=this.scrollWidth!==t.scrollWidth,a=this.scrollLeft!==t.scrollLeft,l=this.height!==t.height,u=this.scrollHeight!==t.scrollHeight,h=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:s,scrollLeftChanged:a,heightChanged:l,scrollHeightChanged:u,scrollTopChanged:h}}},Mq=class extends wt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Ne),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Nq(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var r;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new cE(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=cE.start(this._state,n,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)))}},lE=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function O_(e,t){let n=t-e;return function(r){return e+n*jq(r)}}function Aq(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var cE=class _y{constructor(t,n,r,s){this.from=t,this.to=n,this.duration=s,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,r){if(Math.abs(t-n)>2.5*r){let s,a;return t<n?(s=t+.75*r,a=n-.75*r):(s=t-.75*r,a=n+.75*r),Aq(O_(t,s),O_(a,n),.33)}return O_(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),s=this.scrollTop(n);return new lE(r,s,!1)}return new lE(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return _y.start(t,n,r)}static start(t,n,r){r=r+10;let s=Date.now()-10;return new _y(t,n,s,r)}};function Dq(e){return Math.pow(e,3)}function jq(e){return 1-Dq(1-e)}var Oq=class extends wt{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 Cx)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},Lq=140,kD=class extends Ex{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 Oq(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new CD),this._shouldRender=!0,this.domNode=Qu(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(it(this.domNode.domNode,Gn.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new Tq(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Qu(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(it(this.slider.domNode,Gn.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.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(),s=this._sliderPointerPosition(e);n<=s&&s<=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 s=Cq(this.domNode.domNode);t=e.pageX-s.left,n=e.pageY-s.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,s=>{let a=this._sliderOrthogonalPointerPosition(s),l=Math.abs(a-n);if(yD&&l>Lq){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let u=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(u))},()=>{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()}},ED=class by{constructor(t,n,r,s,a,l){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=s,this._scrollSize=a,this._scrollPosition=l,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new by(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,s,a){let l=Math.max(0,r-t),u=Math.max(0,l-2*n),h=s>0&&s>r;if(!h)return{computedAvailableSize:Math.round(l),computedIsNeeded:h,computedSliderSize:Math.round(u),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(r*u/s))),g=(u-d)/(s-r),p=a*g;return{computedAvailableSize:Math.round(l),computedIsNeeded:h,computedSliderSize:Math.round(d),computedSliderRatio:g,computedSliderPosition:Math.round(p)}}_refreshComputedValues(){let t=by._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},zq=class extends kD{constructor(e,t,n){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new ED(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,s.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Pq=class extends kD{constructor(e,t,n){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new ED(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Bq=500,uE=50,Iq=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},yy=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,r=1,s=this._rear;do{let a=s===this._front?t:Math.pow(2,-r);if(t-=a,n+=this._memory[s].score*a,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(wx){let n=ms(t.browserEvent),r=XV(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let s=null,a=new Iq(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=a,this._front=0,this._rear=0):(s=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]=a),a.score=this._computeScore(a,s)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let s=Math.abs(t.deltaX),a=Math.abs(t.deltaY),l=Math.abs(n.deltaX),u=Math.abs(n.deltaY),h=Math.max(Math.min(s,l),1),d=Math.max(Math.min(a,u),1),g=Math.max(s,l),p=Math.max(a,u);g%h===0&&p%d===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};yy.INSTANCE=new yy;var Hq=yy,Fq=class extends Ex{constructor(e,t,n){super(),this._onScroll=this._register(new Ne),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Ne),this.onWillScroll=this._onWillScroll.event,this._options=$q(t),this._scrollable=n,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let r={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Pq(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new zq(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=Qu(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Qu(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Qu(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,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new Cx),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Ya(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,vs&&(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 rE(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Ya(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new rE(n))};this._mouseWheelToDispose.push(it(this._listenOnDomNode,Gn.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let t=Hq.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let a=e.deltaY*this._options.mouseWheelScrollSensitivity,l=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&l+a===0?l=a=0:Math.abs(a)>=Math.abs(l)?l=0:a=0),this._options.flipAxes&&([a,l]=[l,a]);let u=!vs&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||u)&&!l&&(l=a,a=0),e.browserEvent&&e.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),d={};if(a){let g=uE*a,p=h.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(d,p)}if(l){let g=uE*l,p=h.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(d,p)}d=this._scrollable.validateScrollPosition(d),(h.scrollLeft!==d.scrollLeft||h.scrollTop!==d.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(d):this._scrollable.setScrollPositionNow(d),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 new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",s=t?" top":"",a=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${s}${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(),Bq)}},Uq=class extends Fq{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 $q(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,vs&&(t.className+=" mac"),t}var xy=class extends wt{constructor(e,t,n,r,s,a,l,u){super(),this._bufferService=n,this._optionsService=l,this._renderService=u,this._onRequestScrollLines=this._register(new Ne),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let h=this._register(new Mq({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>kx(r.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Uq(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(fr.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(fn(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(fn(()=>this._styleElement.remove())),this._register(fr.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(`
511
- `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(d=>this._handleScroll(d)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.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}};xy=Sn([Pe(2,Mr),Pe(3,io),Pe(4,oD),Pe(5,Rc),Pe(6,Ar),Pe(7,so)],xy);var wy=class extends wt{constructor(e,t,n,r,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=s,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(a=>this._removeDecoration(a))),this._register(fn(()=>{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){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.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){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};wy=Sn([Pe(1,Mr),Pe(2,io),Pe(3,Pd),Pe(4,so)],wy);var Wq=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)}},ns={full:0,left:0,center:0,right:0},Bo={full:0,left:0,center:0,right:0},ku={full:0,left:0,center:0,right:0},zm=class extends wt{constructor(e,t,n,r,s,a,l,u){var d;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=s,this._optionsService=a,this._themeService=l,this._coreBrowserService=u,this._colorZoneStore=new Wq,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(),(d=this._viewportElement.parentElement)==null||d.insertBefore(this._canvas,this._viewportElement),this._register(fn(()=>{var g;return(g=this._canvas)==null?void 0:g.remove()}));let h=this._canvas.getContext("2d");if(h)this._ctx=h;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Bo.full=this._canvas.width,Bo.left=e,Bo.center=t,Bo.right=e,this._refreshDrawHeightConstants(),ku.full=1,ku.left=1,ku.center=1+Bo.left,ku.right=1+Bo.left+Bo.center}_refreshDrawHeightConstants(){ns.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);ns.left=t,ns.center=t,ns.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ns.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ns.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ns.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ns.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(ku[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-ns[e.position||"full"]/2),Bo[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+ns[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}))}};zm=Sn([Pe(2,Mr),Pe(3,Pd),Pe(4,so),Pe(5,Ar),Pe(6,Rc),Pe(7,io)],zm);var _e;(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=`
512
- `,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=""))(_e||(_e={}));var am;(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="Ÿ"))(am||(am={}));var RD;(e=>e.ST=`${_e.ESC}\\`)(RD||(RD={}));var Sy=class{constructor(e,t,n,r,s,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=s,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 t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${_e.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let a=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Sy=Sn([Pe(2,Mr),Pe(3,Ar),Pe(4,rl),Pe(5,so)],Sy);var Jn=0,er=0,tr=0,wn=0,dE={css:"#00000000",rgba:0},Bn;(e=>{function t(s,a,l,u){return u!==void 0?`#${Ta(s)}${Ta(a)}${Ta(l)}${Ta(u)}`:`#${Ta(s)}${Ta(a)}${Ta(l)}`}e.toCss=t;function n(s,a,l,u=255){return(s<<24|a<<16|l<<8|u)>>>0}e.toRgba=n;function r(s,a,l,u){return{css:e.toCss(s,a,l,u),rgba:e.toRgba(s,a,l,u)}}e.toColor=r})(Bn||(Bn={}));var un;(e=>{function t(h,d){if(wn=(d.rgba&255)/255,wn===1)return{css:d.css,rgba:d.rgba};let g=d.rgba>>24&255,p=d.rgba>>16&255,v=d.rgba>>8&255,y=h.rgba>>24&255,w=h.rgba>>16&255,S=h.rgba>>8&255;Jn=y+Math.round((g-y)*wn),er=w+Math.round((p-w)*wn),tr=S+Math.round((v-S)*wn);let C=Bn.toCss(Jn,er,tr),k=Bn.toRgba(Jn,er,tr);return{css:C,rgba:k}}e.blend=t;function n(h){return(h.rgba&255)===255}e.isOpaque=n;function r(h,d,g){let p=lm.ensureContrastRatio(h.rgba,d.rgba,g);if(p)return Bn.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=r;function s(h){let d=(h.rgba|255)>>>0;return[Jn,er,tr]=lm.toChannels(d),{css:Bn.toCss(Jn,er,tr),rgba:d}}e.opaque=s;function a(h,d){return wn=Math.round(d*255),[Jn,er,tr]=lm.toChannels(h.rgba),{css:Bn.toCss(Jn,er,tr,wn),rgba:Bn.toRgba(Jn,er,tr,wn)}}e.opacity=a;function l(h,d){return wn=h.rgba&255,a(h,wn*d/255)}e.multiplyOpacity=l;function u(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=u})(un||(un={}));var pn;(e=>{let t,n;try{let s=document.createElement("canvas");s.width=1,s.height=1;let a=s.getContext("2d",{willReadFrequently:!0});a&&(t=a,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Jn=parseInt(s.slice(1,2).repeat(2),16),er=parseInt(s.slice(2,3).repeat(2),16),tr=parseInt(s.slice(3,4).repeat(2),16),Bn.toColor(Jn,er,tr);case 5:return Jn=parseInt(s.slice(1,2).repeat(2),16),er=parseInt(s.slice(2,3).repeat(2),16),tr=parseInt(s.slice(3,4).repeat(2),16),wn=parseInt(s.slice(4,5).repeat(2),16),Bn.toColor(Jn,er,tr,wn);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let a=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a)return Jn=parseInt(a[1]),er=parseInt(a[2]),tr=parseInt(a[3]),wn=Math.round((a[5]===void 0?1:parseFloat(a[5]))*255),Bn.toColor(Jn,er,tr,wn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Jn,er,tr,wn]=t.getImageData(0,0,1,1).data,wn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Bn.toRgba(Jn,er,tr,wn),css:s}}e.toColor=r})(pn||(pn={}));var kr;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,s,a){let l=r/255,u=s/255,h=a/255,d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),g=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return d*.2126+g*.7152+p*.0722}e.relativeLuminance2=n})(kr||(kr={}));var lm;(e=>{function t(l,u){if(wn=(u&255)/255,wn===1)return u;let h=u>>24&255,d=u>>16&255,g=u>>8&255,p=l>>24&255,v=l>>16&255,y=l>>8&255;return Jn=p+Math.round((h-p)*wn),er=v+Math.round((d-v)*wn),tr=y+Math.round((g-y)*wn),Bn.toRgba(Jn,er,tr)}e.blend=t;function n(l,u,h){let d=kr.relativeLuminance(l>>8),g=kr.relativeLuminance(u>>8);if($s(d,g)<h){if(g<d){let y=r(l,u,h),w=$s(d,kr.relativeLuminance(y>>8));if(w<h){let S=s(l,u,h),C=$s(d,kr.relativeLuminance(S>>8));return w>C?y:S}return y}let p=s(l,u,h),v=$s(d,kr.relativeLuminance(p>>8));if(v<h){let y=r(l,u,h),w=$s(d,kr.relativeLuminance(y>>8));return v>w?p:y}return p}}e.ensureContrastRatio=n;function r(l,u,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,v=u>>24&255,y=u>>16&255,w=u>>8&255,S=$s(kr.relativeLuminance2(v,y,w),kr.relativeLuminance2(d,g,p));for(;S<h&&(v>0||y>0||w>0);)v-=Math.max(0,Math.ceil(v*.1)),y-=Math.max(0,Math.ceil(y*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=$s(kr.relativeLuminance2(v,y,w),kr.relativeLuminance2(d,g,p));return(v<<24|y<<16|w<<8|255)>>>0}e.reduceLuminance=r;function s(l,u,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,v=u>>24&255,y=u>>16&255,w=u>>8&255,S=$s(kr.relativeLuminance2(v,y,w),kr.relativeLuminance2(d,g,p));for(;S<h&&(v<255||y<255||w<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=$s(kr.relativeLuminance2(v,y,w),kr.relativeLuminance2(d,g,p));return(v<<24|y<<16|w<<8|255)>>>0}e.increaseLuminance=s;function a(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=a})(lm||(lm={}));function Ta(e){let t=e.toString(16);return t.length<2?"0"+t:t}function $s(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Vq=class extends zd{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 new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Pm=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ni}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),s=0,a=0,l=0,u=t.getFg(0),h=t.getBg(0);for(let d=0;d<t.getTrimmedLength();d++)if(t.loadCell(d,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==u||this._workCell.bg!==h){if(d-s>1){let g=this._getJoinedRanges(r,l,a,t,s);for(let p=0;p<g.length;p++)n.push(g[p])}s=d,l=a,u=this._workCell.fg,h=this._workCell.bg}a+=this._workCell.getChars().length||Ko.length}if(this._bufferService.cols-s>1){let d=this._getJoinedRanges(r,l,a,t,s);for(let g=0;g<d.length;g++)n.push(d[g])}return n}_getJoinedRanges(e,t,n,r,s){let a=e.substring(t,n),l=[];try{l=this._characterJoiners[0].handler(a)}catch(u){console.error(u)}for(let u=1;u<this._characterJoiners.length;u++)try{let h=this._characterJoiners[u].handler(a);for(let d=0;d<h.length;d++)Pm._mergeRanges(l,h[d])}catch(h){console.error(h)}return this._stringRangesToCellRanges(l,r,s),l}_stringRangesToCellRanges(e,t,n){let r=0,s=!1,a=0,l=e[r];if(l){for(let u=n;u<this._bufferService.cols;u++){let h=t.getWidth(u),d=t.getString(u).length||Ko.length;if(h!==0){if(!s&&l[0]<=a&&(l[0]=u,s=!0),l[1]<=a){if(l[1]=u,l=e[++r],!l)break;l[0]<=a?(l[0]=u,s=!0):s=!1}a+=d}}l&&(l[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let s=e[r];if(n){if(t[1]<=s[0])return e[r-1][1]=t[1],e;if(t[1]<=s[1])return e[r-1][1]=Math.max(t[1],s[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=s[0])return e.splice(r,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Pm=Sn([Pe(0,Mr)],Pm);function qq(e){return 57508<=e&&e<=57558}function Kq(e){return 9472<=e&&e<=9631}function Gq(e){return qq(e)||Kq(e)}function Yq(){return{css:{canvas:Mf(),cell:Mf()},device:{canvas:Mf(),cell:Mf(),char:{width:0,height:0,left:0,top:0}}}}function Mf(){return{width:0,height:0}}var Cy=class{constructor(e,t,n,r,s,a,l){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=s,this._decorationService=a,this._themeService=l,this._workCell=new Ni,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,s,a,l,u,h,d,g){let p=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,w=e.getNoBgTrimmedLength();n&&w<a+1&&(w=a+1);let S,C=0,k="",R=0,E=0,N=0,j=0,D=!1,L=0,U=!1,Y=0,P=0,V=[],I=d!==-1&&g!==-1;for(let W=0;W<w;W++){e.loadCell(W,this._workCell);let K=this._workCell.getWidth();if(K===0)continue;let q=!1,O=W>=P,F=W,H=this._workCell;if(v.length>0&&W===v[0][0]&&O){let je=v.shift(),Xe=this._isCellInSelection(je[0],t);for(R=je[0]+1;R<je[1];R++)O&&(O=Xe===this._isCellInSelection(R,t));O&&(O=!n||a<je[0]||a>=je[1]),O?(q=!0,H=new Vq(this._workCell,e.translateToString(!0,je[0],je[1]),je[1]-je[0]),F=je[1]-1,K=H.getWidth()):P=je[1]}let $=this._isCellInSelection(W,t),M=n&&W===a,B=I&&W>=d&&W<=g,X=!1;this._decorationService.forEachDecorationAtCell(W,t,void 0,je=>{X=!0});let A=H.getChars()||Ko;if(A===" "&&(H.isUnderline()||H.isOverline())&&(A=" "),Y=K*u-h.get(A,H.isBold(),H.isItalic()),!S)S=this._document.createElement("span");else if(C&&($&&U||!$&&!U&&H.bg===E)&&($&&U&&y.selectionForeground||H.fg===N)&&H.extended.ext===j&&B===D&&Y===L&&!M&&!q&&!X&&O){H.isInvisible()?k+=Ko:k+=A,C++;continue}else C&&(S.textContent=k),S=this._document.createElement("span"),C=0,k="";if(E=H.bg,N=H.fg,j=H.extended.ext,D=B,L=Y,U=$,q&&a>=W&&a<=F&&(a=W),!this._coreService.isCursorHidden&&M&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&V.push("xterm-cursor-blink"),V.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline");break}}if(H.isBold()&&V.push("xterm-bold"),H.isItalic()&&V.push("xterm-italic"),H.isDim()&&V.push("xterm-dim"),H.isInvisible()?k=Ko:k=H.getChars()||Ko,H.isUnderline()&&(V.push(`xterm-underline-${H.extended.underlineStyle}`),k===" "&&(k=" "),!H.isUnderlineColorDefault()))if(H.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${zd.toColorRGB(H.getUnderlineColor()).join(",")})`;else{let je=H.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&H.isBold()&&je<8&&(je+=8),S.style.textDecorationColor=y.ansi[je].css}H.isOverline()&&(V.push("xterm-overline"),k===" "&&(k=" ")),H.isStrikethrough()&&V.push("xterm-strikethrough"),B&&(S.style.textDecoration="underline");let re=H.getFgColor(),se=H.getFgColorMode(),Z=H.getBgColor(),te=H.getBgColorMode(),le=!!H.isInverse();if(le){let je=re;re=Z,Z=je;let Xe=se;se=te,te=Xe}let pe,xe,Me=!1;this._decorationService.forEachDecorationAtCell(W,t,void 0,je=>{je.options.layer!=="top"&&Me||(je.backgroundColorRGB&&(te=50331648,Z=je.backgroundColorRGB.rgba>>8&16777215,pe=je.backgroundColorRGB),je.foregroundColorRGB&&(se=50331648,re=je.foregroundColorRGB.rgba>>8&16777215,xe=je.foregroundColorRGB),Me=je.options.layer==="top")}),!Me&&$&&(pe=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,Z=pe.rgba>>8&16777215,te=50331648,Me=!0,y.selectionForeground&&(se=50331648,re=y.selectionForeground.rgba>>8&16777215,xe=y.selectionForeground)),Me&&V.push("xterm-decoration-top");let Re;switch(te){case 16777216:case 33554432:Re=y.ansi[Z],V.push(`xterm-bg-${Z}`);break;case 50331648:Re=Bn.toColor(Z>>16,Z>>8&255,Z&255),this._addStyle(S,`background-color:#${hE((Z>>>0).toString(16),"0",6)}`);break;case 0:default:le?(Re=y.foreground,V.push("xterm-bg-257")):Re=y.background}switch(pe||H.isDim()&&(pe=un.multiplyOpacity(Re,.5)),se){case 16777216:case 33554432:H.isBold()&&re<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(re+=8),this._applyMinimumContrast(S,Re,y.ansi[re],H,pe,void 0)||V.push(`xterm-fg-${re}`);break;case 50331648:let je=Bn.toColor(re>>16&255,re>>8&255,re&255);this._applyMinimumContrast(S,Re,je,H,pe,xe)||this._addStyle(S,`color:#${hE(re.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(S,Re,y.foreground,H,pe,xe)||le&&V.push("xterm-fg-257")}V.length&&(S.className=V.join(" "),V.length=0),!M&&!q&&!X&&O?C++:S.textContent=k,Y!==this.defaultSpacing&&(S.style.letterSpacing=`${Y}px`),p.push(S),W=F}return S&&C&&(S.textContent=k),p}_applyMinimumContrast(e,t,n,r,s,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||Gq(r.getCode()))return!1;let l=this._getContrastCache(r),u;if(!s&&!a&&(u=l.getColor(t.rgba,n.rgba)),u===void 0){let h=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);u=un.ensureContrastRatio(s||t,a||n,h),l.setColor((s||t).rgba,(a||n).rgba,u??null)}return u?(this._addStyle(e,`color:${u.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]}};Cy=Sn([Pe(1,cD),Pe(2,Ar),Pe(3,io),Pe(4,rl),Pe(5,Pd),Pe(6,Rc)],Cy);function hE(e,t,n){for(;e.length<n;)e=t+e;return e}var Xq=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 s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.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,s,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(s),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 l=this._measure(e,0);return l>0&&(this._flat[r]=l),l}let s=e;t&&(s+="B"),n&&(s+="I");let a=this._holey.get(s);if(a===void 0){let l=0;t&&(l|=1),n&&(l|=2),a=this._measure(e,l),a>0&&this._holey.set(s,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},Zq=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 s=e.buffers.active.ydisp,a=t[1]-s,l=n[1]-s,u=Math.max(a,0),h=Math.min(l,e.rows-1);if(u>=e.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=l,this.viewportCappedStartRow=u,this.viewportCappedEndRow=h,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 Qq(){return new Zq}var L_="xterm-dom-renderer-owner-",_i="xterm-rows",Af="xterm-fg-",fE="xterm-bg-",Eu="xterm-focus",Df="xterm-selection",Jq=1,ky=class extends wt{constructor(e,t,n,r,s,a,l,u,h,d,g,p,v,y){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=s,this._helperContainer=a,this._linkifier2=l,this._charSizeService=h,this._optionsService=d,this._bufferService=g,this._coreService=p,this._coreBrowserService=v,this._themeService=y,this._terminalClass=Jq++,this._rowElements=[],this._selectionRenderModel=Qq(),this.onRequestRedraw=this._register(new Ne).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(_i),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(Df),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Yq(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=u.createInstance(Cy,document),this._element.classList.add(L_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(fn(()=>{this._element.classList.remove(L_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Xq(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 n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${_i} 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} .${_i} { 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} .${_i} .xterm-dim { color: ${un.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}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${_i}.${Eu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${_i}.${Eu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${_i}.${Eu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${_i} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${_i} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${_i} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${_i} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${_i} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Df} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Df} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Df} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[a,l]of e.ansi.entries())t+=`${this._terminalSelector} .${Af}${a} { color: ${l.css}; }${this._terminalSelector} .${Af}${a}.xterm-dim { color: ${un.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${fE}${a} { background-color: ${l.css}; }`;t+=`${this._terminalSelector} .${Af}257 { color: ${un.opaque(e.background).css}; }${this._terminalSelector} .${Af}257.xterm-dim { color: ${un.multiplyOpacity(un.opaque(e.background),.5).css}; }${this._terminalSelector} .${fE}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 n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}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(Eu),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Eu),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,s=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,u=this._document.createDocumentFragment();if(n){let h=e[0]>t[0];u.appendChild(this._createSelectionElement(a,h?t[0]:e[0],h?e[0]:t[0],l-a+1))}else{let h=r===a?e[0]:0,d=a===s?t[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(a,h,d));let g=l-a-1;if(u.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,g)),a!==l){let p=s===l?t[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(l,0,p))}}this._selectionContainer.appendChild(u)}_createSelectionElement(e,t,n,r=1){let s=this._document.createElement("div"),a=t*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(n-t);return a+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-a),s.style.height=`${r*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${a}px`,s.style.width=`${l}px`,s}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,s=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=t;h++){let d=h+n.ydisp,g=this._rowElements[h],p=n.lines.get(d);if(!g||!p)break;g.replaceChildren(...this._rowFactory.createRow(p,d,d===r,l,u,s,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${L_}${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,s,a){n<0&&(e=0),r<0&&(t=0);let l=this._bufferService.rows-1;n=Math.max(Math.min(n,l),0),r=Math.max(Math.min(r,l),0),s=Math.min(s,this._bufferService.cols);let u=this._bufferService.buffer,h=u.ybase+u.y,d=Math.min(u.x,s-1),g=this._optionsService.rawOptions.cursorBlink,p=this._optionsService.rawOptions.cursorStyle,v=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=n;y<=r;++y){let w=y+u.ydisp,S=this._rowElements[y],C=u.lines.get(w);if(!S||!C)break;S.replaceChildren(...this._rowFactory.createRow(C,w,w===h,p,v,d,g,this.dimensions.css.cell.width,this._widthCache,a?y===n?e:0:-1,a?(y===r?t:s)-1:-1))}}};ky=Sn([Pe(7,bx),Pe(8,Op),Pe(9,Ar),Pe(10,Mr),Pe(11,rl),Pe(12,io),Pe(13,Rc)],ky);var Ey=class extends wt{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Ne),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new tK(this._optionsService))}catch{this._measureStrategy=this._register(new eK(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())}};Ey=Sn([Pe(2,Ar)],Ey);var TD=class extends wt{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)}},eK=class extends TD{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}},tK=class extends TD{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},nK=class extends wt{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 rK(this._window)),this._onDprChange=this._register(new Ne),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Ne),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(fr.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(it(this._textarea,"focus",()=>this._isFocused=!0)),this._register(it(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}},rK=class extends wt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new fc),this._onDprChange=this._register(new Ne),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(fn(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=it(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.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)}},iK=class extends wt{constructor(){super(),this.linkProviders=[],this._register(fn(()=>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 Rx(e,t,n){let r=n.getBoundingClientRect(),s=e.getComputedStyle(n),a=parseInt(s.getPropertyValue("padding-left")),l=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-r.left-a,t.clientY-r.top-l]}function sK(e,t,n,r,s,a,l,u,h){if(!a)return;let d=Rx(e,t,n);if(d)return d[0]=Math.ceil((d[0]+(h?l/2:0))/l),d[1]=Math.ceil(d[1]/u),d[0]=Math.min(Math.max(d[0],1),r+(h?1:0)),d[1]=Math.min(Math.max(d[1],1),s),d}var Ry=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,s){return sK(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let n=Rx(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])}}};Ry=Sn([Pe(0,so),Pe(1,Op)],Ry);var oK=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},ND={};gV(ND,{getSafariVersion:()=>lK,isChromeOS:()=>jD,isFirefox:()=>MD,isIpad:()=>cK,isIphone:()=>uK,isLegacyEdge:()=>aK,isLinux:()=>Tx,isMac:()=>Bm,isNode:()=>Lp,isSafari:()=>AD,isWindows:()=>DD});var Lp=typeof process<"u"&&"title"in process,Bd=Lp?"node":navigator.userAgent,Id=Lp?"node":navigator.platform,MD=Bd.includes("Firefox"),aK=Bd.includes("Edge"),AD=/^((?!chrome|android).)*safari/i.test(Bd);function lK(){if(!AD)return 0;let e=Bd.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Bm=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Id),cK=Id==="iPad",uK=Id==="iPhone",DD=["Windows","Win16","Win32","WinCE"].includes(Id),Tx=Id.indexOf("Linux")>=0,jD=/\bCrOS\b/.test(Bd),OD=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),s=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),s=e.timeRemaining(),n*1.5>s){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=s}this.clear()}},dK=class extends OD{_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())}}},hK=class extends OD{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Im=!Lp&&"requestIdleCallback"in window?hK:dK,fK=class{constructor(){this._queue=new Im}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Ty=class extends wt{constructor(e,t,n,r,s,a,l,u,h){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=s,this._coreBrowserService=u,this._renderer=this._register(new fc),this._pausedResizeTask=new fK,this._observerDisposable=this._register(new fc),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 Ne),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Ne),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Ne),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Ne),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new oK((d,g)=>this._renderRows(d,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new mK(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(fn(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>{var d;return(d=this._renderer.value)==null?void 0:d.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(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=fn(()=>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),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),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(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Ty=Sn([Pe(2,Ar),Pe(3,Op),Pe(4,rl),Pe(5,Pd),Pe(6,Mr),Pe(7,io),Pe(8,Rc)],Ty);var mK=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 pK(e,t,n,r){let s=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return _K(s,a,e,t,n,r)+zp(a,t,n,r)+bK(s,a,e,t,n,r);let l;if(a===t)return l=s>e?"D":"C",pd(Math.abs(s-e),md(l,r));l=a>t?"D":"C";let u=Math.abs(a-t),h=vK(a>t?e:s,n)+(u-1)*n.cols+1+gK(a>t?s:e);return pd(h,md(l,r))}function gK(e,t){return e-1}function vK(e,t){return t.cols-e}function _K(e,t,n,r,s,a){return zp(t,r,s,a).length===0?"":pd(zD(e,t,e,t-Xa(t,s),!1,s).length,md("D",a))}function zp(e,t,n,r){let s=e-Xa(e,n),a=t-Xa(t,n),l=Math.abs(s-a)-yK(e,t,n);return pd(l,md(LD(e,t),r))}function bK(e,t,n,r,s,a){let l;zp(t,r,s,a).length>0?l=r-Xa(r,s):l=t;let u=r,h=xK(e,t,n,r,s,a);return pd(zD(e,l,n,u,h==="C",s).length,md(h,a))}function yK(e,t,n){var l;let r=0,s=e-Xa(e,n),a=t-Xa(t,n);for(let u=0;u<Math.abs(s-a);u++){let h=LD(e,t)==="A"?-1:1;(l=n.buffer.lines.get(s+h*u))!=null&&l.isWrapped&&r++}return r}function Xa(e,t){let n=0,r=t.buffer.lines.get(e),s=r==null?void 0:r.isWrapped;for(;s&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),s=r==null?void 0:r.isWrapped;return n}function xK(e,t,n,r,s,a){let l;return zp(n,r,s,a).length>0?l=r-Xa(r,s):l=t,e<n&&l<=r||e>=n&&l<r?"C":"D"}function LD(e,t){return e>t?"A":"B"}function zD(e,t,n,r,s,a){let l=e,u=t,h="";for(;(l!==n||u!==r)&&u>=0&&u<a.buffer.lines.length;)l+=s?1:-1,s&&l>a.cols-1?(h+=a.buffer.translateBufferLineToString(u,!1,e,l),l=0,e=0,u++):!s&&l<0&&(h+=a.buffer.translateBufferLineToString(u,!1,0,e+1),l=a.cols-1,e=l,u--);return h+a.buffer.translateBufferLineToString(u,!1,e,l)}function md(e,t){let n=t?"O":"[";return _e.ESC+n+e}function pd(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var wK=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 mE(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var z_=50,SK=15,CK=50,kK=500,EK=" ",RK=new RegExp(EK,"g"),Ny=class extends wt{constructor(e,t,n,r,s,a,l,u,h){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=s,this._mouseService=a,this._optionsService=l,this._renderService=u,this._coreBrowserService=h,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ni,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Ne),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Ne),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Ne),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Ne),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=d=>this._handleMouseMove(d),this._mouseUpListener=d=>this._handleMouseUp(d),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(d=>this._handleTrim(d)),this._register(this._bufferService.buffers.onBufferActivate(d=>this._handleBufferActivate(d))),this.enable(),this._model=new wK(this._bufferService),this._activeSelectionMode=0,this._register(fn(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(d=>{d.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let l=e[1];l<=t[1];l++){let u=n.translateBufferLineToString(l,!0,s,a);r.push(u)}}else{let s=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],s));for(let a=e[1]+1;a<=t[1]-1;a++){let l=n.lines.get(a),u=n.translateBufferLineToString(a,!0);l!=null&&l.isWrapped?r[r.length-1]+=u:r.push(u)}if(e[1]!==t[1]){let a=n.lines.get(t[1]),l=n.translateBufferLineToString(t[1],!0,0,t[0]);a&&a.isWrapped?r[r.length-1]+=l:r.push(l)}}return r.map(s=>s.replace(RK," ")).join(DD?`\r
513
- `:`
514
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Tx&&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){var s,a;let n=(a=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:a.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=mE(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=Rx(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,-z_),z_),t/=z_,t/Math.abs(t)+Math.round(t*(SK-1)))}shouldForceSelection(e){return Bm?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(),CK)}_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&&!(Bm&&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 r=n.lines.get(this._model.selectionEnd[1]);r&&r.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<kK&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=pK(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!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(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let s=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:s>1&&t!==r&&(n+=s-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 s=this._bufferService.buffer,a=s.lines.get(e[1]);if(!a)return;let l=s.translateBufferLineToString(e[1],!1),u=this._convertViewportColToCharacterIndex(a,e[0]),h=u,d=e[0]-u,g=0,p=0,v=0,y=0;if(l.charAt(u)===" "){for(;u>0&&l.charAt(u-1)===" ";)u--;for(;h<l.length&&l.charAt(h+1)===" ";)h++}else{let C=e[0],k=e[0];a.getWidth(C)===0&&(g++,C--),a.getWidth(k)===2&&(p++,k++);let R=a.getString(k).length;for(R>1&&(y+=R-1,h+=R-1);C>0&&u>0&&!this._isCharWordSeparator(a.loadCell(C-1,this._workCell));){a.loadCell(C-1,this._workCell);let E=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,C--):E>1&&(v+=E-1,u-=E-1),u--,C--}for(;k<a.length&&h+1<l.length&&!this._isCharWordSeparator(a.loadCell(k+1,this._workCell));){a.loadCell(k+1,this._workCell);let E=this._workCell.getChars().length;this._workCell.getWidth()===2?(p++,k++):E>1&&(y+=E-1,h+=E-1),h++,k++}}h++;let w=u+d-g+v,S=Math.min(this._bufferService.cols,h-u+g+p-v-y);if(!(!t&&l.slice(u,h).trim()==="")){if(n&&w===0&&a.getCodePoint(0)!==32){let C=s.lines.get(e[1]-1);if(C&&a.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let k=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(k){let R=this._bufferService.cols-k.start;w-=R,S+=R}}}if(r&&w+S===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let C=s.lines.get(e[1]+1);if(C!=null&&C.isWrapped&&C.getCodePoint(0)!==32){let k=this._getWordAt([0,e[1]+1],!1,!1,!0);k&&(S+=k.length)}}return{start:w,length:S}}}_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?!1: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=mE(n,this._bufferService.cols)}};Ny=Sn([Pe(3,Mr),Pe(4,rl),Pe(5,yx),Pe(6,Ar),Pe(7,so),Pe(8,io)],Ny);var pE=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={}}},gE=class{constructor(){this._color=new pE,this._css=new pE}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()}},Un=Object.freeze((()=>{let e=[pn.toColor("#2e3436"),pn.toColor("#cc0000"),pn.toColor("#4e9a06"),pn.toColor("#c4a000"),pn.toColor("#3465a4"),pn.toColor("#75507b"),pn.toColor("#06989a"),pn.toColor("#d3d7cf"),pn.toColor("#555753"),pn.toColor("#ef2929"),pn.toColor("#8ae234"),pn.toColor("#fce94f"),pn.toColor("#729fcf"),pn.toColor("#ad7fa8"),pn.toColor("#34e2e2"),pn.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],s=t[n/6%6|0],a=t[n%6];e.push({css:Bn.toCss(r,s,a),rgba:Bn.toRgba(r,s,a)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Bn.toCss(r,r,r),rgba:Bn.toRgba(r,r,r)})}return e})()),Aa=pn.toColor("#ffffff"),Uu=pn.toColor("#000000"),vE=pn.toColor("#ffffff"),_E=Uu,Ru={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},TK=Aa,My=class extends wt{constructor(e){super(),this._optionsService=e,this._contrastCache=new gE,this._halfContrastCache=new gE,this._onChangeColors=this._register(new Ne),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Aa,background:Uu,cursor:vE,cursorAccent:_E,selectionForeground:void 0,selectionBackgroundTransparent:Ru,selectionBackgroundOpaque:un.blend(Uu,Ru),selectionInactiveBackgroundTransparent:Ru,selectionInactiveBackgroundOpaque:un.blend(Uu,Ru),scrollbarSliderBackground:un.opacity(Aa,.2),scrollbarSliderHoverBackground:un.opacity(Aa,.4),scrollbarSliderActiveBackground:un.opacity(Aa,.5),overviewRulerBorder:Aa,ansi:Un.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=Qt(e.foreground,Aa),t.background=Qt(e.background,Uu),t.cursor=un.blend(t.background,Qt(e.cursor,vE)),t.cursorAccent=un.blend(t.background,Qt(e.cursorAccent,_E)),t.selectionBackgroundTransparent=Qt(e.selectionBackground,Ru),t.selectionBackgroundOpaque=un.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Qt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=un.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Qt(e.selectionForeground,dE):void 0,t.selectionForeground===dE&&(t.selectionForeground=void 0),un.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=un.opacity(t.selectionBackgroundTransparent,.3)),un.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=un.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Qt(e.scrollbarSliderBackground,un.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Qt(e.scrollbarSliderHoverBackground,un.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Qt(e.scrollbarSliderActiveBackground,un.opacity(t.foreground,.5)),t.overviewRulerBorder=Qt(e.overviewRulerBorder,TK),t.ansi=Un.slice(),t.ansi[0]=Qt(e.black,Un[0]),t.ansi[1]=Qt(e.red,Un[1]),t.ansi[2]=Qt(e.green,Un[2]),t.ansi[3]=Qt(e.yellow,Un[3]),t.ansi[4]=Qt(e.blue,Un[4]),t.ansi[5]=Qt(e.magenta,Un[5]),t.ansi[6]=Qt(e.cyan,Un[6]),t.ansi[7]=Qt(e.white,Un[7]),t.ansi[8]=Qt(e.brightBlack,Un[8]),t.ansi[9]=Qt(e.brightRed,Un[9]),t.ansi[10]=Qt(e.brightGreen,Un[10]),t.ansi[11]=Qt(e.brightYellow,Un[11]),t.ansi[12]=Qt(e.brightBlue,Un[12]),t.ansi[13]=Qt(e.brightMagenta,Un[13]),t.ansi[14]=Qt(e.brightCyan,Un[14]),t.ansi[15]=Qt(e.brightWhite,Un[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]=Qt(e.extendedAnsi[r],Un[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 t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};My=Sn([Pe(0,Ar)],My);function Qt(e,t){if(e!==void 0)try{return pn.toColor(e)}catch{}return t}var NK=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)}},MK=class{constructor(){this._services=new NK,this._services.set(bx,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=SV(e).sort((a,l)=>a.index-l.index),r=[];for(let a of n){let l=this._services.get(a.id);if(!l)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id._id}.`);r.push(l)}let s=n.length>0?n[0].index:t.length;if(t.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},AK={trace:0,debug:1,info:2,warn:3,error:4,off:5},DK="xterm.js: ",Ay=class extends wt{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=AK[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?"":DK)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Ay=Sn([Pe(0,Ar)],Ay);var bE=class extends wt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Ne),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Ne),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Ne),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let 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 new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}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 new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let s=t-1;s>=0;s--)this.set(e+s+n,this.get(e+s));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}},yt=3,zn=Object.freeze(new zd),jf=0,P_=2,$u=class PD{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*yt);let s=n||Ni.fromCharData([0,nD,1,0]);for(let a=0;a<t;++a)this.setCell(a,s);this.length=t}get(t){let n=this._data[t*yt+0],r=n&2097151;return[this._data[t*yt+1],n&2097152?this._combined[t]:r?Wo(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*yt+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*yt+0]=t|2097152|n[2]<<22):this._data[t*yt+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*yt+0]>>22}hasWidth(t){return this._data[t*yt+0]&12582912}getFg(t){return this._data[t*yt+1]}getBg(t){return this._data[t*yt+2]}hasContent(t){return this._data[t*yt+0]&4194303}getCodePoint(t){let n=this._data[t*yt+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*yt+0]&2097152}getString(t){let n=this._data[t*yt+0];return n&2097152?this._combined[t]:n&2097151?Wo(n&2097151):""}isProtected(t){return this._data[t*yt+2]&536870912}loadCell(t,n){return jf=t*yt,n.content=this._data[jf+0],n.fg=this._data[jf+1],n.bg=this._data[jf+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*yt+0]=n.content,this._data[t*yt+1]=n.fg,this._data[t*yt+2]=n.bg}setCellFromCodepoint(t,n,r,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*yt+0]=n|r<<22,this._data[t*yt+1]=s.fg,this._data[t*yt+2]=s.bg}addCodepointToCell(t,n,r){let s=this._data[t*yt+0];s&2097152?this._combined[t]+=Wo(n):s&2097151?(this._combined[t]=Wo(s&2097151)+Wo(n),s&=-2097152,s|=2097152):s=n|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[t*yt+0]=s}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let s=new Ni;for(let a=this.length-t-n-1;a>=0;--a)this.setCell(t+n+a,this.loadCell(t+a,s));for(let a=0;a<n;++a)this.setCell(t+a,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let s=new Ni;for(let a=0;a<this.length-t-n;++a)this.setCell(t+a,this.loadCell(t+n+a,s));for(let a=this.length-n;a<this.length;++a)this.setCell(a,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,s=!1){if(s){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*P_<this._data.buffer.byteLength;let r=t*yt;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,n)}else{this._data=this._data.subarray(0,r);let s=Object.keys(this._combined);for(let l=0;l<s.length;l++){let u=parseInt(s[l],10);u>=t&&delete this._combined[u]}let a=Object.keys(this._extendedAttrs);for(let l=0;l<a.length;l++){let u=parseInt(a[l],10);u>=t&&delete this._extendedAttrs[u]}}return this.length=t,r*4*P_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*P_<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new PD(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*yt+0]&4194303)return t+(this._data[t*yt+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*yt+0]&4194303||this._data[t*yt+2]&50331648)return t+(this._data[t*yt+0]>>22);return 0}copyCellsFrom(t,n,r,s,a){let l=t._data;if(a)for(let h=s-1;h>=0;h--){for(let d=0;d<yt;d++)this._data[(r+h)*yt+d]=l[(n+h)*yt+d];l[(n+h)*yt+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[n+h])}else for(let h=0;h<s;h++){for(let d=0;d<yt;d++)this._data[(r+h)*yt+d]=l[(n+h)*yt+d];l[(n+h)*yt+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[n+h])}let u=Object.keys(t._combined);for(let h=0;h<u.length;h++){let d=parseInt(u[h],10);d>=n&&(this._combined[d-n+r]=t._combined[d])}}translateToString(t,n,r,s){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let a="";for(;n<r;){let l=this._data[n*yt+0],u=l&2097151,h=l&2097152?this._combined[n]:u?Wo(u):Ko;if(a+=h,s)for(let d=0;d<h.length;++d)s.push(n);n+=l>>22||1}return s&&s.push(n),a}};function jK(e,t,n,r,s,a){let l=[];for(let u=0;u<e.length-1;u++){let h=u,d=e.get(++h);if(!d.isWrapped)continue;let g=[e.get(u)];for(;h<e.length&&d.isWrapped;)g.push(d),d=e.get(++h);if(!a&&r>=u&&r<h){u+=g.length-1;continue}let p=0,v=gd(g,p,t),y=1,w=0;for(;y<g.length;){let C=gd(g,y,t),k=C-w,R=n-v,E=Math.min(k,R);g[p].copyCellsFrom(g[y],w,v,E,!1),v+=E,v===n&&(p++,v=0),w+=E,w===C&&(y++,w=0),v===0&&p!==0&&g[p-1].getWidth(n-1)===2&&(g[p].copyCellsFrom(g[p-1],n-1,v++,1,!1),g[p-1].setCell(n-1,s))}g[p].replaceCells(v,n,s);let S=0;for(let C=g.length-1;C>0&&(C>p||g[C].getTrimmedLength()===0);C--)S++;S>0&&(l.push(u+g.length-S),l.push(S)),u+=g.length-1}return l}function OK(e,t){let n=[],r=0,s=t[r],a=0;for(let l=0;l<e.length;l++)if(s===l){let u=t[++r];e.onDeleteEmitter.fire({index:l-a,amount:u}),l+=u-1,a+=u,s=t[++r]}else n.push(l);return{layout:n,countRemoved:a}}function LK(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function zK(e,t,n){let r=[],s=e.map((h,d)=>gd(e,d,t)).reduce((h,d)=>h+d),a=0,l=0,u=0;for(;u<s;){if(s-u<n){r.push(s-u);break}a+=n;let h=gd(e,l,t);a>h&&(a-=h,l++);let d=e[l].getWidth(a-1)===2;d&&a--;let g=d?n-1:n;r.push(g),u+=g}return r}function gd(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,s=e[t+1].getWidth(0)===2;return r&&s?n-1:n}var BD=class ID{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=ID._nextId++,this._onDispose=this.register(new Ne),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ya(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};BD._nextId=1;var PK=BD,qn={},Da=qn.B;qn[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:"≥","{":"π","|":"≠","}":"£","~":"·"};qn.A={"#":"£"};qn.B=void 0;qn[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};qn.C=qn[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};qn.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};qn.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};qn.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};qn.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};qn.E=qn[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};qn.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};qn.H=qn[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};qn["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var yE=4294967295,xE=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=zn.clone(),this.savedCharset=Da,this.markers=[],this._nullCell=Ni.fromCharData([0,nD,1,0]),this._whitespaceCell=Ni.fromCharData([0,Ko,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Im,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new bE(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 Lm),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 Lm),this._whitespaceCell}getBlankLine(e,t){return new $u(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>yE?yE:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=zn);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 bE(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(zn),r=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let l=0;l<this.lines.length;l++)r+=+this.lines.get(l).resize(e,n);let a=0;if(this._rows<t)for(let l=this._rows;l<t;l++)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 $u(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 $u(e,n)));else for(let l=this._rows;l>t;l--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let l=this.lines.length-s;l>0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=s}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 a=0;a<this.lines.length;a++)r+=+this.lines.get(a).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=jK(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(zn),n);if(r.length>0){let s=OK(this.lines,r);LK(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(zn),s=n;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new $u(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(zn),s=[],a=0;for(let l=this.lines.length-1;l>=0;l--){let u=this.lines.get(l);if(!u||!u.isWrapped&&u.getTrimmedLength()<=e)continue;let h=[u];for(;u.isWrapped&&l>0;)u=this.lines.get(--l),h.unshift(u);if(!n){let E=this.ybase+this.y;if(E>=l&&E<l+h.length)continue}let d=h[h.length-1].getTrimmedLength(),g=zK(h,this._cols,e),p=g.length-h.length,v;this.ybase===0&&this.y!==this.lines.length-1?v=Math.max(0,this.y-this.lines.maxLength+p):v=Math.max(0,this.lines.length-this.lines.maxLength+p);let y=[];for(let E=0;E<p;E++){let N=this.getBlankLine(zn,!0);y.push(N)}y.length>0&&(s.push({start:l+h.length+a,newLines:y}),a+=y.length),h.push(...y);let w=g.length-1,S=g[w];S===0&&(w--,S=g[w]);let C=h.length-p-1,k=d;for(;C>=0;){let E=Math.min(k,S);if(h[w]===void 0)break;if(h[w].copyCellsFrom(h[C],k-E,S-E,E,!0),S-=E,S===0&&(w--,S=g[w]),k-=E,k===0){C--;let N=Math.max(C,0);k=gd(h,N,this._cols)}}for(let E=0;E<h.length;E++)g[E]<e&&h[E].setCell(g[E],r);let R=p-v;for(;R-- >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+p,this.ybase+t-1)}if(s.length>0){let l=[],u=[];for(let S=0;S<this.lines.length;S++)u.push(this.lines.get(S));let h=this.lines.length,d=h-1,g=0,p=s[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let v=0;for(let S=Math.min(this.lines.maxLength-1,h+a-1);S>=0;S--)if(p&&p.start>d+v){for(let C=p.newLines.length-1;C>=0;C--)this.lines.set(S--,p.newLines[C]);S++,l.push({index:d+1,amount:p.newLines.length}),v+=p.newLines.length,p=s[++g]}else this.lines.set(S,u[d--]);let y=0;for(let S=l.length-1;S>=0;S--)l[S].index+=y,this.lines.onInsertEmitter.fire(l[S]),y+=l[S].amount;let w=Math.max(0,h+a-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,n=0,r){let s=this.lines.get(e);return s?s.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]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new PK(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},BK=class extends wt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Ne),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 xE(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new xE(!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)}},HD=2,FD=1,Dy=class extends wt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Ne),this.onResize=this._onResize.event,this._onScroll=this._register(new Ne),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,HD),this.rows=Math.max(e.rawOptions.rows||0,FD),this.buffers=this._register(new BK(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.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 s=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let l=n.lines.isFull;a===n.lines.length-1?l?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),l?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let l=a-s+1;n.lines.shiftElements(s+1,l-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))}};Dy=Sn([Pe(0,Ar)],Dy);var Wl={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:Bm,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},IK=["normal","bold","100","200","300","400","500","600","700","800","900"],HK=class extends wt{constructor(e){super(),this._onOptionChange=this._register(new Ne),this.onOptionChange=this._onOptionChange.event;let t={...Wl};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(fn(()=>{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=n=>{if(!(n in Wl))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in Wl))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};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||(t=Wl[e]),!FK(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Wl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=IK.includes(t)?t:Wl[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function FK(e){return e==="block"||e==="underline"||e==="bar"}function Wu(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]&&Wu(e[r],t-1);return n}var wE=Object.freeze({insertMode:!1}),SE=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),jy=class extends wt{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 Ne),this.onData=this._onData.event,this._onUserInput=this._register(new Ne),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Ne),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Ne),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Wu(wE),this.decPrivateModes=Wu(SE)}reset(){this.modes=Wu(wE),this.decPrivateModes=Wu(SE)}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(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};jy=Sn([Pe(0,Mr),Pe(1,aD),Pe(2,Ar)],jy);var CE={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 B_(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 I_=String.fromCharCode,kE={DEFAULT:e=>{let t=[B_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${I_(t[0])}${I_(t[1])}${I_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${B_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${B_(e,!0)};${e.x};${e.y}${t}`}},Oy=class extends wt{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 Ne),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(CE))this.addProtocol(r,CE[r]);for(let r of Object.keys(kE))this.addEncoding(r,kE[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_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)}};Oy=Sn([Pe(0,Mr),Pe(1,rl),Pe(2,Ar)],Oy);var H_=[[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]],UK=[[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]],$n;function $K(e,t){let n=0,r=t.length-1,s;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(s=n+r>>1,e>t[s][1])n=s+1;else if(e<t[s][0])r=s-1;else return!0;return!1}var WK=class{constructor(){if(this.version="6",!$n){$n=new Uint8Array(65536),$n.fill(1),$n[0]=0,$n.fill(0,1,32),$n.fill(0,127,160),$n.fill(2,4352,4448),$n[9001]=2,$n[9002]=2,$n.fill(2,11904,42192),$n[12351]=1,$n.fill(2,44032,55204),$n.fill(2,63744,64256),$n.fill(2,65040,65050),$n.fill(2,65072,65136),$n.fill(2,65280,65377),$n.fill(2,65504,65511);for(let e=0;e<H_.length;++e)$n.fill(0,H_[e][0],H_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?$n[e]:$K(e,UK)?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 s=Ia.extractWidth(t);s===0?r=!1:s>n&&(n=s)}return Ia.createPropertyValue(0,n,r)}},Ia=class cm{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Ne,this.onChange=this._onChange.event;let t=new WK;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,s=t.length;for(let a=0;a<s;++a){let l=t.charCodeAt(a);if(55296<=l&&l<=56319){if(++a>=s)return n+this.wcwidth(l);let d=t.charCodeAt(a);56320<=d&&d<=57343?l=(l-55296)*1024+d-56320+65536:n+=this.wcwidth(d)}let u=this.charProperties(l,r),h=cm.extractWidth(u);cm.extractShouldJoin(u)&&(h-=cm.extractWidth(r)),n+=h,r=u}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},VK=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 EE(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.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 Tu=2147483647,qK=256,UD=class Ly{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>qK)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new Ly;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let s=t[r];if(Array.isArray(s))for(let a=0;a<s.length;++a)n.addSubParam(s[a]);else n.addParam(s)}return n}clone(){let t=new Ly(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,s=this._subParamsIdx[n]&255;s-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,s))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Tu?Tu:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Tu?Tu:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,s=this._subParamsIdx[n]&255;s-r>0&&(t[n]=this._subParams.slice(r,s))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[n-1];r[n-1]=~s?Math.min(s*10+t,Tu):t}},Nu=[],KK=class{constructor(){this._state=0,this._active=Nu,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 r=n.indexOf(t);r!==-1&&n.splice(r,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=Nu}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=Nu,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Nu,!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",jp(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 r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-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,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&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=Nu,this._id=-1,this._state=0}}},ei=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+=jp(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(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},Mu=[],GK=class{constructor(){this._handlers=Object.create(null),this._active=Mu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Mu}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,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=Mu,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Mu,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",jp(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,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&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=Mu,this._ident=0}},Vu=new UD;Vu.addParam(0);var RE=class{constructor(e){this._handler=e,this._data="",this._params=Vu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Vu,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=jp(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(n=>(this._params=Vu,this._data="",this._hitLimit=!1,n));return this._params=Vu,this._data="",this._hitLimit=!1,t}},YK=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 s=0;s<e.length;s++)this.table[t<<8|e[s]]=n<<4|r}},ki=160,XK=(function(){let e=new YK(4095),t=Array.apply(null,Array(256)).map((u,h)=>h),n=(u,h)=>t.slice(u,h),r=n(32,127),s=n(0,24);s.push(25),s.push.apply(s,n(28,32));let a=n(0,14),l;e.setDefault(1,0),e.addMany(r,0,2,0);for(l in a)e.addMany([24,26,153,154],l,3,0),e.addMany(n(128,144),l,3,0),e.addMany(n(144,152),l,3,0),e.add(156,l,0,0),e.add(27,l,11,1),e.add(157,l,4,8),e.addMany([152,158,159],l,0,7),e.add(155,l,11,3),e.add(144,l,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,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(s,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(s,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(s,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(s,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(s,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(s,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(ki,0,2,0),e.add(ki,8,5,8),e.add(ki,6,0,6),e.add(ki,11,0,11),e.add(ki,13,13,13),e})(),ZK=class extends wt{constructor(e=XK){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 UD,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(fn(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new KK),this._dcsParser=this._register(new GK),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 new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<e.intermediates.length;++s){let a=e.intermediates.charCodeAt(s);if(32>a||a>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=a}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new 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 s=r.indexOf(t);s!==-1&&r.splice(s,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 s=r.indexOf(t);s!==-1&&r.splice(s,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,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=s}parse(e,t,n){let r=0,s=0,a=0,l;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,new Error("improper continuation due to previous async handler, giving up parsing");let u=this._parseStack.handlers,h=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&h>-1){for(;h>=0&&(l=u[h](this._params),l!==!0);h--)if(l instanceof Promise)return this._parseStack.handlerPos=h,l}this._parseStack.handlers=[];break;case 4:if(n===!1&&h>-1){for(;h>=0&&(l=u[h](),l!==!0);h--)if(l instanceof Promise)return this._parseStack.handlerPos=h,l}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(r!==24&&r!==26,n),l)return l;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],l=this._oscParser.end(r!==24&&r!==26,n),l)return l;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 u=a;u<t;++u){switch(r=e[u],s=this._transitions.table[this.currentState<<8|(r<160?r:ki)],s>>4){case 2:for(let v=u+1;;++v){if(v>=t||(r=e[v])<32||r>126&&r<ki){this._printHandler(e,u,v),u=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<ki){this._printHandler(e,u,v),u=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<ki){this._printHandler(e,u,v),u=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<ki){this._printHandler(e,u,v),u=v-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:u,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let h=this._csiHandlers[this._collect<<8|r],d=h?h.length-1:-1;for(;d>=0&&(l=h[d](this._params),l!==!0);d--)if(l instanceof Promise)return this._preserveStack(3,h,d,s,u),l;d<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(++u<t&&(r=e[u])>47&&r<60);u--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let g=this._escHandlers[this._collect<<8|r],p=g?g.length-1:-1;for(;p>=0&&(l=g[p](),l!==!0);p--)if(l instanceof Promise)return this._preserveStack(4,g,p,s,u),l;p<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 v=u+1;;++v)if(v>=t||(r=e[v])===24||r===26||r===27||r>127&&r<ki){this._dcsParser.put(e,u,v),u=v-1;break}break;case 14:if(l=this._dcsParser.unhook(r!==24&&r!==26),l)return this._preserveStack(6,[],0,s,u),l;r===27&&(s|=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 v=u+1;;v++)if(v>=t||(r=e[v])<32||r>127&&r<ki){this._oscParser.put(e,u,v),u=v-1;break}break;case 6:if(l=this._oscParser.end(r!==24&&r!==26),l)return this._preserveStack(5,[],0,s,u),l;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},QK=/^([\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})$/,JK=/^[\da-f]+$/;function TE(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=QK.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),JK.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let s=0;s<3;++s){let a=parseInt(t.slice(n*s,n*s+n),16);r[s]=n===1?a<<4:n===2?a:n===3?a>>4:a>>8}return r}}function F_(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 eG(e,t=16){let[n,r,s]=e;return`rgb:${F_(n,t)}/${F_(r,t)}/${F_(s,t)}`}var tG={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Io=131072,NE=10;function ME(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 AE=5e3,DE=0,nG=class extends wt{constructor(e,t,n,r,s,a,l,u,h=new ZK){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=s,this._oscLinkService=a,this._coreMouseService=l,this._unicodeService=u,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new xV,this._utf8Decoder=new wV,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=zn.clone(),this._eraseAttrDataInternal=zn.clone(),this._onRequestBell=this._register(new Ne),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Ne),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Ne),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Ne),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Ne),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Ne),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Ne),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Ne),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Ne),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Ne),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Ne),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Ne),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Ne),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 zy(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(d=>this._activeBuffer=d.activeBuffer)),this._parser.setCsiHandlerFallback((d,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(d),params:g.toArray()})}),this._parser.setEscHandlerFallback(d=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(d)})}),this._parser.setExecuteHandlerFallback(d=>{this._logService.debug("Unknown EXECUTE code: ",{code:d})}),this._parser.setOscHandlerFallback((d,g,p)=>{this._logService.debug("Unknown OSC code: ",{identifier:d,action:g,data:p})}),this._parser.setDcsHandlerFallback((d,g,p)=>{g==="HOOK"&&(p=p.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(d),action:g,payload:p})}),this._parser.setPrintHandler((d,g,p)=>this.print(d,g,p)),this._parser.registerCsiHandler({final:"@"},d=>this.insertChars(d)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},d=>this.scrollLeft(d)),this._parser.registerCsiHandler({final:"A"},d=>this.cursorUp(d)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},d=>this.scrollRight(d)),this._parser.registerCsiHandler({final:"B"},d=>this.cursorDown(d)),this._parser.registerCsiHandler({final:"C"},d=>this.cursorForward(d)),this._parser.registerCsiHandler({final:"D"},d=>this.cursorBackward(d)),this._parser.registerCsiHandler({final:"E"},d=>this.cursorNextLine(d)),this._parser.registerCsiHandler({final:"F"},d=>this.cursorPrecedingLine(d)),this._parser.registerCsiHandler({final:"G"},d=>this.cursorCharAbsolute(d)),this._parser.registerCsiHandler({final:"H"},d=>this.cursorPosition(d)),this._parser.registerCsiHandler({final:"I"},d=>this.cursorForwardTab(d)),this._parser.registerCsiHandler({final:"J"},d=>this.eraseInDisplay(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},d=>this.eraseInDisplay(d,!0)),this._parser.registerCsiHandler({final:"K"},d=>this.eraseInLine(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},d=>this.eraseInLine(d,!0)),this._parser.registerCsiHandler({final:"L"},d=>this.insertLines(d)),this._parser.registerCsiHandler({final:"M"},d=>this.deleteLines(d)),this._parser.registerCsiHandler({final:"P"},d=>this.deleteChars(d)),this._parser.registerCsiHandler({final:"S"},d=>this.scrollUp(d)),this._parser.registerCsiHandler({final:"T"},d=>this.scrollDown(d)),this._parser.registerCsiHandler({final:"X"},d=>this.eraseChars(d)),this._parser.registerCsiHandler({final:"Z"},d=>this.cursorBackwardTab(d)),this._parser.registerCsiHandler({final:"`"},d=>this.charPosAbsolute(d)),this._parser.registerCsiHandler({final:"a"},d=>this.hPositionRelative(d)),this._parser.registerCsiHandler({final:"b"},d=>this.repeatPrecedingCharacter(d)),this._parser.registerCsiHandler({final:"c"},d=>this.sendDeviceAttributesPrimary(d)),this._parser.registerCsiHandler({prefix:">",final:"c"},d=>this.sendDeviceAttributesSecondary(d)),this._parser.registerCsiHandler({final:"d"},d=>this.linePosAbsolute(d)),this._parser.registerCsiHandler({final:"e"},d=>this.vPositionRelative(d)),this._parser.registerCsiHandler({final:"f"},d=>this.hVPosition(d)),this._parser.registerCsiHandler({final:"g"},d=>this.tabClear(d)),this._parser.registerCsiHandler({final:"h"},d=>this.setMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"h"},d=>this.setModePrivate(d)),this._parser.registerCsiHandler({final:"l"},d=>this.resetMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"l"},d=>this.resetModePrivate(d)),this._parser.registerCsiHandler({final:"m"},d=>this.charAttributes(d)),this._parser.registerCsiHandler({final:"n"},d=>this.deviceStatus(d)),this._parser.registerCsiHandler({prefix:"?",final:"n"},d=>this.deviceStatusPrivate(d)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},d=>this.softReset(d)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},d=>this.setCursorStyle(d)),this._parser.registerCsiHandler({final:"r"},d=>this.setScrollRegion(d)),this._parser.registerCsiHandler({final:"s"},d=>this.saveCursor(d)),this._parser.registerCsiHandler({final:"t"},d=>this.windowOptions(d)),this._parser.registerCsiHandler({final:"u"},d=>this.restoreCursor(d)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},d=>this.insertColumns(d)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},d=>this.deleteColumns(d)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},d=>this.selectProtected(d)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},d=>this.requestMode(d,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},d=>this.requestMode(d,!1)),this._parser.setExecuteHandler(_e.BEL,()=>this.bell()),this._parser.setExecuteHandler(_e.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(_e.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(_e.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(_e.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(_e.BS,()=>this.backspace()),this._parser.setExecuteHandler(_e.HT,()=>this.tab()),this._parser.setExecuteHandler(_e.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(_e.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(am.IND,()=>this.index()),this._parser.setExecuteHandler(am.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(am.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ei(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new ei(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new ei(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new ei(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new ei(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new ei(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new ei(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new ei(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new ei(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new ei(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new ei(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new ei(d=>this.restoreCursorColor(d))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let d in qn)this._parser.registerEscHandler({intermediates:"(",final:d},()=>this.selectCharset("("+d)),this._parser.registerEscHandler({intermediates:")",final:d},()=>this.selectCharset(")"+d)),this._parser.registerEscHandler({intermediates:"*",final:d},()=>this.selectCharset("*"+d)),this._parser.registerEscHandler({intermediates:"+",final:d},()=>this.selectCharset("+"+d)),this._parser.registerEscHandler({intermediates:"-",final:d},()=>this.selectCharset("-"+d)),this._parser.registerEscHandler({intermediates:".",final:d},()=>this.selectCharset("."+d)),this._parser.registerEscHandler({intermediates:"/",final:d},()=>this.selectCharset("/"+d));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(d=>(this._logService.error("Parsing error: ",d),d)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new RE((d,g)=>this.requestStatusString(d,g)))}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((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),AE))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${AE} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,s=this._activeBuffer.y,a=0,l=this._parseStack.paused;if(l){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Io&&(a=this._parseStack.position+Io)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,d=>String.fromCharCode(d)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(d=>d.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Io&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Io))),l||this._dirtyRowTracker.clearRange(),e.length>Io)for(let d=a;d<e.length;d+=Io){let g=d+Io<e.length?d+Io:e.length,p=typeof e=="string"?this._stringDecoder.decode(e.substring(d,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(d,g),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,p))return this._preserveStack(r,s,p,d),this._logSlowResolvingAsync(n),n}else if(!l){let d=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,d))return this._preserveStack(r,s,d,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let u=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(u,this._bufferService.rows-1)})}print(e,t,n){let r,s,a=this._charsetService.charset,l=this._optionsService.rawOptions.screenReaderMode,u=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,g=this._curAttrData,p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&p.getWidth(this._activeBuffer.x-1)===2&&p.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let v=this._parser.precedingJoinState;for(let y=t;y<n;++y){if(r=e[y],r<127&&a){let k=a[String.fromCharCode(r)];k&&(r=k.charCodeAt(0))}let w=this._unicodeService.charProperties(r,v);s=Ia.extractWidth(w);let S=Ia.extractShouldJoin(w),C=S?Ia.extractWidth(v):0;if(v=w,l&&this._onA11yChar.fire(Wo(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-C>u){if(h){let k=p,R=this._activeBuffer.x-C;for(this._activeBuffer.x=C,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),C>0&&p instanceof $u&&p.copyCellsFrom(k,R,0,C,!1);R<u;)k.setCellFromCodepoint(R++,0,1,g)}else if(this._activeBuffer.x=u-1,s===2)continue}if(S&&this._activeBuffer.x){let k=p.getWidth(this._activeBuffer.x-1)?1:2;p.addCodepointToCell(this._activeBuffer.x-k,r,s);for(let R=s-C;--R>=0;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(d&&(p.insertCells(this._activeBuffer.x,s-C,this._activeBuffer.getNullCell(g)),p.getWidth(u-1)===2&&p.setCellFromCodepoint(u-1,0,1,g)),p.setCellFromCodepoint(this._activeBuffer.x++,r,s,g),s>0)for(;--s;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=v,this._activeBuffer.x<u&&n-t>0&&p.getWidth(this._activeBuffer.x)===0&&!p.hasContent(this._activeBuffer.x)&&p.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>ME(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new RE(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ei(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(){var e;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&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.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,s=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),s),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){var r;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--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.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 s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,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,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(s-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(zn));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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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=Ia.extractWidth(t),s=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),l=new Uint32Array(a.length*n),u=0;for(let d=0;d<a.length;){let g=a.codePointAt(d)||0;l[u++]=g,d+=g>65535?2:1}let h=u;for(let d=1;d<n;++d)l.copyWithin(h,0,u),h+=u;return this.print(l,0,h),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(_e.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(_e.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(_e.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(_e.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(_e.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,Da),this._charsetService.setgCharset(1,Da),this._charsetService.setgCharset(2,Da),this._charsetService.setgCharset(3,Da);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){(S=>(S[S.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",S[S.SET=1]="SET",S[S.RESET=2]="RESET",S[S.PERMANENTLY_SET=3]="PERMANENTLY_SET",S[S.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:a}=this._coreMouseService,l=this._coreService,{buffers:u,cols:h}=this._bufferService,{active:d,alt:g}=u,p=this._optionsService.rawOptions,v=(S,C)=>(l.triggerDataEvent(`${_e.ESC}[${t?"":"?"}${S};${C}$y`),!0),y=S=>S?1:2,w=e.params[0];return t?w===2?v(w,4):w===4?v(w,y(l.modes.insertMode)):w===12?v(w,3):w===20?v(w,y(p.convertEol)):v(w,0):w===1?v(w,y(r.applicationCursorKeys)):w===3?v(w,p.windowOptions.setWinLines?h===80?2:h===132?1:0:0):w===6?v(w,y(r.origin)):w===7?v(w,y(r.wraparound)):w===8?v(w,3):w===9?v(w,y(s==="X10")):w===12?v(w,y(p.cursorBlink)):w===25?v(w,y(!l.isCursorHidden)):w===45?v(w,y(r.reverseWraparound)):w===66?v(w,y(r.applicationKeypad)):w===67?v(w,4):w===1e3?v(w,y(s==="VT200")):w===1002?v(w,y(s==="DRAG")):w===1003?v(w,y(s==="ANY")):w===1004?v(w,y(r.sendFocus)):w===1005?v(w,4):w===1006?v(w,y(a==="SGR")):w===1015?v(w,4):w===1016?v(w,y(a==="SGR_PIXELS")):w===1048?v(w,1):w===47||w===1047||w===1049?v(w,y(d===g)):w===2004?v(w,y(r.bracketedPasteMode)):w===2026?v(w,y(r.synchronizedOutput)):v(w,0)}_updateAttrColor(e,t,n,r,s){return t===2?(e|=50331648,e&=-16777216,e|=zd.fromColorRGB([n,r,s])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],s=0,a=0;do{if(r[a+s]=e.params[t+a],e.hasSubParams(t+a)){let l=e.getSubParams(t+a),u=0;do r[1]===5&&(s=1),r[a+u+1+s]=l[u];while(++u<l.length&&u+a+1+s<r.length);break}if(r[1]===5&&a+s>=2||r[1]===2&&a+s>=5)break;r[1]&&(s=1)}while(++a+t<e.length&&a+s<r.length);for(let l=2;l<r.length;++l)r[l]===-1&&(r[l]=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=zn.fg,e.bg=zn.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 s=0;s<t;s++)n=e.params[s],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|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[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|=zn.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=zn.bg&16777215):n===38||n===48||n===58?s+=this._extractColor(e,s,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|=zn.fg&16777215,r.bg&=-67108864,r.bg|=zn.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${_e.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${_e.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${_e.ESC}[?${t};${n}R`);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=zn.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 n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}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(!ME(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(`${_e.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>NE&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>NE&&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 r=n.shift(),s=n.shift();if(/^\d+$/.exec(r)){let a=parseInt(r);if(jE(a))if(s==="?")t.push({type:0,index:a});else{let l=TE(s);l&&t.push({type:1,index:a,color:l})}}}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()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,s=n.findIndex(a=>a.startsWith("id="));return s!==-1&&(r=n[s].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 r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let s=TE(n[r]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}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 r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let s=parseInt(n[r]);jE(s)&&t.push({type:2,index:s})}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,Da),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(tG[e[0]],qn[e[1]]||Da),!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=zn.clone(),this._eraseAttrDataInternal=zn.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 Ni;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let 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=l=>(this._coreService.triggerDataEvent(`${_e.ESC}${l}${_e.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"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}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},zy=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&&(DE=e,e=t,t=DE),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};zy=Sn([Pe(0,Mr)],zy);function jE(e){return 0<=e&&e<256}var rG=5e7,OE=12,iG=50,sG=class extends wt{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 Ne),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 r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>rG)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],s=this._action(r,t);if(s){let l=u=>performance.now()-n>=OE?setTimeout(()=>this._innerWrite(0,u)):this._innerWrite(n,u);s.catch(u=>(queueMicrotask(()=>{throw u}),Promise.resolve(!1))).then(l);return}let a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=OE)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>iG&&(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()}},Py=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 u=t.addMarker(t.ybase+t.y),h={data:e,id:this._nextId++,lines:[u]};return u.onDispose(()=>this._removeMarkerFromLink(h,u)),this._dataByLinkId.set(h.id,h),h.id}let n=e,r=this._getEntryIdKey(n),s=this._entriesWithId.get(r);if(s)return this.addLineToLink(s.id,t.ybase+t.y),s.id;let a=t.addMarker(t.ybase+t.y),l={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(l,a)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.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)))}};Py=Sn([Pe(0,Mr)],Py);var LE=!1,oG=class extends wt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new fc),this._onBinary=this._register(new Ne),this.onBinary=this._onBinary.event,this._onData=this._register(new Ne),this.onData=this._onData.event,this._onLineFeed=this._register(new Ne),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Ne),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Ne),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Ne),this._instantiationService=new MK,this.optionsService=this._register(new HK(e)),this._instantiationService.setService(Ar,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Dy)),this._instantiationService.setService(Mr,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Ay)),this._instantiationService.setService(aD,this._logService),this.coreService=this._register(this._instantiationService.createInstance(jy)),this._instantiationService.setService(rl,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Oy)),this._instantiationService.setService(oD,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ia)),this._instantiationService.setService(EV,this.unicodeService),this._charsetService=this._instantiationService.createInstance(VK),this._instantiationService.setService(kV,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Py),this._instantiationService.setService(lD,this._oscLinkService),this._inputHandler=this._register(new nG(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(fr.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(fr.forward(this._bufferService.onResize,this._onResize)),this._register(fr.forward(this.coreService.onData,this._onData)),this._register(fr.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 sG((t,n)=>this._inputHandler.parse(t,n))),this._register(fr.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Ne),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.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&&!LE&&(this._logService.warn("writeSync is unreliable and will be removed soon."),LE=!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,HD),t=Math.max(t,FD),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(EE.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(EE(this._bufferService),!1))),this._windowsWrappingHeuristics.value=fn(()=>{for(let t of e)t.dispose()})}}},aG={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 lG(e,t,n,r){var l;let s={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?s.key=_e.ESC+"OA":s.key=_e.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=_e.ESC+"OD":s.key=_e.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=_e.ESC+"OC":s.key=_e.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=_e.ESC+"OB":s.key=_e.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":_e.DEL,e.altKey&&(s.key=_e.ESC+s.key);break;case 9:if(e.shiftKey){s.key=_e.ESC+"[Z";break}s.key=_e.HT,s.cancel=!0;break;case 13:s.key=e.altKey?_e.ESC+_e.CR:_e.CR,s.cancel=!0;break;case 27:s.key=_e.ESC,e.altKey&&(s.key=_e.ESC+_e.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;a?s.key=_e.ESC+"[1;"+(a+1)+"D":t?s.key=_e.ESC+"OD":s.key=_e.ESC+"[D";break;case 39:if(e.metaKey)break;a?s.key=_e.ESC+"[1;"+(a+1)+"C":t?s.key=_e.ESC+"OC":s.key=_e.ESC+"[C";break;case 38:if(e.metaKey)break;a?s.key=_e.ESC+"[1;"+(a+1)+"A":t?s.key=_e.ESC+"OA":s.key=_e.ESC+"[A";break;case 40:if(e.metaKey)break;a?s.key=_e.ESC+"[1;"+(a+1)+"B":t?s.key=_e.ESC+"OB":s.key=_e.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=_e.ESC+"[2~");break;case 46:a?s.key=_e.ESC+"[3;"+(a+1)+"~":s.key=_e.ESC+"[3~";break;case 36:a?s.key=_e.ESC+"[1;"+(a+1)+"H":t?s.key=_e.ESC+"OH":s.key=_e.ESC+"[H";break;case 35:a?s.key=_e.ESC+"[1;"+(a+1)+"F":t?s.key=_e.ESC+"OF":s.key=_e.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=_e.ESC+"[5;"+(a+1)+"~":s.key=_e.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=_e.ESC+"[6;"+(a+1)+"~":s.key=_e.ESC+"[6~";break;case 112:a?s.key=_e.ESC+"[1;"+(a+1)+"P":s.key=_e.ESC+"OP";break;case 113:a?s.key=_e.ESC+"[1;"+(a+1)+"Q":s.key=_e.ESC+"OQ";break;case 114:a?s.key=_e.ESC+"[1;"+(a+1)+"R":s.key=_e.ESC+"OR";break;case 115:a?s.key=_e.ESC+"[1;"+(a+1)+"S":s.key=_e.ESC+"OS";break;case 116:a?s.key=_e.ESC+"[15;"+(a+1)+"~":s.key=_e.ESC+"[15~";break;case 117:a?s.key=_e.ESC+"[17;"+(a+1)+"~":s.key=_e.ESC+"[17~";break;case 118:a?s.key=_e.ESC+"[18;"+(a+1)+"~":s.key=_e.ESC+"[18~";break;case 119:a?s.key=_e.ESC+"[19;"+(a+1)+"~":s.key=_e.ESC+"[19~";break;case 120:a?s.key=_e.ESC+"[20;"+(a+1)+"~":s.key=_e.ESC+"[20~";break;case 121:a?s.key=_e.ESC+"[21;"+(a+1)+"~":s.key=_e.ESC+"[21~";break;case 122:a?s.key=_e.ESC+"[23;"+(a+1)+"~":s.key=_e.ESC+"[23~";break;case 123:a?s.key=_e.ESC+"[24;"+(a+1)+"~":s.key=_e.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=_e.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=_e.DEL:e.keyCode===219?s.key=_e.ESC:e.keyCode===220?s.key=_e.FS:e.keyCode===221&&(s.key=_e.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let u=(l=aG[e.keyCode])==null?void 0:l[e.shiftKey?1:0];if(u)s.key=_e.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,d=String.fromCharCode(h);e.shiftKey&&(d=d.toUpperCase()),s.key=_e.ESC+d}else if(e.keyCode===32)s.key=_e.ESC+(e.ctrlKey?_e.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),s.key=_e.ESC+h,s.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=_e.US),e.key==="@"&&(s.key=_e.NUL));break}return s}var Rn=0,cG=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Im,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Im,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((s,a)=>this._getKey(s)-this._getKey(a)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<r.length;s++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[s]=e[t],t++):r[s]=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||(Rn=this._search(t),Rn===-1)||this._getKey(this._array[Rn])!==t)return!1;do if(this._array[Rn]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Rn),!0;while(++Rn<this._array.length&&this._getKey(this._array[Rn])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,a)=>s-a),t=0,n=new Array(this._array.length-e.length),r=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:n[r++]=this._array[s];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&&(Rn=this._search(e),!(Rn<0||Rn>=this._array.length)&&this._getKey(this._array[Rn])===e))do yield this._array[Rn];while(++Rn<this._array.length&&this._getKey(this._array[Rn])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Rn=this._search(e),!(Rn<0||Rn>=this._array.length)&&this._getKey(this._array[Rn])===e))do t(this._array[Rn]);while(++Rn<this._array.length&&this._getKey(this._array[Rn])===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,s=this._getKey(this._array[r]);if(s>e)n=r-1;else if(s<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},U_=0,zE=0,uG=class extends wt{constructor(){super(),this._decorations=new cG(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new Ne),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Ne),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(fn(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new dG(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.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,s=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,s=r+(a.options.width??1),e>=r&&e<s&&(!n||(a.options.layer??"bottom")===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,s=>{U_=s.options.x??0,zE=U_+(s.options.width??1),e>=U_&&e<zE&&(!n||(s.options.layer??"bottom")===n)&&r(s)})}},dG=class extends Yo{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Ne),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Ne),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=pn.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=pn.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},hG=1e3,fG=class{constructor(e,t=hG){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?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=r-this._lastRefreshMs,a=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},a)}}_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)}},PE=20,Hm=class extends wt{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 s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let a=0;a<this._terminal.rows;a++)this._rowElements[a]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[a]);if(this._topBoundaryFocusListener=a=>this._handleBoundaryFocus(a,0),this._bottomBoundaryFocusListener=a=>this._handleBoundaryFocus(a,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=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new fG(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(a=>this._handleResize(a.rows))),this._register(this._terminal.onRender(a=>this._refreshRows(a.start,a.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(a=>this._handleChar(a))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
515
- `))),this._register(this._terminal.onA11yTab(a=>this._handleTab(a))),this._register(this._terminal.onKey(a=>this._handleKey(a.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(it(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(fn(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<PE+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
516
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===PE+1&&(this._liveRegion.textContent+=ry.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let s=e;s<=t;s++){let a=n.lines.get(n.ydisp+s),l=[],u=(a==null?void 0:a.translateToString(!0,void 0,void 0,l))||"",h=(n.ydisp+s+1).toString(),d=this._rowElements[s];d&&(u.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=u,this._rowColumns.set(d,l)),d.setAttribute("aria-posinset",h),d.setAttribute("aria-setsize",r),this._alignRowWidth(d))}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],s=n.getAttribute("aria-posinset"),a=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===a||e.relatedTarget!==r)return;let l,u;if(t===0?(l=n,u=this._rowElements.pop(),this._rowContainer.removeChild(u)):(l=this._rowElements.shift(),u=n,this._rowContainer.removeChild(l)),l.removeEventListener("focus",this._topBoundaryFocusListener),u.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}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(){var u;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:((u=r.textContent)==null?void 0:u.length)??0}),!this._rowContainer.contains(n.node))return;let s=({node:h,offset:d})=>{let g=h instanceof Text?h.parentNode:h,p=parseInt(g==null?void 0:g.getAttribute("aria-posinset"),10)-1;if(isNaN(p))return console.warn("row is invalid. Race condition?"),null;let v=this._rowColumns.get(g);if(!v)return console.warn("columns is null. Race condition?"),null;let y=d<v.length?v[d]:v.slice(-1)[0]+1;return y>=this._terminal.cols&&(++p,y=0),{row:p,column:y}},a=s(t),l=s(n);if(!(!a||!l)){if(a.row>l.row||a.row===l.row&&a.column>=l.column)throw new Error("invalid range");this._terminal.select(a.column,a.row,(l.row-a.row)*this._terminal.cols-a.column+l.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var s,a;e.style.transform="";let t=e.getBoundingClientRect().width,n=(a=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:a[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Hm=Sn([Pe(1,bx),Pe(2,io),Pe(3,so)],Hm);var By=class extends wt{constructor(e,t,n,r,s){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Ne),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Ne),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(fn(()=>{var a;Ya(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(a=this._activeProviderReplies)==null||a.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(it(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(it(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(it(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(it(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 r=0;r<n.length;r++){let s=n[r];if(s.classList.contains("xterm"))break;if(s.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){var r,s;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(a=>{a==null||a.forEach(l=>{l.link.dispose&&l.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[a,l]of this._linkProviderService.linkProviders.entries())t?(s=this._activeProviderReplies)!=null&&s.get(a)&&(n=this._checkLinkProviderResult(a,e,n)):l.provideLinks(e.y,u=>{var d,g;if(this._isMouseOut)return;let h=u==null?void 0:u.map(p=>({link:p}));(d=this._activeProviderReplies)==null||d.set(a,h),n=this._checkLinkProviderResult(a,e,n),((g=this._activeProviderReplies)==null?void 0:g.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 s=t.get(r);if(s)for(let a=0;a<s.length;a++){let l=s[a],u=l.link.range.start.y<e?0:l.link.range.start.x,h=l.link.range.end.y>e?this._bufferService.cols:l.link.range.end.x;for(let d=u;d<=h;d++){if(n.has(d)){s.splice(a--,1);break}n.add(d)}}}}_checkLinkProviderResult(e,t,n){var a;if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),s=!1;for(let l=0;l<e;l++)(!this._activeProviderReplies.has(l)||this._activeProviderReplies.get(l))&&(s=!0);if(!s&&r){let l=r.find(u=>this._linkAtPosition(u.link,t));l&&(n=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let l=0;l<this._activeProviderReplies.size;l++){let u=(a=this._activeProviderReplies.get(l))==null?void 0:a.find(h=>this._linkAtPosition(h.link,t));if(u){n=!0,this._handleNewLink(u);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&&mG(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,Ya(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,s,a;(r=this._currentLink)!=null&&r.state&&((a=(s=this._currentLink)==null?void 0:s.state)==null?void 0:a.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(r,s),this._lastMouseEvent)){let a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._askForLink(a,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.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,s=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(s)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.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,s=t.y*this._bufferService.cols+t.x;return n<=s&&s<=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,s){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:s}}};By=Sn([Pe(1,yx),Pe(2,so),Pe(3,Mr),Pe(4,uD)],By);function mG(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 pG=class extends oG{constructor(e={}){super(e),this._linkifier=this._register(new fc),this.browser=ND,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new fc),this._onCursorMove=this._register(new Ne),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Ne),this.onKey=this._onKey.event,this._onRender=this._register(new Ne),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Ne),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Ne),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Ne),this.onBell=this._onBell.event,this._onFocus=this._register(new Ne),this._onBlur=this._register(new Ne),this._onA11yCharEmitter=this._register(new Ne),this._onA11yTabEmitter=this._register(new Ne),this._onWillOpen=this._register(new Ne),this._setup(),this._decorationService=this._instantiationService.createInstance(uG),this._instantiationService.setService(Pd,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(iK),this._instantiationService.setService(uD,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(sy)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(fr.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(fr.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(fr.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(fr.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(fn(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.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 n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let s=un.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${_e.ESC}]${r};${eG(s)}${RD.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(a=>a.ansi[t.index]=Bn.toColor(...t.color));else{let a=n;this._themeService.modifyColors(l=>l[a]=Bn.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(Hm,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(_e.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(_e.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,s=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*s,l=this.buffer.y*this._renderService.dimensions.css.cell.height,u=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=u+"px",this.textarea.style.top=l+"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(it(this.element,"copy",t=>{this.hasSelection()&&bV(t,this._selectionService)}));let e=t=>yV(t,this.textarea,this.coreService,this.optionsService);this._register(it(this.textarea,"paste",e)),this._register(it(this.element,"paste",e)),MD?this._register(it(this.element,"mousedown",t=>{t.button===2&&K2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(it(this.element,"contextmenu",t=>{K2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Tx&&this._register(it(this.element,"auxclick",t=>{t.button===1&&tD(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(it(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(it(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(it(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(it(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(it(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(it(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(it(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((s=this.element)==null?void 0:s.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(it(this.screenElement,"mousemove",a=>this.updateCursorStyle(a))),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",ny.get()),jD||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(nK,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(io,this._coreBrowserService),this._register(it(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(it(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Ey,this._document,this._helperContainer),this._instantiationService.setService(Op,this._charSizeService),this._themeService=this._instantiationService.createInstance(My),this._instantiationService.setService(Rc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Pm),this._instantiationService.setService(cD,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Ty,this.rows,this.screenElement)),this._instantiationService.setService(so,this._renderService),this._register(this._renderService.onRenderedViewportChange(a=>this._onRender.fire(a))),this.onResize(a=>this._renderService.resize(a.cols,a.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Sy,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Ry),this._instantiationService.setService(yx,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(By,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(xy,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(a=>{super.scrollLines(a,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Ny,this.element,this.screenElement,r)),this._instantiationService.setService(TV,this._selectionService),this._register(this._selectionService.onRequestScrollLines(a=>this.scrollLines(a.amount,a.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(a=>this._renderService.handleSelectionChanged(a.start,a.end,a.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(a=>{this.textarea.value=a,this.textarea.focus(),this.textarea.select()})),this._register(fr.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var a;this._selectionService.refresh(),(a=this._viewport)==null||a.queueSync()})),this._register(this._instantiationService.createInstance(wy,this.screenElement)),this._register(it(this.element,"mousedown",a=>this._selectionService.handleMouseDown(a))),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(Hm,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(zm,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(zm,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(ky,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(a){var d,g,p,v,y;let l=e._mouseService.getMouseReportCoords(a,e.screenElement);if(!l)return!1;let u,h;switch(a.overrideType||a.type){case"mousemove":h=32,a.buttons===void 0?(u=3,a.button!==void 0&&(u=a.button<3?a.button:3)):u=a.buttons&1?0:a.buttons&4?1:a.buttons&2?2:3;break;case"mouseup":h=0,u=a.button<3?a.button:3;break;case"mousedown":h=1,u=a.button<3?a.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(a)===!1)return!1;let w=a.deltaY;if(w===0||e.coreMouseService.consumeWheelEvent(a,(v=(p=(g=(d=e._renderService)==null?void 0:d.dimensions)==null?void 0:g.device)==null?void 0:p.cell)==null?void 0:v.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;h=w<0?0:1,u=4;break;default:return!1}return h===void 0||u===void 0||u>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:u,action:h,ctrl:a.ctrlKey,alt:a.altKey,shift:a.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:a=>(n(a),a.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(a)),wheel:a=>(n(a),this.cancel(a,!0)),mousedrag:a=>{a.buttons&&n(a)},mousemove:a=>{a.buttons||n(a)}};this._register(this.coreMouseService.onProtocolChange(a=>{a?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(a)),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()),a&8?r.mousemove||(t.addEventListener("mousemove",s.mousemove),r.mousemove=s.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),a&16?r.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),r.wheel=s.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),a&2?r.mouseup||(r.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),a&4?r.mousedrag||(r.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(it(t,"mousedown",a=>{if(a.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(a)))return n(a),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(a)})),this._register(it(t,"wheel",a=>{var l,u,h,d,g;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(a)===!1)return!1;if(!this.buffer.hasScrollback){if(a.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(a,(d=(h=(u=(l=e._renderService)==null?void 0:l.dimensions)==null?void 0:u.device)==null?void 0:h.cell)==null?void 0:d.height,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return this.cancel(a,!0);let p=_e.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(a.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(p,!0),this.cancel(a,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.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){eD(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,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(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.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=lG(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),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===_e.ETX||n.key===_e.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)&&(gG(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){var n;(n=this._charSizeService)==null||n.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(zn));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(_e.ESC+"[I"):this.coreService.triggerDataEvent(_e.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${_e.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${_e.ESC}[6;${s};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function gG(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var vG=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 new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},_G=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 Ni)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},BE=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 _G(t)}getNullCell(){return new Ni}},bG=class extends wt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Ne),this.onBufferChange=this._onBufferChange.event,this._normal=new BE(this._core.buffers.normal,"normal"),this._alternate=new BE(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},yG=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.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)}},xG=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}},wG=["cols","rows"],rs=0,SG=class extends wt{constructor(e){super(),this._core=this._register(new pG(e)),this._addonManager=this._register(new vG),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,s)=>{this._checkReadonlyOptions(r),this._core.options[r]=s};for(let r in this._core.options){let s={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,s)}}_checkReadonlyOptions(e){if(wG.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new yG(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new xG(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new bG(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
517
- `,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 ny.get()},set promptLabel(e){ny.set(e)},get tooMuchOutput(){return ry.get()},set tooMuchOutput(e){ry.set(e)}}}_verifyIntegers(...e){for(rs of e)if(rs===1/0||isNaN(rs)||rs%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(rs of e)if(rs&&(rs===1/0||isNaN(rs)||rs%1!==0||rs<0))throw new Error("This API only accepts positive integers")}};const IE="lever-theme",$_="20260330",CG={light:`/manifest.webmanifest?v=${$_}`,dark:`/manifest-dark.webmanifest?v=${$_}`,custom:`/manifest-dark.webmanifest?v=${$_}`},$D=_.createContext(void 0),kG=e=>e==="light"||e==="dark"||e==="system"||e==="custom",La=()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",HE=(e,t)=>{if(typeof document>"u")return;let n;e==="custom"?n=t==="system"||!t?La():t:n=e==="system"?La():e,document.documentElement.classList.toggle("dark",n==="dark")},FE=e=>{if(typeof document>"u")return;document.documentElement.style.colorScheme=e;const t=document.querySelector('meta[name="theme-color"]');if(t){const s=getComputedStyle(document.body).backgroundColor;s&&s!=="rgba(0, 0, 0, 0)"&&s!=="transparent"&&t.setAttribute("content",s)}const n=document.querySelector('link[rel="manifest"]#app-manifest'),r=CG[e];n&&n.getAttribute("href")!==r&&n.setAttribute("href",r)};function EG({children:e}){const t=gn(g=>g.themePreference),n=gn(g=>g.setThemePreference),r=gn(g=>g.colorTheme),s=gn(g=>g.customAppearance),a=gn(g=>g.backgroundImage),l=gn(g=>g.backgroundOpacity),u=gn(g=>g.backgroundBlur);_.useEffect(()=>{if(typeof window>"u")return;const g=window.localStorage.getItem(IE);kG(g)&&(gn.getState().themePreference==="system"&&g!=="system"&&n(g),window.localStorage.removeItem(IE))},[]),_.useEffect(()=>{HE(t,s);const g=t==="custom"?s==="system"?La():s:t==="system"?La():t;FE(g)},[t,s]),_.useEffect(()=>{if(t!=="system"&&(t!=="custom"||s!=="system"))return;const g=window.matchMedia("(prefers-color-scheme: dark)"),p=()=>{HE(t,s),FE(La())};return g.addEventListener?(g.addEventListener("change",p),()=>g.removeEventListener("change",p)):(g.addListener(p),()=>g.removeListener(p))},[t,s]),_.useEffect(()=>{typeof document>"u"||(t==="custom"?document.documentElement.setAttribute("data-theme",r):document.documentElement.removeAttribute("data-theme"))},[t,r]),_.useEffect(()=>{if(typeof document>"u")return;let g=document.getElementById("kaizen-custom-theme-styles");g||(g=document.createElement("style"),g.id="kaizen-custom-theme-styles",document.head.appendChild(g));const p=t==="custom"&&a&&a.trim()!=="",v=[];if(p){const y=u?u*2:0;v.push(`
518
- body {
519
- background-image: none !important;
520
- background-color: transparent !important;
521
- }
522
- body::before {
523
- content: "";
524
- position: fixed;
525
- top: -${y}px;
526
- left: -${y}px;
527
- right: -${y}px;
528
- bottom: -${y}px;
529
- background-image: url("${a}");
530
- background-size: cover;
531
- background-position: center;
532
- filter: blur(${u}px);
533
- z-index: -2;
534
- pointer-events: none;
535
- }
536
- body::after {
537
- content: "";
538
- position: fixed;
539
- inset: 0;
540
- background-color: hsl(var(--background) / ${l});
541
- z-index: -1;
542
- pointer-events: none;
543
- }
544
- #root {
545
- background-color: transparent !important;
546
- }
547
- :root {
548
- --color-background: transparent !important;
549
- --color-card: hsl(var(--card) / 0.15) !important;
550
- --color-popover: hsl(var(--popover) / 0.8) !important;
551
- --color-muted: hsl(var(--muted) / 0.25) !important;
552
- }
553
- .kaizen-terminal, .xterm-viewport, .xterm-screen {
554
- background-color: transparent !important;
555
- }
556
- `)}else v.push(`
557
- body {
558
- background-image: none !important;
559
- }
560
- body::before {
561
- display: none;
562
- }
563
- #root {
564
- background-color: transparent;
565
- }
566
- `);g.textContent=v.join(`
567
- `)},[t,a,l,u]);const h=g=>{n(g)},d=_.useMemo(()=>{const g=t==="custom"?s==="system"?La():s:t==="system"?La():t;return{theme:t,resolvedTheme:g,setTheme:h}},[t,s,n]);return f.jsx($D.Provider,{value:d,children:e})}function WD(){const e=_.useContext($D);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const RG={foreground:"#0f172a",background:"transparent",cursor:"#000000",cursorAccent:"#ffffff",selectionBackground:"rgba(221,228,236,0.55)",selectionInactiveBackground:"rgba(221,228,236,0.38)",black:"#0f172a",red:"#dc2626",green:"#16a34a",yellow:"#ca8a04",blue:"#2563eb",magenta:"#9333ea",cyan:"#0891b2",white:"#94a3b8",brightBlack:"#475569",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#eab308",brightBlue:"#3b82f6",brightMagenta:"#a855f7",brightCyan:"#06b6d4",brightWhite:"#e2e8f0"},TG={foreground:"#f8fafc",background:"transparent",cursor:"#ffffff",cursorAccent:"#000000",selectionBackground:"rgba(248,250,252,0.28)",selectionInactiveBackground:"rgba(248,250,252,0.18)",black:"#0f172a",red:"#f87171",green:"#4ade80",yellow:"#facc15",blue:"#60a5fa",magenta:"#c084fc",cyan:"#22d3ee",white:"#cbd5e1",brightBlack:"#64748b",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fde047",brightBlue:"#93c5fd",brightMagenta:"#d8b4fe",brightCyan:"#67e8f9",brightWhite:"#f8fafc"};function VD(e){return{cols:Math.max(1,e.cols||80),rows:Math.max(1,e.rows||24)}}function qD(e,t){var w,S,C,k,R;const n=e.element,r=(k=(C=(S=(w=e._core)==null?void 0:w._renderService)==null?void 0:S.dimensions)==null?void 0:C.css)==null?void 0:k.cell,s=(r==null?void 0:r.width)??0,a=(r==null?void 0:r.height)??0;if(!n||!Number.isFinite(s)||!Number.isFinite(a)||s<=0||a<=0)return null;const l=t.getBoundingClientRect(),u=window.getComputedStyle(t),h=window.getComputedStyle(n),d=e.options.scrollback===0?0:((R=e.options.overviewRuler)==null?void 0:R.width)??14,g=parseFloat(u.paddingLeft)+parseFloat(u.paddingRight)+parseFloat(h.paddingLeft)+parseFloat(h.paddingRight),p=parseFloat(u.paddingTop)+parseFloat(u.paddingBottom)+parseFloat(h.paddingTop)+parseFloat(h.paddingBottom),v=Math.max(0,l.width-g-d-1),y=Math.max(0,l.height-p);return{cols:Math.max(2,Math.floor(v/s)),rows:Math.max(1,Math.floor(y/a))}}function Of(e){e.refresh(0,Math.max(0,e.rows-1))}function Lf(e,t,n,r,s){const a=qD(e,t)??VD(e);return n.current&&n.current.cols===a.cols&&n.current.rows===a.rows||(e.resize(a.cols,a.rows),n.current=a,r&&s(a.cols,a.rows)),a}function NG({projectId:e,terminalId:t,socket:n,scrollback:r,connectionStatus:s,clearVersion:a=0,focusRequestVersion:l=0,onPathChange:u}){const{resolvedTheme:h}=WD(),d=_.useRef(null),g=_.useRef(null),p=_.useRef(null),v=_.useRef(!1),y=_.useRef(0),w=_.useRef(null),S=_.useRef(null),[C,k]=_.useState(null),[R,E]=_.useState(null),N=h==="dark"?TG:RG,j=(L,U)=>{n.command({type:"terminal.resize",terminalId:t,cols:L,rows:U}).catch(()=>{})},D=()=>{const L=()=>{const U=g.current,Y=d.current;!U||!Y||!v.current||Lf(U,Y,S,!0,j)};requestAnimationFrame(()=>{L(),setTimeout(L,0)})};return _.useEffect(()=>{const L=new SG({scrollback:r,cursorBlink:!0,cursorStyle:"bar",cursorWidth:1,lineHeight:1.1,convertEol:!1,allowTransparency:!0,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:13,theme:N}),U=new aV;L.loadAddon(U),L.loadAddon(new mV),g.current=L;const Y=d.current;Y&&(L.open(Y),p.current&&L.write(p.current),Lf(L,Y,S,!1,()=>{}),Of(L),D());const P=L.onData(W=>{n.command({type:"terminal.input",terminalId:t,data:W}).catch(K=>{E(K instanceof Error?K.message:String(K))})}),V=L.onResize(({cols:W,rows:K})=>{if(!v.current)return;const q={cols:W,rows:K};S.current&&S.current.cols===W&&S.current.rows===K||(S.current=q,j(W,K))}),I=new ResizeObserver(()=>{const W=g.current,K=d.current;!W||!K||Lf(W,K,S,v.current,(q,O)=>{n.command({type:"terminal.resize",terminalId:t,cols:q,rows:O}).catch(()=>{})})});return Y&&I.observe(Y),()=>{I.disconnect(),V.dispose(),P.dispose(),p.current=U.serialize(),L.dispose(),g.current=null}},[r,n,t,N]),_.useEffect(()=>{const L=g.current;L&&(L.options.scrollback=r)},[r]),_.useEffect(()=>{const L=g.current;L&&(L.options.theme=N,Of(L))},[N]),_.useEffect(()=>{if(l===0)return;const L=g.current;L&&requestAnimationFrame(()=>{L.focus()})},[l]),_.useEffect(()=>{if(a===0)return;const L=g.current;L&&(v.current=!1,y.current+=1,w.current=null,p.current=null,k(null),E(null),L.reset(),Of(L),n.command({type:"terminal.close",terminalId:t}).catch(U=>{E(U instanceof Error?U.message:String(U))}))},[a,n,t]),_.useEffect(()=>{u==null||u((C==null?void 0:C.cwd)??null)},[C==null?void 0:C.cwd,u]),_.useEffect(()=>{const L=P=>{const V=g.current;if(!V)return;const I=JSON.stringify({cwd:P.cwd,shell:P.shell,cols:P.cols,rows:P.rows,scrollback:P.scrollback,status:P.status,exitCode:P.exitCode,serializedState:P.serializedState});if(w.current===I){k({cwd:P.cwd,shell:P.shell,status:P.status,exitCode:P.exitCode}),p.current=P.serializedState||null;return}w.current=I,k({cwd:P.cwd,shell:P.shell,status:P.status,exitCode:P.exitCode}),p.current=P.serializedState||null,V.options.scrollback=P.scrollback,V.reset(),P.serializedState&&V.write(P.serializedState),Of(V)},U=()=>{const P=g.current,V=d.current;if(!P||!V)return;const I=qD(P,V)??VD(P);P.resize(I.cols,I.rows),S.current=I,n.command({type:"terminal.create",projectId:e,terminalId:t,cols:I.cols,rows:I.rows,scrollback:r}).then(W=>{v.current=!0,E(null),W&&L(W),D()}).catch(W=>{E(W instanceof Error?W.message:String(W))})},Y=()=>{const P=++y.current,V=()=>{if(y.current!==P)return;const I=g.current,W=d.current;if(!I||!W)return;Lf(I,W,S,!1,()=>{});const K=W.getBoundingClientRect();if(K.width<=0||K.height<=0){requestAnimationFrame(V);return}U()};requestAnimationFrame(()=>{requestAnimationFrame(V)})};return Y(),n.subscribeTerminal(t,{onSnapshot:P=>{if(!P){v.current=!1,w.current=null,s==="connected"&&Y();return}v.current=!0,E(null),L(P),D()},onEvent:P=>{const V=g.current;if(V){if(P.type==="terminal.output"){V.write(P.data);return}P.type==="terminal.exit"&&k(I=>({cwd:(I==null?void 0:I.cwd)??"",shell:(I==null?void 0:I.shell)??"",status:"exited",exitCode:P.exitCode}))}}})},[s,e,r,n,t]),f.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden pb-4",children:[f.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 overflow-hidden px-3 py-1",children:f.jsx("div",{ref:d,className:"kaizen-terminal min-h-0 min-w-0 flex-1 overflow-hidden w-full"})}),R?f.jsxs("div",{className:"px-3 py-1 text-xs text-destructive",children:["Terminal error: ",R]}):null]})}const MG=24;function KD(e){return e+MG}function AG(e,t){return Math.max(1,e)*KD(t)}function UE({projectId:e,layout:t,socket:n,connectionStatus:r,scrollback:s,minColumnWidth:a,focusRequestVersion:l=0,splitTerminalShortcut:u,onAddTerminal:h,onRemoveTerminal:d,onTerminalLayout:g}){const p=_.useRef(null),v=_.useRef({}),y=_.useRef([]),[w,S]=_.useState(0),[C,k]=_.useState({}),[R,E]=_.useState({});_.useLayoutEffect(()=>{const Y=p.current;if(!Y)return;const P=()=>{S(Y.getBoundingClientRect().width)},V=new ResizeObserver(P);return V.observe(Y),P(),()=>V.disconnect()},[]);const N=t.terminals.length,j=KD(a),D=AG(N,a),L=Math.max(w,D),U=_.useMemo(()=>t.terminals.map(Y=>Y.id).join(":"),[t.terminals]);return _.useLayoutEffect(()=>{const Y=y.current,P=t.terminals.map(W=>W.id),V=P.find(W=>!Y.includes(W));if(y.current=P,!V||Y.length===0)return;const I=v.current[V];I&&I.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[t.terminals]),f.jsx("div",{className:"flex h-full min-h-0 flex-col",children:f.jsx("div",{ref:p,className:"min-h-0 flex-1 overflow-x-auto overflow-y-hidden",children:f.jsx("div",{className:"h-full min-h-0",style:{width:L||"100%"},children:f.jsx(em,{orientation:"horizontal",className:"h-full min-h-0",onLayoutChanged:Y=>g(e,t.terminals.map(P=>Y[P.id]??P.size)),children:t.terminals.map((Y,P)=>f.jsxs(_.Fragment,{children:[f.jsx(Ma,{id:Y.id,defaultSize:`${Y.size}%`,minSize:`${j}px`,className:"min-h-0 overflow-hidden",style:{minWidth:j},children:f.jsxs("div",{ref:V=>{v.current[Y.id]=V},className:"flex h-full min-h-0 min-w-0 flex-col border-r border-border bg-transparent last:border-r-0",style:{minWidth:j},children:[f.jsxs("div",{className:"flex items-center gap-2 px-3 pr-2 pt-2 pb-1",children:[f.jsx("div",{className:"min-w-0 flex-1 text-left",children:f.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[f.jsx("div",{className:"shrink-0 text-sm font-medium",children:"Terminal"}),f.jsx("div",{className:"min-w-0 truncate text-xs text-muted-foreground",children:C[Y.id]??""})]})}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(tt,{variant:"ghost",size:"icon-sm",className:"md:hidden","aria-label":"Send Ctrl+C",onClick:()=>{n.command({type:"terminal.input",terminalId:Y.id,data:""}).catch(()=>{})},title:"Send Ctrl+C",children:f.jsx(GI,{className:"size-3.5"})}),f.jsx(tt,{variant:"ghost",size:"icon-sm","aria-label":"Clear terminal",onClick:()=>E(V=>({...V,[Y.id]:(V[Y.id]??0)+1})),children:f.jsx(X6,{className:"size-3.5"})}),f.jsxs(Lu,{children:[f.jsx(zu,{asChild:!0,children:f.jsx(tt,{variant:"ghost",size:"icon-sm","aria-label":"Add terminal to the right",onClick:()=>h(e,Y.id),children:f.jsx(_0,{className:"size-3.5"})})}),f.jsx(Zl,{side:"bottom",shortcut:u})]}),f.jsx(tt,{variant:"ghost",size:"icon-sm","aria-label":"Archive terminal",onClick:()=>d(e,Y.id),children:f.jsx(Xo,{className:"size-3.5"})})]})]}),f.jsx(NG,{projectId:e,terminalId:Y.id,socket:n,scrollback:s,connectionStatus:r,clearVersion:R[Y.id]??0,focusRequestVersion:P===0?l:0,onPathChange:V=>k(I=>I[Y.id]===V?I:{...I,[Y.id]:V})})]})}),P<t.terminals.length-1?f.jsx(tm,{withHandle:!0,orientation:"horizontal"}):null]},Y.id))},U)})})})}function $E(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function DG(e){var r;if(!e)return null;const t=e.trim();if(!t||/^(https?:|mailto:|ftp:|file:)/i.test(t)||!t.startsWith("/"))return null;const n=/^(?<path>\/.+?)#L(?<line>\d+)(?:C(?<column>\d+))?$/.exec(t);return(r=n==null?void 0:n.groups)!=null&&r.path?{path:n.groups.path,line:$E(n.groups.line),column:$E(n.groups.column)}:{path:t}}function W_(e,t){if(!e)return"";if(t){const n=t.endsWith("/")?t:`${t}/`;if(e.startsWith(n))return e.slice(n.length);if(e===t)return""}return e.replace(/^\/home\/user\/workspace\//,"")}const Nx=()=>{},GD=_.createContext(Nx);function jG({children:e,onOpenLocalLink:t}){return f.jsx(GD.Provider,{value:t??Nx,children:e})}const Iy={Task:mm,TaskOutput:mm,Bash:y0,Glob:f_,Grep:f_,ExitPlanMode:Nk,Read:nI,Edit:Q6,Write:eI,NotebookEdit:pm,WebFetch:m6,TodoWrite:R6,WebSearch:f_,KillShell:qI,AskUserQuestion:kN,Skill:Tn,EnterPlanMode:Nk},YD=ZI;function XD(e){return Iy[e]?Iy[e]:YD}function oo({children:e,className:t}){return f.jsx("div",{className:me("flex gap-3 justify-start items-center",t),children:e})}function OG({children:e,className:t}){return f.jsx("div",{className:me("flex items-center gap-1.5 text-xs",t),children:e})}function Js({children:e,className:t}){return f.jsx("span",{className:me("font-medium text-foreground/80",t),children:e})}function LG({children:e}){return f.jsx("span",{className:"text-muted-foreground",children:e})}function Hd({children:e,expandedContent:t,defaultExpanded:n=!1}){const[r,s]=_.useState(n);return f.jsxs("div",{className:"flex flex-col w-full",children:[f.jsxs("button",{onClick:()=>s(!r),className:`group/expandable-row cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${r?"":"hover:opacity-60 transition-opacity"}`,children:[f.jsx("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:e}),f.jsx(Tr,{className:`h-4.5 w-4.5 text-muted-icon translate-y-[0.5px] transition-all duration-200 opacity-0 group-hover/expandable-row:opacity-100 ${r?"rotate-90 opacity-100":""}`})]}),r&&t]})}function V_({label:e,children:t,copyText:n}){const[r,s]=_.useState(!1),a=n??Fm(t),l=_.useCallback(async()=>{await navigator.clipboard.writeText(a),s(!0),setTimeout(()=>s(!1),2e3)},[a]);return f.jsxs("div",{children:[f.jsx("span",{className:"font-medium text-muted-foreground",children:e}),f.jsxs("div",{className:"relative group/codeblock",children:[f.jsx("pre",{className:"my-1 text-xs font-mono whitespace-no-wrap break-all bg-muted border border-border rounded-lg p-2 max-h-64 overflow-auto w-full",children:t}),f.jsx(tt,{variant:"ghost",size:"icon",className:me("absolute top-[4px] right-[4px] z-10 h-6.5 w-6.5 rounded-sm text-muted-foreground opacity-0 group-hover/codeblock:opacity-100 transition-opacity",!r&&"hover:text-foreground",r&&"hover:!bg-transparent hover:!border-transparent"),onClick:l,children:r?f.jsx(Wi,{className:"h-3.5 w-3.5 text-green-400"}):f.jsx(Cd,{className:"h-4 w-4"})})]})]})}function ZD({children:e,icon:t,className:n}){return f.jsxs("span",{className:me("inline-flex items-center gap-1 px-2 py-1 bg-muted border border-border rounded-full",n),children:[t&&f.jsx(t,{className:"h-3 w-3 text-muted-foreground"}),e]})}function Fd({children:e,className:t}){return f.jsxs("div",{className:me("grid grid-cols-[auto_1fr] gap-2 min-w-0",t),children:[f.jsx("div",{className:" min-w-5 flex flex-col relative items-center justify-center",children:f.jsx("div",{className:"min-h-full w-[1px] bg-muted-foreground/20"})}),f.jsx("div",{className:"-ml-[1px] min-w-0 overflow-hidden",children:e})]})}function Fm(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(Array.isArray(e))return e.map(Fm).join("");if(e&&typeof e=="object"&&"props"in e){const t=e.props;return Fm(t.children)}return""}function WE(e,t){return _.isValidElement(e)?_.cloneElement(e,{className:me(e.props.className,t)}):e}const zG={h1:({children:e})=>f.jsx("h1",{className:"text-[20px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h2:({children:e})=>f.jsx("h2",{className:"text-[18px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h3:({children:e})=>f.jsx("h3",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h4:({children:e})=>f.jsx("h4",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h5:({children:e})=>f.jsx("h5",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h6:({children:e})=>f.jsx("h6",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),pre:({children:e,...t})=>{const[n,r]=_.useState(!1),s=Fm(e),a=async()=>{await navigator.clipboard.writeText(s),r(!0),setTimeout(()=>r(!1),2e3)};return f.jsxs("div",{className:"relative overflow-x-auto max-w-full min-w-0 no-code-highlight group/pre",children:[f.jsx("pre",{className:"min-w-0 rounded-xl py-2.5 px-3.5 [.no-pre-highlight_&]:bg-background",...t,children:e}),f.jsx(tt,{variant:"ghost",size:"icon",className:me("absolute top-[35px] -translate-y-[50%] -translate-x-[1px] rounded-md right-1.5 h-8 w-8 text-muted-foreground opacity-0 group-hover/pre:opacity-100 transition-opacity",!n&&"hover:text-foreground",n&&"hover:!bg-transparent hover:!border-transparent"),onClick:a,children:n?f.jsx(Wi,{className:"h-4 w-4 text-green-400"}):f.jsx(Cd,{className:"h-4 w-4"})})]})},code:({children:e,className:t,...n})=>t?f.jsx("code",{className:"block text-xs whitespace-pre",...n,children:e}):f.jsx("code",{className:"break-all px-1 bg-border/60 dark:[.no-pre-highlight_&]:bg-background dark:[.text-pretty_&]:bg-neutral [.no-code-highlight_&]:!bg-transparent py-0.5 rounded text-sm whitespace-wrap",...n,children:e}),table:({children:e,...t})=>f.jsx("div",{className:"border border-border rounded-xl overflow-x-auto",children:f.jsx("table",{className:"table-auto min-w-full divide-y divide-border bg-background",...t,children:e})}),tbody:({children:e,...t})=>f.jsx("tbody",{className:"divide-y divide-border",...t,children:e}),th:({children:e,...t})=>f.jsx("th",{className:"text-left text-xs uppercase text-muted-foreground tracking-wider p-2 pl-0 first:pl-3 bg-muted dark:bg-card [&_*]:font-semibold",...t,children:e}),td:({children:e,...t})=>f.jsx("td",{className:"text-left p-2 pl-0 first:pl-3 [&_*]:font-normal ",...t,children:e}),p:({children:e,...t})=>f.jsx("p",{className:"break-words mt-5 mb-3 first:mt-0 last:mb-0",...t,children:e}),blockquote:({children:e,...t})=>(()=>{const n=_.Children.toArray(e),r=n[0];r!==void 0&&(n[0]=WE(r,"mt-0"));const s=n.length-1,a=n[s];return a!==void 0&&(n[s]=WE(a,"mb-0")),f.jsx("blockquote",{className:"my-2 mt-5 mb-3 first:mt-0 last:mb-0 border-l-2 border-border/80 pl-2 text-muted-foreground",...t,children:n})})(),a:({children:e,...t})=>f.jsx("a",{className:"transition-all underline decoration-2 text-logo decoration-logo/50 hover:text-logo/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40 ",target:"_blank",rel:"noopener noreferrer",...t,children:e})};function Ud(e){return{...zG,a:({children:t,href:n,onClick:r,...s})=>{const a=_.useContext(GD),l=DG(n);return f.jsx("a",{className:"transition-all underline decoration-2 text-logo decoration-logo/50 hover:text-logo/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40 ",href:n,target:l?void 0:"_blank",rel:l?void 0:"noopener noreferrer",onClick:u=>{r==null||r(u),!(u.defaultPrevented||!l||a===Nx)&&(u.preventDefault(),a(l))},...s,children:t})}}}const PG={connecting:"Connecting...",acquiring_sandbox:"Booting...",initializing:"Initializing...",starting:"Starting...",running:"Running...",waiting_for_user:"Waiting...",failed:"Failed"};function BG({status:e}){const t=(e?PG[e]:void 0)||"Processing...",n=e==="failed";return f.jsx(oo,{className:"ml-[1px]",children:f.jsxs(OG,{children:[n?f.jsx(Xo,{className:"size-4.5 text-red-500"}):f.jsx(oi,{className:"size-4.5 animate-spin text-muted-icon"}),f.jsx(xp,{className:"ml-[1px] text-sm",shimmerWidth:44,children:t})]})})}const Mx=_.forwardRef(({className:e,children:t,...n},r)=>f.jsx("div",{ref:r,className:me("relative overflow-y-auto overscroll-contain touch-pan-y scrollbar-hide",e),style:{WebkitOverflowScrolling:"touch"},...n,children:t}));Mx.displayName="ScrollArea";function IG(e){return e==="localhost"||e==="127.0.0.1"||e==="::1"}const Pp=20,Hy=50,QD=30;function JD(e){return Number.isFinite(e)?Math.min(Hy,Math.max(Pp,e)):QD}function HG(){return{isVisible:!1,size:Pp}}function zf(e,t){return e[t]??HG()}function FG(e){return!e||typeof e!="object"?{projects:{}}:{projects:Object.fromEntries(Object.entries(e.projects??{}).map(([r,s])=>[r,{isVisible:!1,size:JD(s.size??QD)}]))}}const Ju=no()(ro(e=>({projects:{},toggleVisibility:t=>e(n=>({projects:{...n.projects,[t]:{...zf(n.projects,t),isVisible:!zf(n.projects,t).isVisible}}})),setVisibility:(t,n)=>e(r=>({projects:{...r.projects,[t]:{...zf(r.projects,t),isVisible:n}}})),setSize:(t,n)=>e(r=>({projects:{...r.projects,[t]:{...zf(r.projects,t),size:JD(n)}}})),clearProject:t=>e(n=>{const{[t]:r,...s}=n.projects;return{projects:s}})}),{name:"right-sidebar-layouts",version:2,migrate:FG})),UG={isVisible:!1,size:Pp},Ax=[68,32];function $G(){return{isVisible:!1,mainSizes:[...Ax],terminals:[],nextTerminalIndex:0}}function WG(e,t){return e[t]??$G()}function q_(e){if(e.length===0)return[];const t=e.reduce((n,r)=>n+Math.max(r,0),0);return!Number.isFinite(t)||t<=0?Array.from({length:e.length},()=>100/e.length):e.map(n=>Math.max(n,0)/t*100)}function VG(e){let t=e,n="";do n=String.fromCharCode(65+t%26)+n,t=Math.floor(t/26)-1;while(t>=0);return`Terminal ${n}`}function qG(e){if(e.length===0)return e;const t=e.length+1;return e.map(n=>({...n,size:n.size*e.length/t}))}function Vl(e,t,n){return{...e,[t]:n(WG(e,t))}}const Uo=no()(ro(e=>({projects:{},addTerminal:(t,n)=>e(r=>({projects:Vl(r.projects,t,s=>{var h,d;const a=qG(s.terminals),l={id:((d=(h=globalThis.crypto)==null?void 0:h.randomUUID)==null?void 0:d.call(h))??`terminal-${Date.now()}-${s.nextTerminalIndex}`,title:VG(s.nextTerminalIndex),size:100/(a.length+1)},u=n?Math.max(a.findIndex(g=>g.id===n)+1,0):a.length;return{...s,isVisible:!0,nextTerminalIndex:s.nextTerminalIndex+1,terminals:[...a.slice(0,u),l,...a.slice(u)]}})})),removeTerminal:(t,n)=>e(r=>({projects:Vl(r.projects,t,s=>{const a=s.terminals.filter(u=>u.id!==n);if(a.length===0)return{...s,isVisible:!1,terminals:[]};const l=q_(a.map(u=>u.size));return{...s,terminals:a.map((u,h)=>({...u,size:l[h]??100/a.length}))}})})),toggleVisibility:t=>e(n=>({projects:Vl(n.projects,t,r=>({...r,isVisible:r.terminals.length>0?!r.isVisible:!1}))})),resetMainSizes:t=>e(n=>({projects:Vl(n.projects,t,r=>({...r,mainSizes:[...Ax]}))})),setMainSizes:(t,n)=>e(r=>{if(n.length!==2)return r;const s=q_(n);return{projects:Vl(r.projects,t,a=>({...a,mainSizes:s}))}}),setTerminalSizes:(t,n)=>e(r=>({projects:Vl(r.projects,t,s=>{if(n.length!==s.terminals.length)return s;const a=q_(n);return{...s,terminals:s.terminals.map((l,u)=>({...l,size:a[u]??l.size}))}})})),clearProject:t=>e(n=>{const{[t]:r,...s}=n.projects;return{projects:s}})}),{name:"terminal-layouts",version:1})),KG={isVisible:!1,mainSizes:[...Ax],terminals:[],nextTerminalIndex:0},Um=1e3,Fy=500,Uy=5e3,$m=450,$y=250,Wy=900,Vy="cursor";function qy(e){switch(e){case"vscode":return"code {path}";case"windsurf":return"windsurf {path}";case"custom":return"cursor {path}";case"cursor":default:return"cursor {path}"}}function GG(e){switch(e){case"vscode":return"VS Code";case"windsurf":return"Windsurf";case"custom":return"Custom";case"cursor":default:return"Cursor"}}function VE(e){return Number.isFinite(e)?Math.min(Uy,Math.max(Fy,Math.round(e))):Um}function qE(e){return Number.isFinite(e)?Math.min(Wy,Math.max($y,Math.round(e))):$m}function KE(e){switch(e){case"vscode":case"windsurf":case"custom":case"cursor":return e;default:return Vy}}function K_(e,t){const n=e==null?void 0:e.trim();return n&&n.length>0?n:qy(t)}const wi=no()(ro(e=>({scrollbackLines:Um,minColumnWidth:$m,editorPreset:Vy,editorCommandTemplate:qy(Vy),setScrollbackLines:t=>e({scrollbackLines:VE(t)}),setMinColumnWidth:t=>e({minColumnWidth:qE(t)}),setEditorPreset:t=>e(n=>{const r=KE(t);return{editorPreset:r,editorCommandTemplate:r==="custom"?K_(n.editorCommandTemplate,r):qy(r)}}),setEditorCommandTemplate:t=>e(n=>({editorCommandTemplate:K_(t,n.editorPreset)}))}),{name:"terminal-preferences",version:3,migrate:e=>{const t=e,n=KE(t==null?void 0:t.editorPreset);return{scrollbackLines:VE((t==null?void 0:t.scrollbackLines)??Um),minColumnWidth:qE((t==null?void 0:t.minColumnWidth)??$m),editorPreset:n,editorCommandTemplate:K_(t==null?void 0:t.editorCommandTemplate,n)}}})),YG=35;function XG(e,t){return!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0?0:e*(t/100)}function ZG(e,t){const n=XG(e,t);return n>=0&&n<YG}const tc=350,QG=[.4,0,.2,1],JG=8,GE=1e-6;function eY(e,t,n){const r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function tY(e,t,n){const r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function nY(e,t,n){const r=1-e;return 3*r*r*t+6*r*e*(n-t)+3*e*e*(1-n)}function rY(e,t,n){let r=e;for(let s=0;s<JG;s+=1){const a=eY(r,t,n)-e;if(Math.abs(a)<GE)return r;const l=nY(r,t,n);if(Math.abs(l)<GE)break;r-=a/l}return r}function iY(e){if(e<=0)return 0;if(e>=1)return 1;const[t,n,r,s]=QG,a=rY(e,t,r);return tY(a,n,s)}function ej(e,t,n){const r=iY(n);return[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r]}function sY({projectId:e,shouldRenderRightSidebarLayout:t,showRightSidebar:n,rightSidebarSize:r}){const s=_.useRef(null),a=_.useRef(null),l=_.useRef(null),u=_.useRef(null),h=_.useRef(null),d=_.useRef(!1),g=_.useRef(null),p=_.useRef(!1),v=_.useRef(!1);return _.useEffect(()=>()=>{u.current!==null&&window.cancelAnimationFrame(u.current),h.current!==null&&window.clearTimeout(h.current)},[]),_.useLayoutEffect(()=>{var L,U,Y,P,V,I;if(!t){u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null),h.current!==null&&(window.clearTimeout(h.current),h.current=null),d.current=!1;return}const y=s.current;if(!y)return;u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null),h.current!==null&&(window.clearTimeout(h.current),h.current=null);const w=g.current,S=w!==null&&w!==e,C=n&&!v.current,k=!p.current,R=n?[100-r,r]:[100,0],E=S||k&&n,N=C||k?[100,0]:[y.getLayout().workspace??R[0],y.getLayout().rightSidebar??R[1]];if(g.current=e,p.current=t,v.current=n,E||Math.abs(N[0]-R[0])<.1&&Math.abs(N[1]-R[1])<.1){y.setLayout({workspace:R[0],rightSidebar:R[1]}),(L=a.current)==null||L.setAttribute("data-right-sidebar-open",n?"true":"false"),(U=l.current)==null||U.setAttribute("data-right-sidebar-open",n?"true":"false"),(Y=l.current)==null||Y.setAttribute("data-right-sidebar-animated","false");return}d.current=!0,(P=a.current)==null||P.setAttribute("data-right-sidebar-open",n?"true":"false"),(V=l.current)==null||V.setAttribute("data-right-sidebar-open",n?"true":"false"),(I=l.current)==null||I.setAttribute("data-right-sidebar-animated","true"),y.setLayout({workspace:N[0],rightSidebar:N[1]});const j=performance.now(),D=W=>{const K=Math.min(1,(W-j)/tc),q=ej(N,R,K);if(y.setLayout({workspace:q[0],rightSidebar:q[1]}),K<1){u.current=window.requestAnimationFrame(D);return}y.setLayout({workspace:R[0],rightSidebar:R[1]}),u.current=null,h.current=window.setTimeout(()=>{d.current=!1,h.current=null},0)};u.current=window.requestAnimationFrame(D)},[e,r,t,n]),_.useEffect(()=>{t||(p.current=!1,v.current=!1)},[t]),{isAnimating:d,panelGroupRef:s,sidebarPanelRef:a,sidebarVisualRef:l}}function oY(e){const t=e.previousProjectId!==null&&e.previousProjectId!==e.projectId,n=e.previousProjectId===null&&e.projectId!==null;return!t&&!n&&e.showTerminalPane&&!e.wasTerminalVisible}function aY({previousProjectId:e,projectId:t,previousShouldRenderTerminalLayout:n,previousShowTerminalPane:r,showTerminalPane:s,terminalLayout:a,liveLayout:l}){const u=e!==null&&e!==t,h=s&&!r,d=!n,g=e===null&&t!==null,p=s?a.mainSizes:[100,0];return{currentLayout:h||d?[100,0]:l,shouldSkipAnimation:u||g&&d,targetLayout:p}}function lY({chatInputRef:e,projectId:t,shouldRenderTerminalLayout:n,showTerminalPane:r,terminalLayout:s}){const a=_.useRef(null),l=_.useRef(null),u=_.useRef(null),h=_.useRef(null),d=_.useRef(null),g=_.useRef(!1),p=_.useRef(null),v=_.useRef(!1),y=_.useRef(!1),w=_.useRef(!1),[S,C]=_.useState(0);return _.useEffect(()=>{var E;const k=p.current,R=w.current;oY({previousProjectId:k,projectId:t,showTerminalPane:r,wasTerminalVisible:R})&&C(N=>N+1),k!==null&&k===t&&!r&&R&&((E=e.current)==null||E.focus({preventScroll:!0})),w.current=r,p.current=t},[e,t,r]),_.useEffect(()=>()=>{h.current!==null&&window.cancelAnimationFrame(h.current),d.current!==null&&window.clearTimeout(d.current)},[]),_.useLayoutEffect(()=>{var U,Y,P,V,I,W;if(!n){h.current!==null&&(window.cancelAnimationFrame(h.current),h.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null),g.current=!1;return}const k=a.current;if(!k)return;h.current!==null&&(window.cancelAnimationFrame(h.current),h.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null);const R=p.current,{currentLayout:E,shouldSkipAnimation:N,targetLayout:j}=aY({previousProjectId:R,projectId:t,previousShouldRenderTerminalLayout:v.current,previousShowTerminalPane:y.current,showTerminalPane:r,terminalLayout:s,liveLayout:[k.getLayout().chat??s.mainSizes[0],k.getLayout().terminal??s.mainSizes[1]]});if(v.current=n,y.current=r,N||Math.abs(E[0]-j[0])<.1&&Math.abs(E[1]-j[1])<.1){k.setLayout({chat:j[0],terminal:j[1]}),(U=l.current)==null||U.setAttribute("data-terminal-open",r?"true":"false"),(Y=u.current)==null||Y.setAttribute("data-terminal-open",r?"true":"false"),(P=u.current)==null||P.setAttribute("data-terminal-animated","false");return}g.current=!0,(V=l.current)==null||V.setAttribute("data-terminal-open",r?"true":"false"),(I=u.current)==null||I.setAttribute("data-terminal-open",r?"true":"false"),(W=u.current)==null||W.setAttribute("data-terminal-animated","true"),k.setLayout({chat:E[0],terminal:E[1]});const D=performance.now(),L=K=>{const q=Math.min(1,(K-D)/tc),O=ej(E,j,q);if(k.setLayout({chat:O[0],terminal:O[1]}),q<1){h.current=window.requestAnimationFrame(L);return}k.setLayout({chat:j[0],terminal:j[1]}),h.current=null,d.current=window.setTimeout(()=>{g.current=!1,d.current=null},0)};h.current=window.requestAnimationFrame(L)},[t,n,r,s.mainSizes]),_.useEffect(()=>{n||(v.current=!1,y.current=!1)},[n]),{isAnimating:g,mainPanelGroupRef:a,terminalFocusRequestVersion:S,terminalPanelRef:l,terminalVisualRef:u}}const qs=no()(ro(e=>({folderGroupsEnabled:!1,kanbanStatusesEnabled:!0,commitProjectMetadataDirectory:!0,setFolderGroupsEnabled:t=>e({folderGroupsEnabled:t}),setKanbanStatusesEnabled:t=>e({kanbanStatusesEnabled:t}),setCommitProjectMetadataDirectory:t=>e({commitProjectMetadataDirectory:t})}),{name:"feature-settings"}));function Pf(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function cY(e){if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}}function uY(e,t){const n=cY(t);switch(e.toolKind){case"ask_user_question":{const s=Pf(n),a=Pf(s==null?void 0:s.answers)??(s||{});return{answers:Object.fromEntries(Object.entries(a).map(([l,u])=>Array.isArray(u)?[l,u.map(h=>String(h))]:u&&typeof u=="object"&&Array.isArray(u.answers)?[l,u.answers.map(h=>String(h))]:u==null||u===""?[l,[]]:[l,[String(u)]])),...(s==null?void 0:s.discarded)===!0?{discarded:!0}:{}}}case"exit_plan_mode":{const s=Pf(n);return{confirmed:typeof(s==null?void 0:s.confirmed)=="boolean"?s.confirmed:void 0,clearContext:typeof(s==null?void 0:s.clearContext)=="boolean"?s.clearContext:void 0,message:typeof(s==null?void 0:s.message)=="string"?s.message:void 0,...(s==null?void 0:s.discarded)===!0?{discarded:!0}:{}}}case"read_file":if(typeof n=="string")return n;const r=Pf(n);return{content:typeof(r==null?void 0:r.content)=="string"?r.content:JSON.stringify(n,null,2)};default:return n}}function tj(e){return new Date(e).toISOString()}function bi(e){return{id:e._id,messageId:e.messageId,timestamp:tj(e.createdAt),hidden:e.hidden}}function dY(e){return{id:e._id,messageId:e.messageId,hidden:e.hidden,kind:"tool",toolKind:e.tool.toolKind,toolName:e.tool.toolName,toolId:e.tool.toolId,input:e.tool.input,timestamp:tj(e.createdAt)}}function hY(e){if(e.debugRaw)try{return JSON.parse(e.debugRaw).tool_use_result}catch{return}}function fY(e){if(e!=null&&e.length)return e.map(t=>({...t,previewUrl:`/attachments/${t.relativePath.split("/").map(encodeURIComponent).join("/")}`}))}function YE(e,t){const n=e.at(-1);if((n==null?void 0:n.kind)===t.kind&&n.hidden===t.hidden&&n.messageId===t.messageId){n.text+=t.text;return}e.push(t)}function mY(e){const t=new Map,n=[];for(const r of e)switch(r.kind){case"user_prompt":n.push({...bi(r),kind:"user_prompt",content:r.content,attachments:fY(r.attachments)});break;case"system_init":n.push({...bi(r),kind:"system_init",provider:r.provider,model:r.model,tools:r.tools,agents:r.agents,slashCommands:r.slashCommands,mcpServers:r.mcpServers,debugRaw:r.debugRaw});break;case"account_info":n.push({...bi(r),kind:"account_info",accountInfo:r.accountInfo});break;case"assistant_text":YE(n,{...bi(r),kind:"assistant_text",text:r.text});break;case"assistant_thought":YE(n,{...bi(r),kind:"assistant_thought",text:r.text});break;case"tool_call":{const s=dY(r);t.set(r.tool.toolId,{hydrated:s,normalized:r.tool}),n.push(s);break}case"tool_result":{const s=t.get(r.toolId);if(s){const a=s.normalized.toolKind==="ask_user_question"||s.normalized.toolKind==="exit_plan_mode"?hY(r)??r.content:r.content;s.hydrated.result=uY(s.normalized,a),s.hydrated.rawResult=a,s.hydrated.isError=r.isError}break}case"result":n.push({...bi(r),kind:"result",success:!r.isError,cancelled:r.subtype==="cancelled",result:r.result,durationMs:r.durationMs,costUsd:r.costUsd});break;case"status":n.push({...bi(r),kind:"status",status:r.status});break;case"compact_boundary":n.push({...bi(r),kind:"compact_boundary"});break;case"compact_summary":n.push({...bi(r),kind:"compact_summary",summary:r.summary});break;case"context_cleared":n.push({...bi(r),kind:"context_cleared"});break;case"interrupted":n.push({...bi(r),kind:"interrupted"});break;default:n.push({...bi(r),kind:"unknown",json:JSON.stringify(r,null,2)});break}return n}const pY=["AskUserQuestion","ExitPlanMode","TodoWrite"],gY=new Set(["TodoWrite"]);function vY(e,t){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r.kind!=="tool")continue;const s=r;if(s.toolName===t&&!s.result)return s.id}return null}function _Y(e,t){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r.kind!=="tool")continue;const s=r;if(s.toolName===t)return s.id}return null}function bY(e){const t={};for(const n of pY)t[n]=gY.has(n)?_Y(e,n):vY(e,n);return t}function yY(e){return e==="starting"||e==="running"||e==="waiting_for_user"}function G_(e){return e==="starting"||e==="running"||e==="waiting_for_user"}const xY=25e3,wY=15e3,SY=4e3;class CY{constructor(t){Hn(this,"url");Hn(this,"ws",null);Hn(this,"started",!1);Hn(this,"reconnectTimer",null);Hn(this,"reconnectDelayMs",750);Hn(this,"subscriptions",new Map);Hn(this,"pending",new Map);Hn(this,"outboundQueue",[]);Hn(this,"statusListeners",new Set);Hn(this,"heartbeatTimer",null);Hn(this,"pingTimeoutTimer",null);Hn(this,"pingPromise",null);Hn(this,"lastOpenAt",0);Hn(this,"lastMessageAt",0);Hn(this,"reconnectImmediatelyOnClose",!1);Hn(this,"handleWindowFocus",()=>{this.ensureHealthyConnection()});Hn(this,"handleVisibilityChange",()=>{if(document.visibilityState==="visible"){this.startHeartbeat(),this.ensureHealthyConnection();return}this.stopHeartbeat()});Hn(this,"handleOnline",()=>{this.ensureHealthyConnection()});this.url=t}start(){this.started||(this.started=!0,window.addEventListener("focus",this.handleWindowFocus),window.addEventListener("online",this.handleOnline),document.addEventListener("visibilitychange",this.handleVisibilityChange),this.connect())}dispose(){var t;this.started=!1,this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopHeartbeat(),this.clearPingState(),window.removeEventListener("focus",this.handleWindowFocus),window.removeEventListener("online",this.handleOnline),document.removeEventListener("visibilitychange",this.handleVisibilityChange),(t=this.ws)==null||t.close(),this.ws=null;for(const n of this.pending.values())n.reject(new Error("Socket disposed"));this.pending.clear()}onStatus(t){return this.statusListeners.add(t),t(this.getStatus()),()=>{this.statusListeners.delete(t)}}subscribe(t,n,r){const s=Kf();return this.subscriptions.set(s,{topic:t,listener:n,eventListener:r}),this.enqueue({v:1,type:"subscribe",id:s,topic:t}),()=>{this.subscriptions.delete(s),this.enqueue({v:1,type:"unsubscribe",id:s})}}subscribeTerminal(t,n){const r=Kf(),s={type:"terminal",terminalId:t};return this.subscriptions.set(r,{topic:s,listener:n.onSnapshot,eventListener:n.onEvent}),this.enqueue({v:1,type:"subscribe",id:r,topic:s}),()=>{this.subscriptions.delete(r),this.enqueue({v:1,type:"unsubscribe",id:r})}}command(t){const n=Kf(),r={v:1,type:"command",id:n,command:t};return new Promise((s,a)=>{this.pending.set(n,{resolve:s,reject:a}),this.enqueue(r)})}ensureHealthyConnection(){return!this.ws||this.ws.readyState===WebSocket.CLOSED||this.ws.readyState===WebSocket.CLOSING?(this.reconnectNow(),Promise.resolve()):this.ws.readyState===WebSocket.CONNECTING||!this.isConnectionStale()?Promise.resolve():this.sendPing()}connect(){if(!this.started)return;this.emitStatus("connecting");const t=new WebSocket(this.url);this.ws=t,t.addEventListener("open",()=>{if(this.ws===t){this.reconnectDelayMs=750,this.reconnectImmediatelyOnClose=!1,this.lastOpenAt=Date.now(),this.lastMessageAt=this.lastOpenAt,this.emitStatus("connected"),this.startHeartbeat();for(const[n,r]of this.subscriptions.entries())this.sendNow({v:1,type:"subscribe",id:n,topic:r.topic},t);for(;this.outboundQueue.length>0;){const n=this.outboundQueue.shift();n&&this.sendNow(n,t)}}}),t.addEventListener("message",n=>{var s;if(this.ws!==t)return;this.lastMessageAt=Date.now();let r;try{r=JSON.parse(String(n.data))}catch{return}if(r.type==="snapshot"){const a=this.subscriptions.get(r.id);a==null||a.listener(r.snapshot.data);return}if(r.type==="event"){const a=this.subscriptions.get(r.id);(s=a==null?void 0:a.eventListener)==null||s.call(a,r.event);return}if(r.type==="ack"){const a=this.pending.get(r.id);if(!a)return;this.pending.delete(r.id),a.resolve(r.result);return}if(r.type==="error"){if(!r.id){console.error(e7,r.message);return}const a=this.pending.get(r.id);if(!a)return;this.pending.delete(r.id),a.reject(new Error(r.message))}}),t.addEventListener("close",()=>{if(this.ws!==t||!this.started)return;const n=this.reconnectImmediatelyOnClose;this.reconnectImmediatelyOnClose=!1,this.stopHeartbeat(),this.clearPingState(),this.emitStatus("disconnected");for(const r of this.pending.values())r.reject(new Error("Disconnected"));if(this.pending.clear(),n){this.connect();return}this.scheduleReconnect()})}scheduleReconnect(){this.reconnectTimer===null&&(this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect(),this.reconnectDelayMs=Math.min(this.reconnectDelayMs*2,5e3)},this.reconnectDelayMs))}getStatus(){var t,n;return((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN?"connected":((n=this.ws)==null?void 0:n.readyState)===WebSocket.CONNECTING?"connecting":"disconnected"}emitStatus(t){for(const n of this.statusListeners)n(t)}isConnectionStale(){const t=Math.max(this.lastMessageAt,this.lastOpenAt);return t>0&&Date.now()-t>=xY}sendPing(){if(this.pingPromise)return this.pingPromise;const t=this.command({type:"system.ping"}).then(()=>{this.clearPingState()}).catch(n=>{throw this.clearPingState(),this.reconnectNow(),n});return this.pingTimeoutTimer=window.setTimeout(()=>{this.clearPingState(),this.reconnectNow()},SY),this.pingPromise=t,t}reconnectNow(){if(this.reconnectTimer!==null&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),!this.ws||this.ws.readyState===WebSocket.CLOSED){this.connect();return}this.ws.readyState!==WebSocket.CONNECTING&&(this.reconnectImmediatelyOnClose=!0,this.ws.close())}startHeartbeat(){document.visibilityState==="visible"&&this.heartbeatTimer===null&&(this.heartbeatTimer=window.setInterval(()=>{var t;if(document.visibilityState!=="visible"){this.stopHeartbeat();return}((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN&&this.ensureHealthyConnection()},wY))}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}clearPingState(){this.pingTimeoutTimer!==null&&(window.clearTimeout(this.pingTimeoutTimer),this.pingTimeoutTimer=null),this.pingPromise=null}enqueue(t){var n;if(((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN){this.sendNow(t,this.ws);return}this.outboundQueue.push(t)}sendNow(t,n){if(n.readyState!==WebSocket.OPEN){this.outboundQueue.unshift(t);return}n.send(JSON.stringify(t))}}function kY(e,t){var r;const n=e.find(s=>vd(s).some(a=>a.chatId===t));return n?((r=vd(n).find(s=>s.chatId!==t))==null?void 0:r.chatId)??null:null}function XE(e,t){var n;return((n=e.find(r=>vd(r).some(s=>s.chatId===t)))==null?void 0:n.groupKey)??null}function EY(e,t){for(const n of e){const r=vd(n).find(s=>s.chatId===t);if(r)return r}return null}function RY(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function TY(){const e=_.useRef(null);return e.current||(e.current=new CY(RY())),_.useEffect(()=>{const t=e.current;return t==null||t.start(),()=>{t==null||t.dispose()}},[]),e.current}function qu(e,t){if(t===void 0){console.info(`[useKaizenState] ${e}`);return}console.info(`[useKaizenState] ${e}`,t)}function nj(e){return e<24}function NY(e){return Math.max(136,Math.round(e+24))}function MY(e,t){return e==="awaiting_disconnect"&&t==="disconnected"?"awaiting_reconnect":e==="awaiting_reconnect"&&t==="connected"?"clear_phase":"none"}const Dx=`${_p}ui-update-restart`;function AY(){return window.sessionStorage.getItem(Dx)}function ZE(e){window.sessionStorage.setItem(Dx,e)}function Y_(){window.sessionStorage.removeItem(Dx)}function DY(e){const t=e.selectedProjectId??e.sidebarProjectId??null;return t?{kind:"project_id",projectId:t}:e.fallbackLocalProjectPath?{kind:"local_path",localPath:e.fallbackLocalProjectPath}:null}function jY(e,t){return!e||!t?null:e.runtime.chatId!==t?(qu("stale snapshot masked",{routeChatId:t,snapshotChatId:e.runtime.chatId,snapshotProvider:e.runtime.provider}),null):e}function OY(e){var Xi,ws,Zd;const t=_c(),n=TY(),r=l8(),[s,a]=_.useState({projectGroups:[]}),[l,u]=_.useState(null),[h,d]=_.useState(null),[g,p]=_.useState(null),[v,y]=_.useState(null),[w,S]=_.useState(null),[C,k]=_.useState("connecting"),[R,E]=_.useState(!1),[N,j]=_.useState(!1),[D,L]=_.useState(!1),[U,Y]=_.useState(null),[P,V]=_.useState(!1),[I,W]=_.useState(!1),[K,q]=_.useState(148),[O,F]=_.useState(!0),[H,$]=_.useState(null),[M,B]=_.useState(null),[X,A]=_.useState(null),[re,se]=_.useState(null),[Z,te]=_.useState(!1),le=qs(J=>J.folderGroupsEnabled),pe=qs(J=>J.kanbanStatusesEnabled),xe=GG(wi(J=>J.editorPreset)),Me=_.useRef(null),Re=_.useRef(null),je=Ju(J=>J.setVisibility),[Xe,ft]=_.useState(new Set),pt=_.useRef(new Map),he=_.useRef(e),Le=_.useRef(typeof document<"u"?document.visibilityState==="visible":!0),Ae=_.useRef(!1),nt=_.useRef(null),gt=_.useRef(new Map);_.useEffect(()=>n.onStatus(k),[n]),_.useEffect(()=>{he.current=e},[e]),_.useEffect(()=>{function J(){const ie=document.visibilityState==="visible";if(Le.current=ie,ie){const Ee=he.current;Ee&&ft(Fe=>{if(!Fe.has(Ee))return Fe;const Nt=new Set(Fe);return Nt.delete(Ee),Nt})}}return document.addEventListener("visibilitychange",J),()=>document.removeEventListener("visibilitychange",J)},[]),_.useEffect(()=>n.subscribe({type:"sidebar"},J=>{const ie=new Map;for(const Wt of J.projectGroups)for(const Vt of[...Wt.generalChats,...Wt.features.flatMap(Dr=>Dr.chats)])ie.set(Vt.chatId,Vt.status);const Ee=pt.current,Fe=he.current,Nt=Le.current;ft(Wt=>{let Vt=Wt;for(const[Dr,Qd]of ie){const sl=Ee.get(Dr);G_(Qd)&&Vt.has(Dr)&&(Vt===Wt&&(Vt=new Set(Wt)),Vt.delete(Dr)),sl&&G_(sl)&&Qd==="idle"&&(Dr!==Fe||!Nt)&&(Vt===Wt&&(Vt=new Set(Wt)),Vt.add(Dr))}return Vt}),pt.current=ie,a(J),E(!0),$(null)}),[n]),_.useEffect(()=>n.subscribe({type:"local-projects"},J=>{u(J),j(!0),$(null)}),[n]),_.useEffect(()=>n.subscribe({type:"update"},J=>{d(J),$(null)}),[n]),_.useEffect(()=>{C==="connected"&&n.command({type:"update.check",force:!0}).catch(J=>{$(J instanceof Error?J.message:String(J))})},[C,n]),_.useEffect(()=>{const J=AY(),ie=MY(J,C);if(ie==="awaiting_reconnect"){ZE("awaiting_reconnect");return}ie==="clear_phase"&&Y_()},[C,t]),_.useEffect(()=>{function J(){h!=null&&h.lastCheckedAt&&(Date.now()-h.lastCheckedAt<=3600*1e3||n.command({type:"update.check"}).catch(ie=>{$(ie instanceof Error?ie.message:String(ie))}))}return window.addEventListener("focus",J),()=>{window.removeEventListener("focus",J)}},[n,h==null?void 0:h.lastCheckedAt]),_.useEffect(()=>n.subscribe({type:"keybindings"},J=>{y(J),$(null)}),[n]),_.useEffect(()=>n.subscribe({type:"theme-settings"},J=>{gn.setState({themePreference:J.settings.themePreference,colorTheme:J.settings.colorTheme,customAppearance:J.settings.customAppearance,backgroundImage:J.settings.backgroundImage,backgroundOpacity:J.settings.backgroundOpacity,backgroundBlur:J.settings.backgroundBlur,showProjectIconsInSidebar:J.settings.showProjectIconsInSidebar})}),[n]),_.useEffect(()=>n.subscribe({type:"provider-settings"},J=>{S(J),$(null)}),[n]),_.useEffect(()=>{if(!e){qu("clearing chat snapshot for non-chat route"),p(null),L(!0);return}return qu("subscribing to chat",{activeChatId:e}),p(null),L(!1),n.subscribe({type:"chat",chatId:e},J=>{qu("chat snapshot received",{activeChatId:e,snapshotChatId:(J==null?void 0:J.runtime.chatId)??null,snapshotProvider:(J==null?void 0:J.runtime.provider)??null,snapshotStatus:(J==null?void 0:J.runtime.status)??null}),p(J),L(!0),$(null)})},[e,n]),_.useEffect(()=>{e&&ft(J=>{if(!J.has(e))return J;const ie=new Set(J);return ie.delete(e),ie})},[e]),_.useEffect(()=>{if(!e)return;const J=XE(s.projectGroups,e);J&&je(J,!1)},[e,je,s.projectGroups]),_.useEffect(()=>{if(U)return;const J=s.projectGroups[0];J&&Y(J.groupKey)},[U,s.projectGroups]),_.useEffect(()=>{if(!e||!R||!D)return;if(s.projectGroups.some(ie=>vd(ie).some(Ee=>Ee.chatId===e))){X===e&&A(null);return}X!==e&&t("/")},[e,D,t,X,s.projectGroups,R]),_.useEffect(()=>{g&&(Y(g.runtime.projectId),X===g.runtime.chatId&&A(null))},[g,X]),_.useEffect(()=>{Ae.current=!1,nt.current!==null&&(window.cancelAnimationFrame(nt.current),nt.current=null),F(!0)},[e]),_.useEffect(()=>()=>{nt.current!==null&&window.cancelAnimationFrame(nt.current)},[]),_.useLayoutEffect(()=>{const J=Re.current;if(!J)return;const ie=new ResizeObserver(()=>{q(J.getBoundingClientRect().height)});return ie.observe(J),q(J.getBoundingClientRect().height),()=>ie.disconnect()},[]);const qe=_.useMemo(()=>jY(g,e),[e,g]);_.useEffect(()=>{qu("active snapshot resolved",{routeChatId:e,rawSnapshotChatId:(g==null?void 0:g.runtime.chatId)??null,rawSnapshotProvider:(g==null?void 0:g.runtime.provider)??null,activeSnapshotChatId:(qe==null?void 0:qe.runtime.chatId)??null,activeSnapshotProvider:(qe==null?void 0:qe.runtime.provider)??null,pendingChatId:X})},[e,qe,g,X]);const vt=_.useMemo(()=>{const J=qe;if(!J)return[];const ie=J.messages,Ee=J.runtime.chatId,Fe=ie.at(-1),Nt=`${ie.length}:${(Fe==null?void 0:Fe._id)??""}:${(Fe==null?void 0:Fe.createdAt)??0}`,Wt=gt.current.get(Ee);if((Wt==null?void 0:Wt.signature)===Nt)return Wt.messages;const Vt=mY(ie);return gt.current.set(Ee,{signature:Nt,messages:Vt}),Vt},[qe]),Se=_.useMemo(()=>bY(vt),[vt]),De=(qe==null?void 0:qe.runtime)??null,ce=(qe==null?void 0:qe.usage)??null,be=(qe==null?void 0:qe.availableProviders)??P0((w==null?void 0:w.settings)??Wn),Oe=G_(De==null?void 0:De.status),We=yY(De==null?void 0:De.status),we=NY(K),Ie=!O&&vt.length>0,ot=((Xi=l==null?void 0:l.projects[0])==null?void 0:Xi.localPath)??null,rt=(De==null?void 0:De.localPath)??ot??((ws=s.projectGroups[0])==null?void 0:ws.localPath),ze=!!(U??(De==null?void 0:De.projectId)??((Zd=s.projectGroups[0])==null?void 0:Zd.groupKey)??ot);_.useLayoutEffect(()=>{if(Ae.current)return;const J=Me.current;J&&(e&&!De||(J.scrollTo({top:J.scrollHeight,behavior:"auto"}),nt.current!==null&&window.cancelAnimationFrame(nt.current),nt.current=window.requestAnimationFrame(()=>{const ie=Me.current;ie&&(ie.scrollTo({top:ie.scrollHeight,behavior:"auto"}),nt.current=null)}),Ae.current=!0))},[e,K,vt.length,De]),_.useEffect(()=>{if(!Ae.current||!O)return;const J=window.requestAnimationFrame(()=>{const ie=Me.current;!ie||!O||ie.scrollTo({top:ie.scrollHeight,behavior:"auto"})});return()=>window.cancelAnimationFrame(J)},[e,K,O,vt.length,De==null?void 0:De.status]);function St(){const J=Me.current;if(!J)return;const ie=J.scrollHeight-J.scrollTop-J.clientHeight;F(nj(ie))}function at(J){const ie=Me.current;F(!0),ie&&ie.scrollTo({top:ie.scrollHeight,behavior:J})}function vn(){at("smooth")}async function tn(J,ie){var Nt;xi.getState().initializeComposerForNewChat();const Ee=s.projectGroups.find(Wt=>Wt.groupKey===J);if(Ee){const Vt=(ie?((Nt=Ee.features.find(Dr=>Dr.featureId===ie))==null?void 0:Nt.chats)??[]:Ee.generalChats).find(Dr=>Dr.lastMessageAt==null);if(Vt){Y(J),t(`/chat/${Vt.chatId}`),V(!1),$(null);return}}const Fe=await n.command({type:"chat.create",projectId:J,featureId:ie});Y(J),A(Fe.chatId),t(`/chat/${Fe.chatId}`),V(!1),$(null)}async function Nn(J,ie=qs.getState().commitProjectMetadataDirectory){await n.command({type:"project.setProjectMetadataDirectoryCommitMode",projectId:J.projectId,localPath:J.localPath,commitProjectMetadata:ie})}async function xr(J){return J.kind==="project_id"?{projectId:J.projectId}:J.kind==="local_path"?{projectId:(await n.command({type:"project.open",localPath:J.localPath})).projectId,localPath:J.localPath}:{projectId:(await n.command(J.project.mode==="new"?{type:"project.create",localPath:J.project.localPath,title:J.project.title}:{type:"project.open",localPath:J.project.localPath})).projectId,localPath:J.project.localPath}}async function rr(J){try{const ie=J.kind==="project_id"?null:J.kind==="local_path"?J.localPath:J.project.localPath;ie&&B(ie);const{projectId:Ee}=await xr(J);await Nn({projectId:Ee}),await tn(Ee)}catch(ie){$(ie instanceof Error?ie.message:String(ie))}finally{B(null)}}async function jt(J){const ie=J.split("/").filter(Boolean).pop()??J;if(await r.confirm({title:"Hide Project",description:`Hide "${ie}" from ${Pn}? This only removes it from ${Pn} until you re-add it or reset local state.`,confirmLabel:"Hide",confirmVariant:"destructive"}))try{await n.command({type:"project.hide",localPath:J}),$(null)}catch(Fe){$(Fe instanceof Error?Fe.message:String(Fe))}}async function zt(J,ie){try{await tn(J,ie)}catch(Ee){$(Ee instanceof Error?Ee.message:String(Ee))}}function He(J){se(J)}function ct(){se(null)}async function st(J){const ie=re;if(ie)try{const Ee=await n.command({type:"feature.create",projectId:ie,title:J.title,description:J.description});se(null),await tn(ie,Ee.featureId)}catch(Ee){$(Ee instanceof Error?Ee.message:String(Ee))}}async function mt(J){const ie=s.projectGroups.flatMap(Fe=>Fe.features).find(Fe=>Fe.featureId===J);if(!ie)return;const Ee=await r.prompt({title:"Rename Feature",placeholder:"Feature name",initialValue:ie.title,confirmLabel:"Rename"});if(!(!Ee||Ee===ie.title))try{await n.command({type:"feature.rename",featureId:J,title:Ee}),$(null)}catch(Fe){$(Fe instanceof Error?Fe.message:String(Fe))}}async function an(J){const ie=s.projectGroups.flatMap(Fe=>Fe.features).find(Fe=>Fe.featureId===J);if(!(!ie||!await r.confirm({title:"Delete Feature",description:`Delete "${ie.title}"? Its chats will move to General and the feature folder will be removed.`,confirmLabel:"Delete",confirmVariant:"destructive"})))try{await n.command({type:"feature.delete",featureId:J}),$(null)}catch(Fe){$(Fe instanceof Error?Fe.message:String(Fe))}}async function Ce(J,ie){try{await n.command({type:"feature.setBrowserState",featureId:J,browserState:ie}),$(null)}catch(Ee){$(Ee instanceof Error?Ee.message:String(Ee))}}async function Te(J,ie){try{await n.command({type:"project.setBrowserState",projectId:J,browserState:ie}),$(null)}catch(Ee){$(Ee instanceof Error?Ee.message:String(Ee))}}async function _t(J,ie){try{await n.command({type:"project.setGeneralChatsBrowserState",projectId:J,browserState:ie}),$(null)}catch(Ee){$(Ee instanceof Error?Ee.message:String(Ee))}}async function Qe(J,ie){try{await n.command({type:"feature.setStage",featureId:J,stage:ie}),$(null)}catch(Ee){$(Ee instanceof Error?Ee.message:String(Ee))}}async function bt(J){try{await n.command({type:"provider.refreshUsage",provider:J}),$(null)}catch(ie){$(ie instanceof Error?ie.message:String(ie))}}async function qt(J){if(J==="cursor")try{const ie=await n.command({type:"provider.browserLogin",provider:J});if(ie.availability==="login_required"){ie.statusDetail==="browser_launch_failed"&&te(!0),$(ie.statusDetail==="browser_launch_failed"?"Could not launch a Chromium browser for Cursor sign-in. Paste a copied cURL command instead.":"Cursor sign-in did not complete. Try again and finish login in the opened browser.");return}$(null)}catch(ie){$(ie instanceof Error?ie.message:String(ie))}}async function Ot(J){try{const ie=await n.command({type:"provider.importUsageCurl",provider:"cursor",curlCommand:J});if(ie.availability==="login_required"&&ie.statusDetail==="invalid_curl_import"){$("Could not import that cURL command. Copy the get-current-period-usage request as cURL and paste it here.");return}te(!1),$(null)}catch(ie){$(ie instanceof Error?ie.message:String(ie))}}async function sn(J,ie){try{await n.command({type:"chat.setFeature",chatId:J,featureId:ie}),$(null)}catch(Ee){$(Ee instanceof Error?Ee.message:String(Ee))}}async function G(J,ie){try{await n.command({type:"feature.reorder",projectId:J,orderedFeatureIds:ie}),$(null)}catch(Ee){$(Ee instanceof Error?Ee.message:String(Ee))}}async function Ye(J){await rr({kind:"local_path",localPath:J})}async function It(J){await rr({kind:"project_request",project:J})}async function Cn(J){try{await Promise.all(LY((l==null?void 0:l.projects.map(ie=>({localPath:ie.localPath})))??s.projectGroups.map(ie=>({projectId:ie.groupKey,localPath:ie.localPath}))).map(ie=>Nn(ie,J))),$(null)}catch(ie){throw $(ie instanceof Error?ie.message:String(ie)),ie}}async function li(J){const ie=new URL("/api/directories",window.location.origin);J&&ie.searchParams.set("path",J);const Ee=await fetch(ie.toString());if(!Ee.ok){let Nt="Failed to load directories";try{const Wt=await Ee.json();Wt.error&&(Nt=Wt.error)}catch{}throw new Error(Nt)}const Fe=await Ee.json();return $(null),Fe}async function $t(J){try{await n.command({type:"update.check",force:J==null?void 0:J.force}),$(null)}catch(ie){$(ie instanceof Error?ie.message:String(ie))}}async function ir(){try{const J=await n.command({type:"update.install"});if(!J.ok){Y_(),$(null),await r.alert({title:J.userTitle??"Update failed",description:J.userMessage??`${Pn} could not install the update. Try again later.`,closeLabel:"OK"});return}if(J.ok&&J.action==="reload"){window.location.reload();return}J.ok&&J.action==="restart"&&ZE("awaiting_disconnect"),$(null)}catch(J){Y_(),$(J instanceof Error?J.message:String(J))}}async function Ac(J,ie){var Ee;try{let Fe=U??((Ee=s.projectGroups[0])==null?void 0:Ee.groupKey)??null;if(!e&&!Fe&&ot&&(Fe=(await n.command({type:"project.open",localPath:ot})).projectId,Y(Fe)),!e&&!Fe)throw new Error("Open a project first");if(ie!=null&&ie.provider&&!Xk(ie.provider,(w==null?void 0:w.settings)??Wn))throw new Error(`${ie.provider} is inactive.`);if(at("auto"),ie!=null&&ie.provider&&!Xk(ie.provider,(w==null?void 0:w.settings)??Wn))throw new Error(`${ie.provider} is inactive.`);at("auto");const Nt=await n.command({type:"chat.send",chatId:e??void 0,projectId:e?void 0:Fe??void 0,provider:ie==null?void 0:ie.provider,message:J,model:ie==null?void 0:ie.model,modelOptions:ie==null?void 0:ie.modelOptions,planMode:ie==null?void 0:ie.planMode});!e&&Nt.chatId&&(A(Nt.chatId),t(`/chat/${Nt.chatId}`)),$(null)}catch(Fe){throw $(Fe instanceof Error?Fe.message:String(Fe)),Fe}}async function Gd(){if(e)try{await n.command({type:"chat.cancel",chatId:e})}catch(J){$(J instanceof Error?J.message:String(J))}}async function sa(J){if(await r.confirm({title:"Delete Chat",description:`Delete "${J.title}"? This cannot be undone.`,confirmLabel:"Delete",confirmVariant:"destructive"}))try{if(await n.command({type:"chat.delete",chatId:J.chatId}),J.chatId===e){const Ee=kY(s.projectGroups,J.chatId);t(Ee?`/chat/${Ee}`:"/")}}catch(Ee){$(Ee instanceof Error?Ee.message:String(Ee))}}async function Dc(J){const ie=s.projectGroups.find(Nt=>Nt.groupKey===J);if(!ie)return;const Ee=ie.localPath.split("/").filter(Boolean).pop()??ie.localPath;if(await r.confirm({title:"Hide Project",description:`Hide "${Ee}" from ${Pn}? Existing chats for this project will be removed from ${Pn}, but the project itself is not deleted.`,confirmLabel:"Hide",confirmVariant:"destructive"}))try{await n.command({type:"project.remove",projectId:J}),Uo.getState().clearProject(J),Ju.getState().clearProject(J),(De==null?void 0:De.projectId)===J&&t("/"),$(null)}catch(Nt){$(Nt instanceof Error?Nt.message:String(Nt))}}async function lo(J){var Ee,Fe;const ie=(De==null?void 0:De.localPath)??((Ee=l==null?void 0:l.projects[0])==null?void 0:Ee.localPath)??((Fe=s.projectGroups[0])==null?void 0:Fe.localPath);if(ie)try{await Yi({action:J,localPath:ie})}catch(Nt){$(Nt instanceof Error?Nt.message:String(Nt))}}async function co(J){try{await Yi({action:"open_editor",localPath:J.path,line:J.line,column:J.column})}catch(ie){$(ie instanceof Error?ie.message:String(ie))}}async function oa(J,ie){try{await Yi({action:J,localPath:ie})}catch(Ee){$(Ee instanceof Error?Ee.message:String(Ee))}}async function Yi(J){const ie=wi.getState();$(null),await n.command({type:"system.openExternal",...J,editor:J.action==="open_editor"?{preset:ie.editorPreset,commandTemplate:ie.editorCommandTemplate}:void 0})}function Mn(){var Fe;const J=e?EY(s.projectGroups,e):null,ie=e?XE(s.projectGroups,e):null;if(J&&ie){$(null),zt(ie,J.featureId??void 0);return}const Ee=DY({selectedProjectId:U,sidebarProjectId:(Fe=s.projectGroups[0])==null?void 0:Fe.groupKey,fallbackLocalProjectPath:ot});if(Ee){$(null),rr(Ee);return}$("Open a project first")}async function Yd(J,ie,Ee){if(e)try{await n.command({type:"chat.respondTool",chatId:e,toolUseId:J,result:{questions:ie,answers:Ee}})}catch(Fe){$(Fe instanceof Error?Fe.message:String(Fe))}}async function Xd(J,ie,Ee,Fe){if(e){ie&&xi.getState().setComposerPlanMode(!1);try{await n.command({type:"chat.respondTool",chatId:e,toolUseId:J,result:{confirmed:ie,...Ee?{clearContext:!0}:{},...Fe?{message:Fe}:{}}})}catch(Nt){$(Nt instanceof Error?Nt.message:String(Nt))}}}return{socket:n,activeChatId:e,sidebarData:s,completedChatIds:Xe,localProjects:l,updateSnapshot:h,chatSnapshot:g,keybindings:v,providerSettings:w,connectionStatus:C,sidebarReady:R,localProjectsReady:N,commandError:H,startingLocalPath:M,folderGroupsEnabled:le,kanbanStatusesEnabled:pe,sidebarOpen:P,sidebarCollapsed:I,scrollRef:Me,inputRef:Re,messages:vt,latestToolIds:Se,runtime:De,usage:ce,availableProviders:be,isProcessing:Oe,canCancel:We,transcriptPaddingBottom:we,showScrollButton:Ie,navbarLocalPath:rt,editorLabel:xe,hasSelectedProject:ze,createFeatureModalProjectId:re,cursorCurlImportOpen:Z,openSidebar:()=>V(!0),closeSidebar:()=>V(!1),collapseSidebar:()=>W(!0),expandSidebar:()=>W(!1),toggleProjectsSidebar:J=>{if(J){V(!1),W(ie=>!ie);return}V(ie=>!ie)},updateScrollState:St,scrollToBottom:vn,handleCreateChat:zt,handleCreateFeature:He,handleCloseCreateFeatureModal:ct,handleConfirmCreateFeature:st,handleRenameFeature:mt,handleDeleteFeature:an,handleSetProjectBrowserState:Te,handleSetProjectGeneralChatsBrowserState:_t,handleSetFeatureBrowserState:Ce,handleSetFeatureStage:Qe,handleSetChatFeature:sn,handleReorderFeatures:G,handleOpenLocalProject:Ye,handleHideLocalProject:jt,handleListDirectories:li,handleCreateProject:It,handleCheckForUpdates:$t,handleInstallUpdate:ir,handleRefreshProviderUsage:bt,handleOpenProviderLogin:qt,handleCloseCursorCurlImport:()=>te(!1),handleSubmitCursorCurlImport:Ot,handleSetCommitProjectMetadataDirectory:Cn,handleSend:Ac,handleCancel:Gd,handleDeleteChat:sa,handleRemoveProject:Dc,handleOpenExternal:lo,handleOpenExternalPath:oa,handleOpenLocalLink:co,handleCompose:Mn,handleAskUserQuestion:Yd,handleExitPlanMode:Xd}}function vd(e){return[...e.features.flatMap(t=>t.chats),...e.generalChats]}function LY(e){const t=new Set;return e.filter(n=>{const r=n.localPath??n.projectId;return!r||t.has(r)?!1:(t.add(r),!0)})}function zY(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const PY=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,BY=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,IY={};function QE(e,t){return(IY.jsx?BY:PY).test(e)}const HY=/[ \t\n\f\r]/g;function FY(e){return typeof e=="object"?e.type==="text"?JE(e.value):!1:JE(e)}function JE(e){return e.replace(HY,"")===""}class $d{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}$d.prototype.normal={};$d.prototype.property={};$d.prototype.space=void 0;function rj(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new $d(n,r,t)}function Ky(e){return e.toLowerCase()}class Vr{constructor(t,n){this.attribute=n,this.property=t}}Vr.prototype.attribute="";Vr.prototype.booleanish=!1;Vr.prototype.boolean=!1;Vr.prototype.commaOrSpaceSeparated=!1;Vr.prototype.commaSeparated=!1;Vr.prototype.defined=!1;Vr.prototype.mustUseProperty=!1;Vr.prototype.number=!1;Vr.prototype.overloadedBoolean=!1;Vr.prototype.property="";Vr.prototype.spaceSeparated=!1;Vr.prototype.space=void 0;let UY=0;const ht=il(),Ln=il(),Gy=il(),ke=il(),on=il(),ac=il(),ni=il();function il(){return 2**++UY}const Yy=Object.freeze(Object.defineProperty({__proto__:null,boolean:ht,booleanish:Ln,commaOrSpaceSeparated:ni,commaSeparated:ac,number:ke,overloadedBoolean:Gy,spaceSeparated:on},Symbol.toStringTag,{value:"Module"})),X_=Object.keys(Yy);class jx extends Vr{constructor(t,n,r,s){let a=-1;if(super(t,n),eR(this,"space",s),typeof r=="number")for(;++a<X_.length;){const l=X_[a];eR(this,X_[a],(r&Yy[l])===Yy[l])}}}jx.prototype.defined=!0;function eR(e,t,n){n&&(e[t]=n)}function Nc(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const a=new jx(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Ky(r)]=r,n[Ky(a.attribute)]=r}return new $d(t,n,e.space)}const ij=Nc({properties:{ariaActiveDescendant:null,ariaAtomic:Ln,ariaAutoComplete:null,ariaBusy:Ln,ariaChecked:Ln,ariaColCount:ke,ariaColIndex:ke,ariaColSpan:ke,ariaControls:on,ariaCurrent:null,ariaDescribedBy:on,ariaDetails:null,ariaDisabled:Ln,ariaDropEffect:on,ariaErrorMessage:null,ariaExpanded:Ln,ariaFlowTo:on,ariaGrabbed:Ln,ariaHasPopup:null,ariaHidden:Ln,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:on,ariaLevel:ke,ariaLive:null,ariaModal:Ln,ariaMultiLine:Ln,ariaMultiSelectable:Ln,ariaOrientation:null,ariaOwns:on,ariaPlaceholder:null,ariaPosInSet:ke,ariaPressed:Ln,ariaReadOnly:Ln,ariaRelevant:null,ariaRequired:Ln,ariaRoleDescription:on,ariaRowCount:ke,ariaRowIndex:ke,ariaRowSpan:ke,ariaSelected:Ln,ariaSetSize:ke,ariaSort:null,ariaValueMax:ke,ariaValueMin:ke,ariaValueNow:ke,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function sj(e,t){return t in e?e[t]:t}function oj(e,t){return sj(e,t.toLowerCase())}const $Y=Nc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ac,acceptCharset:on,accessKey:on,action:null,allow:null,allowFullScreen:ht,allowPaymentRequest:ht,allowUserMedia:ht,alt:null,as:null,async:ht,autoCapitalize:null,autoComplete:on,autoFocus:ht,autoPlay:ht,blocking:on,capture:null,charSet:null,checked:ht,cite:null,className:on,cols:ke,colSpan:null,content:null,contentEditable:Ln,controls:ht,controlsList:on,coords:ke|ac,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ht,defer:ht,dir:null,dirName:null,disabled:ht,download:Gy,draggable:Ln,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ht,formTarget:null,headers:on,height:ke,hidden:Gy,high:ke,href:null,hrefLang:null,htmlFor:on,httpEquiv:on,id:null,imageSizes:null,imageSrcSet:null,inert:ht,inputMode:null,integrity:null,is:null,isMap:ht,itemId:null,itemProp:on,itemRef:on,itemScope:ht,itemType:on,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ht,low:ke,manifest:null,max:null,maxLength:ke,media:null,method:null,min:null,minLength:ke,multiple:ht,muted:ht,name:null,nonce:null,noModule:ht,noValidate:ht,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ht,optimum:ke,pattern:null,ping:on,placeholder:null,playsInline:ht,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ht,referrerPolicy:null,rel:on,required:ht,reversed:ht,rows:ke,rowSpan:ke,sandbox:on,scope:null,scoped:ht,seamless:ht,selected:ht,shadowRootClonable:ht,shadowRootDelegatesFocus:ht,shadowRootMode:null,shape:null,size:ke,sizes:null,slot:null,span:ke,spellCheck:Ln,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ke,step:null,style:null,tabIndex:ke,target:null,title:null,translate:null,type:null,typeMustMatch:ht,useMap:null,value:Ln,width:ke,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:on,axis:null,background:null,bgColor:null,border:ke,borderColor:null,bottomMargin:ke,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ht,declare:ht,event:null,face:null,frame:null,frameBorder:null,hSpace:ke,leftMargin:ke,link:null,longDesc:null,lowSrc:null,marginHeight:ke,marginWidth:ke,noResize:ht,noHref:ht,noShade:ht,noWrap:ht,object:null,profile:null,prompt:null,rev:null,rightMargin:ke,rules:null,scheme:null,scrolling:Ln,standby:null,summary:null,text:null,topMargin:ke,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ke,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ht,disableRemotePlayback:ht,prefix:null,property:null,results:ke,security:null,unselectable:null},space:"html",transform:oj}),WY=Nc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ni,accentHeight:ke,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ke,amplitude:ke,arabicForm:null,ascent:ke,attributeName:null,attributeType:null,azimuth:ke,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ke,by:null,calcMode:null,capHeight:ke,className:on,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ke,diffuseConstant:ke,direction:null,display:null,dur:null,divisor:ke,dominantBaseline:null,download:ht,dx:null,dy:null,edgeMode:null,editable:null,elevation:ke,enableBackground:null,end:null,event:null,exponent:ke,externalResourcesRequired:null,fill:null,fillOpacity:ke,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ac,g2:ac,glyphName:ac,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ke,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ke,horizOriginX:ke,horizOriginY:ke,id:null,ideographic:ke,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ke,k:ke,k1:ke,k2:ke,k3:ke,k4:ke,kernelMatrix:ni,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ke,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ke,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ke,overlineThickness:ke,paintOrder:null,panose1:null,path:null,pathLength:ke,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:on,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ke,pointsAtY:ke,pointsAtZ:ke,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ni,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ni,rev:ni,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ni,requiredFeatures:ni,requiredFonts:ni,requiredFormats:ni,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ke,specularExponent:ke,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ke,strikethroughThickness:ke,string:null,stroke:null,strokeDashArray:ni,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ke,strokeOpacity:ke,strokeWidth:null,style:null,surfaceScale:ke,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ni,tabIndex:ke,tableValues:null,target:null,targetX:ke,targetY:ke,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ni,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ke,underlineThickness:ke,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ke,values:null,vAlphabetic:ke,vMathematical:ke,vectorEffect:null,vHanging:ke,vIdeographic:ke,version:null,vertAdvY:ke,vertOriginX:ke,vertOriginY:ke,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ke,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:sj}),aj=Nc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),lj=Nc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:oj}),cj=Nc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),VY={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},qY=/[A-Z]/g,tR=/-[a-z]/g,KY=/^data[-\w.:]+$/i;function GY(e,t){const n=Ky(t);let r=t,s=Vr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&KY.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(tR,XY);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!tR.test(a)){let l=a.replace(qY,YY);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}s=jx}return new s(r,t)}function YY(e){return"-"+e.toLowerCase()}function XY(e){return e.charAt(1).toUpperCase()}const ZY=rj([ij,$Y,aj,lj,cj],"html"),Ox=rj([ij,WY,aj,lj,cj],"svg");function QY(e){return e.join(" ").trim()}var ql={},Z_,nR;function JY(){if(nR)return Z_;nR=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,u=/^\s+|\s+$/g,h=`
568
- `,d="/",g="*",p="",v="comment",y="declaration";function w(C,k){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];k=k||{};var R=1,E=1;function N(K){var q=K.match(t);q&&(R+=q.length);var O=K.lastIndexOf(h);E=~O?K.length-O:E+K.length}function j(){var K={line:R,column:E};return function(q){return q.position=new D(K),Y(),q}}function D(K){this.start=K,this.end={line:R,column:E},this.source=k.source}D.prototype.content=C;function L(K){var q=new Error(k.source+":"+R+":"+E+": "+K);if(q.reason=K,q.filename=k.source,q.line=R,q.column=E,q.source=C,!k.silent)throw q}function U(K){var q=K.exec(C);if(q){var O=q[0];return N(O),C=C.slice(O.length),q}}function Y(){U(n)}function P(K){var q;for(K=K||[];q=V();)q!==!1&&K.push(q);return K}function V(){var K=j();if(!(d!=C.charAt(0)||g!=C.charAt(1))){for(var q=2;p!=C.charAt(q)&&(g!=C.charAt(q)||d!=C.charAt(q+1));)++q;if(q+=2,p===C.charAt(q-1))return L("End of comment missing");var O=C.slice(2,q-2);return E+=2,N(O),C=C.slice(q),E+=2,K({type:v,comment:O})}}function I(){var K=j(),q=U(r);if(q){if(V(),!U(s))return L("property missing ':'");var O=U(a),F=K({type:y,property:S(q[0].replace(e,p)),value:O?S(O[0].replace(e,p)):p});return U(l),F}}function W(){var K=[];P(K);for(var q;q=I();)q!==!1&&(K.push(q),P(K));return K}return Y(),W()}function S(C){return C?C.replace(u,p):p}return Z_=w,Z_}var rR;function eX(){if(rR)return ql;rR=1;var e=ql&&ql.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ql,"__esModule",{value:!0}),ql.default=n;const t=e(JY());function n(r,s){let a=null;if(!r||typeof r!="string")return a;const l=(0,t.default)(r),u=typeof s=="function";return l.forEach(h=>{if(h.type!=="declaration")return;const{property:d,value:g}=h;u?s(d,g,h):g&&(a=a||{},a[d]=g)}),a}return ql}var Au={},iR;function tX(){if(iR)return Au;iR=1,Object.defineProperty(Au,"__esModule",{value:!0}),Au.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,a=function(d){return!d||n.test(d)||e.test(d)},l=function(d,g){return g.toUpperCase()},u=function(d,g){return"".concat(g,"-")},h=function(d,g){return g===void 0&&(g={}),a(d)?d:(d=d.toLowerCase(),g.reactCompat?d=d.replace(s,u):d=d.replace(r,u),d.replace(t,l))};return Au.camelCase=h,Au}var Du,sR;function nX(){if(sR)return Du;sR=1;var e=Du&&Du.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(eX()),n=tX();function r(s,a){var l={};return!s||typeof s!="string"||(0,t.default)(s,function(u,h){u&&h&&(l[(0,n.camelCase)(u,a)]=h)}),l}return r.default=r,Du=r,Du}var rX=nX();const iX=Ym(rX),uj=dj("end"),Lx=dj("start");function dj(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function sX(e){const t=Lx(e),n=uj(e);if(t&&n)return{start:t,end:n}}function ed(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?oR(e.position):"start"in e||"end"in e?oR(e):"line"in e||"column"in e?Xy(e):""}function Xy(e){return aR(e&&e.line)+":"+aR(e&&e.column)}function oR(e){return Xy(e&&e.start)+"-"+Xy(e&&e.end)}function aR(e){return e&&typeof e=="number"?e:1}class yr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",a={},l=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?s=t:!a.cause&&t&&(l=!0,s=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const h=r.indexOf(":");h===-1?a.ruleId=r:(a.source=r.slice(0,h),a.ruleId=r.slice(h+1))}if(!a.place&&a.ancestors&&a.ancestors){const h=a.ancestors[a.ancestors.length-1];h&&(a.place=h.position)}const u=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=u?u.line:void 0,this.name=ed(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}yr.prototype.file="";yr.prototype.name="";yr.prototype.reason="";yr.prototype.message="";yr.prototype.stack="";yr.prototype.column=void 0;yr.prototype.line=void 0;yr.prototype.ancestors=void 0;yr.prototype.cause=void 0;yr.prototype.fatal=void 0;yr.prototype.place=void 0;yr.prototype.ruleId=void 0;yr.prototype.source=void 0;const zx={}.hasOwnProperty,oX=new Map,aX=/[A-Z]/g,lX=new Set(["table","tbody","thead","tfoot","tr"]),cX=new Set(["td","th"]),hj="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function uX(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=_X(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=vX(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ox:ZY,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=fj(s,e,void 0);return a&&typeof a!="string"?a:s.create(e,s.Fragment,{children:a||void 0},void 0)}function fj(e,t,n){if(t.type==="element")return dX(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return hX(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return mX(e,t,n);if(t.type==="mdxjsEsm")return fX(e,t);if(t.type==="root")return pX(e,t,n);if(t.type==="text")return gX(e,t)}function dX(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Ox,e.schema=s),e.ancestors.push(t);const a=pj(e,t.tagName,!1),l=bX(e,t);let u=Bx(e,t);return lX.has(t.tagName)&&(u=u.filter(function(h){return typeof h=="string"?!FY(h):!0})),mj(e,l,a,t),Px(l,u),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function hX(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}_d(e,t.position)}function fX(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);_d(e,t.position)}function mX(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Ox,e.schema=s),e.ancestors.push(t);const a=t.name===null?e.Fragment:pj(e,t.name,!0),l=yX(e,t),u=Bx(e,t);return mj(e,l,a,t),Px(l,u),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function pX(e,t,n){const r={};return Px(r,Bx(e,t)),e.create(t,e.Fragment,r,n)}function gX(e,t){return t.value}function mj(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Px(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function vX(e,t,n){return r;function r(s,a,l,u){const d=Array.isArray(l.children)?n:t;return u?d(a,l,u):d(a,l)}}function _X(e,t){return n;function n(r,s,a,l){const u=Array.isArray(a.children),h=Lx(r);return t(s,a,l,u,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function bX(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&zx.call(t.properties,s)){const a=xX(e,s,t.properties[s]);if(a){const[l,u]=a;e.tableCellAlignToStyle&&l==="align"&&typeof u=="string"&&cX.has(t.tagName)?r=u:n[l]=u}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function yX(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const l=a.expression;l.type;const u=l.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else _d(e,t.position);else{const s=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const u=r.value.data.estree.body[0];u.type,a=e.evaluater.evaluateExpression(u.expression)}else _d(e,t.position);else a=r.value===null?!0:r.value;n[s]=a}return n}function Bx(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:oX;for(;++r<t.children.length;){const a=t.children[r];let l;if(e.passKeys){const h=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(h){const d=s.get(h)||0;l=h+"-"+d,s.set(h,d+1)}}const u=fj(e,a,l);u!==void 0&&n.push(u)}return n}function xX(e,t,n){const r=GY(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?zY(n):QY(n)),r.property==="style"){let s=typeof n=="object"?n:wX(e,String(n));return e.stylePropertyNameCase==="css"&&(s=SX(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?VY[r.property]||r.property:r.attribute,n]}}function wX(e,t){try{return iX(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new yr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=hj+"#cannot-parse-style-attribute",s}}function pj(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let a=-1,l;for(;++a<s.length;){const u=QE(s[a])?{type:"Identifier",name:s[a]}:{type:"Literal",value:s[a]};l=l?{type:"MemberExpression",object:l,property:u,computed:!!(a&&u.type==="Literal"),optional:!1}:u}r=l}else r=QE(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return zx.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);_d(e)}function _d(e,t){const n=new yr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=hj+"#cannot-handle-mdx-estrees-without-createevaluater",n}function SX(e){const t={};let n;for(n in e)zx.call(e,n)&&(t[CX(n)]=e[n]);return t}function CX(e){let t=e.replace(aX,kX);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function kX(e){return"-"+e.toLowerCase()}const Q_={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},EX={};function Ix(e,t){const n=EX,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return gj(e,r,s)}function gj(e,t,n){if(RX(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return lR(e.children,t,n)}return Array.isArray(e)?lR(e,t,n):""}function lR(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=gj(e[s],t,n);return r.join("")}function RX(e){return!!(e&&typeof e=="object")}const cR=document.createElement("i");function Hx(e){const t="&"+e+";";cR.innerHTML=t;const n=cR.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function si(e,t,n,r){const s=e.length;let a=0,l;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);a<r.length;)l=r.slice(a,a+1e4),l.unshift(t,0),e.splice(...l),a+=1e4,t+=1e4}function Ei(e,t){return e.length>0?(si(e,e.length,0,t),e):t}const uR={}.hasOwnProperty;function vj(e){const t={};let n=-1;for(;++n<e.length;)TX(t,e[n]);return t}function TX(e,t){let n;for(n in t){const s=(uR.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let l;if(a)for(l in a){uR.call(s,l)||(s[l]=[]);const u=a[l];NX(s[l],Array.isArray(u)?u:u?[u]:[])}}}function NX(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);si(e,0,0,r)}function _j(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ui(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Rr=ia(/[A-Za-z]/),_r=ia(/[\dA-Za-z]/),MX=ia(/[#-'*+\--9=?A-Z^-~]/);function Wm(e){return e!==null&&(e<32||e===127)}const Zy=ia(/\d/),AX=ia(/[\dA-Fa-f]/),DX=ia(/[!-/:-@[-`{-~]/);function Je(e){return e!==null&&e<-2}function rn(e){return e!==null&&(e<0||e===32)}function Rt(e){return e===-2||e===-1||e===32}const Bp=ia(new RegExp("\\p{P}|\\p{S}","u")),Za=ia(/\s/);function ia(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Mc(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const a=e.charCodeAt(n);let l="";if(a===37&&_r(e.charCodeAt(n+1))&&_r(e.charCodeAt(n+2)))s=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(l=String.fromCharCode(a));else if(a>55295&&a<57344){const u=e.charCodeAt(n+1);a<56320&&u>56319&&u<57344?(l=String.fromCharCode(a,u),s=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+s+1,l=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Lt(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(h){return Rt(h)?(e.enter(n),u(h)):t(h)}function u(h){return Rt(h)&&a++<s?(e.consume(h),u):(e.exit(n),t(h))}}const jX={tokenize:OX};function OX(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Lt(e,t,"linePrefix")}function s(u){return e.enter("paragraph"),a(u)}function a(u){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,l(u)}function l(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return Je(u)?(e.consume(u),e.exit("chunkText"),a):(e.consume(u),l)}}const LX={tokenize:zX},dR={tokenize:PX};function zX(e){const t=this,n=[];let r=0,s,a,l;return u;function u(E){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,h,d)(E)}return d(E)}function h(E){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&R();const N=t.events.length;let j=N,D;for(;j--;)if(t.events[j][0]==="exit"&&t.events[j][1].type==="chunkFlow"){D=t.events[j][1].end;break}k(r);let L=N;for(;L<t.events.length;)t.events[L][1].end={...D},L++;return si(t.events,j+1,0,t.events.slice(N)),t.events.length=L,d(E)}return u(E)}function d(E){if(r===n.length){if(!s)return v(E);if(s.currentConstruct&&s.currentConstruct.concrete)return w(E);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(dR,g,p)(E)}function g(E){return s&&R(),k(r),v(E)}function p(E){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,w(E)}function v(E){return t.containerState={},e.attempt(dR,y,w)(E)}function y(E){return r++,n.push([t.currentConstruct,t.containerState]),v(E)}function w(E){if(E===null){s&&R(),k(0),e.consume(E);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:a}),S(E)}function S(E){if(E===null){C(e.exit("chunkFlow"),!0),k(0),e.consume(E);return}return Je(E)?(e.consume(E),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,u):(e.consume(E),S)}function C(E,N){const j=t.sliceStream(E);if(N&&j.push(null),E.previous=a,a&&(a.next=E),a=E,s.defineSkip(E.start),s.write(j),t.parser.lazy[E.start.line]){let D=s.events.length;for(;D--;)if(s.events[D][1].start.offset<l&&(!s.events[D][1].end||s.events[D][1].end.offset>l))return;const L=t.events.length;let U=L,Y,P;for(;U--;)if(t.events[U][0]==="exit"&&t.events[U][1].type==="chunkFlow"){if(Y){P=t.events[U][1].end;break}Y=!0}for(k(r),D=L;D<t.events.length;)t.events[D][1].end={...P},D++;si(t.events,U+1,0,t.events.slice(L)),t.events.length=D}}function k(E){let N=n.length;for(;N-- >E;){const j=n[N];t.containerState=j[1],j[0].exit.call(t,e)}n.length=E}function R(){s.write([null]),a=void 0,s=void 0,t.containerState._closeFlow=void 0}}function PX(e,t,n){return Lt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function mc(e){if(e===null||rn(e)||Za(e))return 1;if(Bp(e))return 2}function Ip(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const a=e[s].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const Qy={name:"attention",resolveAll:BX,tokenize:IX};function BX(e,t){let n=-1,r,s,a,l,u,h,d,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[r][1].end},v={...e[n][1].start};hR(p,-h),hR(v,h),l={type:h>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},u={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:v},a={type:h>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:h>1?"strong":"emphasis",start:{...l.start},end:{...u.end}},e[r][1].end={...l.start},e[n][1].start={...u.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=Ei(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=Ei(d,[["enter",s,t],["enter",l,t],["exit",l,t],["enter",a,t]]),d=Ei(d,Ip(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=Ei(d,[["exit",a,t],["enter",u,t],["exit",u,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,d=Ei(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,si(e,r-1,n-r+3,d),n=r+d.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function IX(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=mc(r);let a;return l;function l(h){return a=h,e.enter("attentionSequence"),u(h)}function u(h){if(h===a)return e.consume(h),u;const d=e.exit("attentionSequence"),g=mc(h),p=!g||g===2&&s||n.includes(h),v=!s||s===2&&g||n.includes(r);return d._open=!!(a===42?p:p&&(s||!v)),d._close=!!(a===42?v:v&&(g||!p)),t(h)}}function hR(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const HX={name:"autolink",tokenize:FX};function FX(e,t,n){let r=0;return s;function s(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(y){return Rr(y)?(e.consume(y),l):y===64?n(y):d(y)}function l(y){return y===43||y===45||y===46||_r(y)?(r=1,u(y)):d(y)}function u(y){return y===58?(e.consume(y),r=0,h):(y===43||y===45||y===46||_r(y))&&r++<32?(e.consume(y),u):(r=0,d(y))}function h(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||Wm(y)?n(y):(e.consume(y),h)}function d(y){return y===64?(e.consume(y),g):MX(y)?(e.consume(y),d):n(y)}function g(y){return _r(y)?p(y):n(y)}function p(y){return y===46?(e.consume(y),r=0,g):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):v(y)}function v(y){if((y===45||_r(y))&&r++<63){const w=y===45?v:p;return e.consume(y),w}return n(y)}}const Wd={partial:!0,tokenize:UX};function UX(e,t,n){return r;function r(a){return Rt(a)?Lt(e,s,"linePrefix")(a):s(a)}function s(a){return a===null||Je(a)?t(a):n(a)}}const bj={continuation:{tokenize:WX},exit:VX,name:"blockQuote",tokenize:$X};function $X(e,t,n){const r=this;return s;function s(l){if(l===62){const u=r.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),a}return n(l)}function a(l){return Rt(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function WX(e,t,n){const r=this;return s;function s(l){return Rt(l)?Lt(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):a(l)}function a(l){return e.attempt(bj,t,n)(l)}}function VX(e){e.exit("blockQuote")}const yj={name:"characterEscape",tokenize:qX};function qX(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),s}function s(a){return DX(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const xj={name:"characterReference",tokenize:KX};function KX(e,t,n){const r=this;let s=0,a,l;return u;function u(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),h}function h(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),a=31,l=_r,g(p))}function d(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,l=AX,g):(e.enter("characterReferenceValue"),a=7,l=Zy,g(p))}function g(p){if(p===59&&s){const v=e.exit("characterReferenceValue");return l===_r&&!Hx(r.sliceSerialize(v))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(p)&&s++<a?(e.consume(p),g):n(p)}}const fR={partial:!0,tokenize:YX},mR={concrete:!0,name:"codeFenced",tokenize:GX};function GX(e,t,n){const r=this,s={partial:!0,tokenize:j};let a=0,l=0,u;return h;function h(D){return d(D)}function d(D){const L=r.events[r.events.length-1];return a=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,u=D,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(D)}function g(D){return D===u?(l++,e.consume(D),g):l<3?n(D):(e.exit("codeFencedFenceSequence"),Rt(D)?Lt(e,p,"whitespace")(D):p(D))}function p(D){return D===null||Je(D)?(e.exit("codeFencedFence"),r.interrupt?t(D):e.check(fR,S,N)(D)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(D))}function v(D){return D===null||Je(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(D)):Rt(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Lt(e,y,"whitespace")(D)):D===96&&D===u?n(D):(e.consume(D),v)}function y(D){return D===null||Je(D)?p(D):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(D))}function w(D){return D===null||Je(D)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(D)):D===96&&D===u?n(D):(e.consume(D),w)}function S(D){return e.attempt(s,N,C)(D)}function C(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),k}function k(D){return a>0&&Rt(D)?Lt(e,R,"linePrefix",a+1)(D):R(D)}function R(D){return D===null||Je(D)?e.check(fR,S,N)(D):(e.enter("codeFlowValue"),E(D))}function E(D){return D===null||Je(D)?(e.exit("codeFlowValue"),R(D)):(e.consume(D),E)}function N(D){return e.exit("codeFenced"),t(D)}function j(D,L,U){let Y=0;return P;function P(q){return D.enter("lineEnding"),D.consume(q),D.exit("lineEnding"),V}function V(q){return D.enter("codeFencedFence"),Rt(q)?Lt(D,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):I(q)}function I(q){return q===u?(D.enter("codeFencedFenceSequence"),W(q)):U(q)}function W(q){return q===u?(Y++,D.consume(q),W):Y>=l?(D.exit("codeFencedFenceSequence"),Rt(q)?Lt(D,K,"whitespace")(q):K(q)):U(q)}function K(q){return q===null||Je(q)?(D.exit("codeFencedFence"),L(q)):U(q)}}}function YX(e,t,n){const r=this;return s;function s(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const J_={name:"codeIndented",tokenize:ZX},XX={partial:!0,tokenize:QX};function ZX(e,t,n){const r=this;return s;function s(d){return e.enter("codeIndented"),Lt(e,a,"linePrefix",5)(d)}function a(d){const g=r.events[r.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?l(d):n(d)}function l(d){return d===null?h(d):Je(d)?e.attempt(XX,l,h)(d):(e.enter("codeFlowValue"),u(d))}function u(d){return d===null||Je(d)?(e.exit("codeFlowValue"),l(d)):(e.consume(d),u)}function h(d){return e.exit("codeIndented"),t(d)}}function QX(e,t,n){const r=this;return s;function s(l){return r.parser.lazy[r.now().line]?n(l):Je(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):Lt(e,a,"linePrefix",5)(l)}function a(l){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):Je(l)?s(l):n(l)}}const JX={name:"codeText",previous:tZ,resolve:eZ,tokenize:nZ};function eZ(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function tZ(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function nZ(e,t,n){let r=0,s,a;return l;function l(p){return e.enter("codeText"),e.enter("codeTextSequence"),u(p)}function u(p){return p===96?(e.consume(p),r++,u):(e.exit("codeTextSequence"),h(p))}function h(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),h):p===96?(a=e.enter("codeTextSequence"),s=0,g(p)):Je(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),h):(e.enter("codeTextData"),d(p))}function d(p){return p===null||p===32||p===96||Je(p)?(e.exit("codeTextData"),h(p)):(e.consume(p),d)}function g(p){return p===96?(e.consume(p),s++,g):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(a.type="codeTextData",d(p))}}class rZ{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&ju(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ju(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ju(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ju(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ju(this.left,n.reverse())}}}function ju(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function wj(e){const t={};let n=-1,r,s,a,l,u,h,d;const g=new rZ(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(r=g.get(n),n&&r[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(h=r[1]._tokenizer.events,a=0,a<h.length&&h[a][1].type==="lineEndingBlank"&&(a+=2),a<h.length&&h[a][1].type==="content"))for(;++a<h.length&&h[a][1].type!=="content";)h[a][1].type==="chunkText"&&(h[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,iZ(g,n)),n=t[n],d=!0);else if(r[1]._container){for(a=n,s=void 0;a--;)if(l=g.get(a),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(s&&(g.get(s)[1].type="lineEndingBlank"),l[1].type="lineEnding",s=a);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;s&&(r[1].end={...g.get(s)[1].start},u=g.slice(s,n),u.unshift(r),g.splice(s,n-s+1,u))}}return si(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!d}function iZ(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const a=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const u=l.events,h=[],d={};let g,p,v=-1,y=n,w=0,S=0;const C=[S];for(;y;){for(;e.get(++s)[1]!==y;);a.push(s),y._tokenizer||(g=r.sliceStream(y),y.next||g.push(null),p&&l.defineSkip(y.start),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(g),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),p=y,y=y.next}for(y=n;++v<u.length;)u[v][0]==="exit"&&u[v-1][0]==="enter"&&u[v][1].type===u[v-1][1].type&&u[v][1].start.line!==u[v][1].end.line&&(S=v+1,C.push(S),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(l.events=[],y?(y._tokenizer=void 0,y.previous=void 0):C.pop(),v=C.length;v--;){const k=u.slice(C[v],C[v+1]),R=a.pop();h.push([R,R+k.length-1]),e.splice(R,2,k)}for(h.reverse(),v=-1;++v<h.length;)d[w+h[v][0]]=w+h[v][1],w+=h[v][1]-h[v][0]-1;return d}const sZ={resolve:aZ,tokenize:lZ},oZ={partial:!0,tokenize:cZ};function aZ(e){return wj(e),e}function lZ(e,t){let n;return r;function r(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(u)}function s(u){return u===null?a(u):Je(u)?e.check(oZ,l,a)(u):(e.consume(u),s)}function a(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function l(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function cZ(e,t,n){const r=this;return s;function s(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Lt(e,a,"linePrefix")}function a(l){if(l===null||Je(l))return n(l);const u=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function Sj(e,t,n,r,s,a,l,u,h){const d=h||Number.POSITIVE_INFINITY;let g=0;return p;function p(k){return k===60?(e.enter(r),e.enter(s),e.enter(a),e.consume(k),e.exit(a),v):k===null||k===32||k===41||Wm(k)?n(k):(e.enter(r),e.enter(l),e.enter(u),e.enter("chunkString",{contentType:"string"}),S(k))}function v(k){return k===62?(e.enter(a),e.consume(k),e.exit(a),e.exit(s),e.exit(r),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),y(k))}function y(k){return k===62?(e.exit("chunkString"),e.exit(u),v(k)):k===null||k===60||Je(k)?n(k):(e.consume(k),k===92?w:y)}function w(k){return k===60||k===62||k===92?(e.consume(k),y):y(k)}function S(k){return!g&&(k===null||k===41||rn(k))?(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(r),t(k)):g<d&&k===40?(e.consume(k),g++,S):k===41?(e.consume(k),g--,S):k===null||k===32||k===40||Wm(k)?n(k):(e.consume(k),k===92?C:S)}function C(k){return k===40||k===41||k===92?(e.consume(k),S):S(k)}}function Cj(e,t,n,r,s,a){const l=this;let u=0,h;return d;function d(y){return e.enter(r),e.enter(s),e.consume(y),e.exit(s),e.enter(a),g}function g(y){return u>999||y===null||y===91||y===93&&!h||y===94&&!u&&"_hiddenFootnoteSupport"in l.parser.constructs?n(y):y===93?(e.exit(a),e.enter(s),e.consume(y),e.exit(s),e.exit(r),t):Je(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===null||y===91||y===93||Je(y)||u++>999?(e.exit("chunkString"),g(y)):(e.consume(y),h||(h=!Rt(y)),y===92?v:p)}function v(y){return y===91||y===92||y===93?(e.consume(y),u++,p):p(y)}}function kj(e,t,n,r,s,a){let l;return u;function u(v){return v===34||v===39||v===40?(e.enter(r),e.enter(s),e.consume(v),e.exit(s),l=v===40?41:v,h):n(v)}function h(v){return v===l?(e.enter(s),e.consume(v),e.exit(s),e.exit(r),t):(e.enter(a),d(v))}function d(v){return v===l?(e.exit(a),h(l)):v===null?n(v):Je(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),Lt(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===l||v===null||Je(v)?(e.exit("chunkString"),d(v)):(e.consume(v),v===92?p:g)}function p(v){return v===l||v===92?(e.consume(v),g):g(v)}}function td(e,t){let n;return r;function r(s){return Je(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Rt(s)?Lt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const uZ={name:"definition",tokenize:hZ},dZ={partial:!0,tokenize:fZ};function hZ(e,t,n){const r=this;let s;return a;function a(y){return e.enter("definition"),l(y)}function l(y){return Cj.call(r,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function u(y){return s=Ui(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),h):n(y)}function h(y){return rn(y)?td(e,d)(y):d(y)}function d(y){return Sj(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function g(y){return e.attempt(dZ,p,p)(y)}function p(y){return Rt(y)?Lt(e,v,"whitespace")(y):v(y)}function v(y){return y===null||Je(y)?(e.exit("definition"),r.parser.defined.push(s),t(y)):n(y)}}function fZ(e,t,n){return r;function r(u){return rn(u)?td(e,s)(u):n(u)}function s(u){return kj(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function a(u){return Rt(u)?Lt(e,l,"whitespace")(u):l(u)}function l(u){return u===null||Je(u)?t(u):n(u)}}const mZ={name:"hardBreakEscape",tokenize:pZ};function pZ(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),s}function s(a){return Je(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const gZ={name:"headingAtx",resolve:vZ,tokenize:_Z};function vZ(e,t){let n=e.length-2,r=3,s,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},si(e,r,n-r+1,[["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t]])),e}function _Z(e,t,n){let r=0;return s;function s(g){return e.enter("atxHeading"),a(g)}function a(g){return e.enter("atxHeadingSequence"),l(g)}function l(g){return g===35&&r++<6?(e.consume(g),l):g===null||rn(g)?(e.exit("atxHeadingSequence"),u(g)):n(g)}function u(g){return g===35?(e.enter("atxHeadingSequence"),h(g)):g===null||Je(g)?(e.exit("atxHeading"),t(g)):Rt(g)?Lt(e,u,"whitespace")(g):(e.enter("atxHeadingText"),d(g))}function h(g){return g===35?(e.consume(g),h):(e.exit("atxHeadingSequence"),u(g))}function d(g){return g===null||g===35||rn(g)?(e.exit("atxHeadingText"),u(g)):(e.consume(g),d)}}const bZ=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],pR=["pre","script","style","textarea"],yZ={concrete:!0,name:"htmlFlow",resolveTo:SZ,tokenize:CZ},xZ={partial:!0,tokenize:EZ},wZ={partial:!0,tokenize:kZ};function SZ(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function CZ(e,t,n){const r=this;let s,a,l,u,h;return d;function d(A){return g(A)}function g(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),p}function p(A){return A===33?(e.consume(A),v):A===47?(e.consume(A),a=!0,S):A===63?(e.consume(A),s=3,r.interrupt?t:M):Rr(A)?(e.consume(A),l=String.fromCharCode(A),C):n(A)}function v(A){return A===45?(e.consume(A),s=2,y):A===91?(e.consume(A),s=5,u=0,w):Rr(A)?(e.consume(A),s=4,r.interrupt?t:M):n(A)}function y(A){return A===45?(e.consume(A),r.interrupt?t:M):n(A)}function w(A){const re="CDATA[";return A===re.charCodeAt(u++)?(e.consume(A),u===re.length?r.interrupt?t:I:w):n(A)}function S(A){return Rr(A)?(e.consume(A),l=String.fromCharCode(A),C):n(A)}function C(A){if(A===null||A===47||A===62||rn(A)){const re=A===47,se=l.toLowerCase();return!re&&!a&&pR.includes(se)?(s=1,r.interrupt?t(A):I(A)):bZ.includes(l.toLowerCase())?(s=6,re?(e.consume(A),k):r.interrupt?t(A):I(A)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(A):a?R(A):E(A))}return A===45||_r(A)?(e.consume(A),l+=String.fromCharCode(A),C):n(A)}function k(A){return A===62?(e.consume(A),r.interrupt?t:I):n(A)}function R(A){return Rt(A)?(e.consume(A),R):P(A)}function E(A){return A===47?(e.consume(A),P):A===58||A===95||Rr(A)?(e.consume(A),N):Rt(A)?(e.consume(A),E):P(A)}function N(A){return A===45||A===46||A===58||A===95||_r(A)?(e.consume(A),N):j(A)}function j(A){return A===61?(e.consume(A),D):Rt(A)?(e.consume(A),j):E(A)}function D(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),h=A,L):Rt(A)?(e.consume(A),D):U(A)}function L(A){return A===h?(e.consume(A),h=null,Y):A===null||Je(A)?n(A):(e.consume(A),L)}function U(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||rn(A)?j(A):(e.consume(A),U)}function Y(A){return A===47||A===62||Rt(A)?E(A):n(A)}function P(A){return A===62?(e.consume(A),V):n(A)}function V(A){return A===null||Je(A)?I(A):Rt(A)?(e.consume(A),V):n(A)}function I(A){return A===45&&s===2?(e.consume(A),O):A===60&&s===1?(e.consume(A),F):A===62&&s===4?(e.consume(A),B):A===63&&s===3?(e.consume(A),M):A===93&&s===5?(e.consume(A),$):Je(A)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(xZ,X,W)(A)):A===null||Je(A)?(e.exit("htmlFlowData"),W(A)):(e.consume(A),I)}function W(A){return e.check(wZ,K,X)(A)}function K(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),q}function q(A){return A===null||Je(A)?W(A):(e.enter("htmlFlowData"),I(A))}function O(A){return A===45?(e.consume(A),M):I(A)}function F(A){return A===47?(e.consume(A),l="",H):I(A)}function H(A){if(A===62){const re=l.toLowerCase();return pR.includes(re)?(e.consume(A),B):I(A)}return Rr(A)&&l.length<8?(e.consume(A),l+=String.fromCharCode(A),H):I(A)}function $(A){return A===93?(e.consume(A),M):I(A)}function M(A){return A===62?(e.consume(A),B):A===45&&s===2?(e.consume(A),M):I(A)}function B(A){return A===null||Je(A)?(e.exit("htmlFlowData"),X(A)):(e.consume(A),B)}function X(A){return e.exit("htmlFlow"),t(A)}}function kZ(e,t,n){const r=this;return s;function s(l){return Je(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):n(l)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function EZ(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Wd,t,n)}}const RZ={name:"htmlText",tokenize:TZ};function TZ(e,t,n){const r=this;let s,a,l;return u;function u(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),h}function h(M){return M===33?(e.consume(M),d):M===47?(e.consume(M),j):M===63?(e.consume(M),E):Rr(M)?(e.consume(M),U):n(M)}function d(M){return M===45?(e.consume(M),g):M===91?(e.consume(M),a=0,w):Rr(M)?(e.consume(M),R):n(M)}function g(M){return M===45?(e.consume(M),y):n(M)}function p(M){return M===null?n(M):M===45?(e.consume(M),v):Je(M)?(l=p,F(M)):(e.consume(M),p)}function v(M){return M===45?(e.consume(M),y):p(M)}function y(M){return M===62?O(M):M===45?v(M):p(M)}function w(M){const B="CDATA[";return M===B.charCodeAt(a++)?(e.consume(M),a===B.length?S:w):n(M)}function S(M){return M===null?n(M):M===93?(e.consume(M),C):Je(M)?(l=S,F(M)):(e.consume(M),S)}function C(M){return M===93?(e.consume(M),k):S(M)}function k(M){return M===62?O(M):M===93?(e.consume(M),k):S(M)}function R(M){return M===null||M===62?O(M):Je(M)?(l=R,F(M)):(e.consume(M),R)}function E(M){return M===null?n(M):M===63?(e.consume(M),N):Je(M)?(l=E,F(M)):(e.consume(M),E)}function N(M){return M===62?O(M):E(M)}function j(M){return Rr(M)?(e.consume(M),D):n(M)}function D(M){return M===45||_r(M)?(e.consume(M),D):L(M)}function L(M){return Je(M)?(l=L,F(M)):Rt(M)?(e.consume(M),L):O(M)}function U(M){return M===45||_r(M)?(e.consume(M),U):M===47||M===62||rn(M)?Y(M):n(M)}function Y(M){return M===47?(e.consume(M),O):M===58||M===95||Rr(M)?(e.consume(M),P):Je(M)?(l=Y,F(M)):Rt(M)?(e.consume(M),Y):O(M)}function P(M){return M===45||M===46||M===58||M===95||_r(M)?(e.consume(M),P):V(M)}function V(M){return M===61?(e.consume(M),I):Je(M)?(l=V,F(M)):Rt(M)?(e.consume(M),V):Y(M)}function I(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),s=M,W):Je(M)?(l=I,F(M)):Rt(M)?(e.consume(M),I):(e.consume(M),K)}function W(M){return M===s?(e.consume(M),s=void 0,q):M===null?n(M):Je(M)?(l=W,F(M)):(e.consume(M),W)}function K(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||rn(M)?Y(M):(e.consume(M),K)}function q(M){return M===47||M===62||rn(M)?Y(M):n(M)}function O(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function F(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),H}function H(M){return Rt(M)?Lt(e,$,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):$(M)}function $(M){return e.enter("htmlTextData"),l(M)}}const Fx={name:"labelEnd",resolveAll:DZ,resolveTo:jZ,tokenize:OZ},NZ={tokenize:LZ},MZ={tokenize:zZ},AZ={tokenize:PZ};function DZ(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&si(e,0,e.length,n),e}function jZ(e,t){let n=e.length,r=0,s,a,l,u;for(;n--;)if(s=e[n][1],a){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(a=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(l=n);const h={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[a][1].start},end:{...e[l][1].end}},g={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[l-2][1].start}};return u=[["enter",h,t],["enter",d,t]],u=Ei(u,e.slice(a+1,a+r+3)),u=Ei(u,[["enter",g,t]]),u=Ei(u,Ip(t.parser.constructs.insideSpan.null,e.slice(a+r+4,l-3),t)),u=Ei(u,[["exit",g,t],e[l-2],e[l-1],["exit",d,t]]),u=Ei(u,e.slice(l+1)),u=Ei(u,[["exit",h,t]]),si(e,a,e.length,u),e}function OZ(e,t,n){const r=this;let s=r.events.length,a,l;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){a=r.events[s][1];break}return u;function u(v){return a?a._inactive?p(v):(l=r.parser.defined.includes(Ui(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),h):n(v)}function h(v){return v===40?e.attempt(NZ,g,l?g:p)(v):v===91?e.attempt(MZ,g,l?d:p)(v):l?g(v):p(v)}function d(v){return e.attempt(AZ,g,p)(v)}function g(v){return t(v)}function p(v){return a._balanced=!0,n(v)}}function LZ(e,t,n){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),s}function s(p){return rn(p)?td(e,a)(p):a(p)}function a(p){return p===41?g(p):Sj(e,l,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function l(p){return rn(p)?td(e,h)(p):g(p)}function u(p){return n(p)}function h(p){return p===34||p===39||p===40?kj(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):g(p)}function d(p){return rn(p)?td(e,g)(p):g(p)}function g(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function zZ(e,t,n){const r=this;return s;function s(u){return Cj.call(r,e,a,l,"reference","referenceMarker","referenceString")(u)}function a(u){return r.parser.defined.includes(Ui(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function l(u){return n(u)}}function PZ(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),s}function s(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const BZ={name:"labelStartImage",resolveAll:Fx.resolveAll,tokenize:IZ};function IZ(e,t,n){const r=this;return s;function s(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),a}function a(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelImage"),l):n(u)}function l(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):t(u)}}const HZ={name:"labelStartLink",resolveAll:Fx.resolveAll,tokenize:FZ};function FZ(e,t,n){const r=this;return s;function s(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),a}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const eb={name:"lineEnding",tokenize:UZ};function UZ(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Lt(e,t,"linePrefix")}}const um={name:"thematicBreak",tokenize:$Z};function $Z(e,t,n){let r=0,s;return a;function a(d){return e.enter("thematicBreak"),l(d)}function l(d){return s=d,u(d)}function u(d){return d===s?(e.enter("thematicBreakSequence"),h(d)):r>=3&&(d===null||Je(d))?(e.exit("thematicBreak"),t(d)):n(d)}function h(d){return d===s?(e.consume(d),r++,h):(e.exit("thematicBreakSequence"),Rt(d)?Lt(e,u,"whitespace")(d):u(d))}}const Fr={continuation:{tokenize:KZ},exit:YZ,name:"list",tokenize:qZ},WZ={partial:!0,tokenize:XZ},VZ={partial:!0,tokenize:GZ};function qZ(e,t,n){const r=this,s=r.events[r.events.length-1];let a=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return u;function u(y){const w=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:Zy(y)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(um,n,d)(y):d(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(y)}return n(y)}function h(y){return Zy(y)&&++l<10?(e.consume(y),h):(!r.interrupt||l<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),d(y)):n(y)}function d(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(Wd,r.interrupt?n:g,e.attempt(WZ,v,p))}function g(y){return r.containerState.initialBlankLine=!0,a++,v(y)}function p(y){return Rt(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),v):n(y)}function v(y){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function KZ(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Wd,s,a);function s(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Lt(e,t,"listItemIndent",r.containerState.size+1)(u)}function a(u){return r.containerState.furtherBlankLines||!Rt(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(VZ,t,l)(u))}function l(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,Lt(e,e.attempt(Fr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function GZ(e,t,n){const r=this;return Lt(e,s,"listItemIndent",r.containerState.size+1);function s(a){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(a):n(a)}}function YZ(e){e.exit(this.containerState.type)}function XZ(e,t,n){const r=this;return Lt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(a){const l=r.events[r.events.length-1];return!Rt(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const gR={name:"setextUnderline",resolveTo:ZZ,tokenize:QZ};function ZZ(e,t){let n=e.length,r,s,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",a?(e.splice(s,0,["enter",l,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function QZ(e,t,n){const r=this;let s;return a;function a(d){let g=r.events.length,p;for(;g--;)if(r.events[g][1].type!=="lineEnding"&&r.events[g][1].type!=="linePrefix"&&r.events[g][1].type!=="content"){p=r.events[g][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),s=d,l(d)):n(d)}function l(d){return e.enter("setextHeadingLineSequence"),u(d)}function u(d){return d===s?(e.consume(d),u):(e.exit("setextHeadingLineSequence"),Rt(d)?Lt(e,h,"lineSuffix")(d):h(d))}function h(d){return d===null||Je(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const JZ={tokenize:eQ};function eQ(e){const t=this,n=e.attempt(Wd,r,e.attempt(this.parser.constructs.flowInitial,s,Lt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(sZ,s)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const tQ={resolveAll:Rj()},nQ=Ej("string"),rQ=Ej("text");function Ej(e){return{resolveAll:Rj(e==="text"?iQ:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],a=n.attempt(s,l,u);return l;function l(g){return d(g)?a(g):u(g)}function u(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),h}function h(g){return d(g)?(n.exit("data"),a(g)):(n.consume(g),h)}function d(g){if(g===null)return!0;const p=s[g];let v=-1;if(p)for(;++v<p.length;){const y=p[v];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function Rj(e){return t;function t(n,r){let s=-1,a;for(;++s<=n.length;)a===void 0?n[s]&&n[s][1].type==="data"&&(a=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==a+2&&(n[a][1].end=n[s-1][1].end,n.splice(a+2,s-a-2),s=a+2),a=void 0);return e?e(n,r):n}}function iQ(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let a=s.length,l=-1,u=0,h;for(;a--;){const d=s[a];if(typeof d=="string"){for(l=d.length;d.charCodeAt(l-1)===32;)u++,l--;if(l)break;l=-1}else if(d===-2)h=!0,u++;else if(d!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const d={type:n===e.length||h||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?l:r.start._bufferIndex+l,_index:r.start._index+a,line:r.end.line,column:r.end.column-u,offset:r.end.offset-u},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(e.splice(n,0,["enter",d,t],["exit",d,t]),n+=2)}n++}return e}const sQ={42:Fr,43:Fr,45:Fr,48:Fr,49:Fr,50:Fr,51:Fr,52:Fr,53:Fr,54:Fr,55:Fr,56:Fr,57:Fr,62:bj},oQ={91:uZ},aQ={[-2]:J_,[-1]:J_,32:J_},lQ={35:gZ,42:um,45:[gR,um],60:yZ,61:gR,95:um,96:mR,126:mR},cQ={38:xj,92:yj},uQ={[-5]:eb,[-4]:eb,[-3]:eb,33:BZ,38:xj,42:Qy,60:[HX,RZ],91:HZ,92:[mZ,yj],93:Fx,95:Qy,96:JX},dQ={null:[Qy,tQ]},hQ={null:[42,95]},fQ={null:[]},mQ=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:hQ,contentInitial:oQ,disable:fQ,document:sQ,flow:lQ,flowInitial:aQ,insideSpan:dQ,string:cQ,text:uQ},Symbol.toStringTag,{value:"Module"}));function pQ(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},a=[];let l=[],u=[];const h={attempt:L(j),check:L(D),consume:R,enter:E,exit:N,interrupt:L(D,{interrupt:!0})},d={code:null,containerState:{},defineSkip:S,events:[],now:w,parser:e,previous:null,sliceSerialize:v,sliceStream:y,write:p};let g=t.tokenize.call(d,h);return t.resolveAll&&a.push(t),d;function p(V){return l=Ei(l,V),C(),l[l.length-1]!==null?[]:(U(t,0),d.events=Ip(a,d.events,d),d.events)}function v(V,I){return vQ(y(V),I)}function y(V){return gQ(l,V)}function w(){const{_bufferIndex:V,_index:I,line:W,column:K,offset:q}=r;return{_bufferIndex:V,_index:I,line:W,column:K,offset:q}}function S(V){s[V.line]=V.column,P()}function C(){let V;for(;r._index<l.length;){const I=l[r._index];if(typeof I=="string")for(V=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===V&&r._bufferIndex<I.length;)k(I.charCodeAt(r._bufferIndex));else k(I)}}function k(V){g=g(V)}function R(V){Je(V)?(r.line++,r.column=1,r.offset+=V===-3?2:1,P()):V!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=V}function E(V,I){const W=I||{};return W.type=V,W.start=w(),d.events.push(["enter",W,d]),u.push(W),W}function N(V){const I=u.pop();return I.end=w(),d.events.push(["exit",I,d]),I}function j(V,I){U(V,I.from)}function D(V,I){I.restore()}function L(V,I){return W;function W(K,q,O){let F,H,$,M;return Array.isArray(K)?X(K):"tokenize"in K?X([K]):B(K);function B(Z){return te;function te(le){const pe=le!==null&&Z[le],xe=le!==null&&Z.null,Me=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(xe)?xe:xe?[xe]:[]];return X(Me)(le)}}function X(Z){return F=Z,H=0,Z.length===0?O:A(Z[H])}function A(Z){return te;function te(le){return M=Y(),$=Z,Z.partial||(d.currentConstruct=Z),Z.name&&d.parser.constructs.disable.null.includes(Z.name)?se():Z.tokenize.call(I?Object.assign(Object.create(d),I):d,h,re,se)(le)}}function re(Z){return V($,M),q}function se(Z){return M.restore(),++H<F.length?A(F[H]):O}}}function U(V,I){V.resolveAll&&!a.includes(V)&&a.push(V),V.resolve&&si(d.events,I,d.events.length-I,V.resolve(d.events.slice(I),d)),V.resolveTo&&(d.events=V.resolveTo(d.events,d))}function Y(){const V=w(),I=d.previous,W=d.currentConstruct,K=d.events.length,q=Array.from(u);return{from:K,restore:O};function O(){r=V,d.previous=I,d.currentConstruct=W,d.events.length=K,u=q,P()}}function P(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function gQ(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,a=t.end._bufferIndex;let l;if(n===s)l=[e[n].slice(r,a)];else{if(l=e.slice(n,s),r>-1){const u=l[0];typeof u=="string"?l[0]=u.slice(r):l.shift()}a>0&&l.push(e[s].slice(0,a))}return l}function vQ(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const a=e[n];let l;if(typeof a=="string")l=a;else switch(a){case-5:{l="\r";break}case-4:{l=`
569
- `;break}case-3:{l=`\r
570
- `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&s)continue;l=" ";break}default:l=String.fromCharCode(a)}s=a===-2,r.push(l)}return r.join("")}function _Q(e){const r={constructs:vj([mQ,...(e||{}).extensions||[]]),content:s(jX),defined:[],document:s(LX),flow:s(JZ),lazy:{},string:s(nQ),text:s(rQ)};return r;function s(a){return l;function l(u){return pQ(r,a,u)}}}function bQ(e){for(;!wj(e););return e}const vR=/[\0\t\n\r]/g;function yQ(){let e=1,t="",n=!0,r;return s;function s(a,l,u){const h=[];let d,g,p,v,y;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),p=0,t="",n&&(a.charCodeAt(0)===65279&&p++,n=void 0);p<a.length;){if(vR.lastIndex=p,d=vR.exec(a),v=d&&d.index!==void 0?d.index:a.length,y=a.charCodeAt(v),!d){t=a.slice(p);break}if(y===10&&p===v&&r)h.push(-3),r=void 0;else switch(r&&(h.push(-5),r=void 0),p<v&&(h.push(a.slice(p,v)),e+=v-p),y){case 0:{h.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,h.push(-2);e++<g;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:r=!0,e=1}p=v+1}return u&&(r&&h.push(-5),t&&h.push(t),h.push(null)),h}}const xQ=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function wQ(e){return e.replace(xQ,SQ)}function SQ(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),a=s===120||s===88;return _j(n.slice(a?2:1),a?16:10)}return Hx(n)||e}const Tj={}.hasOwnProperty;function CQ(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),kQ(n)(bQ(_Q(n).document().write(yQ()(e,t,!0))))}function kQ(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Ae),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:a(ft),blockQuote:a(xe),characterEscape:Y,characterReference:Y,codeFenced:a(Me),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(Me,l),codeText:a(Re,l),codeTextData:Y,data:Y,codeFlowValue:Y,definition:a(je),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(Xe),hardBreakEscape:a(pt),hardBreakTrailing:a(pt),htmlFlow:a(he,l),htmlFlowData:Y,htmlText:a(he,l),htmlTextData:Y,image:a(Le),label:l,link:a(Ae),listItem:a(gt),listItemValue:v,listOrdered:a(nt,p),listUnordered:a(nt),paragraph:a(qe),reference:A,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a(ft),strong:a(vt),thematicBreak:a(De)},exit:{atxHeading:h(),atxHeadingSequence:j,autolink:h(),autolinkEmail:pe,autolinkProtocol:le,blockQuote:h(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:Z,characterReference:te,codeFenced:h(C),codeFencedFence:S,codeFencedFenceInfo:y,codeFencedFenceMeta:w,codeFlowValue:P,codeIndented:h(k),codeText:h(q),codeTextData:P,data:P,definition:h(),definitionDestinationString:N,definitionLabelString:R,definitionTitleString:E,emphasis:h(),hardBreakEscape:h(I),hardBreakTrailing:h(I),htmlFlow:h(W),htmlFlowData:P,htmlText:h(K),htmlTextData:P,image:h(F),label:$,labelText:H,lineEnding:V,link:h(O),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:re,resourceDestinationString:M,resourceTitleString:B,resource:X,setextHeading:h(U),setextHeadingLineSequence:L,setextHeadingText:D,strong:h(),thematicBreak:h()}};Nj(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ce){let be={type:"root",children:[]};const Oe={stack:[be],tokenStack:[],config:t,enter:u,exit:d,buffer:l,resume:g,data:n},We=[];let we=-1;for(;++we<ce.length;)if(ce[we][1].type==="listOrdered"||ce[we][1].type==="listUnordered")if(ce[we][0]==="enter")We.push(we);else{const Ie=We.pop();we=s(ce,Ie,we)}for(we=-1;++we<ce.length;){const Ie=t[ce[we][0]];Tj.call(Ie,ce[we][1].type)&&Ie[ce[we][1].type].call(Object.assign({sliceSerialize:ce[we][2].sliceSerialize},Oe),ce[we][1])}if(Oe.tokenStack.length>0){const Ie=Oe.tokenStack[Oe.tokenStack.length-1];(Ie[1]||_R).call(Oe,void 0,Ie[0])}for(be.position={start:Ho(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:Ho(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<t.transforms.length;)be=t.transforms[we](be)||be;return be}function s(ce,be,Oe){let We=be-1,we=-1,Ie=!1,ot,rt,ze,St;for(;++We<=Oe;){const at=ce[We];switch(at[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{at[0]==="enter"?we++:we--,St=void 0;break}case"lineEndingBlank":{at[0]==="enter"&&(ot&&!St&&!we&&!ze&&(ze=We),St=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:St=void 0}if(!we&&at[0]==="enter"&&at[1].type==="listItemPrefix"||we===-1&&at[0]==="exit"&&(at[1].type==="listUnordered"||at[1].type==="listOrdered")){if(ot){let vn=We;for(rt=void 0;vn--;){const tn=ce[vn];if(tn[1].type==="lineEnding"||tn[1].type==="lineEndingBlank"){if(tn[0]==="exit")continue;rt&&(ce[rt][1].type="lineEndingBlank",Ie=!0),tn[1].type="lineEnding",rt=vn}else if(!(tn[1].type==="linePrefix"||tn[1].type==="blockQuotePrefix"||tn[1].type==="blockQuotePrefixWhitespace"||tn[1].type==="blockQuoteMarker"||tn[1].type==="listItemIndent"))break}ze&&(!rt||ze<rt)&&(ot._spread=!0),ot.end=Object.assign({},rt?ce[rt][1].start:at[1].end),ce.splice(rt||We,0,["exit",ot,at[2]]),We++,Oe++}if(at[1].type==="listItemPrefix"){const vn={type:"listItem",_spread:!1,start:Object.assign({},at[1].start),end:void 0};ot=vn,ce.splice(We,0,["enter",vn,at[2]]),We++,Oe++,ze=void 0,St=!0}}}return ce[be][1]._spread=Ie,Oe}function a(ce,be){return Oe;function Oe(We){u.call(this,ce(We),We),be&&be.call(this,We)}}function l(){this.stack.push({type:"fragment",children:[]})}function u(ce,be,Oe){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([be,Oe||void 0]),ce.position={start:Ho(be.start),end:void 0}}function h(ce){return be;function be(Oe){ce&&ce.call(this,Oe),d.call(this,Oe)}}function d(ce,be){const Oe=this.stack.pop(),We=this.tokenStack.pop();if(We)We[0].type!==ce.type&&(be?be.call(this,ce,We[0]):(We[1]||_R).call(this,ce,We[0]));else throw new Error("Cannot close `"+ce.type+"` ("+ed({start:ce.start,end:ce.end})+"): it’s not open");Oe.position.end=Ho(ce.end)}function g(){return Ix(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function v(ce){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.lang=ce}function w(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.meta=ce}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce.replace(/(\r?\n|\r)$/g,"")}function R(ce){const be=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=be,Oe.identifier=Ui(this.sliceSerialize(ce)).toLowerCase()}function E(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.title=ce}function N(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.url=ce}function j(ce){const be=this.stack[this.stack.length-1];if(!be.depth){const Oe=this.sliceSerialize(ce).length;be.depth=Oe}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function L(ce){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(ce){const Oe=this.stack[this.stack.length-1].children;let We=Oe[Oe.length-1];(!We||We.type!=="text")&&(We=Se(),We.position={start:Ho(ce.start),end:void 0},Oe.push(We)),this.stack.push(We)}function P(ce){const be=this.stack.pop();be.value+=this.sliceSerialize(ce),be.position.end=Ho(ce.end)}function V(ce){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Oe=be.children[be.children.length-1];Oe.position.end=Ho(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(Y.call(this,ce),P.call(this,ce))}function I(){this.data.atHardBreak=!0}function W(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce}function K(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce}function q(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce}function O(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=be,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function F(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=be,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function H(ce){const be=this.sliceSerialize(ce),Oe=this.stack[this.stack.length-2];Oe.label=wQ(be),Oe.identifier=Ui(be).toLowerCase()}function $(){const ce=this.stack[this.stack.length-1],be=this.resume(),Oe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Oe.type==="link"){const We=ce.children;Oe.children=We}else Oe.alt=be}function M(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.url=ce}function B(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.title=ce}function X(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function re(ce){const be=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=be,Oe.identifier=Ui(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function se(ce){this.data.characterReferenceType=ce.type}function Z(ce){const be=this.sliceSerialize(ce),Oe=this.data.characterReferenceType;let We;Oe?(We=_j(be,Oe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):We=Hx(be);const we=this.stack[this.stack.length-1];we.value+=We}function te(ce){const be=this.stack.pop();be.position.end=Ho(ce.end)}function le(ce){P.call(this,ce);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(ce)}function pe(ce){P.call(this,ce);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(ce)}function xe(){return{type:"blockquote",children:[]}}function Me(){return{type:"code",lang:null,meta:null,value:""}}function Re(){return{type:"inlineCode",value:""}}function je(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Xe(){return{type:"emphasis",children:[]}}function ft(){return{type:"heading",depth:0,children:[]}}function pt(){return{type:"break"}}function he(){return{type:"html",value:""}}function Le(){return{type:"image",title:null,url:"",alt:null}}function Ae(){return{type:"link",title:null,url:"",children:[]}}function nt(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function gt(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function qe(){return{type:"paragraph",children:[]}}function vt(){return{type:"strong",children:[]}}function Se(){return{type:"text",value:""}}function De(){return{type:"thematicBreak"}}}function Ho(e){return{line:e.line,column:e.column,offset:e.offset}}function Nj(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Nj(e,r):EQ(e,r)}}function EQ(e,t){let n;for(n in t)if(Tj.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function _R(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ed({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ed({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ed({start:t.start,end:t.end})+") is still open")}function RQ(e){const t=this;t.parser=n;function n(r){return CQ(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function TQ(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function NQ(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
571
- `}]}function MQ(e,t){const n=t.value?t.value+`
572
- `:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function AQ(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DQ(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jQ(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Mc(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let l,u=e.footnoteCounts.get(r);u===void 0?(u=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=a+1,u+=1,e.footnoteCounts.set(r,u);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,h);const d={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(t,d),e.applyData(t,d)}function OQ(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function LQ(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Mj(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),a=s[0];a&&a.type==="text"?a.value="["+a.value:s.unshift({type:"text",value:"["});const l=s[s.length-1];return l&&l.type==="text"?l.value+=r:s.push({type:"text",value:r}),s}function zQ(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Mj(e,t);const s={src:Mc(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const a={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,a),e.applyData(t,a)}function PQ(e,t){const n={src:Mc(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function BQ(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function IQ(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Mj(e,t);const s={href:Mc(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const a={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function HQ(e,t){const n={href:Mc(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function FQ(e,t,n){const r=e.all(t),s=n?UQ(n):Aj(t),a={},l=[];if(typeof t.checked=="boolean"){const g=r[0];let p;g&&g.type==="element"&&g.tagName==="p"?p=g:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let u=-1;for(;++u<r.length;){const g=r[u];(s||u!==0||g.type!=="element"||g.tagName!=="p")&&l.push({type:"text",value:`
573
- `}),g.type==="element"&&g.tagName==="p"&&!s?l.push(...g.children):l.push(g)}const h=r[r.length-1];h&&(s||h.type!=="element"||h.tagName!=="p")&&l.push({type:"text",value:`
574
- `});const d={type:"element",tagName:"li",properties:a,children:l};return e.patch(t,d),e.applyData(t,d)}function UQ(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Aj(n[r])}return t}function Aj(e){const t=e.spread;return t??e.children.length>1}function $Q(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const l=r[s];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function WQ(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function VQ(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function qQ(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function KQ(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),s.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=Lx(t.children[1]),h=uj(t.children[t.children.length-1]);u&&h&&(l.position={start:u,end:h}),s.push(l)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,a),e.applyData(t,a)}function GQ(e,t,n){const r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,u=l?l.length:t.children.length;let h=-1;const d=[];for(;++h<u;){const p=t.children[h],v={},y=l?l[h]:void 0;y&&(v.align=y);let w={type:"element",tagName:a,properties:v,children:[]};p&&(w.children=e.all(p),e.patch(p,w),w=e.applyData(p,w)),d.push(w)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,g),e.applyData(t,g)}function YQ(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const bR=9,yR=32;function XQ(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const a=[];for(;r;)a.push(xR(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return a.push(xR(t.slice(s),s>0,!1)),a.join("")}function xR(e,t,n){let r=0,s=e.length;if(t){let a=e.codePointAt(r);for(;a===bR||a===yR;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(s-1);for(;a===bR||a===yR;)s--,a=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function ZQ(e,t){const n={type:"text",value:XQ(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function QQ(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const JQ={blockquote:TQ,break:NQ,code:MQ,delete:AQ,emphasis:DQ,footnoteReference:jQ,heading:OQ,html:LQ,imageReference:zQ,image:PQ,inlineCode:BQ,linkReference:IQ,link:HQ,listItem:FQ,list:$Q,paragraph:WQ,root:VQ,strong:qQ,table:KQ,tableCell:YQ,tableRow:GQ,text:ZQ,thematicBreak:QQ,toml:Bf,yaml:Bf,definition:Bf,footnoteDefinition:Bf};function Bf(){}const Dj=-1,Hp=0,nd=1,Vm=2,Ux=3,$x=4,Wx=5,Vx=6,jj=7,Oj=8,wR=typeof self=="object"?self:globalThis,eJ=(e,t)=>{const n=(s,a)=>(e.set(a,s),s),r=s=>{if(e.has(s))return e.get(s);const[a,l]=t[s];switch(a){case Hp:case Dj:return n(l,s);case nd:{const u=n([],s);for(const h of l)u.push(r(h));return u}case Vm:{const u=n({},s);for(const[h,d]of l)u[r(h)]=r(d);return u}case Ux:return n(new Date(l),s);case $x:{const{source:u,flags:h}=l;return n(new RegExp(u,h),s)}case Wx:{const u=n(new Map,s);for(const[h,d]of l)u.set(r(h),r(d));return u}case Vx:{const u=n(new Set,s);for(const h of l)u.add(r(h));return u}case jj:{const{name:u,message:h}=l;return n(new wR[u](h),s)}case Oj:return n(BigInt(l),s);case"BigInt":return n(Object(BigInt(l)),s);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:u}=new Uint8Array(l);return n(new DataView(u),l)}}return n(new wR[a](l),s)};return r},SR=e=>eJ(new Map,e)(0),Kl="",{toString:tJ}={},{keys:nJ}=Object,Ou=e=>{const t=typeof e;if(t!=="object"||!e)return[Hp,t];const n=tJ.call(e).slice(8,-1);switch(n){case"Array":return[nd,Kl];case"Object":return[Vm,Kl];case"Date":return[Ux,Kl];case"RegExp":return[$x,Kl];case"Map":return[Wx,Kl];case"Set":return[Vx,Kl];case"DataView":return[nd,n]}return n.includes("Array")?[nd,n]:n.includes("Error")?[jj,n]:[Vm,n]},If=([e,t])=>e===Hp&&(t==="function"||t==="symbol"),rJ=(e,t,n,r)=>{const s=(l,u)=>{const h=r.push(l)-1;return n.set(u,h),h},a=l=>{if(n.has(l))return n.get(l);let[u,h]=Ou(l);switch(u){case Hp:{let g=l;switch(h){case"bigint":u=Oj,g=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);g=null;break;case"undefined":return s([Dj],l)}return s([u,g],l)}case nd:{if(h){let v=l;return h==="DataView"?v=new Uint8Array(l.buffer):h==="ArrayBuffer"&&(v=new Uint8Array(l)),s([h,[...v]],l)}const g=[],p=s([u,g],l);for(const v of l)g.push(a(v));return p}case Vm:{if(h)switch(h){case"BigInt":return s([h,l.toString()],l);case"Boolean":case"Number":case"String":return s([h,l.valueOf()],l)}if(t&&"toJSON"in l)return a(l.toJSON());const g=[],p=s([u,g],l);for(const v of nJ(l))(e||!If(Ou(l[v])))&&g.push([a(v),a(l[v])]);return p}case Ux:return s([u,l.toISOString()],l);case $x:{const{source:g,flags:p}=l;return s([u,{source:g,flags:p}],l)}case Wx:{const g=[],p=s([u,g],l);for(const[v,y]of l)(e||!(If(Ou(v))||If(Ou(y))))&&g.push([a(v),a(y)]);return p}case Vx:{const g=[],p=s([u,g],l);for(const v of l)(e||!If(Ou(v)))&&g.push(a(v));return p}}const{message:d}=l;return s([u,{name:h,message:d}],l)};return a},CR=(e,{json:t,lossy:n}={})=>{const r=[];return rJ(!(t||n),!!t,new Map,r)(e),r},qm=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?SR(CR(e,t)):structuredClone(e):(e,t)=>SR(CR(e,t));function iJ(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function sJ(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function oJ(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||iJ,r=e.options.footnoteBackLabel||sJ,s=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let h=-1;for(;++h<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[h]);if(!d)continue;const g=e.all(d),p=String(d.identifier).toUpperCase(),v=Mc(p.toLowerCase());let y=0;const w=[],S=e.footnoteCounts.get(p);for(;S!==void 0&&++y<=S;){w.length>0&&w.push({type:"text",value:" "});let R=typeof n=="string"?n:n(h,y);typeof R=="string"&&(R={type:"text",value:R}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+v+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(h,y),className:["data-footnote-backref"]},children:Array.isArray(R)?R:[R]})}const C=g[g.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const R=C.children[C.children.length-1];R&&R.type==="text"?R.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...w)}else g.push(...w);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+v},children:e.wrap(g,!0)};e.patch(d,k),u.push(k)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...qm(l),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
575
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
576
- `}]}}const Fp=(function(e){if(e==null)return uJ;if(typeof e=="function")return Up(e);if(typeof e=="object")return Array.isArray(e)?aJ(e):lJ(e);if(typeof e=="string")return cJ(e);throw new Error("Expected function, string, or object as test")});function aJ(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Fp(e[n]);return Up(r);function r(...s){let a=-1;for(;++a<t.length;)if(t[a].apply(this,s))return!0;return!1}}function lJ(e){const t=e;return Up(n);function n(r){const s=r;let a;for(a in e)if(s[a]!==t[a])return!1;return!0}}function cJ(e){return Up(t);function t(n){return n&&n.type===e}}function Up(e){return t;function t(n,r,s){return!!(dJ(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function uJ(){return!0}function dJ(e){return e!==null&&typeof e=="object"&&"type"in e}const Lj=[],hJ=!0,Jy=!1,fJ="skip";function zj(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const a=Fp(s),l=r?-1:1;u(e,void 0,[])();function u(h,d,g){const p=h&&typeof h=="object"?h:{};if(typeof p.type=="string"){const y=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(h.type+(y?"<"+y+">":""))+")"})}return v;function v(){let y=Lj,w,S,C;if((!t||a(h,d,g[g.length-1]||void 0))&&(y=mJ(n(h,g)),y[0]===Jy))return y;if("children"in h&&h.children){const k=h;if(k.children&&y[0]!==fJ)for(S=(r?k.children.length:-1)+l,C=g.concat(k);S>-1&&S<k.children.length;){const R=k.children[S];if(w=u(R,S,C)(),w[0]===Jy)return w;S=typeof w[1]=="number"?w[1]:S+l}}return y}}}function mJ(e){return Array.isArray(e)?e:typeof e=="number"?[hJ,e]:e==null?Lj:[e]}function qx(e,t,n,r){let s,a,l;typeof t=="function"&&typeof n!="function"?(a=void 0,l=t,s=n):(a=t,l=n,s=r),zj(e,a,u,s);function u(h,d){const g=d[d.length-1],p=g?g.children.indexOf(h):void 0;return l(h,p,g)}}const e0={}.hasOwnProperty,pJ={};function gJ(e,t){const n=t||pJ,r=new Map,s=new Map,a=new Map,l={...JQ,...n.handlers},u={all:d,applyData:_J,definitionById:r,footnoteById:s,footnoteCounts:a,footnoteOrder:[],handlers:l,one:h,options:n,patch:vJ,wrap:yJ};return qx(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const p=g.type==="definition"?r:s,v=String(g.identifier).toUpperCase();p.has(v)||p.set(v,g)}}),u;function h(g,p){const v=g.type,y=u.handlers[v];if(e0.call(u.handlers,v)&&y)return y(u,g,p);if(u.options.passThrough&&u.options.passThrough.includes(v)){if("children"in g){const{children:S,...C}=g,k=qm(C);return k.children=u.all(g),k}return qm(g)}return(u.options.unknownHandler||bJ)(u,g,p)}function d(g){const p=[];if("children"in g){const v=g.children;let y=-1;for(;++y<v.length;){const w=u.one(v[y],g);if(w){if(y&&v[y-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=kR(w.value)),!Array.isArray(w)&&w.type==="element")){const S=w.children[0];S&&S.type==="text"&&(S.value=kR(S.value))}Array.isArray(w)?p.push(...w):p.push(w)}}}return p}}function vJ(e,t){e.position&&(t.position=sX(e))}function _J(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,a=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&a&&Object.assign(n.properties,qm(a)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function bJ(e,t){const n=t.data||{},r="value"in t&&!(e0.call(n,"hProperties")||e0.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function yJ(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
577
- `});++r<e.length;)r&&n.push({type:"text",value:`
578
- `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
579
- `}),n}function kR(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function ER(e,t){const n=gJ(e,t),r=n.one(e,void 0),s=oJ(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&a.children.push({type:"text",value:`
580
- `},s),a}function xJ(e,t){return e&&"run"in e?async function(n,r){const s=ER(n,{file:r,...t});await e.run(s,r)}:function(n,r){return ER(n,{file:r,...e||t})}}function RR(e){if(e)throw e}var tb,TR;function wJ(){if(TR)return tb;TR=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(d){return typeof Array.isArray=="function"?Array.isArray(d):t.call(d)==="[object Array]"},a=function(d){if(!d||t.call(d)!=="[object Object]")return!1;var g=e.call(d,"constructor"),p=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!g&&!p)return!1;var v;for(v in d);return typeof v>"u"||e.call(d,v)},l=function(d,g){n&&g.name==="__proto__"?n(d,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):d[g.name]=g.newValue},u=function(d,g){if(g==="__proto__")if(e.call(d,g)){if(r)return r(d,g).value}else return;return d[g]};return tb=function h(){var d,g,p,v,y,w,S=arguments[0],C=1,k=arguments.length,R=!1;for(typeof S=="boolean"&&(R=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});C<k;++C)if(d=arguments[C],d!=null)for(g in d)p=u(S,g),v=u(d,g),S!==v&&(R&&v&&(a(v)||(y=s(v)))?(y?(y=!1,w=p&&s(p)?p:[]):w=p&&a(p)?p:{},l(S,{name:g,newValue:h(R,w,v)})):typeof v<"u"&&l(S,{name:g,newValue:v}));return S},tb}var SJ=wJ();const nb=Ym(SJ);function t0(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function CJ(){const e=[],t={run:n,use:r};return t;function n(...s){let a=-1;const l=s.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...s);function u(h,...d){const g=e[++a];let p=-1;if(h){l(h);return}for(;++p<s.length;)(d[p]===null||d[p]===void 0)&&(d[p]=s[p]);s=d,g?kJ(g,u)(...d):l(null,...d)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function kJ(e,t){let n;return r;function r(...l){const u=e.length>l.length;let h;u&&l.push(s);try{h=e.apply(this,l)}catch(d){const g=d;if(u&&n)throw g;return s(g)}u||(h&&h.then&&typeof h.then=="function"?h.then(a,s):h instanceof Error?s(h):a(h))}function s(l,...u){n||(n=!0,t(l,...u))}function a(l){s(null,l)}}const ss={basename:EJ,dirname:RJ,extname:TJ,join:NJ,sep:"/"};function EJ(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Vd(e);let n=0,r=-1,s=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else r<0&&(a=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,u=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else l<0&&(a=!0,l=s+1),u>-1&&(e.codePointAt(s)===t.codePointAt(u--)?u<0&&(r=s):(u=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function RJ(e){if(Vd(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function TJ(e){Vd(e);let t=e.length,n=-1,r=0,s=-1,a=0,l;for(;t--;){const u=e.codePointAt(t);if(u===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),u===46?s<0?s=t:a!==1&&(a=1):s>-1&&(a=-1)}return s<0||n<0||a===0||a===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function NJ(...e){let t=-1,n;for(;++t<e.length;)Vd(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":MJ(n)}function MJ(e){Vd(e);const t=e.codePointAt(0)===47;let n=AJ(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function AJ(e,t){let n="",r=0,s=-1,a=0,l=-1,u,h;for(;++l<=e.length;){if(l<e.length)u=e.codePointAt(l);else{if(u===47)break;u=47}if(u===47){if(!(s===l-1||a===1))if(s!==l-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(h=n.lastIndexOf("/"),h!==n.length-1){h<0?(n="",r=0):(n=n.slice(0,h),r=n.length-1-n.lastIndexOf("/")),s=l,a=0;continue}}else if(n.length>0){n="",r=0,s=l,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,l):n=e.slice(s+1,l),r=l-s-1;s=l,a=0}else u===46&&a>-1?a++:a=-1}return n}function Vd(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const DJ={cwd:jJ};function jJ(){return"/"}function n0(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function OJ(e){if(typeof e=="string")e=new URL(e);else if(!n0(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return LJ(e)}function LJ(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const rb=["history","path","basename","stem","extname","dirname"];class Pj{constructor(t){let n;t?n0(t)?n={path:t}:typeof t=="string"||zJ(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":DJ.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<rb.length;){const a=rb[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let s;for(s in n)rb.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?ss.basename(this.path):void 0}set basename(t){sb(t,"basename"),ib(t,"basename"),this.path=ss.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ss.dirname(this.path):void 0}set dirname(t){NR(this.basename,"dirname"),this.path=ss.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ss.extname(this.path):void 0}set extname(t){if(ib(t,"extname"),NR(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ss.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){n0(t)&&(t=OJ(t)),sb(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ss.basename(this.path,this.extname):void 0}set stem(t){sb(t,"stem"),ib(t,"stem"),this.path=ss.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new yr(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function ib(e,t){if(e&&e.includes(ss.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ss.sep+"`")}function sb(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function NR(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function zJ(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const PJ=(function(e){const r=this.constructor.prototype,s=r[e],a=function(){return s.apply(a,arguments)};return Object.setPrototypeOf(a,r),a}),BJ={}.hasOwnProperty;class Kx extends PJ{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=CJ()}copy(){const t=new Kx;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(nb(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(lb("data",this.frozen),this.namespace[t]=n,this):BJ.call(this.namespace,t)&&this.namespace[t]||void 0:t?(lb("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Hf(t),r=this.parser||this.Parser;return ob("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ob("process",this.parser||this.Parser),ab("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(a,l){const u=Hf(t),h=r.parse(u);r.run(h,u,function(g,p,v){if(g||!p||!v)return d(g);const y=p,w=r.stringify(y,v);FJ(w)?v.value=w:v.result=w,d(g,v)});function d(g,p){g||!p?l(g):a?a(p):n(void 0,p)}}}processSync(t){let n=!1,r;return this.freeze(),ob("processSync",this.parser||this.Parser),ab("processSync",this.compiler||this.Compiler),this.process(t,s),AR("processSync","process",n),r;function s(a,l){n=!0,RR(a),r=l}}run(t,n,r){MR(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(l,u){const h=Hf(n);s.run(t,h,d);function d(g,p,v){const y=p||t;g?u(g):l?l(y):r(void 0,y,v)}}}runSync(t,n){let r=!1,s;return this.run(t,n,a),AR("runSync","run",r),s;function a(l,u){RR(l),s=u,r=!0}}stringify(t,n){this.freeze();const r=Hf(n),s=this.compiler||this.Compiler;return ab("stringify",s),MR(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(lb("use",this.frozen),t!=null)if(typeof t=="function")h(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(d){if(typeof d=="function")h(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[g,...p]=d;h(g,p)}else l(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function l(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(d.plugins),d.settings&&(s.settings=nb(!0,s.settings,d.settings))}function u(d){let g=-1;if(d!=null)if(Array.isArray(d))for(;++g<d.length;){const p=d[g];a(p)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function h(d,g){let p=-1,v=-1;for(;++p<r.length;)if(r[p][0]===d){v=p;break}if(v===-1)r.push([d,...g]);else if(g.length>0){let[y,...w]=g;const S=r[v][1];t0(S)&&t0(y)&&(y=nb(!0,S,y)),r[v]=[d,y,...w]}}}}const IJ=new Kx().freeze();function ob(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ab(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function lb(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function MR(e){if(!t0(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function AR(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Hf(e){return HJ(e)?e:new Pj(e)}function HJ(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function FJ(e){return typeof e=="string"||UJ(e)}function UJ(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const $J="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",DR=[],jR={allowDangerousHtml:!0},WJ=/^(https?|ircs?|mailto|xmpp)$/i,VJ=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function qd(e){const t=qJ(e),n=KJ(e);return GJ(t.runSync(t.parse(n),n),e)}function qJ(e){const t=e.rehypePlugins||DR,n=e.remarkPlugins||DR,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...jR}:jR;return IJ().use(RQ).use(n).use(xJ,r).use(t)}function KJ(e){const t=e.children||"",n=new Pj;return typeof t=="string"&&(n.value=t),n}function GJ(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,a=t.disallowedElements,l=t.skipHtml,u=t.unwrapDisallowed,h=t.urlTransform||YJ;for(const g of VJ)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+$J+g.id,void 0);return qx(e,d),uX(e,{Fragment:f.Fragment,components:s,ignoreInvalidStyle:!0,jsx:f.jsx,jsxs:f.jsxs,passKeys:!0,passNode:!0});function d(g,p,v){if(g.type==="raw"&&v&&typeof p=="number")return l?v.children.splice(p,1):v.children[p]={type:"text",value:g.value},p;if(g.type==="element"){let y;for(y in Q_)if(Object.hasOwn(Q_,y)&&Object.hasOwn(g.properties,y)){const w=g.properties[y],S=Q_[y];(S===null||S.includes(g.tagName))&&(g.properties[y]=h(String(w||""),y,g))}}if(g.type==="element"){let y=n?!n.includes(g.tagName):a?a.includes(g.tagName):!1;if(!y&&r&&typeof p=="number"&&(y=!r(g,p,v)),y&&v&&typeof p=="number")return u&&g.children?v.children.splice(p,1,...g.children):v.children.splice(p,1),p}}}function YJ(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||WJ.test(e.slice(0,t))?e:""}function OR(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function XJ(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ZJ(e,t,n){const s=Fp((n||{}).ignore||[]),a=QJ(t);let l=-1;for(;++l<a.length;)zj(e,"text",u);function u(d,g){let p=-1,v;for(;++p<g.length;){const y=g[p],w=v?v.children:void 0;if(s(y,w?w.indexOf(y):void 0,v))return;v=y}if(v)return h(d,g)}function h(d,g){const p=g[g.length-1],v=a[l][0],y=a[l][1];let w=0;const C=p.children.indexOf(d);let k=!1,R=[];v.lastIndex=0;let E=v.exec(d.value);for(;E;){const N=E.index,j={index:E.index,input:E.input,stack:[...g,d]};let D=y(...E,j);if(typeof D=="string"&&(D=D.length>0?{type:"text",value:D}:void 0),D===!1?v.lastIndex=N+1:(w!==N&&R.push({type:"text",value:d.value.slice(w,N)}),Array.isArray(D)?R.push(...D):D&&R.push(D),w=N+E[0].length,k=!0),!v.global)break;E=v.exec(d.value)}return k?(w<d.value.length&&R.push({type:"text",value:d.value.slice(w)}),p.children.splice(C,1,...R)):R=[d],C+R.length}}function QJ(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([JJ(s[0]),eee(s[1])])}return t}function JJ(e){return typeof e=="string"?new RegExp(XJ(e),"g"):e}function eee(e){return typeof e=="function"?e:function(){return e}}const cb="phrasing",ub=["autolink","link","image","label"];function tee(){return{transforms:[lee],enter:{literalAutolink:ree,literalAutolinkEmail:db,literalAutolinkHttp:db,literalAutolinkWww:db},exit:{literalAutolink:aee,literalAutolinkEmail:oee,literalAutolinkHttp:iee,literalAutolinkWww:see}}}function nee(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:cb,notInConstruct:ub},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:cb,notInConstruct:ub},{character:":",before:"[ps]",after:"\\/",inConstruct:cb,notInConstruct:ub}]}}function ree(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function db(e){this.config.enter.autolinkProtocol.call(this,e)}function iee(e){this.config.exit.autolinkProtocol.call(this,e)}function see(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function oee(e){this.config.exit.autolinkEmail.call(this,e)}function aee(e){this.exit(e)}function lee(e){ZJ(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,cee],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),uee]],{ignore:["link","linkReference"]})}function cee(e,t,n,r,s){let a="";if(!Bj(s)||(/^w/i.test(t)&&(n=t+n,t="",a="http://"),!dee(n)))return!1;const l=hee(n+r);if(!l[0])return!1;const u={type:"link",title:null,url:a+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function uee(e,t,n,r){return!Bj(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function dee(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function hee(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=OR(e,"(");let a=OR(e,")");for(;r!==-1&&s>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),a++;return[e,n]}function Bj(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Za(n)||Bp(n))&&(!t||n!==47)}Ij.peek=xee;function fee(){this.buffer()}function mee(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function pee(){this.buffer()}function gee(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function vee(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ui(this.sliceSerialize(e)).toLowerCase(),n.label=t}function _ee(e){this.exit(e)}function bee(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ui(this.sliceSerialize(e)).toLowerCase(),n.label=t}function yee(e){this.exit(e)}function xee(){return"["}function Ij(e,t,n,r){const s=n.createTracker(r);let a=s.move("[^");const l=n.enter("footnoteReference"),u=n.enter("reference");return a+=s.move(n.safe(n.associationId(e),{after:"]",before:a})),u(),l(),a+=s.move("]"),a}function wee(){return{enter:{gfmFootnoteCallString:fee,gfmFootnoteCall:mee,gfmFootnoteDefinitionLabelString:pee,gfmFootnoteDefinition:gee},exit:{gfmFootnoteCallString:vee,gfmFootnoteCall:_ee,gfmFootnoteDefinitionLabelString:bee,gfmFootnoteDefinition:yee}}}function See(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Ij},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,a,l){const u=a.createTracker(l);let h=u.move("[^");const d=a.enter("footnoteDefinition"),g=a.enter("label");return h+=u.move(a.safe(a.associationId(r),{before:h,after:"]"})),g(),h+=u.move("]:"),r.children&&r.children.length>0&&(u.shift(4),h+=u.move((t?`
581
- `:" ")+a.indentLines(a.containerFlow(r,u.current()),t?Hj:Cee))),d(),h}}function Cee(e,t,n){return t===0?e:Hj(e,t,n)}function Hj(e,t,n){return(n?"":" ")+e}const kee=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Fj.peek=Mee;function Eee(){return{canContainEols:["delete"],enter:{strikethrough:Tee},exit:{strikethrough:Nee}}}function Ree(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:kee}],handlers:{delete:Fj}}}function Tee(e){this.enter({type:"delete",children:[]},e)}function Nee(e){this.exit(e)}function Fj(e,t,n,r){const s=n.createTracker(r),a=n.enter("strikethrough");let l=s.move("~~");return l+=n.containerPhrasing(e,{...s.current(),before:l,after:"~"}),l+=s.move("~~"),a(),l}function Mee(){return"~"}function Aee(e){return e.length}function Dee(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||Aee,a=[],l=[],u=[],h=[];let d=0,g=-1;for(;++g<e.length;){const S=[],C=[];let k=-1;for(e[g].length>d&&(d=e[g].length);++k<e[g].length;){const R=jee(e[g][k]);if(n.alignDelimiters!==!1){const E=s(R);C[k]=E,(h[k]===void 0||E>h[k])&&(h[k]=E)}S.push(R)}l[g]=S,u[g]=C}let p=-1;if(typeof r=="object"&&"length"in r)for(;++p<d;)a[p]=LR(r[p]);else{const S=LR(r);for(;++p<d;)a[p]=S}p=-1;const v=[],y=[];for(;++p<d;){const S=a[p];let C="",k="";S===99?(C=":",k=":"):S===108?C=":":S===114&&(k=":");let R=n.alignDelimiters===!1?1:Math.max(1,h[p]-C.length-k.length);const E=C+"-".repeat(R)+k;n.alignDelimiters!==!1&&(R=C.length+R+k.length,R>h[p]&&(h[p]=R),y[p]=R),v[p]=E}l.splice(1,0,v),u.splice(1,0,y),g=-1;const w=[];for(;++g<l.length;){const S=l[g],C=u[g];p=-1;const k=[];for(;++p<d;){const R=S[p]||"";let E="",N="";if(n.alignDelimiters!==!1){const j=h[p]-(C[p]||0),D=a[p];D===114?E=" ".repeat(j):D===99?j%2?(E=" ".repeat(j/2+.5),N=" ".repeat(j/2-.5)):(E=" ".repeat(j/2),N=E):N=" ".repeat(j)}n.delimiterStart!==!1&&!p&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&R==="")&&(n.delimiterStart!==!1||p)&&k.push(" "),n.alignDelimiters!==!1&&k.push(E),k.push(R),n.alignDelimiters!==!1&&k.push(N),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||p!==d-1)&&k.push("|")}w.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return w.join(`
582
- `)}function jee(e){return e==null?"":String(e)}function LR(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Oee(e,t,n,r){const s=n.enter("blockquote"),a=n.createTracker(r);a.move("> "),a.shift(2);const l=n.indentLines(n.containerFlow(e,a.current()),Lee);return s(),l}function Lee(e,t,n){return">"+(n?"":" ")+e}function zee(e,t){return zR(e,t.inConstruct,!0)&&!zR(e,t.notInConstruct,!1)}function zR(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function PR(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
583
- `&&zee(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
584
- `}function Pee(e,t){const n=String(e);let r=n.indexOf(t),s=r,a=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++a>l&&(l=a):a=1,s=r+t.length,r=n.indexOf(t,s);return l}function Bee(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Iee(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Hee(e,t,n,r){const s=Iee(n),a=e.value||"",l=s==="`"?"GraveAccent":"Tilde";if(Bee(e,n)){const p=n.enter("codeIndented"),v=n.indentLines(a,Fee);return p(),v}const u=n.createTracker(r),h=s.repeat(Math.max(Pee(a,s)+1,3)),d=n.enter("codeFenced");let g=u.move(h);if(e.lang){const p=n.enter(`codeFencedLang${l}`);g+=u.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...u.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${l}`);g+=u.move(" "),g+=u.move(n.safe(e.meta,{before:g,after:`
585
- `,encode:["`"],...u.current()})),p()}return g+=u.move(`
586
- `),a&&(g+=u.move(a+`
587
- `)),g+=u.move(h),d(),g}function Fee(e,t,n){return(n?"":" ")+e}function Gx(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Uee(e,t,n,r){const s=Gx(n),a=s==='"'?"Quote":"Apostrophe",l=n.enter("definition");let u=n.enter("label");const h=n.createTracker(r);let d=h.move("[");return d+=h.move(n.safe(n.associationId(e),{before:d,after:"]",...h.current()})),d+=h.move("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=h.move("<"),d+=h.move(n.safe(e.url,{before:d,after:">",...h.current()})),d+=h.move(">")):(u=n.enter("destinationRaw"),d+=h.move(n.safe(e.url,{before:d,after:e.title?" ":`
588
- `,...h.current()}))),u(),e.title&&(u=n.enter(`title${a}`),d+=h.move(" "+s),d+=h.move(n.safe(e.title,{before:d,after:s,...h.current()})),d+=h.move(s),u()),l(),d}function $ee(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function bd(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Km(e,t,n){const r=mc(e),s=mc(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Uj.peek=Wee;function Uj(e,t,n,r){const s=$ee(n),a=n.enter("emphasis"),l=n.createTracker(r),u=l.move(s);let h=l.move(n.containerPhrasing(e,{after:s,before:u,...l.current()}));const d=h.charCodeAt(0),g=Km(r.before.charCodeAt(r.before.length-1),d,s);g.inside&&(h=bd(d)+h.slice(1));const p=h.charCodeAt(h.length-1),v=Km(r.after.charCodeAt(0),p,s);v.inside&&(h=h.slice(0,-1)+bd(p));const y=l.move(s);return a(),n.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},u+h+y}function Wee(e,t,n){return n.options.emphasis||"*"}function Vee(e,t){let n=!1;return qx(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Jy}),!!((!e.depth||e.depth<3)&&Ix(e)&&(t.options.setext||n))}function qee(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(Vee(e,n)){const g=n.enter("headingSetext"),p=n.enter("phrasing"),v=n.containerPhrasing(e,{...a.current(),before:`
589
- `,after:`
590
- `});return p(),g(),v+`
591
- `+(s===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
592
- `))+1))}const l="#".repeat(s),u=n.enter("headingAtx"),h=n.enter("phrasing");a.move(l+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
593
- `,...a.current()});return/^[\t ]/.test(d)&&(d=bd(d.charCodeAt(0))+d.slice(1)),d=d?l+" "+d:l,n.options.closeAtx&&(d+=" "+l),h(),u(),d}$j.peek=Kee;function $j(e){return e.value||""}function Kee(){return"<"}Wj.peek=Gee;function Wj(e,t,n,r){const s=Gx(n),a=s==='"'?"Quote":"Apostrophe",l=n.enter("image");let u=n.enter("label");const h=n.createTracker(r);let d=h.move("![");return d+=h.move(n.safe(e.alt,{before:d,after:"]",...h.current()})),d+=h.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=h.move("<"),d+=h.move(n.safe(e.url,{before:d,after:">",...h.current()})),d+=h.move(">")):(u=n.enter("destinationRaw"),d+=h.move(n.safe(e.url,{before:d,after:e.title?" ":")",...h.current()}))),u(),e.title&&(u=n.enter(`title${a}`),d+=h.move(" "+s),d+=h.move(n.safe(e.title,{before:d,after:s,...h.current()})),d+=h.move(s),u()),d+=h.move(")"),l(),d}function Gee(){return"!"}Vj.peek=Yee;function Vj(e,t,n,r){const s=e.referenceType,a=n.enter("imageReference");let l=n.enter("label");const u=n.createTracker(r);let h=u.move("![");const d=n.safe(e.alt,{before:h,after:"]",...u.current()});h+=u.move(d+"]["),l();const g=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),{before:h,after:"]",...u.current()});return l(),n.stack=g,a(),s==="full"||!d||d!==p?h+=u.move(p+"]"):s==="shortcut"?h=h.slice(0,-1):h+=u.move("]"),h}function Yee(){return"!"}qj.peek=Xee;function qj(e,t,n){let r=e.value||"",s="`",a=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){const l=n.unsafe[a],u=n.compilePattern(l);let h;if(l.atBreak)for(;h=u.exec(r);){let d=h.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(h.index+1)}}return s+r+s}function Xee(){return"`"}function Kj(e,t){const n=Ix(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Gj.peek=Zee;function Gj(e,t,n,r){const s=Gx(n),a=s==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let u,h;if(Kj(e,n)){const g=n.stack;n.stack=[],u=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(e,{before:p,after:">",...l.current()})),p+=l.move(">"),u(),n.stack=g,p}u=n.enter("link"),h=n.enter("label");let d=l.move("[");return d+=l.move(n.containerPhrasing(e,{before:d,after:"](",...l.current()})),d+=l.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),d+=l.move("<"),d+=l.move(n.safe(e.url,{before:d,after:">",...l.current()})),d+=l.move(">")):(h=n.enter("destinationRaw"),d+=l.move(n.safe(e.url,{before:d,after:e.title?" ":")",...l.current()}))),h(),e.title&&(h=n.enter(`title${a}`),d+=l.move(" "+s),d+=l.move(n.safe(e.title,{before:d,after:s,...l.current()})),d+=l.move(s),h()),d+=l.move(")"),u(),d}function Zee(e,t,n){return Kj(e,n)?"<":"["}Yj.peek=Qee;function Yj(e,t,n,r){const s=e.referenceType,a=n.enter("linkReference");let l=n.enter("label");const u=n.createTracker(r);let h=u.move("[");const d=n.containerPhrasing(e,{before:h,after:"]",...u.current()});h+=u.move(d+"]["),l();const g=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),{before:h,after:"]",...u.current()});return l(),n.stack=g,a(),s==="full"||!d||d!==p?h+=u.move(p+"]"):s==="shortcut"?h=h.slice(0,-1):h+=u.move("]"),h}function Qee(){return"["}function Yx(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Jee(e){const t=Yx(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function ete(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Xj(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function tte(e,t,n,r){const s=n.enter("list"),a=n.bulletCurrent;let l=e.ordered?ete(n):Yx(n);const u=e.ordered?l==="."?")":".":Jee(n);let h=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(h=!0),Xj(n)===l&&g){let p=-1;for(;++p<e.children.length;){const v=e.children[p];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(l=u),n.bulletCurrent=l;const d=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=a,s(),d}function nte(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function rte(e,t,n,r){const s=nte(n);let a=n.bulletCurrent||Yx(n);t&&t.type==="list"&&t.ordered&&(a=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let l=a.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const u=n.createTracker(r);u.move(a+" ".repeat(l-a.length)),u.shift(l);const h=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,u.current()),g);return h(),d;function g(p,v,y){return v?(y?"":" ".repeat(l))+p:(y?a:a+" ".repeat(l-a.length))+p}}function ite(e,t,n,r){const s=n.enter("paragraph"),a=n.enter("phrasing"),l=n.containerPhrasing(e,r);return a(),s(),l}const ste=Fp(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function ote(e,t,n,r){return(e.children.some(function(l){return ste(l)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function ate(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Zj.peek=lte;function Zj(e,t,n,r){const s=ate(n),a=n.enter("strong"),l=n.createTracker(r),u=l.move(s+s);let h=l.move(n.containerPhrasing(e,{after:s,before:u,...l.current()}));const d=h.charCodeAt(0),g=Km(r.before.charCodeAt(r.before.length-1),d,s);g.inside&&(h=bd(d)+h.slice(1));const p=h.charCodeAt(h.length-1),v=Km(r.after.charCodeAt(0),p,s);v.inside&&(h=h.slice(0,-1)+bd(p));const y=l.move(s+s);return a(),n.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},u+h+y}function lte(e,t,n){return n.options.strong||"*"}function cte(e,t,n,r){return n.safe(e.value,r)}function ute(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function dte(e,t,n){const r=(Xj(n)+(n.options.ruleSpaces?" ":"")).repeat(ute(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Qj={blockquote:Oee,break:PR,code:Hee,definition:Uee,emphasis:Uj,hardBreak:PR,heading:qee,html:$j,image:Wj,imageReference:Vj,inlineCode:qj,link:Gj,linkReference:Yj,list:tte,listItem:rte,paragraph:ite,root:ote,strong:Zj,text:cte,thematicBreak:dte};function hte(){return{enter:{table:fte,tableData:BR,tableHeader:BR,tableRow:pte},exit:{codeText:gte,table:mte,tableData:hb,tableHeader:hb,tableRow:hb}}}function fte(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function mte(e){this.exit(e),this.data.inTable=void 0}function pte(e){this.enter({type:"tableRow",children:[]},e)}function hb(e){this.exit(e)}function BR(e){this.enter({type:"tableCell",children:[]},e)}function gte(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,vte));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function vte(e,t){return t==="|"?t:e}function _te(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
594
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:l,tableCell:h,tableRow:u}};function l(y,w,S,C){return d(g(y,S,C),y.align)}function u(y,w,S,C){const k=p(y,S,C),R=d([k]);return R.slice(0,R.indexOf(`
595
- `))}function h(y,w,S,C){const k=S.enter("tableCell"),R=S.enter("phrasing"),E=S.containerPhrasing(y,{...C,before:a,after:a});return R(),k(),E}function d(y,w){return Dee(y,{align:w,alignDelimiters:r,padding:n,stringLength:s})}function g(y,w,S){const C=y.children;let k=-1;const R=[],E=w.enter("table");for(;++k<C.length;)R[k]=p(C[k],w,S);return E(),R}function p(y,w,S){const C=y.children;let k=-1;const R=[],E=w.enter("tableRow");for(;++k<C.length;)R[k]=h(C[k],y,w,S);return E(),R}function v(y,w,S){let C=Qj.inlineCode(y,w,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function bte(){return{exit:{taskListCheckValueChecked:IR,taskListCheckValueUnchecked:IR,paragraph:xte}}}function yte(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:wte}}}function IR(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function xte(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let a=-1,l;for(;++a<s.length;){const u=s[a];if(u.type==="paragraph"){l=u;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function wte(e,t,n,r){const s=e.children[0],a=typeof e.checked=="boolean"&&s&&s.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);a&&u.move(l);let h=Qj.listItem(e,t,n,{...r,...u.current()});return a&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),h;function d(g){return g+l}}function Ste(){return[tee(),wee(),Eee(),hte(),bte()]}function Cte(e){return{extensions:[nee(),See(e),Ree(),_te(e),yte()]}}const kte={tokenize:Ate,partial:!0},Jj={tokenize:Dte,partial:!0},e3={tokenize:jte,partial:!0},t3={tokenize:Ote,partial:!0},Ete={tokenize:Lte,partial:!0},n3={name:"wwwAutolink",tokenize:Nte,previous:i3},r3={name:"protocolAutolink",tokenize:Mte,previous:s3},ao={name:"emailAutolink",tokenize:Tte,previous:o3},xs={};function Rte(){return{text:xs}}let Na=48;for(;Na<123;)xs[Na]=ao,Na++,Na===58?Na=65:Na===91&&(Na=97);xs[43]=ao;xs[45]=ao;xs[46]=ao;xs[95]=ao;xs[72]=[ao,r3];xs[104]=[ao,r3];xs[87]=[ao,n3];xs[119]=[ao,n3];function Tte(e,t,n){const r=this;let s,a;return l;function l(p){return!r0(p)||!o3.call(r,r.previous)||Xx(r.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(p))}function u(p){return r0(p)?(e.consume(p),u):p===64?(e.consume(p),h):n(p)}function h(p){return p===46?e.check(Ete,g,d)(p):p===45||p===95||_r(p)?(a=!0,e.consume(p),h):g(p)}function d(p){return e.consume(p),s=!0,h}function g(p){return a&&s&&Rr(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function Nte(e,t,n){const r=this;return s;function s(l){return l!==87&&l!==119||!i3.call(r,r.previous)||Xx(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(kte,e.attempt(Jj,e.attempt(e3,a),n),n)(l))}function a(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function Mte(e,t,n){const r=this;let s="",a=!1;return l;function l(p){return(p===72||p===104)&&s3.call(r,r.previous)&&!Xx(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(p),e.consume(p),u):n(p)}function u(p){if(Rr(p)&&s.length<5)return s+=String.fromCodePoint(p),e.consume(p),u;if(p===58){const v=s.toLowerCase();if(v==="http"||v==="https")return e.consume(p),h}return n(p)}function h(p){return p===47?(e.consume(p),a?d:(a=!0,h)):n(p)}function d(p){return p===null||Wm(p)||rn(p)||Za(p)||Bp(p)?n(p):e.attempt(Jj,e.attempt(e3,g),n)(p)}function g(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function Ate(e,t,n){let r=0;return s;function s(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),s):l===46&&r===3?(e.consume(l),a):n(l)}function a(l){return l===null?n(l):t(l)}}function Dte(e,t,n){let r,s,a;return l;function l(d){return d===46||d===95?e.check(t3,h,u)(d):d===null||rn(d)||Za(d)||d!==45&&Bp(d)?h(d):(a=!0,e.consume(d),l)}function u(d){return d===95?r=!0:(s=r,r=void 0),e.consume(d),l}function h(d){return s||r||!a?n(d):t(d)}}function jte(e,t){let n=0,r=0;return s;function s(l){return l===40?(n++,e.consume(l),s):l===41&&r<n?a(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(t3,t,a)(l):l===null||rn(l)||Za(l)?t(l):(e.consume(l),s)}function a(l){return l===41&&r++,e.consume(l),s}}function Ote(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),a):u===93?(e.consume(u),s):u===60||u===null||rn(u)||Za(u)?t(u):n(u)}function s(u){return u===null||u===40||u===91||rn(u)||Za(u)?t(u):r(u)}function a(u){return Rr(u)?l(u):n(u)}function l(u){return u===59?(e.consume(u),r):Rr(u)?(e.consume(u),l):n(u)}}function Lte(e,t,n){return r;function r(a){return e.consume(a),s}function s(a){return _r(a)?n(a):t(a)}}function i3(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||rn(e)}function s3(e){return!Rr(e)}function o3(e){return!(e===47||r0(e))}function r0(e){return e===43||e===45||e===46||e===95||_r(e)}function Xx(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const zte={tokenize:Wte,partial:!0};function Pte(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Fte,continuation:{tokenize:Ute},exit:$te}},text:{91:{name:"gfmFootnoteCall",tokenize:Hte},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Bte,resolveTo:Ite}}}}function Bte(e,t,n){const r=this;let s=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;s--;){const h=r.events[s][1];if(h.type==="labelImage"){l=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return u;function u(h){if(!l||!l._balanced)return n(h);const d=Ui(r.sliceSerialize({start:l.end,end:r.now()}));return d.codePointAt(0)!==94||!a.includes(d.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function Ite(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function Hte(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,l;return u;function u(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),h}function h(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(p){if(a>999||p===93&&!l||p===null||p===91||rn(p))return n(p);if(p===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return s.includes(Ui(r.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return rn(p)||(l=!0),a++,e.consume(p),p===92?g:d}function g(p){return p===91||p===92||p===93?(e.consume(p),a++,d):d(p)}}function Fte(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,l=0,u;return h;function h(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(w)}function g(w){if(l>999||w===93&&!u||w===null||w===91||rn(w))return n(w);if(w===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return a=Ui(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return rn(w)||(u=!0),l++,e.consume(w),w===92?p:g}function p(w){return w===91||w===92||w===93?(e.consume(w),l++,g):g(w)}function v(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),s.includes(a)||s.push(a),Lt(e,y,"gfmFootnoteDefinitionWhitespace")):n(w)}function y(w){return t(w)}}function Ute(e,t,n){return e.check(Wd,t,e.attempt(zte,t,n))}function $te(e){e.exit("gfmFootnoteDefinition")}function Wte(e,t,n){const r=this;return Lt(e,s,"gfmFootnoteDefinitionIndent",5);function s(a){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(a):n(a)}}function Vte(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(l,u){let h=-1;for(;++h<l.length;)if(l[h][0]==="enter"&&l[h][1].type==="strikethroughSequenceTemporary"&&l[h][1]._close){let d=h;for(;d--;)if(l[d][0]==="exit"&&l[d][1].type==="strikethroughSequenceTemporary"&&l[d][1]._open&&l[h][1].end.offset-l[h][1].start.offset===l[d][1].end.offset-l[d][1].start.offset){l[h][1].type="strikethroughSequence",l[d][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},l[d][1].start),end:Object.assign({},l[h][1].end)},p={type:"strikethroughText",start:Object.assign({},l[d][1].end),end:Object.assign({},l[h][1].start)},v=[["enter",g,u],["enter",l[d][1],u],["exit",l[d][1],u],["enter",p,u]],y=u.parser.constructs.insideSpan.null;y&&si(v,v.length,0,Ip(y,l.slice(d+1,h),u)),si(v,v.length,0,[["exit",p,u],["enter",l[h][1],u],["exit",l[h][1],u],["exit",g,u]]),si(l,d-1,h-d+3,v),h=d+v.length-2;break}}for(h=-1;++h<l.length;)l[h][1].type==="strikethroughSequenceTemporary"&&(l[h][1].type="data");return l}function a(l,u,h){const d=this.previous,g=this.events;let p=0;return v;function v(w){return d===126&&g[g.length-1][1].type!=="characterEscape"?h(w):(l.enter("strikethroughSequenceTemporary"),y(w))}function y(w){const S=mc(d);if(w===126)return p>1?h(w):(l.consume(w),p++,y);if(p<2&&!n)return h(w);const C=l.exit("strikethroughSequenceTemporary"),k=mc(w);return C._open=!k||k===2&&!!S,C._close=!S||S===2&&!!k,u(w)}}}class qte{constructor(){this.map=[]}add(t,n,r){Kte(this,t,n,r)}consume(t){if(this.map.sort(function(a,l){return a[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const a of s)t.push(a);s=r.pop()}this.map.length=0}}function Kte(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function Gte(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const a=r.length-1;r[a]=r[a]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function Yte(){return{flow:{null:{name:"table",tokenize:Xte,resolveAll:Zte}}}}function Xte(e,t,n){const r=this;let s=0,a=0,l;return u;function u(P){let V=r.events.length-1;for(;V>-1;){const K=r.events[V][1].type;if(K==="lineEnding"||K==="linePrefix")V--;else break}const I=V>-1?r.events[V][1].type:null,W=I==="tableHead"||I==="tableRow"?D:h;return W===D&&r.parser.lazy[r.now().line]?n(P):W(P)}function h(P){return e.enter("tableHead"),e.enter("tableRow"),d(P)}function d(P){return P===124||(l=!0,a+=1),g(P)}function g(P){return P===null?n(P):Je(P)?a>1?(a=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),y):n(P):Rt(P)?Lt(e,g,"whitespace")(P):(a+=1,l&&(l=!1,s+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),l=!0,g):(e.enter("data"),p(P)))}function p(P){return P===null||P===124||rn(P)?(e.exit("data"),g(P)):(e.consume(P),P===92?v:p)}function v(P){return P===92||P===124?(e.consume(P),p):p(P)}function y(P){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(P):(e.enter("tableDelimiterRow"),l=!1,Rt(P)?Lt(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):w(P))}function w(P){return P===45||P===58?C(P):P===124?(l=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),S):j(P)}function S(P){return Rt(P)?Lt(e,C,"whitespace")(P):C(P)}function C(P){return P===58?(a+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),k):P===45?(a+=1,k(P)):P===null||Je(P)?N(P):j(P)}function k(P){return P===45?(e.enter("tableDelimiterFiller"),R(P)):j(P)}function R(P){return P===45?(e.consume(P),R):P===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(P))}function E(P){return Rt(P)?Lt(e,N,"whitespace")(P):N(P)}function N(P){return P===124?w(P):P===null||Je(P)?!l||s!==a?j(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(P)):j(P)}function j(P){return n(P)}function D(P){return e.enter("tableRow"),L(P)}function L(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),L):P===null||Je(P)?(e.exit("tableRow"),t(P)):Rt(P)?Lt(e,L,"whitespace")(P):(e.enter("data"),U(P))}function U(P){return P===null||P===124||rn(P)?(e.exit("data"),L(P)):(e.consume(P),P===92?Y:U)}function Y(P){return P===92||P===124?(e.consume(P),U):U(P)}}function Zte(e,t){let n=-1,r=!0,s=0,a=[0,0,0,0],l=[0,0,0,0],u=!1,h=0,d,g,p;const v=new qte;for(;++n<e.length;){const y=e[n],w=y[1];y[0]==="enter"?w.type==="tableHead"?(u=!1,h!==0&&(HR(v,t,h,d,g),g=void 0,h=0),d={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},v.add(n,0,[["enter",d,t]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(r=!0,p=void 0,a=[0,0,0,0],l=[0,n+1,0,0],u&&(u=!1,g={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},v.add(n,0,[["enter",g,t]])),s=w.type==="tableDelimiterRow"?2:g?3:1):s&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(a[1]!==0&&(l[0]=l[1],p=Ff(v,t,a,s,void 0,p),a=[0,0,0,0]),l[2]=n)):w.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(l[0]=l[1],p=Ff(v,t,a,s,void 0,p)),a=l,l=[a[1],n,0,0])):w.type==="tableHead"?(u=!0,h=n):w.type==="tableRow"||w.type==="tableDelimiterRow"?(h=n,a[1]!==0?(l[0]=l[1],p=Ff(v,t,a,s,n,p)):l[1]!==0&&(p=Ff(v,t,l,s,n,p)),s=0):s&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(l[3]=n)}for(h!==0&&HR(v,t,h,d,g),v.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=Gte(t.events,n))}return e}function Ff(e,t,n,r,s,a){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(a.end=Object.assign({},Xl(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));const h=Xl(t.events,n[1]);if(a={type:l,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",a,t]]),n[2]!==0){const d=Xl(t.events,n[2]),g=Xl(t.events,n[3]),p={type:u,start:Object.assign({},d),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",p,t]]),r!==2){const v=t.events[n[2]],y=t.events[n[3]];if(v[1].end=Object.assign({},y[1].end),v[1].type="chunkText",v[1].contentType="text",n[3]>n[2]+1){const w=n[2]+1,S=n[3]-n[2]-1;e.add(w,S,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return s!==void 0&&(a.end=Object.assign({},Xl(t.events,s)),e.add(s,0,[["exit",a,t]]),a=void 0),a}function HR(e,t,n,r,s){const a=[],l=Xl(t.events,n);s&&(s.end=Object.assign({},l),a.push(["exit",s,t])),r.end=Object.assign({},l),a.push(["exit",r,t]),e.add(n+1,0,a)}function Xl(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Qte={name:"tasklistCheck",tokenize:ene};function Jte(){return{text:{91:Qte}}}function ene(e,t,n){const r=this;return s;function s(h){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),a)}function a(h){return rn(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),l):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),l):n(h)}function l(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(h)}function u(h){return Je(h)?t(h):Rt(h)?e.check({tokenize:tne},t,n)(h):n(h)}}function tne(e,t,n){return Lt(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function nne(e){return vj([Rte(),Pte(),Vte(e),Yte(),Jte()])}const rne={};function Kd(e){const t=this,n=e||rne,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(nne(n)),a.push(Ste()),l.push(Cte(n))}function ine({content:e,attachments:t}){const[n,r]=_.useState(null),s=(t==null?void 0:t.find(a=>a.id===n))??null;return _.useEffect(()=>{s||r(null)},[s]),f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"flex gap-2 justify-end",children:f.jsxs("div",{className:"max-w-[85%] sm:max-w-[80%] rounded-[20px] py-1.5 px-3.5 bg-muted text-primary border border-border prose prose-sm prose-invert [&_p]:whitespace-pre-line",children:[t!=null&&t.length?f.jsx("div",{className:"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:t.map(a=>f.jsxs("button",{type:"button",className:"overflow-hidden rounded-lg border border-border/80 bg-background/70 text-left cursor-zoom-in",onClick:()=>r(a.id),children:[f.jsx("img",{src:a.previewUrl,alt:a.name,className:"h-full max-h-[220px] w-full object-cover"}),f.jsx("div",{className:"border-t border-border/60 px-2 py-1 text-[11px] text-muted-foreground",children:a.name})]},a.id))}):null,e.trim()?f.jsx(qd,{remarkPlugins:[Kd],components:Ud(),children:e}):null]})}),s?f.jsx("button",{type:"button",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4 cursor-zoom-out",onClick:()=>r(null),children:f.jsx("img",{src:s.previewUrl,alt:s.name,className:"max-h-full max-w-full rounded-xl shadow-2xl"})}):null]})}function sne({json:e}){return f.jsx("div",{className:"flex gap-3 justify-start",children:f.jsx("div",{className:"flex-1 max-w-[90%]",children:f.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words bg-muted rounded-lg p-3 overflow-auto max-h-96",children:e})})})}function a3({title:e,count:t,children:n,badge:r}){const[s,a]=_.useState(!1);return t===0?null:f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsxs("button",{onClick:()=>a(!s),className:"flex items-center gap-1 cursor-pointer group/section hover:opacity-60 transition-opacity",children:[f.jsx(Tr,{className:me("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",s&&"rotate-90")}),f.jsx("span",{className:"text-muted-foreground font-medium",children:e}),f.jsx("span",{className:"text-muted-foreground/60",children:t}),r]}),s&&f.jsx("div",{className:"ml-5",children:n})]})}function fb({title:e,items:t,icon:n,getIcon:r}){return t.length===0?null:f.jsx(a3,{title:e,count:t.length,children:f.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map(s=>f.jsx(ZD,{icon:r?r(s):n,children:s},s))})})}function one(e){const t=e.match(/^mcp__([^_]+)__(.+)$/);return t?{server:t[1],tool:t[2]}:null}function l3({status:e}){const t=e==="connected"?"bg-emerald-500":e==="pending"?"bg-yellow-500":"bg-red-500";return f.jsx("span",{className:me("inline-block h-2 w-2 rounded-full shrink-0",t)})}function ane(e){switch(e){case"connected":return"Connected";case"failed":return"Failed";case"needs-auth":return"Needs auth";case"pending":return"Connecting...";case"disabled":return"Disabled";default:return e}}function FR({server:e}){const[t,n]=_.useState(!1),r=e.status==="connected";return f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsxs("button",{onClick:()=>r&&e.tools.length>0&&n(!t),className:me("flex items-center gap-1.5",r&&e.tools.length>0&&"cursor-pointer hover:opacity-60 transition-opacity"),children:[r&&e.tools.length>0&&f.jsx(Tr,{className:me("h-3 w-3 text-muted-foreground transition-transform duration-200",t&&"rotate-90")}),f.jsx(l3,{status:e.status}),f.jsx("span",{className:"text-muted-foreground font-medium",children:zb(e.name)}),r?f.jsxs("span",{className:"text-muted-foreground/50",children:[e.tools.length," tools"]}):f.jsx("span",{className:"text-muted-foreground/50",children:ane(e.status)})]}),!r&&e.error&&f.jsx("span",{className:"text-destructive ml-5",children:e.error}),t&&e.tools.length>0&&f.jsx("div",{className:"flex flex-wrap gap-1.5 ml-5",children:e.tools.map(s=>f.jsx(ZD,{icon:XD(`mcp__${e.name}__${s}`),children:s},s))})]})}function lne({servers:e}){if(e.length===0)return null;const t=e.filter(s=>s.status==="connected"),n=e.filter(s=>s.status!=="connected"),r=n.length>0?f.jsxs("span",{className:"flex items-center gap-1 ml-1",children:[f.jsx(l3,{status:"failed"}),f.jsxs("span",{className:"text-muted-foreground/60",children:[n.length," disconnected"]})]}):null;return f.jsx(a3,{title:"MCP Servers",count:e.length,badge:r,children:f.jsxs("div",{className:"flex flex-col gap-2",children:[t.map(s=>f.jsx(FR,{server:s},s.name)),n.map(s=>f.jsx(FR,{server:s},s.name))]})})}function cne({rawJson:e}){const[t,n]=_.useState(!1);return f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsxs("button",{onClick:()=>n(!t),className:"flex items-center gap-1 cursor-pointer group/section hover:opacity-60 transition-opacity",children:[f.jsx(Tr,{className:me("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",t&&"rotate-90")}),f.jsx("span",{className:"text-muted-foreground font-medium",children:"Raw Message"})]}),t&&f.jsx("pre",{className:"ml-5 text-xs whitespace-pre-wrap break-all border border-border rounded-md p-3 overflow-x-auto max-h-96 overflow-y-auto",children:e})]})}function une({message:e,rawJson:t}){const{coreTools:n,mcpServersWithTools:r}=_.useMemo(()=>{const s=new Map,a=[];for(const u of e.tools){const h=one(u);if(h){const d=s.get(h.server)||[];d.push(h.tool),s.set(h.server,d)}else a.push(u)}const l=e.mcpServers.map(u=>({name:u.name,status:u.status,error:u.error,tools:s.get(u.name)||[]}));return{coreTools:a,mcpServersWithTools:l}},[e.tools,e.mcpServers]);return f.jsx(oo,{children:f.jsxs(Hd,{expandedContent:f.jsx(Fd,{className:"my-4 text-xs",children:f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsx(LG,{children:e.model}),f.jsx(fb,{title:"Tools",items:n,getIcon:s=>Iy[s]??YD}),f.jsx(fb,{title:"Agents",items:e.agents,icon:x0}),f.jsx(fb,{title:"Commands",items:e.slashCommands,icon:HI}),f.jsx(lne,{servers:r}),t&&f.jsx(cne,{rawJson:t})]})}),children:[f.jsx(w6,{className:"h-5 w-5 text-logo"}),f.jsx(Js,{children:"Session Started"})]})})}function dne({message:e}){return f.jsx(oo,{className:"hidden",children:f.jsxs(Hd,{expandedContent:f.jsx(Fd,{className:"my-4 text-xs",children:f.jsx("pre",{className:"font-mono whitespace-pre-wrap break-all bg-muted border border-border rounded-lg p-2 max-h-64 overflow-auto",children:JSON.stringify(e.accountInfo,null,2)})}),children:[f.jsx("div",{className:"size-5 flex justify-center items-center ",children:f.jsx(x0,{className:"h-4 w-4 text-muted-foreground"})}),f.jsx(Js,{children:"Account"})]})})}function hne({message:e}){return f.jsx("div",{className:"text-pretty prose prose-sm dark:prose-invert px-0.5 w-full max-w-full space-y-4",children:f.jsx(qd,{remarkPlugins:[Kd],components:Ud(),children:e.text})})}function fne({message:e}){return f.jsx(oo,{className:"w-full",children:f.jsxs(Hd,{expandedContent:f.jsx(Fd,{className:"my-4 text-sm text-muted-foreground/90",children:f.jsx("div",{className:"text-pretty prose prose-sm max-w-full px-0.5 opacity-90 dark:prose-invert",children:f.jsx(qd,{remarkPlugins:[Kd],components:Ud(),children:e.text})})}),children:[f.jsx(ti,{className:"h-4 w-4 text-muted-icon"}),f.jsx(Js,{className:"text-left text-muted-foreground",children:"Thinking"})]})})}function mne({question:e,currentIndex:t,totalQuestions:n,onBack:r,children:s}){const a=r&&t>0;return f.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[f.jsxs("div",{className:"relative",children:[f.jsxs("h3",{className:"font-medium text-foreground text-sm p-3 px-4 bg-card border-b border-border text-foreground flex flex-row items-center gap-2",children:[a?f.jsx("button",{onClick:r,className:" text-muted-foreground hover:opacity-60 transition-all flex items-center",children:f.jsx(bN,{className:"h-4 w-4 -ml-0.5",strokeWidth:3})}):n>1?f.jsxs("span",{className:"font-bold text-muted-foreground whitespace-nowrap",children:[t+1," of ",n]}):null,e]}),n>1&&f.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-border",children:f.jsx("div",{className:"h-full bg-muted-foreground/40 transition-all duration-300",style:{width:`${t/n*100}%`}})})]}),s]})}function UR({label:e,description:t}){return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-foreground text-sm",children:e}),t&&f.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]})}function c3({selected:e,multiSelect:t,onClick:n}){return f.jsx("button",{type:"button",onClick:n,className:me("flex-shrink-0 w-5 h-5 border-1 flex items-center justify-center",t?"rounded":"rounded-full",e?"border-slate-500/0 bg-foreground":"border-muted-foreground/50 bg-background",n&&e&&"cursor-pointer"),children:e&&f.jsx(Wi,{strokeWidth:3,className:"translate-y-[0.5px] h-3 w-3 text-white dark:text-background"})})}function pne({option:e,selected:t,multiSelect:n,onClick:r,isLast:s}){const a="w-full text-left p-3 pt-2.5 pl-4 pr-5 bg-background",l=s?"":"border-b border-border";return r?f.jsx("button",{onClick:r,className:me(a,l,"transition-all cursor-pointer"),children:f.jsxs("div",{className:"flex items-center justify-between gap-3",children:[f.jsx("div",{className:"flex-1 min-w-0",children:f.jsx(UR,{label:e.label,description:e.description})}),f.jsx(c3,{selected:t,multiSelect:n})]})}):f.jsx("div",{className:me(a,l),children:f.jsx(UR,{label:e.label,description:e.description})})}function gne(e){return e==null?void 0:e.answers}function Pi(e){return e.id||e.question}function vne({message:e,onSubmit:t,isLatest:n}){var O,F;const r=e.input.questions,s=!!e.result,a=gne(e.result),l=((O=e.result)==null?void 0:O.discarded)===!0,[u,h]=_.useState(0),[d,g]=_.useState({}),[p,v]=_.useState({}),[y,w]=_.useState(a??null),[S,C]=_.useState(s),k=(H,$)=>{var re;const M=(re=p[H])==null?void 0:re.trim(),B=d[H]||"",X=$||r.find(se=>Pi(se)===H);if(X!=null&&X.multiSelect)return[B,M].filter(Boolean).flatMap(se=>se.split(", ").filter(Boolean));const A=M||B;return A?[A]:[]},R=H=>{const $=d[Pi(H)]||"";return H.multiSelect?$.split(", ").filter(Boolean):[$]},E=(H,$)=>{const M=Pi(H);if(H.multiSelect){const B=d[M]?d[M].split(", ").filter(Boolean):[],X=B.includes($)?B.filter(A=>A!==$):[...B,$];g({...d,[M]:X.join(", ")})}else g({...d,[M]:$}),v({...p,[M]:""}),u<r.length-1&&setTimeout(()=>h(u+1),150)},N=(H,$)=>{const M=Pi(H);v({...p,[M]:$}),$&&!H.multiSelect&&g({...d,[M]:""})},j=H=>{const $=Pi(H);H.multiSelect&&p[$]&&v({...p,[$]:""})},D=r.every(H=>k(Pi(H),H).length>0),L=r[u],U=u===r.length-1,Y=L&&k(Pi(L),L).length>0,P=()=>{u<r.length-1&&h(u+1)},V=()=>{u>0&&h(u-1)},I=()=>{if(!D)return;const H={};for(const $ of r){const M=Pi($);H[M]=k(M,$)}w(H),C(!0),t(e.toolId,r,H)},W=H=>{if(H.key==="Enter"&&!(!L||!Y)){if(H.preventDefault(),U){I();return}P()}};if(S||s){const H=a||y||{};return f.jsx("div",{className:"w-full",children:f.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[f.jsxs("div",{className:"font-medium text-sm p-3 px-4 pr-5 bg-muted border-b border-border flex flex-row items-center justify-between",children:[f.jsxs("p",{children:["Question",r.length!==1?"s":""]}),f.jsx("p",{className:"",children:l?"Discarded":"Answers"})]}),r.map(($,M)=>{const B=H[Pi($)]||H[$.question]||[],X=M===r.length-1;return f.jsxs("div",{className:me("w-full p-3 pt-2.5 pl-4 pr-5 bg-background flex items-center justify-between gap-3",!X&&"border-b border-border"),children:[f.jsx("div",{className:"text-sm text-pretty",children:$.question}),B.length>0&&f.jsx("div",{className:"text-sm font-medium text-right max-w-[50%] text-pretty",children:B.join(", ")}),B.length===0&&f.jsx("div",{className:"text-sm font-medium text-right italic",children:l?"Discarded":"No Response"})]},Pi($))})]})})}if(!n)return f.jsx("div",{className:"w-full py-2",children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(kN,{className:"h-4 w-4 text-muted-foreground"}),f.jsx("span",{className:"text-sm text-muted-foreground",children:"Questions pending (newer question active)"})]})});if(!L)return null;const K=R(L),q=p[Pi(L)]||"";return f.jsxs("div",{className:"w-full space-y-3",children:[f.jsxs(mne,{question:L.question,currentIndex:u,totalQuestions:r.length,onBack:u>0?V:void 0,children:[(F=L.options)==null?void 0:F.map(H=>f.jsx(pne,{option:H,selected:K.includes(H.label),multiSelect:L.multiSelect,onClick:()=>E(L,H.label)},H.label)),f.jsx("div",{className:"transition-all bg-background",children:f.jsxs("div",{className:"flex pr-5 items-center justify-between gap-3",children:[f.jsx("input",{type:"text",value:q,onChange:H=>N(L,H.target.value),onKeyDown:W,placeholder:"Other...",className:"flex-1 px-3 !py-1 pl-4 min-h-[55px] min-w-0 text-base md:text-sm bg-transparent outline-none text-foreground placeholder:text-muted-foreground"}),f.jsx(c3,{selected:!!q,multiSelect:L.multiSelect,onClick:L.multiSelect&&q?()=>j(L):void 0})]})})]}),f.jsxs("div",{className:"flex justify-end gap-2 mx-2",children:[!U&&Y&&(L.multiSelect||!!q)&&f.jsx(tt,{size:"sm",onClick:P,children:"Next"}),U&&f.jsx(tt,{size:"sm",onClick:I,disabled:!D,className:me(!D&&"opacity-50 cursor-not-allowed","rounded-full"),children:"Submit"})]})]})}function _ne({message:e,onConfirm:t,isLatest:n,isActionable:r=n}){const s=!!e.result,[a,l]=_.useState(!1),[u,h]=_.useState(!1),[d,g]=_.useState(!1),[p,v]=_.useState(""),y=_.useRef(null),w=e.input;_.useEffect(()=>{d&&y.current&&y.current.focus()},[d]);const S=async()=>{w!=null&&w.plan&&(await navigator.clipboard.writeText(w.plan),h(!0),setTimeout(()=>h(!1),2e3))},C=s?e.result:null,k=(C==null?void 0:C.discarded)===!0;return f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsxs("div",{className:"relative rounded-2xl border border-border overflow-hidden group/plan",children:[(w==null?void 0:w.plan)&&f.jsx(tt,{variant:"ghost",size:"icon",className:me("absolute top-2 right-2 z-10 h-8 w-8 rounded-md text-muted-foreground opacity-0 group-hover/plan:opacity-100 transition-opacity",!u&&"hover:text-foreground",u&&"hover:!bg-transparent hover:!border-transparent"),onClick:S,children:u?f.jsx(Wi,{className:"h-4 w-4 text-green-400"}):f.jsx(Cd,{className:"h-4 w-4"})}),f.jsxs("div",{className:me("!pt-5 !pb-0 px-4 md:py-4.5 md:px-5.5 bg-muted dark:bg-card overflow-scroll no-pre-highlight transition-all",s&&!a?"max-h-[min(400px,40vh)] ":"",s?"hover:!pb-[32px]":""),children:[s&&f.jsxs(tt,{variant:"ghost",className:"absolute z-10 bottom-2 pr-2.5 !pl-3.5 h-[34px] inline-flex gap-1 text-sm left-[50%] -translate-x-[50%] text-muted-foreground backdrop-blur-sm hover:text-foreground opacity-0 group-hover/plan:opacity-100 transition-all rounded-full border border-border",onClick:()=>l(!a),children:[a?"Show Less":"Show More",f.jsx(rp,{className:`size-3.5 transition-transform ${a?"rotate-180":""}`})]}),w!=null&&w.plan?f.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:[f.jsx(qd,{remarkPlugins:[Kd],components:Ud(),children:w.plan}),f.jsx("div",{className:"mt-5"})]}):f.jsx("p",{className:"text-sm text-muted-foreground",children:"No plan provided"})]})]}),s?f.jsx("div",{className:"flex justify-end mx-2",children:f.jsxs("span",{className:"pl-4 inline text-sm font-medium bg-background text-foreground/60 border border-border py-1.5 px-3 rounded-[20px] leading-relaxed max-w-[85%] sm:max-w-[80%]",children:[f.jsx("em",{children:k?"Discarded":C!=null&&C.clearContext?"Approved & Cleared Context":C!=null&&C.confirmed?"Approved":C!=null&&C.message?`Adjusted: "${C.message}"`:"Adjusted Plan"}),f.jsx(G6,{className:"inline h-4 w-4 ml-1.5 -mt-0.5"})]})}):n?r?f.jsxs("div",{className:"flex flex-col gap-3",children:[!d&&f.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center justify-end gap-2 mx-2",children:[f.jsxs(tt,{size:"sm",onClick:()=>t(e.toolId,!0,!0),className:"rounded-full bg-primary text-primary-foreground pr-4 md:order-last",children:[f.jsx(k6,{className:"h-4 w-4 mr-1.5"}),"Approve & Clear"]}),f.jsxs("div",{className:"flex items-stretch md:items-center gap-2 md:contents",children:[f.jsxs(tt,{size:"sm",variant:"outline",onClick:()=>g(!0),className:"rounded-full border-border flex-1 md:flex-initial md:order-first",children:[f.jsx(pm,{className:"h-4 w-4 mr-1.5"}),"Suggest Edits"]}),f.jsxs(tt,{size:"sm",variant:"outline",onClick:()=>t(e.toolId,!0),className:"rounded-full border-border flex-1 md:flex-initial",children:[f.jsx(Wi,{className:"h-4 w-4 mr-1.5"}),"Approve"]})]})]}),d&&f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx("textarea",{ref:y,value:p,onChange:R=>v(R.target.value),onKeyDown:R=>{R.key==="Enter"&&!R.shiftKey&&p.trim()&&(R.preventDefault(),t(e.toolId,!1,void 0,p.trim())),R.key==="Escape"&&(g(!1),v(""))},placeholder:"Describe what you'd like to change...",rows:3,className:"w-full rounded-2xl border border-border bg-muted dark:bg-card px-4 py-3 text-sm text-foreground placeholder:text-muted-foreground resize-none outline-none"}),f.jsxs("div",{className:"flex items-center justify-end gap-2 mx-2",children:[f.jsx(tt,{size:"sm",variant:"ghost",onClick:()=>{g(!1),v("")},className:"rounded-full text-muted-foreground",children:"Cancel"}),f.jsxs(tt,{size:"sm",disabled:!p.trim(),onClick:()=>t(e.toolId,!1,void 0,p.trim()),className:"rounded-full bg-primary text-primary-foreground disabled:opacity-50 disabled:pointer-events-none",children:[f.jsx(OI,{className:"h-4 w-4 mr-1.5"}),"Adjust Plan"]})]})]})]}):f.jsx("div",{className:"flex justify-end mx-2",children:f.jsx("span",{className:"inline text-sm text-muted-foreground italic",children:"Plan pending"})}):f.jsx("div",{className:"flex justify-end mx-2",children:f.jsx("span",{className:"inline text-sm text-muted-foreground italic",children:"Plan pending (newer prompt active)"})})]})}const bne={completed:{Icon:Wi,iconClass:"text-emerald-500",textClass:"text-muted-foreground"},in_progress:{Icon:oi,iconClass:"text-foreground animate-spin",textClass:"text-foreground font-medium"},pending:{Icon:I6,iconClass:"text-muted-foreground",textClass:"text-muted-foreground"}};function yne({message:e}){const t=e.input.todos;return t.length?f.jsx("div",{className:"w-full",children:f.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[f.jsxs("h3",{className:"font-medium text-foreground text-sm p-3 px-4 bg-card border-b border-border flex items-center gap-2",children:[f.jsx(fI,{className:"h-4 w-4 text-muted-foreground"}),"Progress"]}),f.jsx("div",{children:t.map((n,r)=>{const s=r===t.length-1,{Icon:a,iconClass:l,textClass:u}=bne[n.status];return f.jsxs("div",{className:me("flex items-center gap-3 px-4 py-2.5 bg-background",!s&&"border-b border-border"),children:[f.jsx(a,{className:me("h-4 w-4 flex-shrink-0",l)}),f.jsx("span",{className:me("text-sm",u),children:n.status==="in_progress"?n.activeForm:n.content})]},r)})})]})}):null}function xne(e){const t=e.split(`
596
- `),n=/^\s*(\d+)→(.*)$/;return t.map(r=>{const s=r.match(n);return s?{lineNumber:parseInt(s[1],10),content:s[2]}:{lineNumber:null,content:r}})}function wne(e){return e.replace(/<[^>]+>/g,"")}function Sne(e,t){const n=e.split(`
597
- `),r=t.split(`
598
- `),s=Cne(n,r),a=kne(n,r,s);return Ene(a)}function Cne(e,t){const n=e.length,r=t.length,s=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let a=1;a<=n;a++)for(let l=1;l<=r;l++)s[a][l]=e[a-1]===t[l-1]?s[a-1][l-1]+1:Math.max(s[a-1][l],s[a][l-1]);return s}function kne(e,t,n){const r=[];let s=e.length,a=t.length;for(;s>0||a>0;)s>0&&a>0&&e[s-1]===t[a-1]?(r.push({type:"context",text:e[s-1],oldIdx:s,newIdx:a}),s--,a--):a>0&&(s===0||n[s][a-1]>=n[s-1][a])?(r.push({type:"added",text:t[a-1],oldIdx:s,newIdx:a}),a--):(r.push({type:"removed",text:e[s-1],oldIdx:s,newIdx:a}),s--);return r.reverse()}function Ene(e){return e.map(t=>{const n=t.type==="removed"?"-":t.type==="added"?"+":" ";return{type:t.type,content:`${n}${t.text}`}})}function mb({content:e,isDiff:t=!1,oldString:n,newString:r}){const s=_.useMemo(()=>t&&n!==void 0&&r!==void 0?Sne(n,r):[],[t,n,r]),a=_.useMemo(()=>t?[]:xne(e),[e,t]),l=_.useMemo(()=>a.some(u=>u.lineNumber!==null),[a]);return t&&s.length>0?f.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:f.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:f.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:f.jsx("tbody",{children:s.map((u,h)=>{const d=u.type==="removed"?"bg-red-500/10 dark:bg-red-500/15":u.type==="added"?"bg-green-500/10 dark:bg-green-500/15":"",g=u.type==="removed"?"text-red-700 dark:text-red-400":u.type==="added"?"text-green-700 dark:text-green-400":"text-foreground";return f.jsxs("tr",{className:d,children:[f.jsx("td",{className:`px-2 py-0 select-none w-0 whitespace-nowrap ${u.type==="removed"?"text-red-500/50":u.type==="added"?"text-green-500/50":"text-muted-foreground/50"}`,children:u.type==="removed"?"-":u.type==="added"?"+":" "}),f.jsx("td",{className:`px-2 py-0 whitespace-pre select-all ${g}`,children:u.content.slice(1)})]},h)})})})})}):f.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:f.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:f.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:f.jsx("tbody",{children:a.map((u,h)=>f.jsxs("tr",{children:[l&&f.jsx("td",{className:"px-2 py-0 select-none w-0 whitespace-nowrap text-muted-foreground/50 text-right",children:u.lineNumber!==null?u.lineNumber:""}),f.jsx("td",{className:"px-2 py-0 whitespace-pre select-all text-foreground",children:wne(u.content)})]},h))})})})})}function u3({message:e,isLoading:t=!1,localPath:n}){var k;const r=e.result!==void 0,s=!r&&t,a=_.useMemo(()=>{if(typeof e.result=="string")return e.result;if(!e.result)return"";if(typeof e.result=="object"&&e.result!==null&&"content"in e.result){const R=e.result.content;if(typeof R=="string")return R}return JSON.stringify(e.result,null,2)},[e.result]),l=_.useMemo(()=>{if((e.toolKind==="read_file"||e.toolKind==="write_file"||e.toolKind==="edit_file")&&e.input.filePath)return e.input.filePath;if(e.toolKind==="edit_file"){const R=a.match(/^Updated\s+(.+)$/m);if(R!=null&&R[1])return R[1].trim()}return""},[e.input,e.toolKind,a]),u=_.useMemo(()=>{if(e.toolKind==="skill")return e.input.skill;if(e.toolKind==="glob")return`Search files ${e.input.pattern==="**/*"?"in all directories":`matching ${e.input.pattern}`}`;if(e.toolKind==="grep"){const R=e.input.pattern,E=e.input.outputMode;return E==="count"?`Count \`${R}\` occurrences`:E==="content"?`Find \`${R}\` in text`:`Find \`${R}\` in files`}return e.toolKind==="bash"?e.input.description||(e.input.command?z7(e.input.command):"Bash"):e.toolKind==="web_search"?e.input.query||"Web Search":e.toolKind==="read_file"?l?`Read ${W_(l,n)}`:"Read file":e.toolKind==="write_file"?l?`Write ${W_(l,n)}`:"Write file":e.toolKind==="edit_file"?l?`Edit ${W_(l,n)}`:"Edit file":e.toolKind==="mcp_generic"?`${zb(e.input.tool)} from ${zb(e.input.server)}`:e.toolKind==="subagent_task"&&e.input.subagentType||e.toolName},[l,e.input,e.toolKind,e.toolName,n]),h=_.useMemo(()=>e.toolKind==="subagent_task",[e.toolKind]),d=_.useMemo(()=>{if(e.toolKind==="skill")return e.input.skill},[e.input,e.toolKind]),g=e.toolKind==="bash",p=e.toolKind==="write_file",v=e.toolKind==="edit_file",y=e.toolKind==="read_file",w=y&&!!a.trim(),S=v&&(!!e.input.oldString.trim()||!!e.input.newString.trim()),C=_.useMemo(()=>{switch(e.toolKind){case"bash":return e.input.command;case"write_file":return e.input.content;default:return JSON.stringify(e.input,null,2)}},[e]);return f.jsx(oo,{className:"w-full",children:f.jsxs(Hd,{expandedContent:f.jsx(Fd,{className:"my-4 text-sm",children:f.jsxs("div",{className:"flex flex-col gap-2",children:[v?S?f.jsx(mb,{content:"",isDiff:!0,oldString:e.input.oldString,newString:e.input.newString}):a.trim()?f.jsx(V_,{label:e.isError?"Error":"Result",copyText:a,children:a}):f.jsx("div",{className:"text-muted-foreground text-xs",children:"Cursor completed this edit, but ACP did not include the file diff details."}):!y&&!p&&f.jsx(V_,{label:g?f.jsxs("span",{className:"flex items-center gap-2 w-full",children:[f.jsx("span",{children:"Command"}),!!e.input.timeoutMs&&f.jsxs("span",{className:"text-muted-foreground",children:["timeout: ",String(e.input.timeoutMs),"ms"]}),!!e.input.runInBackground&&f.jsx("span",{className:"text-muted-foreground",children:"background"})]}):p?"Contents":"Input",copyText:C,children:C}),r&&y&&!e.isError&&(w?f.jsx(mb,{content:a}):f.jsx("div",{className:"text-muted-foreground text-xs",children:"Cursor completed this read, but ACP did not include the file contents."})),p&&!e.isError&&f.jsx(mb,{content:e.input.content}),r&&!y&&!(p&&!e.isError)&&!(v&&!e.isError)&&f.jsx(V_,{label:e.isError?"Error":"Result",copyText:a,children:a})]})}),children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:(()=>{if(e.isError)return f.jsx(Xo,{className:"size-4 text-destructive"});if(h)return f.jsx(x0,{className:"size-4 text-muted-icon"});const R=XD(e.toolName);return f.jsx(R,{className:"size-4 text-muted-icon"})})()}),f.jsx(Js,{className:"text-left transition-opacity duration-200 truncate",children:f.jsx(xp,{animate:s,shimmerWidth:Math.max(20,(((k=d||u)==null?void 0:k.length)??33)*3),children:d||u})})]})})}function Rne({message:e}){const t=n=>{if(n<1e3)return`${n}ms`;const r=Math.floor(n/1e3),s=Math.floor(r/3600),a=Math.floor(r%3600/60),l=r%60;return s>0?`${s}h${a>0?` ${a}m`:""}`:a>0?`${a}m${l>0?` ${l}s`:""}`:`${l}s`};return e.success?f.jsxs(oo,{className:`px-0.5 text-xs tracking-wide ${e.durationMs>6e4?"":"hidden"}`,children:[f.jsx("div",{className:"w-full h-[1px] bg-border"}),f.jsxs(Js,{className:"whitespace-nowrap text-[11px] tracking-widest text-muted-foreground/60 uppercase flex-shrink-0",children:["Worked for ",t(e.durationMs)]}),f.jsx("div",{className:"w-full h-[1px] bg-border"})]}):f.jsx("div",{className:"px-4 py-3 mx-2 my-1 rounded-lg bg-destructive/10 border border-destructive/20 text-destructive text-sm",children:e.result||"An unknown error occurred."})}function Tne({message:e}){return f.jsx("div",{className:"flex items-center justify-end gap-2 text-sm text-muted-foreground my-3",children:f.jsxs("div",{className:"inline-flex gap-1.5 items-center justify-center whitespace-nowrap text-sm font-medium bg-background text-foreground/60 border border-border h-9 pl-1 pr-4 rounded-full",children:[f.jsx(P6,{className:"h-4 w-4 ml-1.5"}),f.jsx("em",{children:"Interrupted"})]})})}function Gm({size:e=4}){return f.jsxs("svg",{className:"flex-1",viewBox:`0 0 100 ${e}`,preserveAspectRatio:"none",style:{height:`${e}px`},children:[f.jsx("pattern",{id:"zigzag",width:e,height:e,patternUnits:"userSpaceOnUse",children:f.jsx("path",{d:`M0 ${e} L${e/2} 0 L${e} ${e}`,fill:"none",stroke:"currentColor",strokeWidth:"0.5",className:"text-muted-foreground/30",style:{stroke:"currentColor"}})}),f.jsx("rect",{width:"100%",height:e,fill:"url(#zigzag)",className:"text-muted-foreground/30"})]})}function Nne(){return f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(Gm,{}),f.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Compacted"}),f.jsx(Gm,{})]})}function Mne(){return f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(Gm,{}),f.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Context Cleared"}),f.jsx(Gm,{})]})}function Ane({message:e}){return f.jsx(oo,{children:f.jsxs(Hd,{expandedContent:f.jsx(Fd,{className:"my-4 text-xs",children:f.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:f.jsx(qd,{remarkPlugins:[Kd],components:Ud(),children:e.summary})})}),children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:f.jsx(EN,{className:"h-4.5 w-4.5 text-muted-foreground"})}),f.jsx(Js,{children:"Summarized"})]})})}const Dne={compacting:"Compacting..."};function jne({message:e}){const t=Dne[e.status]||e.status;return f.jsxs(oo,{className:"grid grid-cols-[auto_1fr] items-center gap-1.5 text-sm animate-pulse",children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:f.jsx(EN,{className:"h-4.5 w-4.5 text-muted-foreground"})}),f.jsx(Js,{className:"text-left transition-opacity duration-200 truncate",children:t})]})}const One={read_file:{key:"read",singular:"read",plural:"reads"},edit_file:{key:"edit",singular:"edit",plural:"edits"},write_file:{key:"write",singular:"write",plural:"writes"},bash:{key:"bash",singular:"command",plural:"commands"},grep:{key:"grep",singular:"search",plural:"searches"},glob:{key:"glob",singular:"glob",plural:"globs"},subagent_task:{key:"task",singular:"agent",plural:"agents"},web_search:{key:"websearch",singular:"web search",plural:"web searches"},skill:{key:"skill",singular:"skill",plural:"skills"},todo_write:{key:"todo",singular:"todo update",plural:"todo updates"}},Lne={key:"other",singular:"tool call",plural:"tool calls"};function zne(e){return One[e]??Lne}function Pne(e){const t=new Map,n=[];for(const r of e){const s=r.toolKind,a=zne(s),l=t.get(a.key);l?l.count++:(t.set(a.key,{category:a,count:1}),n.push(a.key))}return n.map(r=>{const{category:s,count:a}=t.get(r);return`${a} ${a===1?s.singular:s.plural}`}).join(", ")}function Bne({messages:e,isLoading:t,localPath:n}){const[r,s]=_.useState(!1),a=_.useMemo(()=>Pne(e),[e]),u=e.some(h=>h.result===void 0)&&t;return f.jsx(oo,{className:"w-full",children:f.jsxs("div",{className:"flex flex-col w-full",children:[f.jsx("button",{onClick:()=>s(!r),className:`group cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${!r&&!u?"hover:opacity-60 transition-opacity":""}`,children:f.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:f.jsx(Tr,{className:`h-4.5 w-4.5 text-muted-icon transition-all duration-200 ${r?"rotate-90":""}`})}),f.jsx(Js,{className:"text-left",children:f.jsx(xp,{animate:u,children:a})})]})}),r&&f.jsxs("div",{className:"my-4 flex flex-col gap-3",children:[e.map(h=>f.jsx(u3,{message:h,isLoading:t,localPath:n},h.id)),e.length>5&&f.jsx("button",{onClick:()=>s(!1),className:"cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-xs hover:opacity-80 transition-opacity",children:f.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:f.jsx(Tr,{className:"h-4.5 w-4.5 text-muted-icon -rotate-90"})}),f.jsx(Js,{className:"text-left",children:"Collapse"})]})})]})]})})}const Ine=new Set(["AskUserQuestion","ExitPlanMode","TodoWrite"]);function $R(e){if(e.kind!=="tool")return!1;const t=e.toolName;return!Ine.has(t)}function Hne(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if($R(r)){const s=[r],a=n;for(n+=1;n<e.length&&$R(e[n]);)s.push(e[n]),n+=1;s.length>=2?t.push({type:"tool-group",messages:s,startIndex:a}):t.push({type:"single",message:r,index:a});continue}t.push({type:"single",message:r,index:n}),n+=1}return t}function Fne({messages:e,isLoading:t,localPath:n,latestToolIds:r,onOpenLocalLink:s,onAskUserQuestionSubmit:a,onExitPlanModeConfirm:l,pendingTool:u}){const h=_.useMemo(()=>Hne(e),[e]);function d(g,p){if(g.kind==="user_prompt")return f.jsx(ine,{content:g.content,attachments:g.attachments},g.id);switch(g.kind){case"unknown":return f.jsx(sne,{json:g.json},g.id);case"system_init":return e.findIndex(y=>y.kind==="system_init")===p?f.jsx(une,{message:g,rawJson:g.debugRaw},g.id):null;case"account_info":return e.findIndex(y=>y.kind==="account_info")===p?f.jsx(dne,{message:g},g.id):null;case"assistant_text":return f.jsx(hne,{message:g},g.id);case"assistant_thought":return f.jsx(fne,{message:g},g.id);case"tool":return g.toolKind==="ask_user_question"?f.jsx(vne,{message:g,onSubmit:a,isLatest:g.id===r.AskUserQuestion},g.id):g.toolKind==="exit_plan_mode"?f.jsx(_ne,{message:g,onConfirm:l,isLatest:g.id===r.ExitPlanMode,isActionable:(u==null?void 0:u.toolKind)==="exit_plan_mode"&&u.toolUseId===g.toolId},g.id):g.toolKind==="todo_write"?g.id!==r.TodoWrite?null:f.jsx(yne,{message:g},g.id):f.jsx(u3,{message:g,isLoading:t,localPath:n},g.id);case"result":{const v=e[p+1],y=e[p-1];return(v==null?void 0:v.kind)==="context_cleared"||(y==null?void 0:y.kind)==="context_cleared"?null:f.jsx(Rne,{message:g},g.id)}case"interrupted":return f.jsx(Tne,{message:g},g.id);case"compact_boundary":return f.jsx(Nne,{},g.id);case"context_cleared":return f.jsx(Mne,{},g.id);case"compact_summary":return f.jsx(Ane,{message:g},g.id);case"status":return p===e.length-1?f.jsx(jne,{message:g},g.id):null}}return f.jsx(jG,{onOpenLocalLink:s,children:h.map(g=>{if(g.type==="tool-group")return f.jsx("div",{className:"group relative",[vm]:"",children:f.jsx(Bne,{messages:g.messages,isLoading:t,localPath:n})},`group-${g.startIndex}`);const p=d(g.message,g.index);return p?f.jsx("div",{id:`msg-${g.message.id}`,className:"group relative",[vm]:"",children:p},g.message.id):null})})}function Une({rootRef:e,fallbackRef:t,enabled:n,canCancel:r}){_.useEffect(()=>{if(!n)return;let s=0,a=null;const l=p=>{const v=p instanceof Element?p:null,y=e.current,w=t.current;if(jk({trigger:"pointer",activeElement:document.activeElement,pointerStartTarget:a,pointerEndTarget:v,root:y,fallback:w,hasActiveOverlay:Dk(document),hasActiveSelection:r8(window.getSelection())})!=="restore"){a=null;return}w==null||w.focus({preventScroll:!0}),a=null},u=p=>{cancelAnimationFrame(s),a=p.target instanceof Element?p.target:null},h=p=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{l(p.target)})},d=()=>{a=null;const p=t.current;!p||p.disabled||p.focus({preventScroll:!0})},g=p=>{if(p.key!=="Escape")return;const v=t.current;jk({trigger:"escape",activeElement:document.activeElement,fallback:v,hasActiveOverlay:Dk(document),canCancel:r,defaultPrevented:p.defaultPrevented})==="escape-focus"&&(p.preventDefault(),v==null||v.focus({preventScroll:!0}))};return window.addEventListener("pointerdown",u,!0),window.addEventListener("pointerup",h,!0),window.addEventListener("keydown",g,!0),window.addEventListener(gm,d),()=>{cancelAnimationFrame(s),window.removeEventListener("pointerdown",u,!0),window.removeEventListener("pointerup",h,!0),window.removeEventListener("keydown",g,!0),window.removeEventListener(gm,d)}},[r,n,t,e])}const Uf="How can I help you?",$ne=19,Wne=72,Vne=120;function qne(){var je,Xe,ft,pt,he,Le,Ae,nt,gt,qe,vt;const e=a0(),t=_.useRef(null),n=_.useRef(null),r=_.useRef(null),[s,a]=_.useState(""),[l,u]=_.useState(!1),[h,d]=_.useState(0),g=Ap("(min-width: 768px)"),p=typeof window>"u"?!0:IG(window.location.hostname),v=((je=e.runtime)==null?void 0:je.projectId)??null,w=Uo(Se=>v?Se.projects[v]:void 0)??KG,C=Ju(Se=>v?Se.projects[v]:void 0)??UG,k=Uo(Se=>Se.addTerminal),R=Uo(Se=>Se.removeTerminal),E=Uo(Se=>Se.toggleVisibility),N=Uo(Se=>Se.resetMainSizes),j=Uo(Se=>Se.setMainSizes),D=Uo(Se=>Se.setTerminalSizes),L=Ju(Se=>Se.toggleVisibility),U=Ju(Se=>Se.setSize),Y=wi(Se=>Se.scrollbackLines),P=wi(Se=>Se.minColumnWidth),V=e.keybindings,I=_.useMemo(()=>ux(V),[V]),W=w.terminals.length>0,K=!!(v&&w.isVisible&&W),q=!!(v&&W),O=!!(v&&C.isVisible),F=!!(v&&!g&&O),H=!!(v&&g),{isAnimating:$,mainPanelGroupRef:M,terminalFocusRequestVersion:B,terminalPanelRef:X,terminalVisualRef:A}=lY({showTerminalPane:K,shouldRenderTerminalLayout:q,projectId:v,terminalLayout:w,chatInputRef:r}),{isAnimating:re,panelGroupRef:se,sidebarPanelRef:Z,sidebarVisualRef:te}=sY({projectId:v,shouldRenderRightSidebarLayout:H,showRightSidebar:O,rightSidebarSize:C.size});Une({rootRef:n,fallbackRef:r,enabled:e.hasSelectedProject&&((Xe=e.runtime)==null?void 0:Xe.status)!=="waiting_for_user",canCancel:e.canCancel});const le=()=>{if(v){if(W){E(v);return}k(v)}},pe=Se=>{var Oe;if(!v||!K||$.current)return;const De=Se.chat,ce=Se.terminal;if(!Number.isFinite(De)||!Number.isFinite(ce))return;const be=((Oe=t.current)==null?void 0:Oe.getBoundingClientRect().height)??0;if(ZG(be,ce)){N(v),E(v);return}j(v,[De,ce])};_.useEffect(()=>{if(e.messages.length!==0)return;a(""),u(!1);let Se=0;const De=window.setInterval(()=>{Se+=1,a(Uf.slice(0,Se)),Se>=Uf.length&&(window.clearInterval(De),u(!0))},$ne);return()=>window.clearInterval(De)},[e.activeChatId,e.messages.length]),_.useEffect(()=>{function Se(De){if(v){if(Oa(I,"toggleEmbeddedTerminal",De)){De.preventDefault(),le();return}if(Oa(I,"toggleRightSidebar",De)){De.preventDefault(),L(v);return}if(Oa(I,"openInFinder",De)){if(!p)return;De.preventDefault(),e.handleOpenExternal("open_finder");return}if(Oa(I,"openInEditor",De)){if(!p)return;De.preventDefault(),e.handleOpenExternal("open_editor");return}Oa(I,"addSplitTerminal",De)&&(De.preventDefault(),k(v))}}return window.addEventListener("keydown",Se),()=>window.removeEventListener("keydown",Se)},[k,p,le,v,I,L]),_.useEffect(()=>{const Se=window.requestAnimationFrame(()=>{e.updateScrollState()}),De=window.setTimeout(()=>{e.updateScrollState()},tc);return()=>{window.cancelAnimationFrame(Se),window.clearTimeout(De)}},[q,K,e.updateScrollState]),_.useEffect(()=>{function Se(){e.updateScrollState()}return window.addEventListener("resize",Se),()=>window.removeEventListener("resize",Se)},[e.updateScrollState]),_.useEffect(()=>{if(g)return;const Se=window.visualViewport;if(!Se)return;const De=()=>{const ce=e.scrollRef.current;if(!ce)return;const be=ce.scrollHeight-ce.scrollTop-ce.clientHeight;if(nj(be)){requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.scrollToBottom(),e.updateScrollState()})});return}const Oe=document.activeElement;Oe&&ce.contains(Oe)&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{var Ie;const We=(Ie=e.inputRef.current)==null?void 0:Ie.getBoundingClientRect(),we=Oe.getBoundingClientRect();if(We&&we.bottom>We.top){const ot=we.bottom-We.top;ce.scrollBy({top:ot+16,behavior:"auto"})}e.updateScrollState()})})};return Se.addEventListener("resize",De),Se.addEventListener("scroll",De),()=>{Se.removeEventListener("resize",De),Se.removeEventListener("scroll",De)}},[g,e.scrollRef,e.scrollToBottom,e.updateScrollState]),_.useEffect(()=>{const Se=t.current;if(!Se||!q)return;const De=()=>{const be=Se.getBoundingClientRect().height;if(be<=0)return;const Oe=be*(w.mainSizes[1]/100);Oe<=0||d(We=>Math.abs(We-Oe)<1?We:Oe)},ce=new ResizeObserver(De);return ce.observe(Se),De(),()=>ce.disconnect()},[v,q,w.mainSizes]);const xe=Se=>Number.isFinite(Se)?Math.min(Hy,Math.max(Pp,Se)):C.size,Me=()=>{v&&L(v)},Re=f.jsxs(MA,{ref:n,className:"bg-background h-full flex flex-col overflow-hidden border-0 rounded-none relative",children:[f.jsxs(DA,{className:"flex flex-1 min-h-0 flex-col p-0 overflow-hidden relative",children:[f.jsx(SW,{sidebarCollapsed:e.sidebarCollapsed,hasCompletedChats:e.completedChatIds.size>0,onOpenSidebar:e.openSidebar,onExpandSidebar:e.expandSidebar,usage:e.usage,localPath:e.navbarLocalPath,embeddedTerminalVisible:K,onToggleEmbeddedTerminal:v?le:void 0,rightSidebarVisible:O,onToggleRightSidebar:v?()=>L(v):void 0,onOpenExternal:p?Se=>{e.handleOpenExternal(Se)}:void 0,editorLabel:e.editorLabel,projectId:v??void 0,socket:e.socket,finderShortcut:p?I.bindings.openInFinder:void 0,editorShortcut:p?I.bindings.openInEditor:void 0,terminalShortcut:I.bindings.toggleEmbeddedTerminal,rightSidebarShortcut:I.bindings.toggleRightSidebar}),f.jsxs(Mx,{ref:e.scrollRef,onScroll:e.updateScrollState,className:"flex-1 min-h-0 px-4 scroll-pt-[72px]",children:[(ft=e.runtime)!=null&&ft.inactiveProviderMessage?f.jsxs("div",{className:"mx-auto mt-[72px] max-w-[800px] rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-sm text-amber-900 dark:text-amber-200",children:["This thread uses ",e.runtime.provider,", which is currently inactive. ",e.runtime.inactiveProviderMessage]}):null,e.messages.length===0?f.jsx("div",{style:{height:e.transcriptPaddingBottom},"aria-hidden":"true"}):null,e.messages.length>0?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"animate-fade-in space-y-5 pt-[72px] max-w-[800px] mx-auto",children:[f.jsx(Fne,{messages:e.messages,isLoading:e.isProcessing,localPath:(pt=e.runtime)==null?void 0:pt.localPath,latestToolIds:e.latestToolIds,pendingTool:((he=e.runtime)==null?void 0:he.pendingTool)??null,onOpenLocalLink:e.handleOpenLocalLink,onAskUserQuestionSubmit:e.handleAskUserQuestion,onExitPlanModeConfirm:e.handleExitPlanMode}),e.isProcessing?f.jsx(BG,{status:(Le=e.runtime)==null?void 0:Le.status}):null,e.commandError?f.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3",children:e.commandError}):null]}),f.jsx("div",{style:{height:e.transcriptPaddingBottom},"aria-hidden":"true"})]}):null]}),e.messages.length===0?f.jsx("div",{className:"pointer-events-none absolute inset-x-4 animate-fade-in",style:{top:Wne,bottom:e.transcriptPaddingBottom},children:f.jsx("div",{className:"mx-auto flex h-full max-w-[800px] items-center justify-center",children:f.jsxs("div",{className:"flex flex-col items-center justify-center text-muted-foreground gap-4 opacity-70",children:[f.jsx(Sm,{className:"size-8 text-muted-foreground kaizen-empty-state-flower"}),f.jsx("div",{className:"text-base font-normal text-muted-foreground text-center max-w-xs flex items-center kaizen-empty-state-text","aria-label":Uf,children:f.jsxs("span",{className:"relative inline-grid place-items-start",children:[f.jsxs("span",{className:"invisible col-start-1 row-start-1 whitespace-pre flex items-center",children:[f.jsx("span",{children:Uf}),f.jsx("span",{className:"kaizen-typewriter-cursor-slot","aria-hidden":"true"})]}),f.jsxs("span",{className:"col-start-1 row-start-1 whitespace-pre flex items-center",children:[f.jsx("span",{children:s}),f.jsx("span",{className:"kaizen-typewriter-cursor-slot","aria-hidden":"true",children:f.jsx("span",{className:"kaizen-typewriter-cursor","data-typing-complete":l?"true":"false"})})]})]})})]})})},e.activeChatId??"new-chat"):null,f.jsx("div",{style:{bottom:Vne},className:me("absolute left-1/2 -translate-x-1/2 z-10 transition-all",e.showScrollButton?"scale-100 duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)]":"scale-60 duration-300 ease-out pointer-events-none blur-sm opacity-0"),children:f.jsx("button",{onClick:e.scrollToBottom,className:"flex items-center transition-colors gap-1.5 px-2 bg-background/80 dark:bg-card/40 backdrop-blur-lg hover:bg-muted/80 border border-border rounded-full aspect-square cursor-pointer text-sm text-foreground/80 hover:text-foreground",children:f.jsx(g6,{className:"h-5 w-5"})})})]}),f.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-20 pointer-events-none",children:f.jsx("div",{className:"bg-gradient-to-t from-background via-background pointer-events-auto",ref:e.inputRef,children:f.jsx(_W,{ref:r,onSubmit:e.handleSend,onCancel:()=>{e.handleCancel()},disabled:!e.hasSelectedProject||((Ae=e.runtime)==null?void 0:Ae.status)==="waiting_for_user"||!!((nt=e.runtime)!=null&&nt.inactiveProviderMessage),canCancel:e.canCancel,chatId:e.activeChatId,activeProvider:((gt=e.runtime)==null?void 0:gt.provider)??null,activeModel:((qe=e.runtime)==null?void 0:qe.model)??null,activePlanMode:((vt=e.runtime)==null?void 0:vt.planMode)??!1,availableProviders:e.availableProviders,keybindings:I},e.activeChatId??"new-chat")})})]});return f.jsxs("div",{ref:t,className:"flex-1 flex flex-col min-w-0 relative",children:[H&&v?f.jsxs(em,{groupRef:se,orientation:"horizontal",className:"flex-1 min-h-0",onLayoutChange:Se=>{var ce;if(!O||re.current)return;const De=xe(Se.rightSidebar);Math.abs(De-Se.rightSidebar)<.1||(ce=se.current)==null||ce.setLayout({workspace:100-De,rightSidebar:De})},onLayoutChanged:Se=>{!O||re.current||U(v,xe(Se.rightSidebar))},children:[f.jsx(Ma,{id:"workspace",defaultSize:`${100-C.size}%`,minSize:"50%",className:"min-h-0 min-w-0",children:q?f.jsxs(em,{groupRef:M,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:pe,children:[f.jsx(Ma,{id:"chat",defaultSize:`${w.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:Re}),f.jsx(tm,{withHandle:!0,orientation:"vertical",disabled:!K,className:me(!K&&"pointer-events-none opacity-0")}),f.jsx(Ma,{id:"terminal",defaultSize:`${w.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:X,children:f.jsx("div",{ref:A,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":K?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${tc}ms`},children:f.jsx("div",{style:h>0?{height:`${h}px`}:void 0,children:f.jsx(UE,{projectId:v,layout:w,onAddTerminal:k,socket:e.socket,connectionStatus:e.connectionStatus,scrollback:Y,minColumnWidth:P,splitTerminalShortcut:I.bindings.addSplitTerminal,focusRequestVersion:B,onRemoveTerminal:(Se,De)=>{e.socket.command({type:"terminal.close",terminalId:De}).catch(()=>{}),R(Se,De)},onTerminalLayout:D})})})})]},v):Re}),f.jsx(tm,{withHandle:!0,orientation:"horizontal",disabled:!O,className:me(!O&&"pointer-events-none opacity-0")}),f.jsx(Ma,{id:"rightSidebar",defaultSize:`${C.size}%`,maxSize:`${Hy}%`,className:"min-h-0 min-w-0",elementRef:Z,children:f.jsx("div",{ref:te,className:"h-full min-h-0 overflow-hidden","data-right-sidebar-open":O?"true":"false","data-right-sidebar-animated":"false","data-right-sidebar-visual":!0,style:{"--terminal-toggle-duration":`${tc}ms`},children:f.jsx(R2,{onClose:()=>L(v)})})})]},`${v}-right-sidebar`):q&&v?f.jsxs(em,{groupRef:M,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:pe,children:[f.jsx(Ma,{id:"chat",defaultSize:`${w.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:Re}),f.jsx(tm,{withHandle:!0,orientation:"vertical",disabled:!K,className:me(!K&&"pointer-events-none opacity-0")}),f.jsx(Ma,{id:"terminal",defaultSize:`${w.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:X,children:f.jsx("div",{ref:A,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":K?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${tc}ms`},children:f.jsx("div",{style:h>0?{height:`${h}px`}:void 0,children:f.jsx(UE,{projectId:v,layout:w,onAddTerminal:k,socket:e.socket,connectionStatus:e.connectionStatus,scrollback:Y,minColumnWidth:P,splitTerminalShortcut:I.bindings.addSplitTerminal,focusRequestVersion:B,onRemoveTerminal:(Se,De)=>{e.socket.command({type:"terminal.close",terminalId:De}).catch(()=>{}),R(Se,De)},onTerminalLayout:D})})})})]},v):Re,F?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"fixed inset-0 z-40 bg-black/40 md:hidden",onClick:Me}),f.jsx("div",{className:"fixed inset-0 z-50 flex flex-col bg-background/95 backdrop-blur-2xl md:hidden",children:f.jsx(R2,{onClose:Me,className:"h-[var(--app-shell-height)]"})})]}):null]})}function WR({narrow:e=!1,title:t,subtitle:n,icon:r=RN}){return f.jsxs("div",{className:me("w-full",e?"max-w-2xl px-6 pt-16 mx-auto":"px-6 pt-16 mb-10"),children:[f.jsxs("div",{className:me("flex items-center gap-1 mb-2",e&&"justify-center"),children:[f.jsx("div",{className:"p-2 pl-0 rounded-lg",children:f.jsx(r,{className:"h-6 w-6 text-muted-foreground"})}),f.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:t})]}),n&&f.jsx("p",{className:me("text-muted-foreground",e&&"mb-10 text-center"),children:n})]})}const Kne={sm:"text-sm px-2.5 py-1",md:"text-sm px-3 py-1.5"};function Gne({value:e,onValueChange:t,options:n,size:r="md",className:s,optionClassName:a}){return f.jsx("div",{className:me("inline-flex items-center rounded-lg border border-border p-[3px] ",s),children:n.map(l=>{const u=l.value===e,h=l.icon,d=h?_.isValidElement(h)?h:(()=>{const p=h;return f.jsx(p,{className:r==="sm"?"h-3.5 w-3.5":"h-4 w-4"})})():null,g=f.jsxs("button",{type:"button",onClick:()=>t(l.value),disabled:l.disabled,"aria-pressed":u,className:me("rounded-[4px] border transition-colors",h?"grid grid-cols-[auto_auto] items-center gap-2":"inline-flex items-center gap-1.5",Kne[r],u?"bg-white dark:bg-muted text-slate-900 dark:text-slate-200 border-slate-300 dark:border-white/10 bg-slate-200 ":"border-transparent text-slate-800 hover:text-slate-900 dark:text-muted-foreground dark:hover:text-foreground",l.disabled&&"opacity-50 pointer-events-none",a),children:[d,f.jsx("span",{children:l.label})]},l.value);return l.tooltip?f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:g}),f.jsx(Fi,{children:l.tooltip})]},l.value):g})})}function Yne(e){return e.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Xne(e){const t=e.split("/").filter(Boolean);return t[t.length-1]||e}function Zne({open:e,onOpenChange:t,initialDirectory:n,onListDirectories:r,onConfirm:s}){var O;const[a,l]=_.useState("new"),[u,h]=_.useState(""),[d,g]=_.useState([]),[p,v]=_.useState({}),[y,w]=_.useState([]),[S,C]=_.useState(null),[k,R]=_.useState(""),[E,N]=_.useState(null),[j,D]=_.useState(null),L=_.useRef(null);_.useEffect(()=>{e&&(l("new"),h(""),g(n?n.roots:[]),v(n?{[n.currentPath]:n.entries}:{}),w(n?[n.currentPath]:[]),C((n==null?void 0:n.currentPath)??null),R(""),N(null),D(null),setTimeout(()=>{var F;return(F=L.current)==null?void 0:F.focus()},0))},[n,e]),_.useEffect(()=>{e&&setTimeout(()=>{var F;a==="new"&&((F=L.current)==null||F.focus())},0)},[a,e]);const U=Yne(u),Y=U?`${t7}/${U}`:"",P=k.trim(),V=a==="new"?!!U:!!P,I=async F=>{N(null),D(F??"__root__");try{const H=await r(F);if(!F){g(H.roots),C(H.currentPath),v({[H.currentPath]:H.entries}),w([H.currentPath]);return}d.length===0&&(g([{name:Xne(H.currentPath),localPath:H.currentPath}]),C(H.currentPath)),v($=>({...$,[H.currentPath]:H.entries})),w($=>$.includes(H.currentPath)?$:[...$,H.currentPath])}catch(H){N(H instanceof Error?H.message:String(H))}finally{D(null)}},W=async F=>{if(y.includes(F)){w(H=>H.filter($=>$!==F));return}if(p[F]){w(H=>[...H,F]);return}await I(F)},K=(F,H,$)=>{const M=y.includes(F),B=k===F,X=p[F]??[],A=j===F;return f.jsxs("div",{children:[f.jsxs("div",{className:me("grid grid-cols-[auto_1fr] items-center gap-2 px-3 py-2",B?"bg-muted":"hover:bg-muted/50"),style:{paddingLeft:`${12+$*16}px`},children:[f.jsx("button",{type:"button",className:"flex h-6 w-6 items-center justify-center rounded hover:bg-background disabled:opacity-50",onClick:()=>void W(F),disabled:A,children:A?f.jsx(oi,{className:"h-4 w-4 animate-spin text-muted-foreground"}):f.jsx(Tr,{className:me("h-4 w-4 text-muted-foreground transition-transform",M&&"rotate-90")})}),f.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-2 text-left",onClick:()=>R(F),children:[M?f.jsx(xN,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):f.jsx(SN,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),f.jsx("span",{className:"truncate",children:H})]})]}),M&&X.length>0?X.map(re=>K(re.localPath,re.name,$+1)):null]},F)},q=()=>{if(V){if(a==="new")s({mode:"new",localPath:Y,title:u.trim()});else{const F=P.split("/").pop()||P;s({mode:"existing",localPath:P,title:F})}t(!1)}};return f.jsx(ip,{open:e,onOpenChange:t,children:f.jsxs(kd,{size:"sm",children:[f.jsxs(op,{className:"space-y-4",children:[f.jsx(sp,{children:"Add Project"}),f.jsx(Gne,{value:a,onValueChange:l,options:[{value:"new",label:"New Folder"},{value:"existing",label:"Existing Folder"}],className:"w-full mb-2",optionClassName:"flex-1 justify-center"}),a==="new"?f.jsxs("div",{className:"space-y-2",children:[f.jsx(Si,{ref:L,type:"text",value:u,onChange:F=>h(F.target.value),onKeyDown:F=>{F.key==="Enter"&&q(),F.key==="Escape"&&t(!1)},placeholder:"Project name"}),Y&&f.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:Y})]}):f.jsxs("div",{className:"space-y-2",children:[f.jsx(Si,{type:"text",value:k,onChange:F=>R(F.target.value),onKeyDown:F=>{F.key==="Enter"&&I(k||void 0)},placeholder:"Enter a server path, for example /home/bettie/Projects/my-app"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"Import an existing folder from the connected server machine. You can type a path manually or choose from the root folder list below."}),f.jsx("div",{className:"flex justify-end",children:f.jsx(tt,{type:"button",variant:"ghost",size:"sm",onClick:()=>void I("~"),disabled:j!==null,children:"Load Root"})}),d.length>0?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Server Folders"}),f.jsxs(Mx,{className:"max-h-64 rounded-xl border border-border",children:[d.map(F=>K(F.localPath,F.name,0)),S&&((O=p[S])==null?void 0:O.length)===0?f.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"No subfolders"}):null]})]}):j?f.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-border px-3 py-2 text-sm text-muted-foreground",children:[f.jsx(oi,{className:"h-4 w-4 animate-spin"}),"Loading folders from server machine..."]}):null,E?f.jsx("p",{className:"text-xs text-destructive",children:E}):null]})]}),f.jsxs(ap,{children:[f.jsx(tt,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),f.jsx(tt,{variant:"secondary",size:"sm",onClick:q,disabled:!V,children:a==="new"?"Create":"Import"})]})]})})}function Qne({text:e}){const[t,n]=_.useState(!1);async function r(){await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}return f.jsx(tt,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>void r(),children:t?f.jsx(Wi,{className:"h-4 w-4 text-green-400"}):f.jsx(Cd,{className:"h-4 w-4"})})}function VR({children:e}){return f.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center group bg-background border border-border text-foreground rounded-xl p-1.5 pl-3 font-mono text-sm",children:[f.jsxs("pre",{className:"inline-flex items-center gap-2 overflow-x-auto",children:[f.jsx(Tr,{className:"inline h-4 w-4 opacity-40"}),f.jsx("code",{children:e})]}),f.jsx(Qne,{text:e})]})}function $f({children:e}){return f.jsx("div",{className:"bg-card border border-border rounded-2xl p-4",children:e})}function pb({children:e}){return f.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider mb-3",children:e})}function gb({icon:e,title:t,subtitle:n,iconClassName:r}){return f.jsxs("div",{className:"flex flex-col items-center gap-0",children:[f.jsx("div",{className:"p-3 mb-2 rounded-xl bg-background border border-border",children:f.jsx(e,{className:r||"h-8 w-8 text-muted-foreground"})}),f.jsx("span",{className:"text-sm font-medium",children:t}),f.jsx("span",{className:"text-xs text-muted-foreground",children:n})]})}function qR(){return f.jsx(_6,{className:"h-4 w-4 text-muted-foreground"})}function KR({number:e,title:t,children:n}){return f.jsx("div",{className:"flex gap-4",children:f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-baseline gap-3",children:[f.jsxs("div",{className:"flex-shrink-0 flex items-center justify-center font-medium text-logo",children:[e,"."]}),f.jsx("h3",{className:"font-medium text-foreground mb-2",children:t})]}),f.jsx("div",{className:"text-muted-foreground text-sm space-y-3",children:n})]})})}function Jne({localPath:e,iconDataUrl:t,loading:n,onClick:r,onHide:s}){const a=gn(l=>l.showProjectIconsInSidebar);return f.jsxs("div",{className:"relative group",children:[f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsxs("button",{className:me("border border-border hover:border-primary/30 rounded-lg bg-card px-4 py-3 flex items-center gap-3 w-full text-left hover:bg-muted/50 transition-colors",n&&"opacity-50 cursor-not-allowed"),disabled:n,onClick:r,children:[a?f.jsx(CA,{iconDataUrl:t,alt:`${km(e)} icon`,className:"h-5.5 w-5.5",fallback:f.jsx(SN,{className:"h-5.5 w-5.5 text-muted-foreground flex-shrink-0"})}):null,f.jsx("span",{className:"font-medium text-foreground truncate flex-1 pr-10",children:km(e)}),n?f.jsx(oi,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary animate-spin flex-shrink-0"}):null]})}),f.jsx(Fi,{children:f.jsx("p",{children:e})})]}),f.jsx(tt,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 h-7 w-7 -translate-y-1/2 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",disabled:n,onClick:l=>{l.stopPropagation(),s()},children:f.jsx(id,{className:"h-4 w-4"})})]})}function ere({connectionStatus:e,ready:t,snapshot:n,startingLocalPath:r,commandError:s,onOpenProject:a,onHideProject:l,onListDirectories:u,onCreateProject:h}){const[d,g]=sz(),[p,v]=_.useState(!1),y=_.useMemo(()=>(n==null?void 0:n.projects)??[],[n==null?void 0:n.projects]),w=e==="connecting"||!t,S=e==="connected"&&t,C=d.get("newProject")==="1";_.useEffect(()=>{S&&C&&v(!0)},[S,C]);const k=R=>{if(v(R),!R&&C){const E=new URLSearchParams(d);E.delete("newProject"),g(E,{replace:!0})}};return f.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-y-auto",children:[S?f.jsxs(f.Fragment,{children:[f.jsx(WR,{title:(n==null?void 0:n.machine.displayName)??"Local Projects",subtitle:`${Pn} is connected, choose a project below to get started.`}),f.jsxs("div",{className:"w-full px-6 mb-10",children:[f.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[f.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider",children:"Projects"}),f.jsxs(tt,{variant:"default",size:"sm",onClick:()=>v(!0),children:[f.jsx(_0,{className:"h-4 w-4 mr-1.5"}),"Add Project"]})]}),y.length>0?f.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-4 3xl:grid-cols-5 gap-2",children:y.map(R=>f.jsx(Jne,{localPath:R.localPath,iconDataUrl:R.iconDataUrl,loading:r===R.localPath,onClick:()=>{a(R.localPath)},onHide:()=>{l(R.localPath)}},R.localPath))}):f.jsx($f,{children:f.jsx("p",{className:"text-sm text-muted-foreground",children:"No local projects discovered yet. Open one with Claude or Codex, or create a new project here."})}),s?f.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3 mt-4",children:s}):null]})]}):f.jsxs(f.Fragment,{children:[f.jsx(WR,{narrow:!0,icon:Rk,title:w?`Connecting ${Pn}`:`Connect ${Pn}`,subtitle:w?`${Pn} is starting up and loading your local projects.`:`Run ${Pn} directly on your machine with full access to your local files and agent project history.`}),f.jsxs("div",{className:"max-w-2xl w-full mx-auto pb-12 px-6",children:[f.jsx(pb,{children:"Status"}),f.jsx("div",{className:"mb-8",children:f.jsx($f,{children:f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(oi,{className:"h-4 w-4 text-muted-foreground animate-spin"}),f.jsx("span",{className:"text-sm text-muted-foreground",children:w?`Connecting to your local ${Pn} server...`:f.jsxs(f.Fragment,{children:["Not connected. Run ",f.jsx("code",{className:"bg-background border border-border rounded-md mx-0.5 p-1 font-mono text-xs text-foreground",children:xf()})," from any terminal on this machine."]})})]})})}),w?null:f.jsxs("div",{className:"mb-10",children:[f.jsx(pb,{children:"How it works"}),f.jsx($f,{children:f.jsxs("div",{className:"flex items-center justify-around gap-6 py-4 px-2",children:[f.jsx(gb,{icon:y0,title:`${Pn} CLI`,subtitle:"On Your Machine"}),f.jsx(qR,{}),f.jsx(gb,{icon:RN,title:`${Pn} Server`,subtitle:"Local WebSocket"}),f.jsx(qR,{}),f.jsx(gb,{icon:Rk,title:`${Pn} UI`,subtitle:"Project Chat"})]})})]}),w?null:f.jsxs("div",{className:"mb-10",children:[f.jsx(pb,{children:"Setup"}),f.jsx($f,{children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs(KR,{number:1,title:`Start ${Pn}`,children:[f.jsx("p",{children:"Run this command in your terminal:"}),f.jsx(VR,{children:xf()})]}),f.jsxs(KR,{number:2,title:"Open the local UI",children:[f.jsxs("p",{children:[Pn," serves the app locally and opens the Local Projects page in an app-style browser window."]}),f.jsx(VR,{children:"http://localhost:3210/local"})]}),f.jsxs("div",{className:"mt-8",children:[f.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-4",children:"Notes"}),f.jsxs("div",{className:"space-y-3 text-sm",children:[f.jsxs("div",{className:"flex gap-4",children:[f.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:xf("").trim()}),f.jsx("span",{className:"text-muted-foreground",children:"Start in the current directory"})]}),f.jsxs("div",{className:"flex gap-4",children:[f.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:xf("--no-open")}),f.jsx("span",{className:"text-muted-foreground",children:"Start the server without opening the browser"})]})]})]})]})})]})]})]}),f.jsx(Zne,{open:p,onOpenChange:k,initialDirectory:(n==null?void 0:n.rootDirectory)??null,onListDirectories:u,onConfirm:R=>{h(R)}}),f.jsx("div",{className:"py-4 text-center",children:f.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v",L0.split("/")[1]]})})]})}function tre(){const e=a0();return f.jsx("div",{className:"flex-1 flex flex-col min-w-0 relative",children:f.jsx(ere,{connectionStatus:e.connectionStatus,ready:e.localProjectsReady,snapshot:e.localProjects,startingLocalPath:e.startingLocalPath,commandError:e.commandError,onOpenProject:e.handleOpenLocalProject,onHideProject:e.handleHideLocalProject,onListDirectories:e.handleListDirectories,onCreateProject:e.handleCreateProject})})}function vb({children:e,className:t,icon:n,type:r="button",variant:s="outline",...a}){return f.jsxs("button",{type:r,className:me(FT({variant:s,size:"sm"}),"h-auto gap-1.5 px-3 py-1.5",t),...a,children:[n,e?f.jsx("span",{children:e}):null]})}const Ku=[{id:"general",label:"General",icon:BI,subtitle:"Manage appearance, editor behavior, and embedded terminal defaults."},{id:"providers",label:"Providers",icon:xI,subtitle:"Manage the default chat provider and saved model defaults for Claude, Codex, Gemini, and Cursor."},{id:"keybindings",label:"Keybindings",icon:V6,subtitle:"Edit global app shortcuts stored in the active keybindings file."}];function GR(e){return e&&Ku.some(t=>t.id===e)?e:null}const nre=[{value:"cursor",label:"Cursor"},{value:"vscode",label:"VS Code"},{value:"windsurf",label:"Windsurf"},{value:"custom",label:"Custom"}],YR=Object.keys(NA);function rre(e){return`Edit global app shortcuts stored in ${e}.`}function ire(e){const t=(e==null?void 0:e.status)==="checking",n=(e==null?void 0:e.status)==="updating"||(e==null?void 0:e.status)==="restart_pending";return e!=null&&e.updateAvailable?{disabled:n,kind:"update",label:"Update",variant:"default"}:{disabled:t||n,kind:"check",label:"Check for updates",spinning:t,variant:"outline"}}function Wf(e,t){const n=Jt(t),r=(e==null?void 0:e.settings[t])??Wn[t];return n.systemActive?r.active?"Active.":"Inactive.":"Inactive by server policy."}function sre(e){return e&&typeof e=="object"&&"idx"in e&&typeof e.idx=="number"&&e.idx>0?"back":"home"}function XR({themePreference:e,nextBackgroundImage:t,backgroundOpacity:n}){const r=typeof t=="string"&&t.trim()!=="";return e!=="custom"||!r||n!==1?{}:{backgroundOpacity:.85,backgroundBlur:6}}function yn({title:e,description:t,children:n,bordered:r=!0,alignStart:s=!1}){return f.jsx("div",{className:r?"border-t border-border":void 0,children:f.jsxs("div",{className:`flex flex-col sm:flex-row sm:justify-between gap-3 sm:gap-8 py-5 ${s?"sm:items-start":"sm:items-center"}`,children:[f.jsxs("div",{className:"min-w-0 max-w-xl",children:[f.jsx("div",{className:"text-sm font-medium text-foreground",children:e}),f.jsx("div",{className:"mt-1 text-[13px] text-muted-foreground",children:t})]}),f.jsx("div",{className:"flex w-full items-center sm:w-auto sm:shrink-0",children:n})]})})}function ore(){var Ot,sn;const e=_c(),{sectionId:t}=pT(),n=a0(),{theme:r,setTheme:s}=WD(),a=GR(t)??"general",l=n.connectionStatus==="connecting"||!n.localProjectsReady,u=((Ot=n.localProjects)==null?void 0:Ot.machine.displayName)??"Unavailable",h=((sn=n.localProjects)==null?void 0:sn.projects.length)??0,d=L0.split("/")[1]??"unknown",g=wi(G=>G.scrollbackLines),p=wi(G=>G.minColumnWidth),v=wi(G=>G.editorPreset),y=wi(G=>G.editorCommandTemplate),w=wi(G=>G.setScrollbackLines),S=wi(G=>G.setMinColumnWidth),C=wi(G=>G.setEditorPreset),k=wi(G=>G.setEditorCommandTemplate),R=n.keybindings,E=n.providerSettings,N=xi(G=>G.defaultProvider),j=xi(G=>G.providerDefaults),D=xi(G=>G.showProviderIconsInSideTray),L=xi(G=>G.setDefaultProvider),U=xi(G=>G.setProviderDefaultModel),Y=xi(G=>G.setProviderDefaultModelOptions),P=xi(G=>G.setProviderDefaultPlanMode),V=xi(G=>G.setShowProviderIconsInSideTray),I=qs(G=>G.folderGroupsEnabled),W=qs(G=>G.kanbanStatusesEnabled),K=qs(G=>G.commitProjectMetadataDirectory),q=qs(G=>G.setFolderGroupsEnabled),O=qs(G=>G.setKanbanStatusesEnabled),F=qs(G=>G.setCommitProjectMetadataDirectory),H=gn(G=>G.colorTheme),$=gn(G=>G.customAppearance),M=gn(G=>G.backgroundImage),B=gn(G=>G.backgroundOpacity),X=gn(G=>G.backgroundBlur),A=gn(G=>G.showProjectIconsInSidebar),re=gn(G=>G.setColorTheme),se=gn(G=>G.setCustomAppearance),Z=gn(G=>G.setBackgroundImage),te=gn(G=>G.setBackgroundOpacity),le=gn(G=>G.setBackgroundBlur),pe=gn(G=>G.setShowProjectIconsInSidebar),xe=_.useMemo(()=>ux(R),[R]),Me=xe.filePathDisplay||s7(),[Re,je]=_.useState(String(g)),[Xe,ft]=_.useState(String(p)),[pt,he]=_.useState(y),[Le,Ae]=_.useState(M??""),[nt,gt]=_.useState(String(B)),[qe,vt]=_.useState(String(X)),[Se,De]=_.useState({}),[ce,be]=_.useState(null),[Oe,We]=_.useState(null),we=_.useMemo(()=>P0((E==null?void 0:E.settings)??Wn),[E==null?void 0:E.settings]),Ie=N==="last_used"||we.some(G=>G.id===N)?N:"last_used",[ot,rt]=_.useState([]),ze=n.updateSnapshot,St=ire(ze),at=(ze==null?void 0:ze.status)==="checking"?"Checking for updates…":(ze==null?void 0:ze.status)==="updating"?"Installing update…":(ze==null?void 0:ze.status)==="restart_pending"?`Restarting ${Pn}…`:(ze==null?void 0:ze.status)==="available"?`Update available${ze.latestVersion?`: ${ze.latestVersion}`:""}`:(ze==null?void 0:ze.status)==="up_to_date"?"Up to date":(ze==null?void 0:ze.status)==="error"?"Update check failed":"Not checked yet";_.useEffect(()=>{fetch("/api/backgrounds").then(G=>G.json()).then(G=>rt(G)).catch(G=>console.error("Failed to load system backgrounds",G))},[]),_.useEffect(()=>{je(String(g))},[g]),_.useEffect(()=>{ft(String(p))},[p]),_.useEffect(()=>{he(y)},[y]),_.useEffect(()=>{Ae(M??"")},[M]),_.useEffect(()=>{gt(String(B))},[B]),_.useEffect(()=>{vt(String(X))},[X]),_.useEffect(()=>{De(Object.fromEntries(YR.map(G=>[G,T_(xe.bindings[G])])))},[xe]),_.useEffect(()=>{t&&(GR(t)||e("/settings/general",{replace:!0}))},[e,t]);function vn(){const G=Number(Re);if(!Number.isFinite(G)){je(String(g));return}w(G)}function tn(){const G=Number(Xe);if(!Number.isFinite(G)){ft(String(p));return}S(G)}function Nn(){const G=Le.trim()===""?null:Le.trim(),Ye=XR({themePreference:r,nextBackgroundImage:G,backgroundOpacity:B});Z(G),Ye.backgroundOpacity!==void 0&&te(Ye.backgroundOpacity),Ye.backgroundBlur!==void 0&&le(Ye.backgroundBlur),st({backgroundImage:G,...Ye})}function xr(){const G=Number(nt);if(!Number.isFinite(G)||G<0||G>1){gt(String(B));return}te(G),st({backgroundOpacity:G})}function rr(){const G=Number(qe);if(!Number.isFinite(G)||G<0){vt(String(X));return}le(G),st({backgroundBlur:G})}function jt(G,Ye){G.key==="Enter"&&(Ye(),G.currentTarget.blur())}function zt(G,Ye){G.key==="Enter"&&(Ye(),G.currentTarget.blur())}function He(){k(pt)}async function ct(G=Se){try{be(null),await n.socket.command({type:"settings.writeKeybindings",bindings:ZR(G)})}catch(Ye){be(Ye instanceof Error?Ye.message:"Unable to save keybindings.")}}async function st(G){try{await n.socket.command({type:"settings.writeThemeSettings",settings:{themePreference:(G==null?void 0:G.themePreference)??r,colorTheme:(G==null?void 0:G.colorTheme)??H,customAppearance:(G==null?void 0:G.customAppearance)??$,backgroundImage:(G==null?void 0:G.backgroundImage)!==void 0?G.backgroundImage:M,backgroundOpacity:(G==null?void 0:G.backgroundOpacity)??B,backgroundBlur:(G==null?void 0:G.backgroundBlur)??X,showProjectIconsInSidebar:(G==null?void 0:G.showProjectIconsInSidebar)??A}})}catch(Ye){console.error("Failed to save theme settings:",Ye)}}async function mt(G){try{We(null),await n.socket.command({type:"settings.writeProviderSettings",settings:G})}catch(Ye){We(Ye instanceof Error?Ye.message:"Unable to save provider settings.")}}async function an(G){const Ye={...Se,[G]:T_(os[G])};De(Ye);try{be(null),await n.socket.command({type:"settings.writeKeybindings",bindings:ZR(Ye)})}catch(It){be(It instanceof Error?It.message:"Unable to save keybindings.")}}const Ce=pt.replaceAll("{path}","/Users/jake/Projects/kaizen/src/client/app/App.tsx").replaceAll("{line}","12").replaceAll("{column}","1"),Te=Ku.find(G=>G.id===a)??Ku[0],_t=a==="keybindings"?rre(Me):Te.subtitle,Qe=!l,bt=a==="keybindings"?f.jsxs(vb,{onClick:()=>{n.handleOpenExternalPath("open_editor",Me)},icon:f.jsx(yN,{className:"h-4 w-4"}),children:["Open in ",n.editorLabel]}):a==="general"?f.jsx(vb,{variant:St.variant,onClick:()=>{if(St.kind==="update"){n.handleInstallUpdate();return}n.handleCheckForUpdates({force:!0})},disabled:St.disabled,icon:St.kind==="check"?f.jsx(b0,{className:me("size-3.5",St.spinning&&"animate-spin")}):St.kind==="update"?f.jsx(F6,{className:me("size-3.5")}):void 0,children:St.label}):null;function qt(){if(sre(window.history.state)==="back"){e(-1);return}e("/",{replace:!0})}return f.jsxs("div",{className:"relative flex h-full flex-1 min-w-0 bg-background",children:[f.jsxs("div",{className:"flex min-w-0 flex-1",children:[f.jsx("aside",{className:`hidden w-[200px] shrink-0 md:block ${Qe?"pb-[89px]":""}`,children:f.jsxs("div",{className:"flex flex-col gap-1 px-4 py-6",children:[f.jsx("div",{className:"px-3 pb-5 text-[22px] font-extrabold tracking-[-0.5px] text-foreground",children:"Settings"}),Ku.map(G=>f.jsx("button",{type:"button",onClick:()=>e(`/settings/${G.id}`),className:`cursor-pointer rounded-lg px-3 py-2 text-sm ${G.id===a?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`,children:f.jsxs("div",{className:"flex items-center gap-2.5",children:[f.jsx(G.icon,{className:"h-4 w-4 shrink-0"}),f.jsx("span",{children:G.label})]})},G.label))]})}),f.jsxs("div",{className:"min-w-0 flex-1 overflow-y-auto",children:[f.jsx("div",{className:"md:hidden sticky top-0 z-10 bg-background border-b border-border px-4 py-2 backdrop-blur-md",children:f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto scrollbar-hide",children:Ku.map(G=>f.jsxs("button",{type:"button",onClick:()=>e(`/settings/${G.id}`),className:`flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm transition-colors ${G.id===a?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`,children:[f.jsx(G.icon,{className:"h-3.5 w-3.5 shrink-0"}),f.jsx("span",{children:G.label})]},G.id))}),f.jsx("button",{type:"button","aria-label":"Close settings",onClick:qt,className:"ml-1 flex shrink-0 items-center justify-center rounded-lg p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:f.jsx(Xo,{className:"h-4 w-4"})})]})}),f.jsxs("div",{className:"w-full px-6 pt-8 md:pt-16 pb-32",children:[l?f.jsx("div",{className:"flex min-h-[240px] items-center justify-center rounded-2xl border border-border bg-card/40 px-4 py-6 text-sm text-muted-foreground",children:f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(oi,{className:"h-4 w-4 animate-spin"}),f.jsx("span",{children:"Loading machine settings…"})]})}):f.jsxs("div",{className:"mx-auto max-w-4xl",children:[f.jsxs("div",{className:"pb-6",children:[f.jsxs("div",{className:"flex items-center justify-between gap-4 min-h-[34px]",children:[f.jsx("div",{className:"text-lg font-semibold tracking-[-0.2px] text-foreground",children:Te.label}),f.jsxs("div",{className:"flex items-center gap-2",children:[bt,f.jsx(vb,{"aria-label":"Close settings",title:"Close settings",onClick:qt,icon:f.jsx(Xo,{className:"h-4 w-4"}),className:"hidden md:flex"})]})]}),f.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:_t})]}),a==="general"?f.jsx(f.Fragment,{children:f.jsxs("div",{className:"border-b border-border",children:[f.jsx(yn,{title:"Application Update",description:f.jsxs(f.Fragment,{children:[f.jsxs("span",{children:[at,"."]}),ze!=null&&ze.lastCheckedAt?f.jsxs("span",{children:[" Last checked ",new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(ze.lastCheckedAt),"."]}):null,ze!=null&&ze.error?f.jsxs("span",{children:[" ",ze.error]}):null]}),bordered:!1,children:f.jsxs("div",{className:"text-right text-sm text-foreground",children:[f.jsxs("div",{children:["Current: ",(ze==null?void 0:ze.currentVersion)??d]}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:["Latest: ",(ze==null?void 0:ze.latestVersion)??"Unknown"]})]})}),f.jsx(yn,{title:"Release Notes",description:f.jsxs(f.Fragment,{children:[f.jsx("span",{children:"The old GitHub changelog page is hidden after the rebrand because releases are no longer sourced from a public GitHub repo."}),f.jsx("span",{children:" We need to come back to this and wire release notes to the deployment/NPX update flow."})]}),children:f.jsx("div",{className:"rounded-full border border-border bg-muted/40 px-3 py-1 text-xs font-medium text-muted-foreground",children:"Temporary placeholder"})}),f.jsx(yn,{title:"Theme",description:"Choose between light, dark, system, or custom appearance",children:f.jsxs(pr,{value:r,onValueChange:G=>{s(G),st({themePreference:G})},children:[f.jsx(ur,{className:"w-[150px]",children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"light",children:"Light"}),f.jsx(Et,{value:"dark",children:"Dark"}),f.jsx(Et,{value:"system",children:"System"}),f.jsx(Et,{value:"custom",children:"Custom"})]})]})}),r==="custom"?f.jsxs("div",{className:"mb-2 ml-6 space-y-0 border-l border-border/60 pl-4",children:[f.jsx(yn,{title:"Appearance",description:"Choose light, dark, or system mode for your custom theme",bordered:!1,children:f.jsxs(pr,{value:$,onValueChange:G=>{se(G),st({customAppearance:G})},children:[f.jsx(ur,{className:"w-[150px]",children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"light",children:"Light"}),f.jsx(Et,{value:"dark",children:"Dark"}),f.jsx(Et,{value:"system",children:"System"})]})]})}),f.jsx(yn,{title:"Color Theme",description:"Choose a color palette for the interface",alignStart:!0,bordered:!1,children:f.jsxs(pr,{value:H,onValueChange:G=>{re(G),st({colorTheme:G})},children:[f.jsx(ur,{className:"min-w-[180px]",children:f.jsx(Sr,{})}),f.jsx(dr,{children:f.jsxs(C_,{children:[f.jsx(Et,{value:"default",children:"Default"}),f.jsx(Et,{value:"tokyo-night",children:"Tokyo Night"}),f.jsx(Et,{value:"catppuccin",children:"Catppuccin"}),f.jsx(Et,{value:"dracula",children:"Dracula"}),f.jsx(Et,{value:"nord",children:"Nord"}),f.jsx(Et,{value:"everforest",children:"Everforest"}),f.jsx(Et,{value:"rose-pine",children:"Rose Pine"})]})})]})}),f.jsx(yn,{title:"Background Image",description:"Choose a background or enter a custom URL",alignStart:!0,bordered:!1,children:(()=>{const G=ot.find($t=>$t.url===Le),Ye=!Le,It=!!Le&&!G,Cn=Ye?"__none__":It?"__custom__":Le,li=Ye?"None":It?"Custom URL":(G==null?void 0:G.name)??"Unknown";return f.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-2 sm:max-w-[320px]",children:[f.jsxs(pr,{value:Cn,onValueChange:$t=>{if($t==="__none__")Ae(""),Z(null),st({backgroundImage:null});else{const ir=XR({themePreference:r,nextBackgroundImage:$t,backgroundOpacity:B});Ae($t),Z($t),ir.backgroundOpacity!==void 0&&te(ir.backgroundOpacity),ir.backgroundBlur!==void 0&&le(ir.backgroundBlur),st({backgroundImage:$t,...ir})}},children:[f.jsx(ur,{className:"w-full",children:f.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[Ye?null:f.jsx("img",{src:Le,alt:"",className:"h-5 w-9 shrink-0 rounded object-cover"}),f.jsx("span",{className:"truncate",children:li})]})}),f.jsxs(dr,{children:[f.jsx(Qf,{value:"__none__",children:"None"}),ot.map($t=>f.jsx(Qf,{value:$t.url,thumbnail:$t.url,thumbnailAlt:$t.name,children:$t.name},$t.id)),It?f.jsx(Qf,{value:"__custom__",thumbnail:Le,thumbnailAlt:"Custom",children:"Custom URL"}):null]})]}),f.jsx(Si,{type:"text",placeholder:"Or enter a custom URL...",value:Le,onChange:$t=>Ae($t.target.value),onBlur:Nn,onKeyDown:$t=>zt($t,Nn),className:"w-full"})]})})()}),f.jsx(yn,{title:"Background Opacity",description:"Opacity of the interface layered over the background (0 to 1)",bordered:!1,children:f.jsx("div",{className:"flex min-w-0 flex-col items-end gap-2",children:f.jsx(Si,{type:"number",min:0,max:1,step:.05,value:nt,onChange:G=>gt(G.target.value),onBlur:xr,onKeyDown:G=>jt(G,xr),className:"hide-number-steppers w-28 text-right font-mono"})})}),f.jsx(yn,{title:"Background Blur",description:"Blur applied to the background image (in pixels)",bordered:!1,children:f.jsx("div",{className:"flex min-w-0 flex-col items-end gap-2",children:f.jsx(Si,{type:"number",min:0,max:50,step:1,value:qe,onChange:G=>vt(G.target.value),onBlur:rr,onKeyDown:G=>jt(G,rr),className:"hide-number-steppers w-28 text-right font-mono"})})})]}):null,f.jsx(yn,{title:"Project Icons",description:"Show detected project icons in the sidebar and open-project list.",children:f.jsxs(pr,{value:A?"enabled":"disabled",onValueChange:G=>{const Ye=G==="enabled";pe(Ye),st({showProjectIconsInSidebar:Ye})},children:[f.jsx(ur,{className:"w-[100px]",children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"disabled",children:"Off"}),f.jsx(Et,{value:"enabled",children:"On"})]})]})}),f.jsx(yn,{title:"Folder Groups",description:"Show or hide feature folder grouping in the sidebar. Turning this off keeps the existing feature state, but flattens chats into a direct list and hides the new-folder button.",children:f.jsxs(pr,{value:I?"enabled":"disabled",onValueChange:G=>q(G==="enabled"),children:[f.jsx(ur,{className:"w-[100px]",children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"disabled",children:"Off"}),f.jsx(Et,{value:"enabled",children:"On"})]})]})}),I?f.jsxs("div",{className:"mb-2 ml-6 space-y-0 border-l border-border/60 pl-4",children:[f.jsx(yn,{title:"Kanban Status",description:"Show or hide feature status controls like Idea, Todo, Progress, Testing, and Done.",bordered:!1,children:f.jsxs(pr,{value:W?"enabled":"disabled",onValueChange:G=>O(G==="enabled"),children:[f.jsx(ur,{className:"w-[100px]",children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"disabled",children:"Off"}),f.jsx(Et,{value:"enabled",children:"On"})]})]})}),f.jsx(yn,{title:`${v_} In Git`,description:`Control whether ${Pn} keeps the project ${v_} directory tracked in git or adds it to .gitignore for currently loaded projects and future opens. This is best suited to solo developers working across multiple machines. For team repos, we recommend ignoring \`${v_}\`.`,bordered:!1,children:f.jsxs(pr,{value:K?"commit":"ignore",onValueChange:G=>{const Ye=G==="commit";F(Ye),n.handleSetCommitProjectMetadataDirectory(Ye)},children:[f.jsx(ur,{className:"w-[120px]",children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"commit",children:"Commit"}),f.jsx(Et,{value:"ignore",children:"Ignore"})]})]})})]}):null,f.jsx(yn,{title:"Provider Icons In Side Tray",description:"Show provider badges next to chats in the left sidebar side tray.",children:f.jsxs(pr,{value:D?"enabled":"disabled",onValueChange:G=>V(G==="enabled"),children:[f.jsx(ur,{className:"w-[100px]",children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"disabled",children:"Off"}),f.jsx(Et,{value:"enabled",children:"On"})]})]})}),f.jsx(yn,{title:"Default Editor",description:"Used by the navbar code button and local file links in chat",alignStart:!0,children:f.jsxs(pr,{value:v,onValueChange:G=>C(G),children:[f.jsx(ur,{className:"min-w-[180px]",children:f.jsx(Sr,{})}),f.jsx(dr,{children:f.jsx(C_,{children:nre.map(G=>f.jsx(Et,{value:G.value,children:G.label},G.value))})})]})}),v==="custom"?f.jsx("div",{className:"border-t border-border",children:f.jsxs("div",{className:"flex justify-between gap-8 py-5 pl-6",children:[f.jsxs("div",{className:"min-w-0 max-w-xl",children:[f.jsx("div",{className:"text-sm font-medium text-foreground",children:"Command Template"}),f.jsxs("div",{className:"mt-1 text-[13px] text-muted-foreground",children:["Include ","{path}"," and optionally ","{line}"," and ","{column}"," in your command."]})]}),f.jsxs("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:[f.jsx(Si,{type:"text",value:pt,onChange:G=>he(G.target.value),onBlur:He,onKeyDown:G=>zt(G,He),className:"font-mono"}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:["Preview: ",f.jsx("span",{className:"font-mono",children:Ce})]})]})]})}):null,f.jsx(yn,{title:"Terminal Scrollback",description:"Lines retained for embedded terminal history",children:f.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[f.jsx(Si,{type:"number",min:Fy,max:Uy,step:100,value:Re,onChange:G=>je(G.target.value),onBlur:vn,onKeyDown:G=>jt(G,vn),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),f.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[Fy,"-",Uy," lines",g===Um?" (default)":""]})]})}),f.jsx(yn,{title:"Terminal Min Column Width",description:"Minimum width for each terminal pane",children:f.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[f.jsx(Si,{type:"number",min:$y,max:Wy,step:10,value:Xe,onChange:G=>ft(G.target.value),onBlur:tn,onKeyDown:G=>jt(G,tn),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),f.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[$y,"-",Wy," px",p===$m?" (default)":""]})]})})]})}):a==="providers"?f.jsxs("div",{className:"border-b border-border",children:[f.jsx(yn,{title:"Default Provider",description:"The default harness used for new chats before a provider is locked by an existing session.",bordered:!1,children:f.jsxs(pr,{value:Ie,onValueChange:G=>L(G),children:[f.jsx(ur,{className:"min-w-[180px]",children:f.jsx(Sr,{})}),f.jsx(dr,{children:f.jsxs(C_,{children:[f.jsx(Et,{value:"last_used",children:"Last Used"}),we.map(G=>f.jsx(Et,{value:G.id,children:G.label},G.id))]})})]})}),Oe?f.jsx("div",{className:"border-t border-border px-0 py-3 text-sm text-destructive",children:Oe}):null,f.jsx(yn,{title:"Claude Code Defaults",description:`Saved defaults when using Claude Code. ${Wf(E,"claude")}`,alignStart:!0,children:f.jsxs("div",{className:me("max-w-[420px]",!Jt("claude").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(pr,{value:((E==null?void 0:E.settings.claude)??Wn.claude).active?"active":"inactive",onValueChange:G=>{mt({...(E==null?void 0:E.settings)??Wn,claude:{...(E==null?void 0:E.settings.claude)??Wn.claude,active:G==="active"}})},children:[f.jsx(ur,{className:"min-w-[140px]",disabled:!Jt("claude").systemActive,children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"active",children:"Active"}),f.jsx(Et,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(Pu,{availableProviders:qo,selectedProvider:"claude",disabled:!Jt("claude").systemActive,showProviderPicker:!1,providerLocked:!0,model:j.claude.model,modelOptions:j.claude.modelOptions,onModelChange:(G,Ye)=>{U("claude",Ye)},onClaudeReasoningEffortChange:G=>{Y("claude",{reasoningEffort:G})},onClaudeContextWindowChange:G=>{Y("claude",{contextWindow:G})},onCodexReasoningEffortChange:()=>{},onGeminiThinkingModeChange:()=>{},onCodexFastModeChange:()=>{},planMode:j.claude.planMode,onPlanModeChange:G=>P("claude",G),includePlanMode:!0,className:"justify-start flex-wrap"})]})}),f.jsx(yn,{title:"Codex Defaults",description:`Saved defaults when using Codex. ${Wf(E,"codex")}`,alignStart:!0,children:f.jsxs("div",{className:me("max-w-[420px]",!Jt("codex").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(pr,{value:((E==null?void 0:E.settings.codex)??Wn.codex).active?"active":"inactive",onValueChange:G=>{mt({...(E==null?void 0:E.settings)??Wn,codex:{...(E==null?void 0:E.settings.codex)??Wn.codex,active:G==="active"}})},children:[f.jsx(ur,{className:"min-w-[140px]",disabled:!Jt("codex").systemActive,children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"active",children:"Active"}),f.jsx(Et,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(Pu,{availableProviders:qo,selectedProvider:"codex",disabled:!Jt("codex").systemActive,showProviderPicker:!1,providerLocked:!0,model:j.codex.model,modelOptions:j.codex.modelOptions,onModelChange:(G,Ye)=>{U("codex",Ye)},onClaudeReasoningEffortChange:()=>{},onClaudeContextWindowChange:()=>{},onCodexReasoningEffortChange:G=>{Y("codex",{reasoningEffort:G})},onGeminiThinkingModeChange:()=>{},onCodexFastModeChange:G=>{Y("codex",{fastMode:G})},planMode:j.codex.planMode,onPlanModeChange:G=>P("codex",G),includePlanMode:!0,className:"justify-start flex-wrap"})]})}),f.jsx(yn,{title:"Gemini Defaults",description:`Saved defaults when using Gemini. ${Wf(E,"gemini")}`,alignStart:!0,children:f.jsxs("div",{className:me("max-w-[420px]",!Jt("gemini").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(pr,{value:((E==null?void 0:E.settings.gemini)??Wn.gemini).active?"active":"inactive",onValueChange:G=>{mt({...(E==null?void 0:E.settings)??Wn,gemini:{...(E==null?void 0:E.settings.gemini)??Wn.gemini,active:G==="active"}})},children:[f.jsx(ur,{className:"min-w-[140px]",disabled:!Jt("gemini").systemActive,children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"active",children:"Active"}),f.jsx(Et,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(Pu,{availableProviders:qo,selectedProvider:"gemini",disabled:!Jt("gemini").systemActive,showProviderPicker:!1,providerLocked:!0,model:j.gemini.model,modelOptions:j.gemini.modelOptions,onModelChange:(G,Ye)=>{U("gemini",Ye)},onClaudeReasoningEffortChange:()=>{},onClaudeContextWindowChange:()=>{},onCodexReasoningEffortChange:()=>{},onGeminiThinkingModeChange:G=>{Y("gemini",{thinkingMode:G})},onCodexFastModeChange:()=>{},planMode:j.gemini.planMode,onPlanModeChange:G=>P("gemini",G),includePlanMode:!0,className:"justify-start flex-wrap"})]})}),f.jsx(yn,{title:"Cursor Defaults",description:`Saved defaults when using Cursor. ${Wf(E,"cursor")}`,alignStart:!0,children:f.jsxs("div",{className:me("max-w-[420px]",!Jt("cursor").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(pr,{value:((E==null?void 0:E.settings.cursor)??Wn.cursor).active?"active":"inactive",onValueChange:G=>{mt({...(E==null?void 0:E.settings)??Wn,cursor:{...(E==null?void 0:E.settings.cursor)??Wn.cursor,active:G==="active"}})},children:[f.jsx(ur,{className:"min-w-[140px]",disabled:!Jt("cursor").systemActive,children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"active",children:"Active"}),f.jsx(Et,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(Pu,{availableProviders:qo,selectedProvider:"cursor",disabled:!Jt("cursor").systemActive,showProviderPicker:!1,providerLocked:!0,model:j.cursor.model,modelOptions:j.cursor.modelOptions,onModelChange:(G,Ye)=>{U("cursor",Ye)},onClaudeReasoningEffortChange:()=>{},onClaudeContextWindowChange:()=>{},onCodexReasoningEffortChange:()=>{},onGeminiThinkingModeChange:()=>{},onCodexFastModeChange:()=>{},planMode:j.cursor.planMode,onPlanModeChange:G=>P("cursor",G),includePlanMode:!0,className:"justify-start flex-wrap"})]})})]}):a==="keybindings"?f.jsxs("div",{className:"border-b border-border",children:[ce?f.jsx("div",{className:"mb-4 rounded-2xl border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:ce}):null,xe.warning?f.jsx("div",{className:"mb-4 rounded-2xl border border-border bg-card/30 px-4 py-3 text-sm text-muted-foreground",children:xe.warning}):null,YR.map((G,Ye)=>{const It=T_(os[G]),Cn=Se[G]??"",li=Cn!==It;return f.jsx(yn,{title:NA[G],description:f.jsxs(f.Fragment,{children:[f.jsx("span",{children:"Comma-separated shortcuts."}),li?f.jsxs(f.Fragment,{children:[f.jsx("span",{children:" "}),f.jsxs("button",{type:"button",onClick:()=>{an(G)},className:"inline rounded text-foreground hover:text-foreground/80",children:["Restore: ",It]})]}):null]}),bordered:Ye!==0,children:f.jsx("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:f.jsx(Si,{type:"text",value:Cn,onChange:$t=>{const ir=$t.target.value;De(Ac=>({...Ac,[G]:ir}))},onBlur:$t=>{const ir={...Se,[G]:$t.currentTarget.value};De(ir),ct(ir)},onKeyDown:$t=>zt($t,()=>{const ir={...Se,[G]:$t.currentTarget.value};De(ir),ct(ir)}),className:"font-mono"})})},G)})]}):null]}),n.commandError?f.jsxs("div",{className:"mx-auto mt-4 flex max-w-4xl items-start gap-3 rounded-2xl border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:[f.jsx(dI,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),f.jsx("span",{children:n.commandError})]}):null]})]})]}),Qe?f.jsx("div",{className:"absolute bottom-0 left-0 right-0 border-t border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:f.jsx("div",{className:"px-6 py-[14.25px]",children:f.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-xs text-muted-foreground lg:grid-cols-4 lg:gap-3",children:[f.jsx("div",{className:"min-w-0",children:f.jsxs("div",{className:"flex items-baseline gap-1.5 lg:block",children:[f.jsx("div",{className:"uppercase tracking-wide text-[11px] text-muted-foreground/80 lg:mb-1",children:"Machine"}),f.jsx("div",{className:"truncate text-foreground/80",children:u})]})}),f.jsx("div",{className:"min-w-0",children:f.jsxs("div",{className:"flex items-baseline gap-1.5 lg:block",children:[f.jsx("div",{className:"uppercase tracking-wide text-[11px] text-muted-foreground/80 lg:mb-1",children:"Connection"}),f.jsx("div",{className:"truncate text-foreground/80",children:n.connectionStatus})]})}),f.jsx("div",{className:"min-w-0",children:f.jsxs("div",{className:"flex items-baseline gap-1.5 lg:block",children:[f.jsx("div",{className:"uppercase tracking-wide text-[11px] text-muted-foreground/80 lg:mb-1",children:"Projects"}),f.jsx("div",{className:"truncate text-foreground/80",children:h})]})}),f.jsx("div",{className:"min-w-0",children:f.jsxs("div",{className:"flex items-baseline gap-1.5 lg:block",children:[f.jsx("div",{className:"uppercase tracking-wide text-[11px] text-muted-foreground/80 lg:mb-1",children:"Version"}),f.jsx("div",{className:"truncate text-foreground/80",children:d})]})})]})})}):null]})}function ZR(e){return{submitChatMessage:ka(e.submitChatMessage??""),toggleProjectsSidebar:ka(e.toggleProjectsSidebar??""),toggleEmbeddedTerminal:ka(e.toggleEmbeddedTerminal??""),toggleRightSidebar:ka(e.toggleRightSidebar??""),openInFinder:ka(e.openInFinder??""),openInEditor:ka(e.openInEditor??""),addSplitTerminal:ka(e.addSplitTerminal??"")}}function are(){const e=typeof navigator<"u"&&navigator.standalone===!0,t=typeof window<"u"&&window.matchMedia("(display-mode: standalone)").matches;return e||t}function lre(){const e=window.visualViewport,t=Math.round((e==null?void 0:e.height)??window.innerHeight),n=Math.max(0,Math.round((e==null?void 0:e.offsetTop)??0));return{height:t,offsetTop:n}}function cre(){_.useLayoutEffect(()=>{let e=0,t=null,n=0;const r=are(),s=()=>{e=0;const{height:u,offsetTop:h}=lre();t===null&&(t=h),u>n&&(n=u);const d=Math.max(0,h-t),g=n-u>120||d>12,p=document.documentElement;p.style.setProperty("--app-shell-height",`${u}px`),p.style.setProperty("--app-shell-offset-top",r?g?`max(0px, calc(${d}px - env(safe-area-inset-top)))`:"0px":`${d}px`),p.style.setProperty("--app-composer-bottom-padding",r?g?"0px":"max(12px, env(safe-area-inset-bottom))":g?"12px":"20px")},a=()=>{e!==0&&window.cancelAnimationFrame(e),e=window.requestAnimationFrame(s)};a();const l=window.visualViewport;return window.addEventListener("resize",a),window.addEventListener("orientationchange",a),l==null||l.addEventListener("resize",a),l==null||l.addEventListener("scroll",a),()=>{e!==0&&window.cancelAnimationFrame(e),window.removeEventListener("resize",a),window.removeEventListener("orientationchange",a),l==null||l.removeEventListener("resize",a),l==null||l.removeEventListener("scroll",a)}},[])}const ure=`${_p}last-seen-version`;function dre(e,t){return!(!t||e.defaultPrevented||e.isComposing||dW(e.target))}function hre(){const e=Di(),t=pT(),n=OY(t.chatId??null),r=Ap("(min-width: 768px)"),s=S2(d=>d.widthPx),a=S2(d=>d.setWidth),l=e.pathname==="/",u=L0.split("/")[1]??"unknown",h=_.useMemo(()=>ux(n.keybindings),[n.keybindings]);return cre(),_.useEffect(()=>{window.localStorage.setItem(ure,u)},[u]),_.useEffect(()=>{function d(g){const p=Oa(h,"toggleProjectsSidebar",g);dre(g,p)&&(g.preventDefault(),n.toggleProjectsSidebar(r))}return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[r,h,n.toggleProjectsSidebar]),f.jsxs("div",{className:"relative flex h-[var(--app-shell-height)] min-h-[var(--app-shell-height)] overflow-hidden",style:{top:"var(--app-shell-offset-top)"},children:[f.jsx(aW,{data:n.sidebarData,completedChatIds:n.completedChatIds,activeChatId:n.activeChatId,connectionStatus:n.connectionStatus,ready:n.sidebarReady,open:n.sidebarOpen,collapsed:n.sidebarCollapsed,isDesktopViewport:r,showMobileOpenButton:l,onOpen:n.openSidebar,onClose:n.closeSidebar,onToggle:n.toggleProjectsSidebar,onExpand:n.expandSidebar,desktopWidth:s,toggleShortcut:h.bindings.toggleProjectsSidebar,onResizeDesktopWidth:a,onCreateChat:(d,g)=>{n.handleCreateChat(d,g)},onCreateFeature:d=>{n.handleCreateFeature(d)},onRenameFeature:d=>{n.handleRenameFeature(d)},onDeleteFeature:d=>{n.handleDeleteFeature(d)},onSetProjectBrowserState:(d,g)=>{n.handleSetProjectBrowserState(d,g)},onSetProjectGeneralChatsBrowserState:(d,g)=>{n.handleSetProjectGeneralChatsBrowserState(d,g)},onSetFeatureBrowserState:(d,g)=>{n.handleSetFeatureBrowserState(d,g)},onSetFeatureStage:(d,g)=>{n.handleSetFeatureStage(d,g)},onSetChatFeature:(d,g)=>{n.handleSetChatFeature(d,g)},onReorderFeatures:(d,g)=>{n.handleReorderFeatures(d,g)},folderGroupsEnabled:n.folderGroupsEnabled,kanbanStatusesEnabled:n.kanbanStatusesEnabled,onDeleteChat:d=>{n.handleDeleteChat(d)},onRemoveProject:d=>{n.handleRemoveProject(d)},onRefreshProviderUsage:n.handleRefreshProviderUsage,onOpenProviderLogin:d=>{n.handleOpenProviderLogin(d)},providerSettings:n.providerSettings,startingLocalPath:n.startingLocalPath,updateSnapshot:n.updateSnapshot,onInstallUpdate:()=>{n.handleInstallUpdate()}}),f.jsx(u8,{open:n.createFeatureModalProjectId!==null,onOpenChange:d=>{d||n.handleCloseCreateFeatureModal()},onConfirm:d=>n.handleConfirmCreateFeature(d)}),f.jsx(d8,{open:n.cursorCurlImportOpen,onOpenChange:d=>{d||n.handleCloseCursorCurlImport()},onSubmit:d=>n.handleSubmitCursorCurlImport(d)}),f.jsx(RL,{context:n})]})}function fre(){return f.jsx(K9,{children:f.jsxs(a8,{children:[f.jsx(NL,{children:f.jsxs(Gl,{element:f.jsx(hre,{}),children:[f.jsx(Gl,{path:"/",element:f.jsx(tre,{})}),f.jsx(Gl,{path:"/settings",element:f.jsx(EL,{to:"/settings/general",replace:!0})}),f.jsx(Gl,{path:"/settings/:sectionId",element:f.jsx(ore,{})}),f.jsx(Gl,{path:"/chat/:chatId",element:f.jsx(qne,{})})]})}),f.jsx(Pz,{})]})})}const d3=document.getElementById("root");if(!d3)throw new Error("Missing #root");N4.createRoot(d3).render(f.jsx(_.StrictMode,{children:f.jsx(ez,{children:f.jsx(EG,{children:f.jsx(fre,{})})})}));