kaizenai 0.4.0 → 0.5.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.
@@ -0,0 +1,638 @@
1
+ var BL=Object.defineProperty;var zk=e=>{throw TypeError(e)};var FL=(e,t,n)=>t in e?BL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var tr=(e,t,n)=>FL(e,typeof t!="symbol"?t+"":t,n),Pk=(e,t,n)=>t.has(e)||zk("Cannot "+n);var sd=(e,t,n)=>(Pk(e,t,"read from private field"),n?n.call(e):t.get(e)),Ik=(e,t,n)=>t.has(e)?zk("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Bk=(e,t,n,r)=>(Pk(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function HL(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const o=Object.getOwnPropertyDescriptor(r,i);o&&Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:()=>r[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function qp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var q_={exports:{}},od={};/**
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 Fk;function $L(){if(Fk)return od;Fk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,o){var l=null;if(o!==void 0&&(l=""+o),i.key!==void 0&&(l=""+i.key),"key"in i){o={};for(var c in i)c!=="key"&&(o[c]=i[c])}else o=i;return i=o.ref,{$$typeof:e,type:r,key:l,ref:i!==void 0?i:null,props:o}}return od.Fragment=t,od.jsx=n,od.jsxs=n,od}var Hk;function UL(){return Hk||(Hk=1,q_.exports=$L()),q_.exports}var f=UL(),K_={exports:{}},dt={};/**
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 $k;function VL(){if($k)return dt;$k=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=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 b(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,Z,A){this.props=B,this.context=Z,this.refs=C,this.updater=A||w}k.prototype.isReactComponent={},k.prototype.setState=function(B,Z){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,Z,"setState")},k.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function R(){}R.prototype=k.prototype;function E(B,Z,A){this.props=B,this.context=Z,this.refs=C,this.updater=A||w}var N=E.prototype=new R;N.constructor=E,S(N,k.prototype),N.isPureReactComponent=!0;var L=Array.isArray;function j(){}var D={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function Y(B,Z,A){var ie=A.ref;return{$$typeof:e,type:B,key:Z,ref:ie!==void 0?ie:null,props:A}}function P(B,Z){return Y(B.type,Z,B.props)}function q(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function F(B){var Z={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(A){return Z[A]})}var U=/\/+/g;function W(B,Z){return typeof B=="object"&&B!==null&&B.key!=null?F(""+B.key):Z.toString(36)}function V(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(j,j):(B.status="pending",B.then(function(Z){B.status==="pending"&&(B.status="fulfilled",B.value=Z)},function(Z){B.status==="pending"&&(B.status="rejected",B.reason=Z)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function O(B,Z,A,ie,J){var ee=typeof B;(ee==="undefined"||ee==="boolean")&&(B=null);var re=!1;if(B===null)re=!0;else switch(ee){case"bigint":case"string":case"number":re=!0;break;case"object":switch(B.$$typeof){case e:case t:re=!0;break;case g:return re=B._init,O(re(B._payload),Z,A,ie,J)}}if(re)return J=J(B),re=ie===""?"."+W(B,0):ie,L(J)?(A="",re!=null&&(A=re.replace(U,"$&/")+"/"),O(J,Z,A,"",function(pe){return pe})):J!=null&&(q(J)&&(J=P(J,A+(J.key==null||B&&B.key===J.key?"":(""+J.key).replace(U,"$&/")+"/")+re)),Z.push(J)),1;re=0;var ce=ie===""?".":ie+":";if(L(B))for(var he=0;he<B.length;he++)ie=B[he],ee=ce+W(ie,he),re+=O(ie,Z,A,ee,J);else if(he=b(B),typeof he=="function")for(B=he.call(B),he=0;!(ie=B.next()).done;)ie=ie.value,ee=ce+W(ie,he++),re+=O(ie,Z,A,ee,J);else if(ee==="object"){if(typeof B.then=="function")return O(V(B),Z,A,ie,J);throw Z=String(B),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return re}function $(B,Z,A){if(B==null)return B;var ie=[],J=0;return O(B,ie,"","",function(ee){return Z.call(A,ee,J++)}),ie}function z(B){if(B._status===-1){var Z=B._result;Z=Z(),Z.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=Z)}if(B._status===1)return B._result.default;throw B._result}var G=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=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(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},M={map:$,forEach:function(B,Z,A){$(B,function(){Z.apply(this,arguments)},A)},count:function(B){var Z=0;return $(B,function(){Z++}),Z},toArray:function(B){return $(B,function(Z){return Z})||[]},only:function(B){if(!q(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return dt.Activity=p,dt.Children=M,dt.Component=k,dt.Fragment=n,dt.Profiler=i,dt.PureComponent=E,dt.StrictMode=r,dt.Suspense=h,dt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,dt.__COMPILER_RUNTIME={__proto__:null,c:function(B){return D.H.useMemoCache(B)}},dt.cache=function(B){return function(){return B.apply(null,arguments)}},dt.cacheSignal=function(){return null},dt.cloneElement=function(B,Z,A){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var ie=S({},B.props),J=B.key;if(Z!=null)for(ee in Z.key!==void 0&&(J=""+Z.key),Z)!H.call(Z,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&Z.ref===void 0||(ie[ee]=Z[ee]);var ee=arguments.length-2;if(ee===1)ie.children=A;else if(1<ee){for(var re=Array(ee),ce=0;ce<ee;ce++)re[ce]=arguments[ce+2];ie.children=re}return Y(B.type,J,ie)},dt.createContext=function(B){return B={$$typeof:l,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:o,_context:B},B},dt.createElement=function(B,Z,A){var ie,J={},ee=null;if(Z!=null)for(ie in Z.key!==void 0&&(ee=""+Z.key),Z)H.call(Z,ie)&&ie!=="key"&&ie!=="__self"&&ie!=="__source"&&(J[ie]=Z[ie]);var re=arguments.length-2;if(re===1)J.children=A;else if(1<re){for(var ce=Array(re),he=0;he<re;he++)ce[he]=arguments[he+2];J.children=ce}if(B&&B.defaultProps)for(ie in re=B.defaultProps,re)J[ie]===void 0&&(J[ie]=re[ie]);return Y(B,ee,J)},dt.createRef=function(){return{current:null}},dt.forwardRef=function(B){return{$$typeof:c,render:B}},dt.isValidElement=q,dt.lazy=function(B){return{$$typeof:g,_payload:{_status:-1,_result:B},_init:z}},dt.memo=function(B,Z){return{$$typeof:d,type:B,compare:Z===void 0?null:Z}},dt.startTransition=function(B){var Z=D.T,A={};D.T=A;try{var ie=B(),J=D.S;J!==null&&J(A,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(j,G)}catch(ee){G(ee)}finally{Z!==null&&A.types!==null&&(Z.types=A.types),D.T=Z}},dt.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},dt.use=function(B){return D.H.use(B)},dt.useActionState=function(B,Z,A){return D.H.useActionState(B,Z,A)},dt.useCallback=function(B,Z){return D.H.useCallback(B,Z)},dt.useContext=function(B){return D.H.useContext(B)},dt.useDebugValue=function(){},dt.useDeferredValue=function(B,Z){return D.H.useDeferredValue(B,Z)},dt.useEffect=function(B,Z){return D.H.useEffect(B,Z)},dt.useEffectEvent=function(B){return D.H.useEffectEvent(B)},dt.useId=function(){return D.H.useId()},dt.useImperativeHandle=function(B,Z,A){return D.H.useImperativeHandle(B,Z,A)},dt.useInsertionEffect=function(B,Z){return D.H.useInsertionEffect(B,Z)},dt.useLayoutEffect=function(B,Z){return D.H.useLayoutEffect(B,Z)},dt.useMemo=function(B,Z){return D.H.useMemo(B,Z)},dt.useOptimistic=function(B,Z){return D.H.useOptimistic(B,Z)},dt.useReducer=function(B,Z,A){return D.H.useReducer(B,Z,A)},dt.useRef=function(B){return D.H.useRef(B)},dt.useState=function(B){return D.H.useState(B)},dt.useSyncExternalStore=function(B,Z,A){return D.H.useSyncExternalStore(B,Z,A)},dt.useTransition=function(){return D.H.useTransition()},dt.version="19.2.1",dt}var Uk;function l0(){return Uk||(Uk=1,K_.exports=VL()),K_.exports}var _=l0();const xe=qp(_),yN=HL({__proto__:null,default:xe},[_]);var G_={exports:{}},ad={},Y_={exports:{}},X_={};/**
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 Vk;function WL(){return Vk||(Vk=1,function(e){function t(O,$){var z=O.length;O.push($);e:for(;0<z;){var G=z-1>>>1,M=O[G];if(0<i(M,$))O[G]=$,O[z]=M,z=G;else break e}}function n(O){return O.length===0?null:O[0]}function r(O){if(O.length===0)return null;var $=O[0],z=O.pop();if(z!==$){O[0]=z;e:for(var G=0,M=O.length,B=M>>>1;G<B;){var Z=2*(G+1)-1,A=O[Z],ie=Z+1,J=O[ie];if(0>i(A,z))ie<M&&0>i(J,A)?(O[G]=J,O[ie]=z,G=ie):(O[G]=A,O[Z]=z,G=Z);else if(ie<M&&0>i(J,z))O[G]=J,O[ie]=z,G=ie;else break e}}return $}function i(O,$){var z=O.sortIndex-$.sortIndex;return z!==0?z:O.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var h=[],d=[],g=1,p=null,v=3,b=!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 $=n(d);$!==null;){if($.callback===null)r(d);else if($.startTime<=O)r(d),$.sortIndex=$.expirationTime,t(h,$);else break;$=n(d)}}function L(O){if(S=!1,N(O),!w)if(n(h)!==null)w=!0,j||(j=!0,F());else{var $=n(d);$!==null&&V(L,$.startTime-O)}}var j=!1,D=-1,H=5,Y=-1;function P(){return C?!0:!(e.unstable_now()-Y<H)}function q(){if(C=!1,j){var O=e.unstable_now();Y=O;var $=!0;try{e:{w=!1,S&&(S=!1,R(D),D=-1),b=!0;var z=v;try{t:{for(N(O),p=n(h);p!==null&&!(p.expirationTime>O&&P());){var G=p.callback;if(typeof G=="function"){p.callback=null,v=p.priorityLevel;var M=G(p.expirationTime<=O);if(O=e.unstable_now(),typeof M=="function"){p.callback=M,N(O),$=!0;break t}p===n(h)&&r(h),N(O)}else r(h);p=n(h)}if(p!==null)$=!0;else{var B=n(d);B!==null&&V(L,B.startTime-O),$=!1}}break e}finally{p=null,v=z,b=!1}$=void 0}}finally{$?F():j=!1}}}var F;if(typeof E=="function")F=function(){E(q)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,W=U.port2;U.port1.onmessage=q,F=function(){W.postMessage(null)}}else F=function(){k(q,0)};function V(O,$){D=k(function(){O(e.unstable_now())},$)}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"):H=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 $=3;break;default:$=v}var z=v;v=$;try{return O()}finally{v=z}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(O,$){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var z=v;v=O;try{return $()}finally{v=z}},e.unstable_scheduleCallback=function(O,$,z){var G=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?G+z:G):z=G,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=z+M,O={id:g++,callback:$,priorityLevel:O,startTime:z,expirationTime:M,sortIndex:-1},z>G?(O.sortIndex=z,t(d,O),n(h)===null&&O===n(d)&&(S?(R(D),D=-1):S=!0,V(L,z-G))):(O.sortIndex=M,t(h,O),w||b||(w=!0,j||(j=!0,F()))),O},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(O){var $=v;return function(){var z=v;v=$;try{return O.apply(this,arguments)}finally{v=z}}}}(X_)),X_}var Wk;function qL(){return Wk||(Wk=1,Y_.exports=WL()),Y_.exports}var Z_={exports:{}},Ar={};/**
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 qk;function KL(){if(qk)return Ar;qk=1;var e=l0();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},i=Symbol.for("react.portal");function o(h,d,g){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,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 c(h,d){if(h==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Ar.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Ar.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 o(h,d,null,g)},Ar.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()}},Ar.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))},Ar.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},Ar.preinit=function(h,d){if(typeof h=="string"&&d&&typeof d.as=="string"){var g=d.as,p=c(g,d.crossOrigin),v=typeof d.integrity=="string"?d.integrity:void 0,b=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:b}):g==="script"&&r.d.X(h,{crossOrigin:p,integrity:v,fetchPriority:b,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Ar.preinitModule=function(h,d){if(typeof h=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var g=c(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)},Ar.preload=function(h,d){if(typeof h=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var g=d.as,p=c(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})}},Ar.preloadModule=function(h,d){if(typeof h=="string")if(d){var g=c(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)},Ar.requestFormReset=function(h){r.d.r(h)},Ar.unstable_batchedUpdates=function(h,d){return h(d)},Ar.useFormState=function(h,d,g){return l.H.useFormState(h,d,g)},Ar.useFormStatus=function(){return l.H.useHostTransitionStatus()},Ar.version="19.2.1",Ar}var Kk;function bN(){if(Kk)return Z_.exports;Kk=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(),Z_.exports=KL(),Z_.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 Gk;function GL(){if(Gk)return ad;Gk=1;var e=qL(),t=l0(),n=bN();function r(s){var a="https://react.dev/errors/"+s;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var a=s,u=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(u=a.return),s=a.return;while(s)}return a.tag===3?u:null}function l(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function c(s){if(s.tag===31){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function h(s){if(o(s)!==s)throw Error(r(188))}function d(s){var a=s.alternate;if(!a){if(a=o(s),a===null)throw Error(r(188));return a!==s?null:s}for(var u=s,m=a;;){var y=u.return;if(y===null)break;var x=y.alternate;if(x===null){if(m=y.return,m!==null){u=m;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===u)return h(y),s;if(x===m)return h(y),a;x=x.sibling}throw Error(r(188))}if(u.return!==m.return)u=y,m=x;else{for(var T=!1,I=y.child;I;){if(I===u){T=!0,u=y,m=x;break}if(I===m){T=!0,m=y,u=x;break}I=I.sibling}if(!T){for(I=x.child;I;){if(I===u){T=!0,u=x,m=y;break}if(I===m){T=!0,m=x,u=y;break}I=I.sibling}if(!T)throw Error(r(189))}}if(u.alternate!==m)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?s:a}function g(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=g(s),a!==null)return a;s=s.sibling}return null}var p=Object.assign,v=Symbol.for("react.element"),b=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"),L=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function F(s){return s===null||typeof s!="object"?null:(s=q&&s[q]||s["@@iterator"],typeof s=="function"?s:null)}var U=Symbol.for("react.client.reference");function W(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===U?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case S:return"Fragment";case k:return"Profiler";case C:return"StrictMode";case L:return"Suspense";case j:return"SuspenseList";case Y:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case E:return s.displayName||"Context";case R:return(s._context.displayName||"Context")+".Consumer";case N:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case D:return a=s.displayName||null,a!==null?a:W(s.type)||"Memo";case H:a=s._payload,s=s._init;try{return W(s(a))}catch{}}return null}var V=Array.isArray,O=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z={pending:!1,data:null,method:null,action:null},G=[],M=-1;function B(s){return{current:s}}function Z(s){0>M||(s.current=G[M],G[M]=null,M--)}function A(s,a){M++,G[M]=s.current,s.current=a}var ie=B(null),J=B(null),ee=B(null),re=B(null);function ce(s,a){switch(A(ee,a),A(J,s),A(ie,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?sk(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=sk(a),s=ok(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Z(ie),A(ie,s)}function he(){Z(ie),Z(J),Z(ee)}function pe(s){s.memoizedState!==null&&A(re,s);var a=ie.current,u=ok(a,s.type);a!==u&&(A(J,s),A(ie,u))}function Se(s){J.current===s&&(Z(ie),Z(J)),re.current===s&&(Z(re),td._currentValue=z)}var Re,je;function Xe(s){if(Re===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);Re=a&&a[1]||"",je=-1<u.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Re+s+je}var Et=!1;function Rt(s,a){if(!s||Et)return"";Et=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(a){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(de){var ue=de}Reflect.construct(s,[],ye)}else{try{ye.call()}catch(de){ue=de}s.call(ye.prototype)}}else{try{throw Error()}catch(de){ue=de}(ye=s())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(de){if(de&&ue&&typeof de.stack=="string")return[de.stack,ue.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=m.DetermineComponentFrameRoot(),T=x[0],I=x[1];if(T&&I){var Q=T.split(`
44
+ `),le=I.split(`
45
+ `);for(y=m=0;m<Q.length&&!Q[m].includes("DetermineComponentFrameRoot");)m++;for(;y<le.length&&!le[y].includes("DetermineComponentFrameRoot");)y++;if(m===Q.length||y===le.length)for(m=Q.length-1,y=le.length-1;1<=m&&0<=y&&Q[m]!==le[y];)y--;for(;1<=m&&0<=y;m--,y--)if(Q[m]!==le[y]){if(m!==1||y!==1)do if(m--,y--,0>y||Q[m]!==le[y]){var ge=`
46
+ `+Q[m].replace(" at new "," at ");return s.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",s.displayName)),ge}while(1<=m&&0<=y);break}}}finally{Et=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?Xe(u):""}function fe(s,a){switch(s.tag){case 26:case 27:case 5:return Xe(s.type);case 16:return Xe("Lazy");case 13:return s.child!==a&&a!==null?Xe("Suspense Fallback"):Xe("Suspense");case 19:return Xe("SuspenseList");case 0:case 15:return Rt(s.type,!1);case 11:return Rt(s.type.render,!1);case 1:return Rt(s.type,!0);case 31:return Xe("Activity");default:return""}}function He(s){try{var a="",u=null;do a+=fe(s,u),u=s,s=s.return;while(s);return a}catch(m){return`
47
+ Error generating stack: `+m.message+`
48
+ `+m.stack}}var De=Object.prototype.hasOwnProperty,mt=e.unstable_scheduleCallback,ct=e.unstable_cancelCallback,ot=e.unstable_shouldYield,fn=e.unstable_requestPaint,Ce=e.unstable_now,tt=e.unstable_getCurrentPriorityLevel,oe=e.unstable_ImmediatePriority,ve=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,Ae=e.unstable_LowPriority,Qe=e.unstable_IdlePriority,At=e.log,rt=e.unstable_setDisableYieldValue,Oe=null,qe=null;function gt(s){if(typeof At=="function"&&rt(s),qe&&typeof qe.setStrictMode=="function")try{qe.setStrictMode(Oe,s)}catch{}}var Ve=Math.clz32?Math.clz32:Je,mn=Math.log,sn=Math.LN2;function Je(s){return s>>>=0,s===0?32:31-(mn(s)/sn|0)|0}var tn=256,$n=262144,Jt=4194304;function Kt(s){var a=s&42;if(a!==0)return a;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Be(s,a,u){var m=s.pendingLanes;if(m===0)return 0;var y=0,x=s.suspendedLanes,T=s.pingedLanes;s=s.warmLanes;var I=m&134217727;return I!==0?(m=I&~x,m!==0?y=Kt(m):(T&=I,T!==0?y=Kt(T):u||(u=I&~s,u!==0&&(y=Kt(u))))):(I=m&~x,I!==0?y=Kt(I):T!==0?y=Kt(T):u||(u=m&~s,u!==0&&(y=Kt(u)))),y===0?0:a!==0&&a!==y&&(a&x)===0&&(x=y&-y,u=a&-a,x>=u||x===32&&(u&4194048)!==0)?a:y}function vt(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function wt(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Tt(){var s=Jt;return Jt<<=1,(Jt&62914560)===0&&(Jt=4194304),s}function en(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function _t(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function yt(s,a,u,m,y,x){var T=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var I=s.entanglements,Q=s.expirationTimes,le=s.hiddenUpdates;for(u=T&~u;0<u;){var ge=31-Ve(u),ye=1<<ge;I[ge]=0,Q[ge]=-1;var ue=le[ge];if(ue!==null)for(le[ge]=null,ge=0;ge<ue.length;ge++){var de=ue[ge];de!==null&&(de.lane&=-536870913)}u&=~ye}m!==0&&Cn(s,m,0),x!==0&&y===0&&s.tag!==0&&(s.suspendedLanes|=x&~(T&~a))}function Cn(s,a,u){s.pendingLanes|=a,s.suspendedLanes&=~a;var m=31-Ve(a);s.entangledLanes|=a,s.entanglements[m]=s.entanglements[m]|1073741824|u&261930}function ke(s,a){var u=s.entangledLanes|=a;for(s=s.entanglements;u;){var m=31-Ve(u),y=1<<m;y&a|s[m]&a&&(s[m]|=a),u&=~y}}function Le(s,a){var u=a&-a;return u=(u&42)!==0?1:Nt(u),(u&(s.suspendedLanes|a))!==0?0:u}function Nt(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function ut(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function pn(){var s=$.p;return s!==0?s:(s=window.event,s===void 0?32:Nk(s.type))}function bn(s,a){var u=$.p;try{return $.p=s,a()}finally{$.p=u}}var on=Math.random().toString(36).slice(2),Gt="__reactFiber$"+on,Yt="__reactProps$"+on,Mr="__reactContainer$"+on,fs="__reactEvents$"+on,Dl="__reactListeners$"+on,K="__reactHandles$"+on,at="__reactResources$"+on,Un="__reactMarker$"+on;function ms(s){delete s[Gt],delete s[Yt],delete s[fs],delete s[Dl],delete s[K]}function ki(s){var a=s[Gt];if(a)return a;for(var u=s.parentNode;u;){if(a=u[Mr]||u[Gt]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(s=fk(s);s!==null;){if(u=s[Gt])return u;s=fk(s)}return a}s=u,u=s.parentNode}return null}function Ht(s){if(s=s[Gt]||s[Mr]){var a=s.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return s}return null}function Pn(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s.stateNode;throw Error(r(33))}function ps(s){var a=s[at];return a||(a=s[at]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Vn(s){s[Un]=!0}var Fh=new Set,Hh={};function $s(s,a){Ao(s,a),Ao(s+"Capture",a)}function Ao(s,a){for(Hh[s]=a,s=0;s<a.length;s++)Fh.add(a[s])}var Bg=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]*$"),$h={},Uh={};function Fg(s){return De.call(Uh,s)?!0:De.call($h,s)?!1:Bg.test(s)?Uh[s]=!0:($h[s]=!0,!1)}function Ol(s,a,u){if(Fg(a))if(u===null)s.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":s.removeAttribute(a);return;case"boolean":var m=a.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){s.removeAttribute(a);return}}s.setAttribute(a,""+u)}}function Ll(s,a,u){if(u===null)s.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(a);return}s.setAttribute(a,""+u)}}function Qi(s,a,u,m){if(m===null)s.removeAttribute(u);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(u);return}s.setAttributeNS(a,u,""+m)}}function br(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Vh(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Hg(s,a,u){var m=Object.getOwnPropertyDescriptor(s.constructor.prototype,a);if(!s.hasOwnProperty(a)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var y=m.get,x=m.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return y.call(this)},set:function(T){u=""+T,x.call(this,T)}}),Object.defineProperty(s,a,{enumerable:m.enumerable}),{getValue:function(){return u},setValue:function(T){u=""+T},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function pu(s){if(!s._valueTracker){var a=Vh(s)?"checked":"value";s._valueTracker=Hg(s,a,""+s[a])}}function gu(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var u=a.getValue(),m="";return s&&(m=Vh(s)?s.checked?"true":"false":s.value),s=m,s!==u?(a.setValue(s),!0):!1}function Ma(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Wh=/[\n"\\]/g;function X(s){return s.replace(Wh,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function ne(s,a,u,m,y,x,T,I){s.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?s.type=T:s.removeAttribute("type"),a!=null?T==="number"?(a===0&&s.value===""||s.value!=a)&&(s.value=""+br(a)):s.value!==""+br(a)&&(s.value=""+br(a)):T!=="submit"&&T!=="reset"||s.removeAttribute("value"),a!=null?$e(s,T,br(a)):u!=null?$e(s,T,br(u)):m!=null&&s.removeAttribute("value"),y==null&&x!=null&&(s.defaultChecked=!!x),y!=null&&(s.checked=y&&typeof y!="function"&&typeof y!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?s.name=""+br(I):s.removeAttribute("name")}function we(s,a,u,m,y,x,T,I){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(s.type=x),a!=null||u!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){pu(s);return}u=u!=null?""+br(u):"",a=a!=null?""+br(a):u,I||a===s.value||(s.value=a),s.defaultValue=a}m=m??y,m=typeof m!="function"&&typeof m!="symbol"&&!!m,s.checked=I?s.checked:!!m,s.defaultChecked=!!m,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(s.name=T),pu(s)}function $e(s,a,u){a==="number"&&Ma(s.ownerDocument)===s||s.defaultValue===""+u||(s.defaultValue=""+u)}function Bt(s,a,u,m){if(s=s.options,a){a={};for(var y=0;y<u.length;y++)a["$"+u[y]]=!0;for(u=0;u<s.length;u++)y=a.hasOwnProperty("$"+s[u].value),s[u].selected!==y&&(s[u].selected=y),y&&m&&(s[u].defaultSelected=!0)}else{for(u=""+br(u),a=null,y=0;y<s.length;y++){if(s[y].value===u){s[y].selected=!0,m&&(s[y].defaultSelected=!0);return}a!==null||s[y].disabled||(a=s[y])}a!==null&&(a.selected=!0)}}function kn(s,a,u){if(a!=null&&(a=""+br(a),a!==s.value&&(s.value=a),u==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=u!=null?""+br(u):""}function xr(s,a,u,m){if(a==null){if(m!=null){if(u!=null)throw Error(r(92));if(V(m)){if(1<m.length)throw Error(r(93));m=m[0]}u=m}u==null&&(u=""),a=u}u=br(a),s.defaultValue=u,m=s.textContent,m===u&&m!==""&&m!==null&&(s.value=m),pu(s)}function Gr(s,a){if(a){var u=s.firstChild;if(u&&u===s.lastChild&&u.nodeType===3){u.nodeValue=a;return}}s.textContent=a}var qh=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 vu(s,a,u){var m=a.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?m?s.setProperty(a,""):a==="float"?s.cssFloat="":s[a]="":m?s.setProperty(a,u):typeof u!="number"||u===0||qh.has(a)?a==="float"?s.cssFloat=u:s[a]=(""+u).trim():s[a]=u+"px"}function r1(s,a,u){if(a!=null&&typeof a!="object")throw Error(r(62));if(s=s.style,u!=null){for(var m in u)!u.hasOwnProperty(m)||a!=null&&a.hasOwnProperty(m)||(m.indexOf("--")===0?s.setProperty(m,""):m==="float"?s.cssFloat="":s[m]="");for(var y in a)m=a[y],a.hasOwnProperty(y)&&u[y]!==m&&vu(s,y,m)}else for(var x in a)a.hasOwnProperty(x)&&vu(s,x,a[x])}function $g(s){if(s.indexOf("-")===-1)return!1;switch(s){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 L4=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"]]),z4=/^[\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 Kh(s){return z4.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Us(){}var Ug=null;function Vg(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var zl=null,Pl=null;function i1(s){var a=Ht(s);if(a&&(s=a.stateNode)){var u=s[Yt]||null;e:switch(s=a.stateNode,a.type){case"input":if(ne(s,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),a=u.name,u.type==="radio"&&a!=null){for(u=s;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+X(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var m=u[a];if(m!==s&&m.form===s.form){var y=m[Yt]||null;if(!y)throw Error(r(90));ne(m,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(a=0;a<u.length;a++)m=u[a],m.form===s.form&&gu(m)}break e;case"textarea":kn(s,u.value,u.defaultValue);break e;case"select":a=u.value,a!=null&&Bt(s,!!u.multiple,a,!1)}}}var Wg=!1;function s1(s,a,u){if(Wg)return s(a,u);Wg=!0;try{var m=s(a);return m}finally{if(Wg=!1,(zl!==null||Pl!==null)&&(Lf(),zl&&(a=zl,s=Pl,Pl=zl=null,i1(a),s)))for(a=0;a<s.length;a++)i1(s[a])}}function _u(s,a){var u=s.stateNode;if(u===null)return null;var m=u[Yt]||null;if(m===null)return null;u=m[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(s=s.type,m=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!m;break e;default:s=!1}if(s)return null;if(u&&typeof u!="function")throw Error(r(231,a,typeof u));return u}var Vs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qg=!1;if(Vs)try{var yu={};Object.defineProperty(yu,"passive",{get:function(){qg=!0}}),window.addEventListener("test",yu,yu),window.removeEventListener("test",yu,yu)}catch{qg=!1}var jo=null,Kg=null,Gh=null;function o1(){if(Gh)return Gh;var s,a=Kg,u=a.length,m,y="value"in jo?jo.value:jo.textContent,x=y.length;for(s=0;s<u&&a[s]===y[s];s++);var T=u-s;for(m=1;m<=T&&a[u-m]===y[x-m];m++);return Gh=y.slice(s,1<m?1-m:void 0)}function Yh(s){var a=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&a===13&&(s=13)):s=a,s===10&&(s=13),32<=s||s===13?s:0}function Xh(){return!0}function a1(){return!1}function Yr(s){function a(u,m,y,x,T){this._reactName=u,this._targetInst=y,this.type=m,this.nativeEvent=x,this.target=T,this.currentTarget=null;for(var I in s)s.hasOwnProperty(I)&&(u=s[I],this[I]=u?u(x):x[I]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Xh:a1,this.isPropagationStopped=a1,this}return p(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=Xh)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Xh)},persist:function(){},isPersistent:Xh}),a}var Aa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zh=Yr(Aa),bu=p({},Aa,{view:0,detail:0}),P4=Yr(bu),Gg,Yg,xu,Qh=p({},bu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zg,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==xu&&(xu&&s.type==="mousemove"?(Gg=s.screenX-xu.screenX,Yg=s.screenY-xu.screenY):Yg=Gg=0,xu=s),Gg)},movementY:function(s){return"movementY"in s?s.movementY:Yg}}),l1=Yr(Qh),I4=p({},Qh,{dataTransfer:0}),B4=Yr(I4),F4=p({},bu,{relatedTarget:0}),Xg=Yr(F4),H4=p({},Aa,{animationName:0,elapsedTime:0,pseudoElement:0}),$4=Yr(H4),U4=p({},Aa,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),V4=Yr(U4),W4=p({},Aa,{data:0}),c1=Yr(W4),q4={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},K4={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"},G4={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Y4(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=G4[s])?!!a[s]:!1}function Zg(){return Y4}var X4=p({},bu,{key:function(s){if(s.key){var a=q4[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=Yh(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?K4[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zg,charCode:function(s){return s.type==="keypress"?Yh(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Yh(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Z4=Yr(X4),Q4=p({},Qh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),u1=Yr(Q4),J4=p({},bu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zg}),e3=Yr(J4),t3=p({},Aa,{propertyName:0,elapsedTime:0,pseudoElement:0}),n3=Yr(t3),r3=p({},Qh,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),i3=Yr(r3),s3=p({},Aa,{newState:0,oldState:0}),o3=Yr(s3),a3=[9,13,27,32],Qg=Vs&&"CompositionEvent"in window,wu=null;Vs&&"documentMode"in document&&(wu=document.documentMode);var l3=Vs&&"TextEvent"in window&&!wu,d1=Vs&&(!Qg||wu&&8<wu&&11>=wu),h1=" ",f1=!1;function m1(s,a){switch(s){case"keyup":return a3.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function p1(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Il=!1;function c3(s,a){switch(s){case"compositionend":return p1(a);case"keypress":return a.which!==32?null:(f1=!0,h1);case"textInput":return s=a.data,s===h1&&f1?null:s;default:return null}}function u3(s,a){if(Il)return s==="compositionend"||!Qg&&m1(s,a)?(s=o1(),Gh=Kg=jo=null,Il=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return d1&&a.locale!=="ko"?null:a.data;default:return null}}var d3={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 g1(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!d3[s.type]:a==="textarea"}function v1(s,a,u,m){zl?Pl?Pl.push(m):Pl=[m]:zl=m,a=$f(a,"onChange"),0<a.length&&(u=new Zh("onChange","change",null,u,m),s.push({event:u,listeners:a}))}var Su=null,Cu=null;function h3(s){JC(s,0)}function Jh(s){var a=Pn(s);if(gu(a))return s}function _1(s,a){if(s==="change")return a}var y1=!1;if(Vs){var Jg;if(Vs){var ev="oninput"in document;if(!ev){var b1=document.createElement("div");b1.setAttribute("oninput","return;"),ev=typeof b1.oninput=="function"}Jg=ev}else Jg=!1;y1=Jg&&(!document.documentMode||9<document.documentMode)}function x1(){Su&&(Su.detachEvent("onpropertychange",w1),Cu=Su=null)}function w1(s){if(s.propertyName==="value"&&Jh(Cu)){var a=[];v1(a,Cu,s,Vg(s)),s1(h3,a)}}function f3(s,a,u){s==="focusin"?(x1(),Su=a,Cu=u,Su.attachEvent("onpropertychange",w1)):s==="focusout"&&x1()}function m3(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Jh(Cu)}function p3(s,a){if(s==="click")return Jh(a)}function g3(s,a){if(s==="input"||s==="change")return Jh(a)}function v3(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var li=typeof Object.is=="function"?Object.is:v3;function ku(s,a){if(li(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var u=Object.keys(s),m=Object.keys(a);if(u.length!==m.length)return!1;for(m=0;m<u.length;m++){var y=u[m];if(!De.call(a,y)||!li(s[y],a[y]))return!1}return!0}function S1(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function C1(s,a){var u=S1(s);s=0;for(var m;u;){if(u.nodeType===3){if(m=s+u.textContent.length,s<=a&&m>=a)return{node:u,offset:a-s};s=m}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=S1(u)}}function k1(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?k1(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function E1(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var a=Ma(s.document);a instanceof s.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)s=a.contentWindow;else break;a=Ma(s.document)}return a}function tv(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}var _3=Vs&&"documentMode"in document&&11>=document.documentMode,Bl=null,nv=null,Eu=null,rv=!1;function R1(s,a,u){var m=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;rv||Bl==null||Bl!==Ma(m)||(m=Bl,"selectionStart"in m&&tv(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}),Eu&&ku(Eu,m)||(Eu=m,m=$f(nv,"onSelect"),0<m.length&&(a=new Zh("onSelect","select",null,a,u),s.push({event:a,listeners:m}),a.target=Bl)))}function ja(s,a){var u={};return u[s.toLowerCase()]=a.toLowerCase(),u["Webkit"+s]="webkit"+a,u["Moz"+s]="moz"+a,u}var Fl={animationend:ja("Animation","AnimationEnd"),animationiteration:ja("Animation","AnimationIteration"),animationstart:ja("Animation","AnimationStart"),transitionrun:ja("Transition","TransitionRun"),transitionstart:ja("Transition","TransitionStart"),transitioncancel:ja("Transition","TransitionCancel"),transitionend:ja("Transition","TransitionEnd")},iv={},T1={};Vs&&(T1=document.createElement("div").style,"AnimationEvent"in window||(delete Fl.animationend.animation,delete Fl.animationiteration.animation,delete Fl.animationstart.animation),"TransitionEvent"in window||delete Fl.transitionend.transition);function Da(s){if(iv[s])return iv[s];if(!Fl[s])return s;var a=Fl[s],u;for(u in a)if(a.hasOwnProperty(u)&&u in T1)return iv[s]=a[u];return s}var N1=Da("animationend"),M1=Da("animationiteration"),A1=Da("animationstart"),y3=Da("transitionrun"),b3=Da("transitionstart"),x3=Da("transitioncancel"),j1=Da("transitionend"),D1=new Map,sv="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(" ");sv.push("scrollEnd");function Ji(s,a){D1.set(s,a),$s(a,[s])}var ef=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Ei=[],Hl=0,ov=0;function tf(){for(var s=Hl,a=ov=Hl=0;a<s;){var u=Ei[a];Ei[a++]=null;var m=Ei[a];Ei[a++]=null;var y=Ei[a];Ei[a++]=null;var x=Ei[a];if(Ei[a++]=null,m!==null&&y!==null){var T=m.pending;T===null?y.next=y:(y.next=T.next,T.next=y),m.pending=y}x!==0&&O1(u,y,x)}}function nf(s,a,u,m){Ei[Hl++]=s,Ei[Hl++]=a,Ei[Hl++]=u,Ei[Hl++]=m,ov|=m,s.lanes|=m,s=s.alternate,s!==null&&(s.lanes|=m)}function av(s,a,u,m){return nf(s,a,u,m),rf(s)}function Oa(s,a){return nf(s,null,null,a),rf(s)}function O1(s,a,u){s.lanes|=u;var m=s.alternate;m!==null&&(m.lanes|=u);for(var y=!1,x=s.return;x!==null;)x.childLanes|=u,m=x.alternate,m!==null&&(m.childLanes|=u),x.tag===22&&(s=x.stateNode,s===null||s._visibility&1||(y=!0)),s=x,x=x.return;return s.tag===3?(x=s.stateNode,y&&a!==null&&(y=31-Ve(u),s=x.hiddenUpdates,m=s[y],m===null?s[y]=[a]:m.push(a),a.lane=u|536870912),x):null}function rf(s){if(50<Gu)throw Gu=0,g_=null,Error(r(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}var $l={};function w3(s,a,u,m){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ci(s,a,u,m){return new w3(s,a,u,m)}function lv(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Ws(s,a){var u=s.alternate;return u===null?(u=ci(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function L1(s,a){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function sf(s,a,u,m,y,x){var T=0;if(m=s,typeof s=="function")lv(s)&&(T=1);else if(typeof s=="string")T=RL(s,u,ie.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case Y:return s=ci(31,u,a,y),s.elementType=Y,s.lanes=x,s;case S:return La(u.children,y,x,a);case C:T=8,y|=24;break;case k:return s=ci(12,u,a,y|2),s.elementType=k,s.lanes=x,s;case L:return s=ci(13,u,a,y),s.elementType=L,s.lanes=x,s;case j:return s=ci(19,u,a,y),s.elementType=j,s.lanes=x,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case E:T=10;break e;case R:T=9;break e;case N:T=11;break e;case D:T=14;break e;case H:T=16,m=null;break e}T=29,u=Error(r(130,s===null?"null":typeof s,"")),m=null}return a=ci(T,u,a,y),a.elementType=s,a.type=m,a.lanes=x,a}function La(s,a,u,m){return s=ci(7,s,m,a),s.lanes=u,s}function cv(s,a,u){return s=ci(6,s,null,a),s.lanes=u,s}function z1(s){var a=ci(18,null,null,0);return a.stateNode=s,a}function uv(s,a,u){return a=ci(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}var P1=new WeakMap;function Ri(s,a){if(typeof s=="object"&&s!==null){var u=P1.get(s);return u!==void 0?u:(a={value:s,source:a,stack:He(a)},P1.set(s,a),a)}return{value:s,source:a,stack:He(a)}}var Ul=[],Vl=0,of=null,Ru=0,Ti=[],Ni=0,Do=null,gs=1,vs="";function qs(s,a){Ul[Vl++]=Ru,Ul[Vl++]=of,of=s,Ru=a}function I1(s,a,u){Ti[Ni++]=gs,Ti[Ni++]=vs,Ti[Ni++]=Do,Do=s;var m=gs;s=vs;var y=32-Ve(m)-1;m&=~(1<<y),u+=1;var x=32-Ve(a)+y;if(30<x){var T=y-y%5;x=(m&(1<<T)-1).toString(32),m>>=T,y-=T,gs=1<<32-Ve(a)+y|u<<y|m,vs=x+s}else gs=1<<x|u<<y|m,vs=s}function dv(s){s.return!==null&&(qs(s,1),I1(s,1,0))}function hv(s){for(;s===of;)of=Ul[--Vl],Ul[Vl]=null,Ru=Ul[--Vl],Ul[Vl]=null;for(;s===Do;)Do=Ti[--Ni],Ti[Ni]=null,vs=Ti[--Ni],Ti[Ni]=null,gs=Ti[--Ni],Ti[Ni]=null}function B1(s,a){Ti[Ni++]=gs,Ti[Ni++]=vs,Ti[Ni++]=Do,gs=a.id,vs=a.overflow,Do=s}var wr=null,xn=null,It=!1,Oo=null,Mi=!1,fv=Error(r(519));function Lo(s){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Tu(Ri(a,s)),fv}function F1(s){var a=s.stateNode,u=s.type,m=s.memoizedProps;switch(a[Gt]=s,a[Yt]=m,u){case"dialog":Dt("cancel",a),Dt("close",a);break;case"iframe":case"object":case"embed":Dt("load",a);break;case"video":case"audio":for(u=0;u<Xu.length;u++)Dt(Xu[u],a);break;case"source":Dt("error",a);break;case"img":case"image":case"link":Dt("error",a),Dt("load",a);break;case"details":Dt("toggle",a);break;case"input":Dt("invalid",a),we(a,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":Dt("invalid",a);break;case"textarea":Dt("invalid",a),xr(a,m.value,m.defaultValue,m.children)}u=m.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||a.textContent===""+u||m.suppressHydrationWarning===!0||rk(a.textContent,u)?(m.popover!=null&&(Dt("beforetoggle",a),Dt("toggle",a)),m.onScroll!=null&&Dt("scroll",a),m.onScrollEnd!=null&&Dt("scrollend",a),m.onClick!=null&&(a.onclick=Us),a=!0):a=!1,a||Lo(s,!0)}function H1(s){for(wr=s.return;wr;)switch(wr.tag){case 5:case 31:case 13:Mi=!1;return;case 27:case 3:Mi=!0;return;default:wr=wr.return}}function Wl(s){if(s!==wr)return!1;if(!It)return H1(s),It=!0,!1;var a=s.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=s.type,u=!(u!=="form"&&u!=="button")||A_(s.type,s.memoizedProps)),u=!u),u&&xn&&Lo(s),H1(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));xn=hk(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));xn=hk(s)}else a===27?(a=xn,Yo(s.type)?(s=z_,z_=null,xn=s):xn=a):xn=wr?ji(s.stateNode.nextSibling):null;return!0}function za(){xn=wr=null,It=!1}function mv(){var s=Oo;return s!==null&&(Jr===null?Jr=s:Jr.push.apply(Jr,s),Oo=null),s}function Tu(s){Oo===null?Oo=[s]:Oo.push(s)}var pv=B(null),Pa=null,Ks=null;function zo(s,a,u){A(pv,a._currentValue),a._currentValue=u}function Gs(s){s._currentValue=pv.current,Z(pv)}function gv(s,a,u){for(;s!==null;){var m=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,m!==null&&(m.childLanes|=a)):m!==null&&(m.childLanes&a)!==a&&(m.childLanes|=a),s===u)break;s=s.return}}function vv(s,a,u,m){var y=s.child;for(y!==null&&(y.return=s);y!==null;){var x=y.dependencies;if(x!==null){var T=y.child;x=x.firstContext;e:for(;x!==null;){var I=x;x=y;for(var Q=0;Q<a.length;Q++)if(I.context===a[Q]){x.lanes|=u,I=x.alternate,I!==null&&(I.lanes|=u),gv(x.return,u,s),m||(T=null);break e}x=I.next}}else if(y.tag===18){if(T=y.return,T===null)throw Error(r(341));T.lanes|=u,x=T.alternate,x!==null&&(x.lanes|=u),gv(T,u,s),T=null}else T=y.child;if(T!==null)T.return=y;else for(T=y;T!==null;){if(T===s){T=null;break}if(y=T.sibling,y!==null){y.return=T.return,T=y;break}T=T.return}y=T}}function ql(s,a,u,m){s=null;for(var y=a,x=!1;y!==null;){if(!x){if((y.flags&524288)!==0)x=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var T=y.alternate;if(T===null)throw Error(r(387));if(T=T.memoizedProps,T!==null){var I=y.type;li(y.pendingProps.value,T.value)||(s!==null?s.push(I):s=[I])}}else if(y===re.current){if(T=y.alternate,T===null)throw Error(r(387));T.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(s!==null?s.push(td):s=[td])}y=y.return}s!==null&&vv(a,s,u,m),a.flags|=262144}function af(s){for(s=s.firstContext;s!==null;){if(!li(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Ia(s){Pa=s,Ks=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Sr(s){return $1(Pa,s)}function lf(s,a){return Pa===null&&Ia(s),$1(s,a)}function $1(s,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},Ks===null){if(s===null)throw Error(r(308));Ks=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else Ks=Ks.next=a;return u}var S3=typeof AbortController<"u"?AbortController:function(){var s=[],a=this.signal={aborted:!1,addEventListener:function(u,m){s.push(m)}};this.abort=function(){a.aborted=!0,s.forEach(function(u){return u()})}},C3=e.unstable_scheduleCallback,k3=e.unstable_NormalPriority,Wn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function _v(){return{controller:new S3,data:new Map,refCount:0}}function Nu(s){s.refCount--,s.refCount===0&&C3(k3,function(){s.controller.abort()})}var Mu=null,yv=0,Kl=0,Gl=null;function E3(s,a){if(Mu===null){var u=Mu=[];yv=0,Kl=w_(),Gl={status:"pending",value:void 0,then:function(m){u.push(m)}}}return yv++,a.then(U1,U1),a}function U1(){if(--yv===0&&Mu!==null){Gl!==null&&(Gl.status="fulfilled");var s=Mu;Mu=null,Kl=0,Gl=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function R3(s,a){var u=[],m={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return s.then(function(){m.status="fulfilled",m.value=a;for(var y=0;y<u.length;y++)(0,u[y])(a)},function(y){for(m.status="rejected",m.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),m}var V1=O.S;O.S=function(s,a){RC=Ce(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&E3(s,a),V1!==null&&V1(s,a)};var Ba=B(null);function bv(){var s=Ba.current;return s!==null?s:gn.pooledCache}function cf(s,a){a===null?A(Ba,Ba.current):A(Ba,a.pool)}function W1(){var s=bv();return s===null?null:{parent:Wn._currentValue,pool:s}}var Yl=Error(r(460)),xv=Error(r(474)),uf=Error(r(542)),df={then:function(){}};function q1(s){return s=s.status,s==="fulfilled"||s==="rejected"}function K1(s,a,u){switch(u=s[u],u===void 0?s.push(a):u!==a&&(a.then(Us,Us),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,Y1(s),s;default:if(typeof a.status=="string")a.then(Us,Us);else{if(s=gn,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=a,s.status="pending",s.then(function(m){if(a.status==="pending"){var y=a;y.status="fulfilled",y.value=m}},function(m){if(a.status==="pending"){var y=a;y.status="rejected",y.reason=m}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,Y1(s),s}throw Ha=a,Yl}}function Fa(s){try{var a=s._init;return a(s._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(Ha=u,Yl):u}}var Ha=null;function G1(){if(Ha===null)throw Error(r(459));var s=Ha;return Ha=null,s}function Y1(s){if(s===Yl||s===uf)throw Error(r(483))}var Xl=null,Au=0;function hf(s){var a=Au;return Au+=1,Xl===null&&(Xl=[]),K1(Xl,s,a)}function ju(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function ff(s,a){throw a.$$typeof===v?Error(r(525)):(s=Object.prototype.toString.call(a),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s)))}function X1(s){function a(se,te){if(s){var ae=se.deletions;ae===null?(se.deletions=[te],se.flags|=16):ae.push(te)}}function u(se,te){if(!s)return null;for(;te!==null;)a(se,te),te=te.sibling;return null}function m(se){for(var te=new Map;se!==null;)se.key!==null?te.set(se.key,se):te.set(se.index,se),se=se.sibling;return te}function y(se,te){return se=Ws(se,te),se.index=0,se.sibling=null,se}function x(se,te,ae){return se.index=ae,s?(ae=se.alternate,ae!==null?(ae=ae.index,ae<te?(se.flags|=67108866,te):ae):(se.flags|=67108866,te)):(se.flags|=1048576,te)}function T(se){return s&&se.alternate===null&&(se.flags|=67108866),se}function I(se,te,ae,_e){return te===null||te.tag!==6?(te=cv(ae,se.mode,_e),te.return=se,te):(te=y(te,ae),te.return=se,te)}function Q(se,te,ae,_e){var nt=ae.type;return nt===S?ge(se,te,ae.props.children,_e,ae.key):te!==null&&(te.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===H&&Fa(nt)===te.type)?(te=y(te,ae.props),ju(te,ae),te.return=se,te):(te=sf(ae.type,ae.key,ae.props,null,se.mode,_e),ju(te,ae),te.return=se,te)}function le(se,te,ae,_e){return te===null||te.tag!==4||te.stateNode.containerInfo!==ae.containerInfo||te.stateNode.implementation!==ae.implementation?(te=uv(ae,se.mode,_e),te.return=se,te):(te=y(te,ae.children||[]),te.return=se,te)}function ge(se,te,ae,_e,nt){return te===null||te.tag!==7?(te=La(ae,se.mode,_e,nt),te.return=se,te):(te=y(te,ae),te.return=se,te)}function ye(se,te,ae){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=cv(""+te,se.mode,ae),te.return=se,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case b:return ae=sf(te.type,te.key,te.props,null,se.mode,ae),ju(ae,te),ae.return=se,ae;case w:return te=uv(te,se.mode,ae),te.return=se,te;case H:return te=Fa(te),ye(se,te,ae)}if(V(te)||F(te))return te=La(te,se.mode,ae,null),te.return=se,te;if(typeof te.then=="function")return ye(se,hf(te),ae);if(te.$$typeof===E)return ye(se,lf(se,te),ae);ff(se,te)}return null}function ue(se,te,ae,_e){var nt=te!==null?te.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return nt!==null?null:I(se,te,""+ae,_e);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case b:return ae.key===nt?Q(se,te,ae,_e):null;case w:return ae.key===nt?le(se,te,ae,_e):null;case H:return ae=Fa(ae),ue(se,te,ae,_e)}if(V(ae)||F(ae))return nt!==null?null:ge(se,te,ae,_e,null);if(typeof ae.then=="function")return ue(se,te,hf(ae),_e);if(ae.$$typeof===E)return ue(se,te,lf(se,ae),_e);ff(se,ae)}return null}function de(se,te,ae,_e,nt){if(typeof _e=="string"&&_e!==""||typeof _e=="number"||typeof _e=="bigint")return se=se.get(ae)||null,I(te,se,""+_e,nt);if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case b:return se=se.get(_e.key===null?ae:_e.key)||null,Q(te,se,_e,nt);case w:return se=se.get(_e.key===null?ae:_e.key)||null,le(te,se,_e,nt);case H:return _e=Fa(_e),de(se,te,ae,_e,nt)}if(V(_e)||F(_e))return se=se.get(ae)||null,ge(te,se,_e,nt,null);if(typeof _e.then=="function")return de(se,te,ae,hf(_e),nt);if(_e.$$typeof===E)return de(se,te,ae,lf(te,_e),nt);ff(te,_e)}return null}function Ue(se,te,ae,_e){for(var nt=null,Vt=null,Ye=te,bt=te=0,Pt=null;Ye!==null&&bt<ae.length;bt++){Ye.index>bt?(Pt=Ye,Ye=null):Pt=Ye.sibling;var Wt=ue(se,Ye,ae[bt],_e);if(Wt===null){Ye===null&&(Ye=Pt);break}s&&Ye&&Wt.alternate===null&&a(se,Ye),te=x(Wt,te,bt),Vt===null?nt=Wt:Vt.sibling=Wt,Vt=Wt,Ye=Pt}if(bt===ae.length)return u(se,Ye),It&&qs(se,bt),nt;if(Ye===null){for(;bt<ae.length;bt++)Ye=ye(se,ae[bt],_e),Ye!==null&&(te=x(Ye,te,bt),Vt===null?nt=Ye:Vt.sibling=Ye,Vt=Ye);return It&&qs(se,bt),nt}for(Ye=m(Ye);bt<ae.length;bt++)Pt=de(Ye,se,bt,ae[bt],_e),Pt!==null&&(s&&Pt.alternate!==null&&Ye.delete(Pt.key===null?bt:Pt.key),te=x(Pt,te,bt),Vt===null?nt=Pt:Vt.sibling=Pt,Vt=Pt);return s&&Ye.forEach(function(ea){return a(se,ea)}),It&&qs(se,bt),nt}function st(se,te,ae,_e){if(ae==null)throw Error(r(151));for(var nt=null,Vt=null,Ye=te,bt=te=0,Pt=null,Wt=ae.next();Ye!==null&&!Wt.done;bt++,Wt=ae.next()){Ye.index>bt?(Pt=Ye,Ye=null):Pt=Ye.sibling;var ea=ue(se,Ye,Wt.value,_e);if(ea===null){Ye===null&&(Ye=Pt);break}s&&Ye&&ea.alternate===null&&a(se,Ye),te=x(ea,te,bt),Vt===null?nt=ea:Vt.sibling=ea,Vt=ea,Ye=Pt}if(Wt.done)return u(se,Ye),It&&qs(se,bt),nt;if(Ye===null){for(;!Wt.done;bt++,Wt=ae.next())Wt=ye(se,Wt.value,_e),Wt!==null&&(te=x(Wt,te,bt),Vt===null?nt=Wt:Vt.sibling=Wt,Vt=Wt);return It&&qs(se,bt),nt}for(Ye=m(Ye);!Wt.done;bt++,Wt=ae.next())Wt=de(Ye,se,bt,Wt.value,_e),Wt!==null&&(s&&Wt.alternate!==null&&Ye.delete(Wt.key===null?bt:Wt.key),te=x(Wt,te,bt),Vt===null?nt=Wt:Vt.sibling=Wt,Vt=Wt);return s&&Ye.forEach(function(IL){return a(se,IL)}),It&&qs(se,bt),nt}function cn(se,te,ae,_e){if(typeof ae=="object"&&ae!==null&&ae.type===S&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case b:e:{for(var nt=ae.key;te!==null;){if(te.key===nt){if(nt=ae.type,nt===S){if(te.tag===7){u(se,te.sibling),_e=y(te,ae.props.children),_e.return=se,se=_e;break e}}else if(te.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===H&&Fa(nt)===te.type){u(se,te.sibling),_e=y(te,ae.props),ju(_e,ae),_e.return=se,se=_e;break e}u(se,te);break}else a(se,te);te=te.sibling}ae.type===S?(_e=La(ae.props.children,se.mode,_e,ae.key),_e.return=se,se=_e):(_e=sf(ae.type,ae.key,ae.props,null,se.mode,_e),ju(_e,ae),_e.return=se,se=_e)}return T(se);case w:e:{for(nt=ae.key;te!==null;){if(te.key===nt)if(te.tag===4&&te.stateNode.containerInfo===ae.containerInfo&&te.stateNode.implementation===ae.implementation){u(se,te.sibling),_e=y(te,ae.children||[]),_e.return=se,se=_e;break e}else{u(se,te);break}else a(se,te);te=te.sibling}_e=uv(ae,se.mode,_e),_e.return=se,se=_e}return T(se);case H:return ae=Fa(ae),cn(se,te,ae,_e)}if(V(ae))return Ue(se,te,ae,_e);if(F(ae)){if(nt=F(ae),typeof nt!="function")throw Error(r(150));return ae=nt.call(ae),st(se,te,ae,_e)}if(typeof ae.then=="function")return cn(se,te,hf(ae),_e);if(ae.$$typeof===E)return cn(se,te,lf(se,ae),_e);ff(se,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,te!==null&&te.tag===6?(u(se,te.sibling),_e=y(te,ae),_e.return=se,se=_e):(u(se,te),_e=cv(ae,se.mode,_e),_e.return=se,se=_e),T(se)):u(se,te)}return function(se,te,ae,_e){try{Au=0;var nt=cn(se,te,ae,_e);return Xl=null,nt}catch(Ye){if(Ye===Yl||Ye===uf)throw Ye;var Vt=ci(29,Ye,null,se.mode);return Vt.lanes=_e,Vt.return=se,Vt}finally{}}}var $a=X1(!0),Z1=X1(!1),Po=!1;function wv(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sv(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Io(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Bo(s,a,u){var m=s.updateQueue;if(m===null)return null;if(m=m.shared,(Xt&2)!==0){var y=m.pending;return y===null?a.next=a:(a.next=y.next,y.next=a),m.pending=a,a=rf(s),O1(s,null,u),a}return nf(s,m,a,u),rf(s)}function Du(s,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var m=a.lanes;m&=s.pendingLanes,u|=m,a.lanes=u,ke(s,u)}}function Cv(s,a){var u=s.updateQueue,m=s.alternate;if(m!==null&&(m=m.updateQueue,u===m)){var y=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var T={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};x===null?y=x=T:x=x.next=T,u=u.next}while(u!==null);x===null?y=x=a:x=x.next=a}else y=x=a;u={baseState:m.baseState,firstBaseUpdate:y,lastBaseUpdate:x,shared:m.shared,callbacks:m.callbacks},s.updateQueue=u;return}s=u.lastBaseUpdate,s===null?u.firstBaseUpdate=a:s.next=a,u.lastBaseUpdate=a}var kv=!1;function Ou(){if(kv){var s=Gl;if(s!==null)throw s}}function Lu(s,a,u,m){kv=!1;var y=s.updateQueue;Po=!1;var x=y.firstBaseUpdate,T=y.lastBaseUpdate,I=y.shared.pending;if(I!==null){y.shared.pending=null;var Q=I,le=Q.next;Q.next=null,T===null?x=le:T.next=le,T=Q;var ge=s.alternate;ge!==null&&(ge=ge.updateQueue,I=ge.lastBaseUpdate,I!==T&&(I===null?ge.firstBaseUpdate=le:I.next=le,ge.lastBaseUpdate=Q))}if(x!==null){var ye=y.baseState;T=0,ge=le=Q=null,I=x;do{var ue=I.lane&-536870913,de=ue!==I.lane;if(de?(zt&ue)===ue:(m&ue)===ue){ue!==0&&ue===Kl&&(kv=!0),ge!==null&&(ge=ge.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var Ue=s,st=I;ue=a;var cn=u;switch(st.tag){case 1:if(Ue=st.payload,typeof Ue=="function"){ye=Ue.call(cn,ye,ue);break e}ye=Ue;break e;case 3:Ue.flags=Ue.flags&-65537|128;case 0:if(Ue=st.payload,ue=typeof Ue=="function"?Ue.call(cn,ye,ue):Ue,ue==null)break e;ye=p({},ye,ue);break e;case 2:Po=!0}}ue=I.callback,ue!==null&&(s.flags|=64,de&&(s.flags|=8192),de=y.callbacks,de===null?y.callbacks=[ue]:de.push(ue))}else de={lane:ue,tag:I.tag,payload:I.payload,callback:I.callback,next:null},ge===null?(le=ge=de,Q=ye):ge=ge.next=de,T|=ue;if(I=I.next,I===null){if(I=y.shared.pending,I===null)break;de=I,I=de.next,de.next=null,y.lastBaseUpdate=de,y.shared.pending=null}}while(!0);ge===null&&(Q=ye),y.baseState=Q,y.firstBaseUpdate=le,y.lastBaseUpdate=ge,x===null&&(y.shared.lanes=0),Vo|=T,s.lanes=T,s.memoizedState=ye}}function Q1(s,a){if(typeof s!="function")throw Error(r(191,s));s.call(a)}function J1(s,a){var u=s.callbacks;if(u!==null)for(s.callbacks=null,s=0;s<u.length;s++)Q1(u[s],a)}var Zl=B(null),mf=B(0);function eS(s,a){s=ro,A(mf,s),A(Zl,a),ro=s|a.baseLanes}function Ev(){A(mf,ro),A(Zl,Zl.current)}function Rv(){ro=mf.current,Z(Zl),Z(mf)}var ui=B(null),Ai=null;function Fo(s){var a=s.alternate;A(In,In.current&1),A(ui,s),Ai===null&&(a===null||Zl.current!==null||a.memoizedState!==null)&&(Ai=s)}function Tv(s){A(In,In.current),A(ui,s),Ai===null&&(Ai=s)}function tS(s){s.tag===22?(A(In,In.current),A(ui,s),Ai===null&&(Ai=s)):Ho()}function Ho(){A(In,In.current),A(ui,ui.current)}function di(s){Z(ui),Ai===s&&(Ai=null),Z(In)}var In=B(0);function pf(s){for(var a=s;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||O_(u)||L_(u)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Ys=0,pt=null,an=null,qn=null,gf=!1,Ql=!1,Ua=!1,vf=0,zu=0,Jl=null,T3=0;function An(){throw Error(r(321))}function Nv(s,a){if(a===null)return!1;for(var u=0;u<a.length&&u<s.length;u++)if(!li(s[u],a[u]))return!1;return!0}function Mv(s,a,u,m,y,x){return Ys=x,pt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,O.H=s===null||s.memoizedState===null?IS:Wv,Ua=!1,x=u(m,y),Ua=!1,Ql&&(x=rS(a,u,m,y)),nS(s),x}function nS(s){O.H=Bu;var a=an!==null&&an.next!==null;if(Ys=0,qn=an=pt=null,gf=!1,zu=0,Jl=null,a)throw Error(r(300));s===null||Kn||(s=s.dependencies,s!==null&&af(s)&&(Kn=!0))}function rS(s,a,u,m){pt=s;var y=0;do{if(Ql&&(Jl=null),zu=0,Ql=!1,25<=y)throw Error(r(301));if(y+=1,qn=an=null,s.updateQueue!=null){var x=s.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}O.H=BS,x=a(u,m)}while(Ql);return x}function N3(){var s=O.H,a=s.useState()[0];return a=typeof a.then=="function"?Pu(a):a,s=s.useState()[0],(an!==null?an.memoizedState:null)!==s&&(pt.flags|=1024),a}function Av(){var s=vf!==0;return vf=0,s}function jv(s,a,u){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~u}function Dv(s){if(gf){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}gf=!1}Ys=0,qn=an=pt=null,Ql=!1,zu=vf=0,Jl=null}function Br(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qn===null?pt.memoizedState=qn=s:qn=qn.next=s,qn}function Bn(){if(an===null){var s=pt.alternate;s=s!==null?s.memoizedState:null}else s=an.next;var a=qn===null?pt.memoizedState:qn.next;if(a!==null)qn=a,an=s;else{if(s===null)throw pt.alternate===null?Error(r(467)):Error(r(310));an=s,s={memoizedState:an.memoizedState,baseState:an.baseState,baseQueue:an.baseQueue,queue:an.queue,next:null},qn===null?pt.memoizedState=qn=s:qn=qn.next=s}return qn}function _f(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Pu(s){var a=zu;return zu+=1,Jl===null&&(Jl=[]),s=K1(Jl,s,a),a=pt,(qn===null?a.memoizedState:qn.next)===null&&(a=a.alternate,O.H=a===null||a.memoizedState===null?IS:Wv),s}function yf(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Pu(s);if(s.$$typeof===E)return Sr(s)}throw Error(r(438,String(s)))}function Ov(s){var a=null,u=pt.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var m=pt.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(a={data:m.data.map(function(y){return y.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),u===null&&(u=_f(),pt.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(s),m=0;m<s;m++)u[m]=P;return a.index++,u}function Xs(s,a){return typeof a=="function"?a(s):a}function bf(s){var a=Bn();return Lv(a,an,s)}function Lv(s,a,u){var m=s.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=u;var y=s.baseQueue,x=m.pending;if(x!==null){if(y!==null){var T=y.next;y.next=x.next,x.next=T}a.baseQueue=y=x,m.pending=null}if(x=s.baseState,y===null)s.memoizedState=x;else{a=y.next;var I=T=null,Q=null,le=a,ge=!1;do{var ye=le.lane&-536870913;if(ye!==le.lane?(zt&ye)===ye:(Ys&ye)===ye){var ue=le.revertLane;if(ue===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),ye===Kl&&(ge=!0);else if((Ys&ue)===ue){le=le.next,ue===Kl&&(ge=!0);continue}else ye={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},Q===null?(I=Q=ye,T=x):Q=Q.next=ye,pt.lanes|=ue,Vo|=ue;ye=le.action,Ua&&u(x,ye),x=le.hasEagerState?le.eagerState:u(x,ye)}else ue={lane:ye,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},Q===null?(I=Q=ue,T=x):Q=Q.next=ue,pt.lanes|=ye,Vo|=ye;le=le.next}while(le!==null&&le!==a);if(Q===null?T=x:Q.next=I,!li(x,s.memoizedState)&&(Kn=!0,ge&&(u=Gl,u!==null)))throw u;s.memoizedState=x,s.baseState=T,s.baseQueue=Q,m.lastRenderedState=x}return y===null&&(m.lanes=0),[s.memoizedState,m.dispatch]}function zv(s){var a=Bn(),u=a.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=s;var m=u.dispatch,y=u.pending,x=a.memoizedState;if(y!==null){u.pending=null;var T=y=y.next;do x=s(x,T.action),T=T.next;while(T!==y);li(x,a.memoizedState)||(Kn=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),u.lastRenderedState=x}return[x,m]}function iS(s,a,u){var m=pt,y=Bn(),x=It;if(x){if(u===void 0)throw Error(r(407));u=u()}else u=a();var T=!li((an||y).memoizedState,u);if(T&&(y.memoizedState=u,Kn=!0),y=y.queue,Bv(aS.bind(null,m,y,s),[s]),y.getSnapshot!==a||T||qn!==null&&qn.memoizedState.tag&1){if(m.flags|=2048,ec(9,{destroy:void 0},oS.bind(null,m,y,u,a),null),gn===null)throw Error(r(349));x||(Ys&127)!==0||sS(m,a,u)}return u}function sS(s,a,u){s.flags|=16384,s={getSnapshot:a,value:u},a=pt.updateQueue,a===null?(a=_f(),pt.updateQueue=a,a.stores=[s]):(u=a.stores,u===null?a.stores=[s]:u.push(s))}function oS(s,a,u,m){a.value=u,a.getSnapshot=m,lS(a)&&cS(s)}function aS(s,a,u){return u(function(){lS(a)&&cS(s)})}function lS(s){var a=s.getSnapshot;s=s.value;try{var u=a();return!li(s,u)}catch{return!0}}function cS(s){var a=Oa(s,2);a!==null&&ei(a,s,2)}function Pv(s){var a=Br();if(typeof s=="function"){var u=s;if(s=u(),Ua){gt(!0);try{u()}finally{gt(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xs,lastRenderedState:s},a}function uS(s,a,u,m){return s.baseState=u,Lv(s,an,typeof m=="function"?m:Xs)}function M3(s,a,u,m,y){if(Sf(s))throw Error(r(485));if(s=a.action,s!==null){var x={payload:y,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(T){x.listeners.push(T)}};O.T!==null?u(!0):x.isTransition=!1,m(x),u=a.pending,u===null?(x.next=a.pending=x,dS(a,x)):(x.next=u.next,a.pending=u.next=x)}}function dS(s,a){var u=a.action,m=a.payload,y=s.state;if(a.isTransition){var x=O.T,T={};O.T=T;try{var I=u(y,m),Q=O.S;Q!==null&&Q(T,I),hS(s,a,I)}catch(le){Iv(s,a,le)}finally{x!==null&&T.types!==null&&(x.types=T.types),O.T=x}}else try{x=u(y,m),hS(s,a,x)}catch(le){Iv(s,a,le)}}function hS(s,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(m){fS(s,a,m)},function(m){return Iv(s,a,m)}):fS(s,a,u)}function fS(s,a,u){a.status="fulfilled",a.value=u,mS(a),s.state=u,a=s.pending,a!==null&&(u=a.next,u===a?s.pending=null:(u=u.next,a.next=u,dS(s,u)))}function Iv(s,a,u){var m=s.pending;if(s.pending=null,m!==null){m=m.next;do a.status="rejected",a.reason=u,mS(a),a=a.next;while(a!==m)}s.action=null}function mS(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function pS(s,a){return a}function gS(s,a){if(It){var u=gn.formState;if(u!==null){e:{var m=pt;if(It){if(xn){t:{for(var y=xn,x=Mi;y.nodeType!==8;){if(!x){y=null;break t}if(y=ji(y.nextSibling),y===null){y=null;break t}}x=y.data,y=x==="F!"||x==="F"?y:null}if(y){xn=ji(y.nextSibling),m=y.data==="F!";break e}}Lo(m)}m=!1}m&&(a=u[0])}}return u=Br(),u.memoizedState=u.baseState=a,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pS,lastRenderedState:a},u.queue=m,u=LS.bind(null,pt,m),m.dispatch=u,m=Pv(!1),x=Vv.bind(null,pt,!1,m.queue),m=Br(),y={state:a,dispatch:null,action:s,pending:null},m.queue=y,u=M3.bind(null,pt,y,x,u),y.dispatch=u,m.memoizedState=s,[a,u,!1]}function vS(s){var a=Bn();return _S(a,an,s)}function _S(s,a,u){if(a=Lv(s,a,pS)[0],s=bf(Xs)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var m=Pu(a)}catch(T){throw T===Yl?uf:T}else m=a;a=Bn();var y=a.queue,x=y.dispatch;return u!==a.memoizedState&&(pt.flags|=2048,ec(9,{destroy:void 0},A3.bind(null,y,u),null)),[m,x,s]}function A3(s,a){s.action=a}function yS(s){var a=Bn(),u=an;if(u!==null)return _S(a,u,s);Bn(),a=a.memoizedState,u=Bn();var m=u.queue.dispatch;return u.memoizedState=s,[a,m,!1]}function ec(s,a,u,m){return s={tag:s,create:u,deps:m,inst:a,next:null},a=pt.updateQueue,a===null&&(a=_f(),pt.updateQueue=a),u=a.lastEffect,u===null?a.lastEffect=s.next=s:(m=u.next,u.next=s,s.next=m,a.lastEffect=s),s}function bS(){return Bn().memoizedState}function xf(s,a,u,m){var y=Br();pt.flags|=s,y.memoizedState=ec(1|a,{destroy:void 0},u,m===void 0?null:m)}function wf(s,a,u,m){var y=Bn();m=m===void 0?null:m;var x=y.memoizedState.inst;an!==null&&m!==null&&Nv(m,an.memoizedState.deps)?y.memoizedState=ec(a,x,u,m):(pt.flags|=s,y.memoizedState=ec(1|a,x,u,m))}function xS(s,a){xf(8390656,8,s,a)}function Bv(s,a){wf(2048,8,s,a)}function j3(s){pt.flags|=4;var a=pt.updateQueue;if(a===null)a=_f(),pt.updateQueue=a,a.events=[s];else{var u=a.events;u===null?a.events=[s]:u.push(s)}}function wS(s){var a=Bn().memoizedState;return j3({ref:a,nextImpl:s}),function(){if((Xt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function SS(s,a){return wf(4,2,s,a)}function CS(s,a){return wf(4,4,s,a)}function kS(s,a){if(typeof a=="function"){s=s();var u=a(s);return function(){typeof u=="function"?u():a(null)}}if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function ES(s,a,u){u=u!=null?u.concat([s]):null,wf(4,4,kS.bind(null,a,s),u)}function Fv(){}function RS(s,a){var u=Bn();a=a===void 0?null:a;var m=u.memoizedState;return a!==null&&Nv(a,m[1])?m[0]:(u.memoizedState=[s,a],s)}function TS(s,a){var u=Bn();a=a===void 0?null:a;var m=u.memoizedState;if(a!==null&&Nv(a,m[1]))return m[0];if(m=s(),Ua){gt(!0);try{s()}finally{gt(!1)}}return u.memoizedState=[m,a],m}function Hv(s,a,u){return u===void 0||(Ys&1073741824)!==0&&(zt&261930)===0?s.memoizedState=a:(s.memoizedState=u,s=NC(),pt.lanes|=s,Vo|=s,u)}function NS(s,a,u,m){return li(u,a)?u:Zl.current!==null?(s=Hv(s,u,m),li(s,a)||(Kn=!0),s):(Ys&42)===0||(Ys&1073741824)!==0&&(zt&261930)===0?(Kn=!0,s.memoizedState=u):(s=NC(),pt.lanes|=s,Vo|=s,a)}function MS(s,a,u,m,y){var x=$.p;$.p=x!==0&&8>x?x:8;var T=O.T,I={};O.T=I,Vv(s,!1,a,u);try{var Q=y(),le=O.S;if(le!==null&&le(I,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var ge=R3(Q,m);Iu(s,a,ge,mi(s))}else Iu(s,a,m,mi(s))}catch(ye){Iu(s,a,{then:function(){},status:"rejected",reason:ye},mi())}finally{$.p=x,T!==null&&I.types!==null&&(T.types=I.types),O.T=T}}function D3(){}function $v(s,a,u,m){if(s.tag!==5)throw Error(r(476));var y=AS(s).queue;MS(s,y,a,z,u===null?D3:function(){return jS(s),u(m)})}function AS(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xs,lastRenderedState:z},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xs,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function jS(s){var a=AS(s);a.next===null&&(a=s.alternate.memoizedState),Iu(s,a.next.queue,{},mi())}function Uv(){return Sr(td)}function DS(){return Bn().memoizedState}function OS(){return Bn().memoizedState}function O3(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=mi();s=Io(u);var m=Bo(a,s,u);m!==null&&(ei(m,a,u),Du(m,a,u)),a={cache:_v()},s.payload=a;return}a=a.return}}function L3(s,a,u){var m=mi();u={lane:m,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Sf(s)?zS(a,u):(u=av(s,a,u,m),u!==null&&(ei(u,s,m),PS(u,a,m)))}function LS(s,a,u){var m=mi();Iu(s,a,u,m)}function Iu(s,a,u,m){var y={lane:m,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Sf(s))zS(a,y);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var T=a.lastRenderedState,I=x(T,u);if(y.hasEagerState=!0,y.eagerState=I,li(I,T))return nf(s,a,y,0),gn===null&&tf(),!1}catch{}finally{}if(u=av(s,a,y,m),u!==null)return ei(u,s,m),PS(u,a,m),!0}return!1}function Vv(s,a,u,m){if(m={lane:2,revertLane:w_(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},Sf(s)){if(a)throw Error(r(479))}else a=av(s,u,m,2),a!==null&&ei(a,s,2)}function Sf(s){var a=s.alternate;return s===pt||a!==null&&a===pt}function zS(s,a){Ql=gf=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function PS(s,a,u){if((u&4194048)!==0){var m=a.lanes;m&=s.pendingLanes,u|=m,a.lanes=u,ke(s,u)}}var Bu={readContext:Sr,use:yf,useCallback:An,useContext:An,useEffect:An,useImperativeHandle:An,useLayoutEffect:An,useInsertionEffect:An,useMemo:An,useReducer:An,useRef:An,useState:An,useDebugValue:An,useDeferredValue:An,useTransition:An,useSyncExternalStore:An,useId:An,useHostTransitionStatus:An,useFormState:An,useActionState:An,useOptimistic:An,useMemoCache:An,useCacheRefresh:An};Bu.useEffectEvent=An;var IS={readContext:Sr,use:yf,useCallback:function(s,a){return Br().memoizedState=[s,a===void 0?null:a],s},useContext:Sr,useEffect:xS,useImperativeHandle:function(s,a,u){u=u!=null?u.concat([s]):null,xf(4194308,4,kS.bind(null,a,s),u)},useLayoutEffect:function(s,a){return xf(4194308,4,s,a)},useInsertionEffect:function(s,a){xf(4,2,s,a)},useMemo:function(s,a){var u=Br();a=a===void 0?null:a;var m=s();if(Ua){gt(!0);try{s()}finally{gt(!1)}}return u.memoizedState=[m,a],m},useReducer:function(s,a,u){var m=Br();if(u!==void 0){var y=u(a);if(Ua){gt(!0);try{u(a)}finally{gt(!1)}}}else y=a;return m.memoizedState=m.baseState=y,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:y},m.queue=s,s=s.dispatch=L3.bind(null,pt,s),[m.memoizedState,s]},useRef:function(s){var a=Br();return s={current:s},a.memoizedState=s},useState:function(s){s=Pv(s);var a=s.queue,u=LS.bind(null,pt,a);return a.dispatch=u,[s.memoizedState,u]},useDebugValue:Fv,useDeferredValue:function(s,a){var u=Br();return Hv(u,s,a)},useTransition:function(){var s=Pv(!1);return s=MS.bind(null,pt,s.queue,!0,!1),Br().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,u){var m=pt,y=Br();if(It){if(u===void 0)throw Error(r(407));u=u()}else{if(u=a(),gn===null)throw Error(r(349));(zt&127)!==0||sS(m,a,u)}y.memoizedState=u;var x={value:u,getSnapshot:a};return y.queue=x,xS(aS.bind(null,m,x,s),[s]),m.flags|=2048,ec(9,{destroy:void 0},oS.bind(null,m,x,u,a),null),u},useId:function(){var s=Br(),a=gn.identifierPrefix;if(It){var u=vs,m=gs;u=(m&~(1<<32-Ve(m)-1)).toString(32)+u,a="_"+a+"R_"+u,u=vf++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=T3++,a="_"+a+"r_"+u.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:Uv,useFormState:gS,useActionState:gS,useOptimistic:function(s){var a=Br();a.memoizedState=a.baseState=s;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=Vv.bind(null,pt,!0,u),u.dispatch=a,[s,a]},useMemoCache:Ov,useCacheRefresh:function(){return Br().memoizedState=O3.bind(null,pt)},useEffectEvent:function(s){var a=Br(),u={impl:s};return a.memoizedState=u,function(){if((Xt&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},Wv={readContext:Sr,use:yf,useCallback:RS,useContext:Sr,useEffect:Bv,useImperativeHandle:ES,useInsertionEffect:SS,useLayoutEffect:CS,useMemo:TS,useReducer:bf,useRef:bS,useState:function(){return bf(Xs)},useDebugValue:Fv,useDeferredValue:function(s,a){var u=Bn();return NS(u,an.memoizedState,s,a)},useTransition:function(){var s=bf(Xs)[0],a=Bn().memoizedState;return[typeof s=="boolean"?s:Pu(s),a]},useSyncExternalStore:iS,useId:DS,useHostTransitionStatus:Uv,useFormState:vS,useActionState:vS,useOptimistic:function(s,a){var u=Bn();return uS(u,an,s,a)},useMemoCache:Ov,useCacheRefresh:OS};Wv.useEffectEvent=wS;var BS={readContext:Sr,use:yf,useCallback:RS,useContext:Sr,useEffect:Bv,useImperativeHandle:ES,useInsertionEffect:SS,useLayoutEffect:CS,useMemo:TS,useReducer:zv,useRef:bS,useState:function(){return zv(Xs)},useDebugValue:Fv,useDeferredValue:function(s,a){var u=Bn();return an===null?Hv(u,s,a):NS(u,an.memoizedState,s,a)},useTransition:function(){var s=zv(Xs)[0],a=Bn().memoizedState;return[typeof s=="boolean"?s:Pu(s),a]},useSyncExternalStore:iS,useId:DS,useHostTransitionStatus:Uv,useFormState:yS,useActionState:yS,useOptimistic:function(s,a){var u=Bn();return an!==null?uS(u,an,s,a):(u.baseState=s,[s,u.queue.dispatch])},useMemoCache:Ov,useCacheRefresh:OS};BS.useEffectEvent=wS;function qv(s,a,u,m){a=s.memoizedState,u=u(m,a),u=u==null?a:p({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}var Kv={enqueueSetState:function(s,a,u){s=s._reactInternals;var m=mi(),y=Io(m);y.payload=a,u!=null&&(y.callback=u),a=Bo(s,y,m),a!==null&&(ei(a,s,m),Du(a,s,m))},enqueueReplaceState:function(s,a,u){s=s._reactInternals;var m=mi(),y=Io(m);y.tag=1,y.payload=a,u!=null&&(y.callback=u),a=Bo(s,y,m),a!==null&&(ei(a,s,m),Du(a,s,m))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var u=mi(),m=Io(u);m.tag=2,a!=null&&(m.callback=a),a=Bo(s,m,u),a!==null&&(ei(a,s,u),Du(a,s,u))}};function FS(s,a,u,m,y,x,T){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(m,x,T):a.prototype&&a.prototype.isPureReactComponent?!ku(u,m)||!ku(y,x):!0}function HS(s,a,u,m){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,m),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,m),a.state!==s&&Kv.enqueueReplaceState(a,a.state,null)}function Va(s,a){var u=a;if("ref"in a){u={};for(var m in a)m!=="ref"&&(u[m]=a[m])}if(s=s.defaultProps){u===a&&(u=p({},u));for(var y in s)u[y]===void 0&&(u[y]=s[y])}return u}function $S(s){ef(s)}function US(s){console.error(s)}function VS(s){ef(s)}function Cf(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(m){setTimeout(function(){throw m})}}function WS(s,a,u){try{var m=s.onCaughtError;m(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Gv(s,a,u){return u=Io(u),u.tag=3,u.payload={element:null},u.callback=function(){Cf(s,a)},u}function qS(s){return s=Io(s),s.tag=3,s}function KS(s,a,u,m){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var x=m.value;s.payload=function(){return y(x)},s.callback=function(){WS(a,u,m)}}var T=u.stateNode;T!==null&&typeof T.componentDidCatch=="function"&&(s.callback=function(){WS(a,u,m),typeof y!="function"&&(Wo===null?Wo=new Set([this]):Wo.add(this));var I=m.stack;this.componentDidCatch(m.value,{componentStack:I!==null?I:""})})}function z3(s,a,u,m,y){if(u.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(a=u.alternate,a!==null&&ql(a,u,y,!0),u=ui.current,u!==null){switch(u.tag){case 31:case 13:return Ai===null?zf():u.alternate===null&&jn===0&&(jn=3),u.flags&=-257,u.flags|=65536,u.lanes=y,m===df?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([m]):a.add(m),y_(s,m,y)),!1;case 22:return u.flags|=65536,m===df?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([m])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([m]):u.add(m)),y_(s,m,y)),!1}throw Error(r(435,u.tag))}return y_(s,m,y),zf(),!1}if(It)return a=ui.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=y,m!==fv&&(s=Error(r(422),{cause:m}),Tu(Ri(s,u)))):(m!==fv&&(a=Error(r(423),{cause:m}),Tu(Ri(a,u))),s=s.current.alternate,s.flags|=65536,y&=-y,s.lanes|=y,m=Ri(m,u),y=Gv(s.stateNode,m,y),Cv(s,y),jn!==4&&(jn=2)),!1;var x=Error(r(520),{cause:m});if(x=Ri(x,u),Ku===null?Ku=[x]:Ku.push(x),jn!==4&&(jn=2),a===null)return!0;m=Ri(m,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=y&-y,u.lanes|=s,s=Gv(u.stateNode,m,s),Cv(u,s),!1;case 1:if(a=u.type,x=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Wo===null||!Wo.has(x))))return u.flags|=65536,y&=-y,u.lanes|=y,y=qS(y),KS(y,s,u,m),Cv(u,y),!1}u=u.return}while(u!==null);return!1}var Yv=Error(r(461)),Kn=!1;function Cr(s,a,u,m){a.child=s===null?Z1(a,null,u,m):$a(a,s.child,u,m)}function GS(s,a,u,m,y){u=u.render;var x=a.ref;if("ref"in m){var T={};for(var I in m)I!=="ref"&&(T[I]=m[I])}else T=m;return Ia(a),m=Mv(s,a,u,T,x,y),I=Av(),s!==null&&!Kn?(jv(s,a,y),Zs(s,a,y)):(It&&I&&dv(a),a.flags|=1,Cr(s,a,m,y),a.child)}function YS(s,a,u,m,y){if(s===null){var x=u.type;return typeof x=="function"&&!lv(x)&&x.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=x,XS(s,a,x,m,y)):(s=sf(u.type,null,m,a,a.mode,y),s.ref=a.ref,s.return=a,a.child=s)}if(x=s.child,!r_(s,y)){var T=x.memoizedProps;if(u=u.compare,u=u!==null?u:ku,u(T,m)&&s.ref===a.ref)return Zs(s,a,y)}return a.flags|=1,s=Ws(x,m),s.ref=a.ref,s.return=a,a.child=s}function XS(s,a,u,m,y){if(s!==null){var x=s.memoizedProps;if(ku(x,m)&&s.ref===a.ref)if(Kn=!1,a.pendingProps=m=x,r_(s,y))(s.flags&131072)!==0&&(Kn=!0);else return a.lanes=s.lanes,Zs(s,a,y)}return Xv(s,a,u,m,y)}function ZS(s,a,u,m){var y=m.children,x=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|u:u,s!==null){for(m=a.child=s.child,y=0;m!==null;)y=y|m.lanes|m.childLanes,m=m.sibling;m=y&~x}else m=0,a.child=null;return QS(s,a,x,u,m)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&cf(a,x!==null?x.cachePool:null),x!==null?eS(a,x):Ev(),tS(a);else return m=a.lanes=536870912,QS(s,a,x!==null?x.baseLanes|u:u,u,m)}else x!==null?(cf(a,x.cachePool),eS(a,x),Ho(),a.memoizedState=null):(s!==null&&cf(a,null),Ev(),Ho());return Cr(s,a,y,u),a.child}function Fu(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function QS(s,a,u,m,y){var x=bv();return x=x===null?null:{parent:Wn._currentValue,pool:x},a.memoizedState={baseLanes:u,cachePool:x},s!==null&&cf(a,null),Ev(),tS(a),s!==null&&ql(s,a,m,!0),a.childLanes=y,null}function kf(s,a){return a=Rf({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function JS(s,a,u){return $a(a,s.child,null,u),s=kf(a,a.pendingProps),s.flags|=2,di(a),a.memoizedState=null,s}function P3(s,a,u){var m=a.pendingProps,y=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(It){if(m.mode==="hidden")return s=kf(a,m),a.lanes=536870912,Fu(null,s);if(Tv(a),(s=xn)?(s=dk(s,Mi),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:Do!==null?{id:gs,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},u=z1(s),u.return=a,a.child=u,wr=a,xn=null)):s=null,s===null)throw Lo(a);return a.lanes=536870912,null}return kf(a,m)}var x=s.memoizedState;if(x!==null){var T=x.dehydrated;if(Tv(a),y)if(a.flags&256)a.flags&=-257,a=JS(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(r(558));else if(Kn||ql(s,a,u,!1),y=(u&s.childLanes)!==0,Kn||y){if(m=gn,m!==null&&(T=Le(m,u),T!==0&&T!==x.retryLane))throw x.retryLane=T,Oa(s,T),ei(m,s,T),Yv;zf(),a=JS(s,a,u)}else s=x.treeContext,xn=ji(T.nextSibling),wr=a,It=!0,Oo=null,Mi=!1,s!==null&&B1(a,s),a=kf(a,m),a.flags|=4096;return a}return s=Ws(s.child,{mode:m.mode,children:m.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Ef(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(r(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function Xv(s,a,u,m,y){return Ia(a),u=Mv(s,a,u,m,void 0,y),m=Av(),s!==null&&!Kn?(jv(s,a,y),Zs(s,a,y)):(It&&m&&dv(a),a.flags|=1,Cr(s,a,u,y),a.child)}function eC(s,a,u,m,y,x){return Ia(a),a.updateQueue=null,u=rS(a,m,u,y),nS(s),m=Av(),s!==null&&!Kn?(jv(s,a,x),Zs(s,a,x)):(It&&m&&dv(a),a.flags|=1,Cr(s,a,u,x),a.child)}function tC(s,a,u,m,y){if(Ia(a),a.stateNode===null){var x=$l,T=u.contextType;typeof T=="object"&&T!==null&&(x=Sr(T)),x=new u(m,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Kv,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=m,x.state=a.memoizedState,x.refs={},wv(a),T=u.contextType,x.context=typeof T=="object"&&T!==null?Sr(T):$l,x.state=a.memoizedState,T=u.getDerivedStateFromProps,typeof T=="function"&&(qv(a,u,T,m),x.state=a.memoizedState),typeof u.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&&Kv.enqueueReplaceState(x,x.state,null),Lu(a,m,x,y),Ou(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),m=!0}else if(s===null){x=a.stateNode;var I=a.memoizedProps,Q=Va(u,I);x.props=Q;var le=x.context,ge=u.contextType;T=$l,typeof ge=="object"&&ge!==null&&(T=Sr(ge));var ye=u.getDerivedStateFromProps;ge=typeof ye=="function"||typeof x.getSnapshotBeforeUpdate=="function",I=a.pendingProps!==I,ge||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(I||le!==T)&&HS(a,x,m,T),Po=!1;var ue=a.memoizedState;x.state=ue,Lu(a,m,x,y),Ou(),le=a.memoizedState,I||ue!==le||Po?(typeof ye=="function"&&(qv(a,u,ye,m),le=a.memoizedState),(Q=Po||FS(a,u,Q,m,ue,le,T))?(ge||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"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=m,a.memoizedState=le),x.props=m,x.state=le,x.context=T,m=Q):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),m=!1)}else{x=a.stateNode,Sv(s,a),T=a.memoizedProps,ge=Va(u,T),x.props=ge,ye=a.pendingProps,ue=x.context,le=u.contextType,Q=$l,typeof le=="object"&&le!==null&&(Q=Sr(le)),I=u.getDerivedStateFromProps,(le=typeof I=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T!==ye||ue!==Q)&&HS(a,x,m,Q),Po=!1,ue=a.memoizedState,x.state=ue,Lu(a,m,x,y),Ou();var de=a.memoizedState;T!==ye||ue!==de||Po||s!==null&&s.dependencies!==null&&af(s.dependencies)?(typeof I=="function"&&(qv(a,u,I,m),de=a.memoizedState),(ge=Po||FS(a,u,ge,m,ue,de,Q)||s!==null&&s.dependencies!==null&&af(s.dependencies))?(le||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"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||T===s.memoizedProps&&ue===s.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===s.memoizedProps&&ue===s.memoizedState||(a.flags|=1024),a.memoizedProps=m,a.memoizedState=de),x.props=m,x.state=de,x.context=Q,m=ge):(typeof x.componentDidUpdate!="function"||T===s.memoizedProps&&ue===s.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===s.memoizedProps&&ue===s.memoizedState||(a.flags|=1024),m=!1)}return x=m,Ef(s,a),m=(a.flags&128)!==0,x||m?(x=a.stateNode,u=m&&typeof u.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,s!==null&&m?(a.child=$a(a,s.child,null,y),a.child=$a(a,null,u,y)):Cr(s,a,u,y),a.memoizedState=x.state,s=a.child):s=Zs(s,a,y),s}function nC(s,a,u,m){return za(),a.flags|=256,Cr(s,a,u,m),a.child}var Zv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qv(s){return{baseLanes:s,cachePool:W1()}}function Jv(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=fi),s}function rC(s,a,u){var m=a.pendingProps,y=!1,x=(a.flags&128)!==0,T;if((T=x)||(T=s!==null&&s.memoizedState===null?!1:(In.current&2)!==0),T&&(y=!0,a.flags&=-129),T=(a.flags&32)!==0,a.flags&=-33,s===null){if(It){if(y?Fo(a):Ho(),(s=xn)?(s=dk(s,Mi),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:Do!==null?{id:gs,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},u=z1(s),u.return=a,a.child=u,wr=a,xn=null)):s=null,s===null)throw Lo(a);return L_(s)?a.lanes=32:a.lanes=536870912,null}var I=m.children;return m=m.fallback,y?(Ho(),y=a.mode,I=Rf({mode:"hidden",children:I},y),m=La(m,y,u,null),I.return=a,m.return=a,I.sibling=m,a.child=I,m=a.child,m.memoizedState=Qv(u),m.childLanes=Jv(s,T,u),a.memoizedState=Zv,Fu(null,m)):(Fo(a),e_(a,I))}var Q=s.memoizedState;if(Q!==null&&(I=Q.dehydrated,I!==null)){if(x)a.flags&256?(Fo(a),a.flags&=-257,a=t_(s,a,u)):a.memoizedState!==null?(Ho(),a.child=s.child,a.flags|=128,a=null):(Ho(),I=m.fallback,y=a.mode,m=Rf({mode:"visible",children:m.children},y),I=La(I,y,u,null),I.flags|=2,m.return=a,I.return=a,m.sibling=I,a.child=m,$a(a,s.child,null,u),m=a.child,m.memoizedState=Qv(u),m.childLanes=Jv(s,T,u),a.memoizedState=Zv,a=Fu(null,m));else if(Fo(a),L_(I)){if(T=I.nextSibling&&I.nextSibling.dataset,T)var le=T.dgst;T=le,m=Error(r(419)),m.stack="",m.digest=T,Tu({value:m,source:null,stack:null}),a=t_(s,a,u)}else if(Kn||ql(s,a,u,!1),T=(u&s.childLanes)!==0,Kn||T){if(T=gn,T!==null&&(m=Le(T,u),m!==0&&m!==Q.retryLane))throw Q.retryLane=m,Oa(s,m),ei(T,s,m),Yv;O_(I)||zf(),a=t_(s,a,u)}else O_(I)?(a.flags|=192,a.child=s.child,a=null):(s=Q.treeContext,xn=ji(I.nextSibling),wr=a,It=!0,Oo=null,Mi=!1,s!==null&&B1(a,s),a=e_(a,m.children),a.flags|=4096);return a}return y?(Ho(),I=m.fallback,y=a.mode,Q=s.child,le=Q.sibling,m=Ws(Q,{mode:"hidden",children:m.children}),m.subtreeFlags=Q.subtreeFlags&65011712,le!==null?I=Ws(le,I):(I=La(I,y,u,null),I.flags|=2),I.return=a,m.return=a,m.sibling=I,a.child=m,Fu(null,m),m=a.child,I=s.child.memoizedState,I===null?I=Qv(u):(y=I.cachePool,y!==null?(Q=Wn._currentValue,y=y.parent!==Q?{parent:Q,pool:Q}:y):y=W1(),I={baseLanes:I.baseLanes|u,cachePool:y}),m.memoizedState=I,m.childLanes=Jv(s,T,u),a.memoizedState=Zv,Fu(s.child,m)):(Fo(a),u=s.child,s=u.sibling,u=Ws(u,{mode:"visible",children:m.children}),u.return=a,u.sibling=null,s!==null&&(T=a.deletions,T===null?(a.deletions=[s],a.flags|=16):T.push(s)),a.child=u,a.memoizedState=null,u)}function e_(s,a){return a=Rf({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Rf(s,a){return s=ci(22,s,null,a),s.lanes=0,s}function t_(s,a,u){return $a(a,s.child,null,u),s=e_(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function iC(s,a,u){s.lanes|=a;var m=s.alternate;m!==null&&(m.lanes|=a),gv(s.return,a,u)}function n_(s,a,u,m,y,x){var T=s.memoizedState;T===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:m,tail:u,tailMode:y,treeForkCount:x}:(T.isBackwards=a,T.rendering=null,T.renderingStartTime=0,T.last=m,T.tail=u,T.tailMode=y,T.treeForkCount=x)}function sC(s,a,u){var m=a.pendingProps,y=m.revealOrder,x=m.tail;m=m.children;var T=In.current,I=(T&2)!==0;if(I?(T=T&1|2,a.flags|=128):T&=1,A(In,T),Cr(s,a,m,u),m=It?Ru:0,!I&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&iC(s,u,a);else if(s.tag===19)iC(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(y){case"forwards":for(u=a.child,y=null;u!==null;)s=u.alternate,s!==null&&pf(s)===null&&(y=u),u=u.sibling;u=y,u===null?(y=a.child,a.child=null):(y=u.sibling,u.sibling=null),n_(a,!1,y,u,x,m);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=a.child,a.child=null;y!==null;){if(s=y.alternate,s!==null&&pf(s)===null){a.child=y;break}s=y.sibling,y.sibling=u,u=y,y=s}n_(a,!0,u,null,x,m);break;case"together":n_(a,!1,null,null,void 0,m);break;default:a.memoizedState=null}return a.child}function Zs(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),Vo|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(ql(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(r(153));if(a.child!==null){for(s=a.child,u=Ws(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=Ws(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function r_(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&af(s)))}function I3(s,a,u){switch(a.tag){case 3:ce(a,a.stateNode.containerInfo),zo(a,Wn,s.memoizedState.cache),za();break;case 27:case 5:pe(a);break;case 4:ce(a,a.stateNode.containerInfo);break;case 10:zo(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Tv(a),null;break;case 13:var m=a.memoizedState;if(m!==null)return m.dehydrated!==null?(Fo(a),a.flags|=128,null):(u&a.child.childLanes)!==0?rC(s,a,u):(Fo(a),s=Zs(s,a,u),s!==null?s.sibling:null);Fo(a);break;case 19:var y=(s.flags&128)!==0;if(m=(u&a.childLanes)!==0,m||(ql(s,a,u,!1),m=(u&a.childLanes)!==0),y){if(m)return sC(s,a,u);a.flags|=128}if(y=a.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),A(In,In.current),m)break;return null;case 22:return a.lanes=0,ZS(s,a,u,a.pendingProps);case 24:zo(a,Wn,s.memoizedState.cache)}return Zs(s,a,u)}function oC(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)Kn=!0;else{if(!r_(s,u)&&(a.flags&128)===0)return Kn=!1,I3(s,a,u);Kn=(s.flags&131072)!==0}else Kn=!1,It&&(a.flags&1048576)!==0&&I1(a,Ru,a.index);switch(a.lanes=0,a.tag){case 16:e:{var m=a.pendingProps;if(s=Fa(a.elementType),a.type=s,typeof s=="function")lv(s)?(m=Va(s,m),a.tag=1,a=tC(null,a,s,m,u)):(a.tag=0,a=Xv(null,a,s,m,u));else{if(s!=null){var y=s.$$typeof;if(y===N){a.tag=11,a=GS(null,a,s,m,u);break e}else if(y===D){a.tag=14,a=YS(null,a,s,m,u);break e}}throw a=W(s)||s,Error(r(306,a,""))}}return a;case 0:return Xv(s,a,a.type,a.pendingProps,u);case 1:return m=a.type,y=Va(m,a.pendingProps),tC(s,a,m,y,u);case 3:e:{if(ce(a,a.stateNode.containerInfo),s===null)throw Error(r(387));m=a.pendingProps;var x=a.memoizedState;y=x.element,Sv(s,a),Lu(a,m,null,u);var T=a.memoizedState;if(m=T.cache,zo(a,Wn,m),m!==x.cache&&vv(a,[Wn],u,!0),Ou(),m=T.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:T.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=nC(s,a,m,u);break e}else if(m!==y){y=Ri(Error(r(424)),a),Tu(y),a=nC(s,a,m,u);break e}else{switch(s=a.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(xn=ji(s.firstChild),wr=a,It=!0,Oo=null,Mi=!0,u=Z1(a,null,m,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(za(),m===y){a=Zs(s,a,u);break e}Cr(s,a,m,u)}a=a.child}return a;case 26:return Ef(s,a),s===null?(u=vk(a.type,null,a.pendingProps,null))?a.memoizedState=u:It||(u=a.type,s=a.pendingProps,m=Uf(ee.current).createElement(u),m[Gt]=a,m[Yt]=s,kr(m,u,s),Vn(m),a.stateNode=m):a.memoizedState=vk(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return pe(a),s===null&&It&&(m=a.stateNode=mk(a.type,a.pendingProps,ee.current),wr=a,Mi=!0,y=xn,Yo(a.type)?(z_=y,xn=ji(m.firstChild)):xn=y),Cr(s,a,a.pendingProps.children,u),Ef(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&It&&((y=m=xn)&&(m=mL(m,a.type,a.pendingProps,Mi),m!==null?(a.stateNode=m,wr=a,xn=ji(m.firstChild),Mi=!1,y=!0):y=!1),y||Lo(a)),pe(a),y=a.type,x=a.pendingProps,T=s!==null?s.memoizedProps:null,m=x.children,A_(y,x)?m=null:T!==null&&A_(y,T)&&(a.flags|=32),a.memoizedState!==null&&(y=Mv(s,a,N3,null,null,u),td._currentValue=y),Ef(s,a),Cr(s,a,m,u),a.child;case 6:return s===null&&It&&((s=u=xn)&&(u=pL(u,a.pendingProps,Mi),u!==null?(a.stateNode=u,wr=a,xn=null,s=!0):s=!1),s||Lo(a)),null;case 13:return rC(s,a,u);case 4:return ce(a,a.stateNode.containerInfo),m=a.pendingProps,s===null?a.child=$a(a,null,m,u):Cr(s,a,m,u),a.child;case 11:return GS(s,a,a.type,a.pendingProps,u);case 7:return Cr(s,a,a.pendingProps,u),a.child;case 8:return Cr(s,a,a.pendingProps.children,u),a.child;case 12:return Cr(s,a,a.pendingProps.children,u),a.child;case 10:return m=a.pendingProps,zo(a,a.type,m.value),Cr(s,a,m.children,u),a.child;case 9:return y=a.type._context,m=a.pendingProps.children,Ia(a),y=Sr(y),m=m(y),a.flags|=1,Cr(s,a,m,u),a.child;case 14:return YS(s,a,a.type,a.pendingProps,u);case 15:return XS(s,a,a.type,a.pendingProps,u);case 19:return sC(s,a,u);case 31:return P3(s,a,u);case 22:return ZS(s,a,u,a.pendingProps);case 24:return Ia(a),m=Sr(Wn),s===null?(y=bv(),y===null&&(y=gn,x=_v(),y.pooledCache=x,x.refCount++,x!==null&&(y.pooledCacheLanes|=u),y=x),a.memoizedState={parent:m,cache:y},wv(a),zo(a,Wn,y)):((s.lanes&u)!==0&&(Sv(s,a),Lu(a,null,null,u),Ou()),y=s.memoizedState,x=a.memoizedState,y.parent!==m?(y={parent:m,cache:m},a.memoizedState=y,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=y),zo(a,Wn,m)):(m=x.cache,zo(a,Wn,m),m!==y.cache&&vv(a,[Wn],u,!0))),Cr(s,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Qs(s){s.flags|=4}function i_(s,a,u,m,y){if((a=(s.mode&32)!==0)&&(a=!1),a){if(s.flags|=16777216,(y&335544128)===y)if(s.stateNode.complete)s.flags|=8192;else if(DC())s.flags|=8192;else throw Ha=df,xv}else s.flags&=-16777217}function aC(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!wk(a))if(DC())s.flags|=8192;else throw Ha=df,xv}function Tf(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?Tt():536870912,s.lanes|=a,ic|=a)}function Hu(s,a){if(!It)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var m=null;u!==null;)u.alternate!==null&&(m=u),u=u.sibling;m===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:m.sibling=null}}function wn(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,m=0;if(a)for(var y=s.child;y!==null;)u|=y.lanes|y.childLanes,m|=y.subtreeFlags&65011712,m|=y.flags&65011712,y.return=s,y=y.sibling;else for(y=s.child;y!==null;)u|=y.lanes|y.childLanes,m|=y.subtreeFlags,m|=y.flags,y.return=s,y=y.sibling;return s.subtreeFlags|=m,s.childLanes=u,a}function B3(s,a,u){var m=a.pendingProps;switch(hv(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return wn(a),null;case 1:return wn(a),null;case 3:return u=a.stateNode,m=null,s!==null&&(m=s.memoizedState.cache),a.memoizedState.cache!==m&&(a.flags|=2048),Gs(Wn),he(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(Wl(a)?Qs(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,mv())),wn(a),null;case 26:var y=a.type,x=a.memoizedState;return s===null?(Qs(a),x!==null?(wn(a),aC(a,x)):(wn(a),i_(a,y,null,m,u))):x?x!==s.memoizedState?(Qs(a),wn(a),aC(a,x)):(wn(a),a.flags&=-16777217):(s=s.memoizedProps,s!==m&&Qs(a),wn(a),i_(a,y,s,m,u)),null;case 27:if(Se(a),u=ee.current,y=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==m&&Qs(a);else{if(!m){if(a.stateNode===null)throw Error(r(166));return wn(a),null}s=ie.current,Wl(a)?F1(a):(s=mk(y,m,u),a.stateNode=s,Qs(a))}return wn(a),null;case 5:if(Se(a),y=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==m&&Qs(a);else{if(!m){if(a.stateNode===null)throw Error(r(166));return wn(a),null}if(x=ie.current,Wl(a))F1(a);else{var T=Uf(ee.current);switch(x){case 1:x=T.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:x=T.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":x=T.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":x=T.createElementNS("http://www.w3.org/1998/Math/MathML",y);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(y,{is:m.is}):T.createElement(y)}}x[Gt]=a,x[Yt]=m;e:for(T=a.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===a)break e;for(;T.sibling===null;){if(T.return===null||T.return===a)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}a.stateNode=x;e:switch(kr(x,y,m),y){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&Qs(a)}}return wn(a),i_(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==m&&Qs(a);else{if(typeof m!="string"&&a.stateNode===null)throw Error(r(166));if(s=ee.current,Wl(a)){if(s=a.stateNode,u=a.memoizedProps,m=null,y=wr,y!==null)switch(y.tag){case 27:case 5:m=y.memoizedProps}s[Gt]=a,s=!!(s.nodeValue===u||m!==null&&m.suppressHydrationWarning===!0||rk(s.nodeValue,u)),s||Lo(a,!0)}else s=Uf(s).createTextNode(m),s[Gt]=a,a.stateNode=s}return wn(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(m=Wl(a),u!==null){if(s===null){if(!m)throw Error(r(318));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[Gt]=a}else za(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;wn(a),s=!1}else u=mv(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(di(a),a):(di(a),null);if((a.flags&128)!==0)throw Error(r(558))}return wn(a),null;case 13:if(m=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(y=Wl(a),m!==null&&m.dehydrated!==null){if(s===null){if(!y)throw Error(r(318));if(y=a.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[Gt]=a}else za(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;wn(a),y=!1}else y=mv(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=y),y=!0;if(!y)return a.flags&256?(di(a),a):(di(a),null)}return di(a),(a.flags&128)!==0?(a.lanes=u,a):(u=m!==null,s=s!==null&&s.memoizedState!==null,u&&(m=a.child,y=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(y=m.alternate.memoizedState.cachePool.pool),x=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(x=m.memoizedState.cachePool.pool),x!==y&&(m.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),Tf(a,a.updateQueue),wn(a),null);case 4:return he(),s===null&&E_(a.stateNode.containerInfo),wn(a),null;case 10:return Gs(a.type),wn(a),null;case 19:if(Z(In),m=a.memoizedState,m===null)return wn(a),null;if(y=(a.flags&128)!==0,x=m.rendering,x===null)if(y)Hu(m,!1);else{if(jn!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(x=pf(s),x!==null){for(a.flags|=128,Hu(m,!1),s=x.updateQueue,a.updateQueue=s,Tf(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)L1(u,s),u=u.sibling;return A(In,In.current&1|2),It&&qs(a,m.treeForkCount),a.child}s=s.sibling}m.tail!==null&&Ce()>Df&&(a.flags|=128,y=!0,Hu(m,!1),a.lanes=4194304)}else{if(!y)if(s=pf(x),s!==null){if(a.flags|=128,y=!0,s=s.updateQueue,a.updateQueue=s,Tf(a,s),Hu(m,!0),m.tail===null&&m.tailMode==="hidden"&&!x.alternate&&!It)return wn(a),null}else 2*Ce()-m.renderingStartTime>Df&&u!==536870912&&(a.flags|=128,y=!0,Hu(m,!1),a.lanes=4194304);m.isBackwards?(x.sibling=a.child,a.child=x):(s=m.last,s!==null?s.sibling=x:a.child=x,m.last=x)}return m.tail!==null?(s=m.tail,m.rendering=s,m.tail=s.sibling,m.renderingStartTime=Ce(),s.sibling=null,u=In.current,A(In,y?u&1|2:u&1),It&&qs(a,m.treeForkCount),s):(wn(a),null);case 22:case 23:return di(a),Rv(),m=a.memoizedState!==null,s!==null?s.memoizedState!==null!==m&&(a.flags|=8192):m&&(a.flags|=8192),m?(u&536870912)!==0&&(a.flags&128)===0&&(wn(a),a.subtreeFlags&6&&(a.flags|=8192)):wn(a),u=a.updateQueue,u!==null&&Tf(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),m=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(m=a.memoizedState.cachePool.pool),m!==u&&(a.flags|=2048),s!==null&&Z(Ba),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Gs(Wn),wn(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function F3(s,a){switch(hv(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Gs(Wn),he(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Se(a),null;case 31:if(a.memoizedState!==null){if(di(a),a.alternate===null)throw Error(r(340));za()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(di(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(r(340));za()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return Z(In),null;case 4:return he(),null;case 10:return Gs(a.type),null;case 22:case 23:return di(a),Rv(),s!==null&&Z(Ba),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Gs(Wn),null;case 25:return null;default:return null}}function lC(s,a){switch(hv(a),a.tag){case 3:Gs(Wn),he();break;case 26:case 27:case 5:Se(a);break;case 4:he();break;case 31:a.memoizedState!==null&&di(a);break;case 13:di(a);break;case 19:Z(In);break;case 10:Gs(a.type);break;case 22:case 23:di(a),Rv(),s!==null&&Z(Ba);break;case 24:Gs(Wn)}}function $u(s,a){try{var u=a.updateQueue,m=u!==null?u.lastEffect:null;if(m!==null){var y=m.next;u=y;do{if((u.tag&s)===s){m=void 0;var x=u.create,T=u.inst;m=x(),T.destroy=m}u=u.next}while(u!==y)}}catch(I){rn(a,a.return,I)}}function $o(s,a,u){try{var m=a.updateQueue,y=m!==null?m.lastEffect:null;if(y!==null){var x=y.next;m=x;do{if((m.tag&s)===s){var T=m.inst,I=T.destroy;if(I!==void 0){T.destroy=void 0,y=a;var Q=u,le=I;try{le()}catch(ge){rn(y,Q,ge)}}}m=m.next}while(m!==x)}}catch(ge){rn(a,a.return,ge)}}function cC(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{J1(a,u)}catch(m){rn(s,s.return,m)}}}function uC(s,a,u){u.props=Va(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(m){rn(s,a,m)}}function Uu(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var m=s.stateNode;break;case 30:m=s.stateNode;break;default:m=s.stateNode}typeof u=="function"?s.refCleanup=u(m):u.current=m}}catch(y){rn(s,a,y)}}function _s(s,a){var u=s.ref,m=s.refCleanup;if(u!==null)if(typeof m=="function")try{m()}catch(y){rn(s,a,y)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(y){rn(s,a,y)}else u.current=null}function dC(s){var a=s.type,u=s.memoizedProps,m=s.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":u.autoFocus&&m.focus();break e;case"img":u.src?m.src=u.src:u.srcSet&&(m.srcset=u.srcSet)}}catch(y){rn(s,s.return,y)}}function s_(s,a,u){try{var m=s.stateNode;lL(m,s.type,u,a),m[Yt]=a}catch(y){rn(s,s.return,y)}}function hC(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Yo(s.type)||s.tag===4}function o_(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||hC(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Yo(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function a_(s,a,u){var m=s.tag;if(m===5||m===6)s=s.stateNode,a?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(s,a):(a=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,a.appendChild(s),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=Us));else if(m!==4&&(m===27&&Yo(s.type)&&(u=s.stateNode,a=null),s=s.child,s!==null))for(a_(s,a,u),s=s.sibling;s!==null;)a_(s,a,u),s=s.sibling}function Nf(s,a,u){var m=s.tag;if(m===5||m===6)s=s.stateNode,a?u.insertBefore(s,a):u.appendChild(s);else if(m!==4&&(m===27&&Yo(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Nf(s,a,u),s=s.sibling;s!==null;)Nf(s,a,u),s=s.sibling}function fC(s){var a=s.stateNode,u=s.memoizedProps;try{for(var m=s.type,y=a.attributes;y.length;)a.removeAttributeNode(y[0]);kr(a,m,u),a[Gt]=s,a[Yt]=u}catch(x){rn(s,s.return,x)}}var Js=!1,Gn=!1,l_=!1,mC=typeof WeakSet=="function"?WeakSet:Set,lr=null;function H3(s,a){if(s=s.containerInfo,N_=Xf,s=E1(s),tv(s)){if("selectionStart"in s)var u={start:s.selectionStart,end:s.selectionEnd};else e:{u=(u=s.ownerDocument)&&u.defaultView||window;var m=u.getSelection&&u.getSelection();if(m&&m.rangeCount!==0){u=m.anchorNode;var y=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{u.nodeType,x.nodeType}catch{u=null;break e}var T=0,I=-1,Q=-1,le=0,ge=0,ye=s,ue=null;t:for(;;){for(var de;ye!==u||y!==0&&ye.nodeType!==3||(I=T+y),ye!==x||m!==0&&ye.nodeType!==3||(Q=T+m),ye.nodeType===3&&(T+=ye.nodeValue.length),(de=ye.firstChild)!==null;)ue=ye,ye=de;for(;;){if(ye===s)break t;if(ue===u&&++le===y&&(I=T),ue===x&&++ge===m&&(Q=T),(de=ye.nextSibling)!==null)break;ye=ue,ue=ye.parentNode}ye=de}u=I===-1||Q===-1?null:{start:I,end:Q}}else u=null}u=u||{start:0,end:0}}else u=null;for(M_={focusedElem:s,selectionRange:u},Xf=!1,lr=a;lr!==null;)if(a=lr,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,lr=s;else for(;lr!==null;){switch(a=lr,x=a.alternate,s=a.flags,a.tag){case 0:if((s&4)!==0&&(s=a.updateQueue,s=s!==null?s.events:null,s!==null))for(u=0;u<s.length;u++)y=s[u],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&x!==null){s=void 0,u=a,y=x.memoizedProps,x=x.memoizedState,m=u.stateNode;try{var Ue=Va(u.type,y);s=m.getSnapshotBeforeUpdate(Ue,x),m.__reactInternalSnapshotBeforeUpdate=s}catch(st){rn(u,u.return,st)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,u=s.nodeType,u===9)D_(s);else if(u===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":D_(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=a.sibling,s!==null){s.return=a.return,lr=s;break}lr=a.return}}function pC(s,a,u){var m=u.flags;switch(u.tag){case 0:case 11:case 15:to(s,u),m&4&&$u(5,u);break;case 1:if(to(s,u),m&4)if(s=u.stateNode,a===null)try{s.componentDidMount()}catch(T){rn(u,u.return,T)}else{var y=Va(u.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(y,a,s.__reactInternalSnapshotBeforeUpdate)}catch(T){rn(u,u.return,T)}}m&64&&cC(u),m&512&&Uu(u,u.return);break;case 3:if(to(s,u),m&64&&(s=u.updateQueue,s!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=u.child.stateNode;break;case 1:a=u.child.stateNode}try{J1(s,a)}catch(T){rn(u,u.return,T)}}break;case 27:a===null&&m&4&&fC(u);case 26:case 5:to(s,u),a===null&&m&4&&dC(u),m&512&&Uu(u,u.return);break;case 12:to(s,u);break;case 31:to(s,u),m&4&&_C(s,u);break;case 13:to(s,u),m&4&&yC(s,u),m&64&&(s=u.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(u=X3.bind(null,u),gL(s,u))));break;case 22:if(m=u.memoizedState!==null||Js,!m){a=a!==null&&a.memoizedState!==null||Gn,y=Js;var x=Gn;Js=m,(Gn=a)&&!x?no(s,u,(u.subtreeFlags&8772)!==0):to(s,u),Js=y,Gn=x}break;case 30:break;default:to(s,u)}}function gC(s){var a=s.alternate;a!==null&&(s.alternate=null,gC(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&ms(a)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var En=null,Xr=!1;function eo(s,a,u){for(u=u.child;u!==null;)vC(s,a,u),u=u.sibling}function vC(s,a,u){if(qe&&typeof qe.onCommitFiberUnmount=="function")try{qe.onCommitFiberUnmount(Oe,u)}catch{}switch(u.tag){case 26:Gn||_s(u,a),eo(s,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:Gn||_s(u,a);var m=En,y=Xr;Yo(u.type)&&(En=u.stateNode,Xr=!1),eo(s,a,u),Qu(u.stateNode),En=m,Xr=y;break;case 5:Gn||_s(u,a);case 6:if(m=En,y=Xr,En=null,eo(s,a,u),En=m,Xr=y,En!==null)if(Xr)try{(En.nodeType===9?En.body:En.nodeName==="HTML"?En.ownerDocument.body:En).removeChild(u.stateNode)}catch(x){rn(u,a,x)}else try{En.removeChild(u.stateNode)}catch(x){rn(u,a,x)}break;case 18:En!==null&&(Xr?(s=En,ck(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,u.stateNode),hc(s)):ck(En,u.stateNode));break;case 4:m=En,y=Xr,En=u.stateNode.containerInfo,Xr=!0,eo(s,a,u),En=m,Xr=y;break;case 0:case 11:case 14:case 15:$o(2,u,a),Gn||$o(4,u,a),eo(s,a,u);break;case 1:Gn||(_s(u,a),m=u.stateNode,typeof m.componentWillUnmount=="function"&&uC(u,a,m)),eo(s,a,u);break;case 21:eo(s,a,u);break;case 22:Gn=(m=Gn)||u.memoizedState!==null,eo(s,a,u),Gn=m;break;default:eo(s,a,u)}}function _C(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{hc(s)}catch(u){rn(a,a.return,u)}}}function yC(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{hc(s)}catch(u){rn(a,a.return,u)}}function $3(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new mC),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new mC),a;default:throw Error(r(435,s.tag))}}function Mf(s,a){var u=$3(s);a.forEach(function(m){if(!u.has(m)){u.add(m);var y=Z3.bind(null,s,m);m.then(y,y)}})}function Zr(s,a){var u=a.deletions;if(u!==null)for(var m=0;m<u.length;m++){var y=u[m],x=s,T=a,I=T;e:for(;I!==null;){switch(I.tag){case 27:if(Yo(I.type)){En=I.stateNode,Xr=!1;break e}break;case 5:En=I.stateNode,Xr=!1;break e;case 3:case 4:En=I.stateNode.containerInfo,Xr=!0;break e}I=I.return}if(En===null)throw Error(r(160));vC(x,T,y),En=null,Xr=!1,x=y.alternate,x!==null&&(x.return=null),y.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)bC(a,s),a=a.sibling}var es=null;function bC(s,a){var u=s.alternate,m=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Zr(a,s),Qr(s),m&4&&($o(3,s,s.return),$u(3,s),$o(5,s,s.return));break;case 1:Zr(a,s),Qr(s),m&512&&(Gn||u===null||_s(u,u.return)),m&64&&Js&&(s=s.updateQueue,s!==null&&(m=s.callbacks,m!==null&&(u=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=u===null?m:u.concat(m))));break;case 26:var y=es;if(Zr(a,s),Qr(s),m&512&&(Gn||u===null||_s(u,u.return)),m&4){var x=u!==null?u.memoizedState:null;if(m=s.memoizedState,u===null)if(m===null)if(s.stateNode===null){e:{m=s.type,u=s.memoizedProps,y=y.ownerDocument||y;t:switch(m){case"title":x=y.getElementsByTagName("title")[0],(!x||x[Un]||x[Gt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=y.createElement(m),y.head.insertBefore(x,y.querySelector("head > title"))),kr(x,m,u),x[Gt]=s,Vn(x),m=x;break e;case"link":var T=bk("link","href",y).get(m+(u.href||""));if(T){for(var I=0;I<T.length;I++)if(x=T[I],x.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&x.getAttribute("rel")===(u.rel==null?null:u.rel)&&x.getAttribute("title")===(u.title==null?null:u.title)&&x.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){T.splice(I,1);break t}}x=y.createElement(m),kr(x,m,u),y.head.appendChild(x);break;case"meta":if(T=bk("meta","content",y).get(m+(u.content||""))){for(I=0;I<T.length;I++)if(x=T[I],x.getAttribute("content")===(u.content==null?null:""+u.content)&&x.getAttribute("name")===(u.name==null?null:u.name)&&x.getAttribute("property")===(u.property==null?null:u.property)&&x.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&x.getAttribute("charset")===(u.charSet==null?null:u.charSet)){T.splice(I,1);break t}}x=y.createElement(m),kr(x,m,u),y.head.appendChild(x);break;default:throw Error(r(468,m))}x[Gt]=s,Vn(x),m=x}s.stateNode=m}else xk(y,s.type,s.stateNode);else s.stateNode=yk(y,m,s.memoizedProps);else x!==m?(x===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):x.count--,m===null?xk(y,s.type,s.stateNode):yk(y,m,s.memoizedProps)):m===null&&s.stateNode!==null&&s_(s,s.memoizedProps,u.memoizedProps)}break;case 27:Zr(a,s),Qr(s),m&512&&(Gn||u===null||_s(u,u.return)),u!==null&&m&4&&s_(s,s.memoizedProps,u.memoizedProps);break;case 5:if(Zr(a,s),Qr(s),m&512&&(Gn||u===null||_s(u,u.return)),s.flags&32){y=s.stateNode;try{Gr(y,"")}catch(Ue){rn(s,s.return,Ue)}}m&4&&s.stateNode!=null&&(y=s.memoizedProps,s_(s,y,u!==null?u.memoizedProps:y)),m&1024&&(l_=!0);break;case 6:if(Zr(a,s),Qr(s),m&4){if(s.stateNode===null)throw Error(r(162));m=s.memoizedProps,u=s.stateNode;try{u.nodeValue=m}catch(Ue){rn(s,s.return,Ue)}}break;case 3:if(qf=null,y=es,es=Vf(a.containerInfo),Zr(a,s),es=y,Qr(s),m&4&&u!==null&&u.memoizedState.isDehydrated)try{hc(a.containerInfo)}catch(Ue){rn(s,s.return,Ue)}l_&&(l_=!1,xC(s));break;case 4:m=es,es=Vf(s.stateNode.containerInfo),Zr(a,s),Qr(s),es=m;break;case 12:Zr(a,s),Qr(s);break;case 31:Zr(a,s),Qr(s),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,Mf(s,m)));break;case 13:Zr(a,s),Qr(s),s.child.flags&8192&&s.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(jf=Ce()),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,Mf(s,m)));break;case 22:y=s.memoizedState!==null;var Q=u!==null&&u.memoizedState!==null,le=Js,ge=Gn;if(Js=le||y,Gn=ge||Q,Zr(a,s),Gn=ge,Js=le,Qr(s),m&8192)e:for(a=s.stateNode,a._visibility=y?a._visibility&-2:a._visibility|1,y&&(u===null||Q||Js||Gn||Wa(s)),u=null,a=s;;){if(a.tag===5||a.tag===26){if(u===null){Q=u=a;try{if(x=Q.stateNode,y)T=x.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none";else{I=Q.stateNode;var ye=Q.memoizedProps.style,ue=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;I.style.display=ue==null||typeof ue=="boolean"?"":(""+ue).trim()}}catch(Ue){rn(Q,Q.return,Ue)}}}else if(a.tag===6){if(u===null){Q=a;try{Q.stateNode.nodeValue=y?"":Q.memoizedProps}catch(Ue){rn(Q,Q.return,Ue)}}}else if(a.tag===18){if(u===null){Q=a;try{var de=Q.stateNode;y?uk(de,!0):uk(Q.stateNode,!1)}catch(Ue){rn(Q,Q.return,Ue)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===s)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break e;for(;a.sibling===null;){if(a.return===null||a.return===s)break e;u===a&&(u=null),a=a.return}u===a&&(u=null),a.sibling.return=a.return,a=a.sibling}m&4&&(m=s.updateQueue,m!==null&&(u=m.retryQueue,u!==null&&(m.retryQueue=null,Mf(s,u))));break;case 19:Zr(a,s),Qr(s),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,Mf(s,m)));break;case 30:break;case 21:break;default:Zr(a,s),Qr(s)}}function Qr(s){var a=s.flags;if(a&2){try{for(var u,m=s.return;m!==null;){if(hC(m)){u=m;break}m=m.return}if(u==null)throw Error(r(160));switch(u.tag){case 27:var y=u.stateNode,x=o_(s);Nf(s,x,y);break;case 5:var T=u.stateNode;u.flags&32&&(Gr(T,""),u.flags&=-33);var I=o_(s);Nf(s,I,T);break;case 3:case 4:var Q=u.stateNode.containerInfo,le=o_(s);a_(s,le,Q);break;default:throw Error(r(161))}}catch(ge){rn(s,s.return,ge)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function xC(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;xC(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function to(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)pC(s,a.alternate,a),a=a.sibling}function Wa(s){for(s=s.child;s!==null;){var a=s;switch(a.tag){case 0:case 11:case 14:case 15:$o(4,a,a.return),Wa(a);break;case 1:_s(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&uC(a,a.return,u),Wa(a);break;case 27:Qu(a.stateNode);case 26:case 5:_s(a,a.return),Wa(a);break;case 22:a.memoizedState===null&&Wa(a);break;case 30:Wa(a);break;default:Wa(a)}s=s.sibling}}function no(s,a,u){for(u=u&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var m=a.alternate,y=s,x=a,T=x.flags;switch(x.tag){case 0:case 11:case 15:no(y,x,u),$u(4,x);break;case 1:if(no(y,x,u),m=x,y=m.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(le){rn(m,m.return,le)}if(m=x,y=m.updateQueue,y!==null){var I=m.stateNode;try{var Q=y.shared.hiddenCallbacks;if(Q!==null)for(y.shared.hiddenCallbacks=null,y=0;y<Q.length;y++)Q1(Q[y],I)}catch(le){rn(m,m.return,le)}}u&&T&64&&cC(x),Uu(x,x.return);break;case 27:fC(x);case 26:case 5:no(y,x,u),u&&m===null&&T&4&&dC(x),Uu(x,x.return);break;case 12:no(y,x,u);break;case 31:no(y,x,u),u&&T&4&&_C(y,x);break;case 13:no(y,x,u),u&&T&4&&yC(y,x);break;case 22:x.memoizedState===null&&no(y,x,u),Uu(x,x.return);break;case 30:break;default:no(y,x,u)}a=a.sibling}}function c_(s,a){var u=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==u&&(s!=null&&s.refCount++,u!=null&&Nu(u))}function u_(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Nu(s))}function ts(s,a,u,m){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)wC(s,a,u,m),a=a.sibling}function wC(s,a,u,m){var y=a.flags;switch(a.tag){case 0:case 11:case 15:ts(s,a,u,m),y&2048&&$u(9,a);break;case 1:ts(s,a,u,m);break;case 3:ts(s,a,u,m),y&2048&&(s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Nu(s)));break;case 12:if(y&2048){ts(s,a,u,m),s=a.stateNode;try{var x=a.memoizedProps,T=x.id,I=x.onPostCommit;typeof I=="function"&&I(T,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(Q){rn(a,a.return,Q)}}else ts(s,a,u,m);break;case 31:ts(s,a,u,m);break;case 13:ts(s,a,u,m);break;case 23:break;case 22:x=a.stateNode,T=a.alternate,a.memoizedState!==null?x._visibility&2?ts(s,a,u,m):Vu(s,a):x._visibility&2?ts(s,a,u,m):(x._visibility|=2,tc(s,a,u,m,(a.subtreeFlags&10256)!==0||!1)),y&2048&&c_(T,a);break;case 24:ts(s,a,u,m),y&2048&&u_(a.alternate,a);break;default:ts(s,a,u,m)}}function tc(s,a,u,m,y){for(y=y&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=s,T=a,I=u,Q=m,le=T.flags;switch(T.tag){case 0:case 11:case 15:tc(x,T,I,Q,y),$u(8,T);break;case 23:break;case 22:var ge=T.stateNode;T.memoizedState!==null?ge._visibility&2?tc(x,T,I,Q,y):Vu(x,T):(ge._visibility|=2,tc(x,T,I,Q,y)),y&&le&2048&&c_(T.alternate,T);break;case 24:tc(x,T,I,Q,y),y&&le&2048&&u_(T.alternate,T);break;default:tc(x,T,I,Q,y)}a=a.sibling}}function Vu(s,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var u=s,m=a,y=m.flags;switch(m.tag){case 22:Vu(u,m),y&2048&&c_(m.alternate,m);break;case 24:Vu(u,m),y&2048&&u_(m.alternate,m);break;default:Vu(u,m)}a=a.sibling}}var Wu=8192;function nc(s,a,u){if(s.subtreeFlags&Wu)for(s=s.child;s!==null;)SC(s,a,u),s=s.sibling}function SC(s,a,u){switch(s.tag){case 26:nc(s,a,u),s.flags&Wu&&s.memoizedState!==null&&TL(u,es,s.memoizedState,s.memoizedProps);break;case 5:nc(s,a,u);break;case 3:case 4:var m=es;es=Vf(s.stateNode.containerInfo),nc(s,a,u),es=m;break;case 22:s.memoizedState===null&&(m=s.alternate,m!==null&&m.memoizedState!==null?(m=Wu,Wu=16777216,nc(s,a,u),Wu=m):nc(s,a,u));break;default:nc(s,a,u)}}function CC(s){var a=s.alternate;if(a!==null&&(s=a.child,s!==null)){a.child=null;do a=s.sibling,s.sibling=null,s=a;while(s!==null)}}function qu(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var m=a[u];lr=m,EC(m,s)}CC(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)kC(s),s=s.sibling}function kC(s){switch(s.tag){case 0:case 11:case 15:qu(s),s.flags&2048&&$o(9,s,s.return);break;case 3:qu(s);break;case 12:qu(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,Af(s)):qu(s);break;default:qu(s)}}function Af(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var m=a[u];lr=m,EC(m,s)}CC(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:$o(8,a,a.return),Af(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,Af(a));break;default:Af(a)}s=s.sibling}}function EC(s,a){for(;lr!==null;){var u=lr;switch(u.tag){case 0:case 11:case 15:$o(8,u,a);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var m=u.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:Nu(u.memoizedState.cache)}if(m=u.child,m!==null)m.return=u,lr=m;else e:for(u=s;lr!==null;){m=lr;var y=m.sibling,x=m.return;if(gC(m),m===u){lr=null;break e}if(y!==null){y.return=x,lr=y;break e}lr=x}}}var U3={getCacheForType:function(s){var a=Sr(Wn),u=a.data.get(s);return u===void 0&&(u=s(),a.data.set(s,u)),u},cacheSignal:function(){return Sr(Wn).controller.signal}},V3=typeof WeakMap=="function"?WeakMap:Map,Xt=0,gn=null,jt=null,zt=0,nn=0,hi=null,Uo=!1,rc=!1,d_=!1,ro=0,jn=0,Vo=0,qa=0,h_=0,fi=0,ic=0,Ku=null,Jr=null,f_=!1,jf=0,RC=0,Df=1/0,Of=null,Wo=null,er=0,qo=null,sc=null,io=0,m_=0,p_=null,TC=null,Gu=0,g_=null;function mi(){return(Xt&2)!==0&&zt!==0?zt&-zt:O.T!==null?w_():pn()}function NC(){if(fi===0)if((zt&536870912)===0||It){var s=$n;$n<<=1,($n&3932160)===0&&($n=262144),fi=s}else fi=536870912;return s=ui.current,s!==null&&(s.flags|=32),fi}function ei(s,a,u){(s===gn&&(nn===2||nn===9)||s.cancelPendingCommit!==null)&&(oc(s,0),Ko(s,zt,fi,!1)),_t(s,u),((Xt&2)===0||s!==gn)&&(s===gn&&((Xt&2)===0&&(qa|=u),jn===4&&Ko(s,zt,fi,!1)),ys(s))}function MC(s,a,u){if((Xt&6)!==0)throw Error(r(327));var m=!u&&(a&127)===0&&(a&s.expiredLanes)===0||vt(s,a),y=m?K3(s,a):__(s,a,!0),x=m;do{if(y===0){rc&&!m&&Ko(s,a,0,!1);break}else{if(u=s.current.alternate,x&&!W3(u)){y=__(s,a,!1),x=!1;continue}if(y===2){if(x=a,s.errorRecoveryDisabledLanes&x)var T=0;else T=s.pendingLanes&-536870913,T=T!==0?T:T&536870912?536870912:0;if(T!==0){a=T;e:{var I=s;y=Ku;var Q=I.current.memoizedState.isDehydrated;if(Q&&(oc(I,T).flags|=256),T=__(I,T,!1),T!==2){if(d_&&!Q){I.errorRecoveryDisabledLanes|=x,qa|=x,y=4;break e}x=Jr,Jr=y,x!==null&&(Jr===null?Jr=x:Jr.push.apply(Jr,x))}y=T}if(x=!1,y!==2)continue}}if(y===1){oc(s,0),Ko(s,a,0,!0);break}e:{switch(m=s,x=y,x){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Ko(m,a,fi,!Uo);break e;case 2:Jr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(y=jf+300-Ce(),10<y)){if(Ko(m,a,fi,!Uo),Be(m,0,!0)!==0)break e;io=a,m.timeoutHandle=ak(AC.bind(null,m,u,Jr,Of,f_,a,fi,qa,ic,Uo,x,"Throttled",-0,0),y);break e}AC(m,u,Jr,Of,f_,a,fi,qa,ic,Uo,x,null,-0,0)}}break}while(!0);ys(s)}function AC(s,a,u,m,y,x,T,I,Q,le,ge,ye,ue,de){if(s.timeoutHandle=-1,ye=a.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Us},SC(a,x,ye);var Ue=(x&62914560)===x?jf-Ce():(x&4194048)===x?RC-Ce():0;if(Ue=NL(ye,Ue),Ue!==null){io=x,s.cancelPendingCommit=Ue(BC.bind(null,s,a,x,u,m,y,T,I,Q,ge,ye,null,ue,de)),Ko(s,x,T,!le);return}}BC(s,a,x,u,m,y,T,I,Q)}function W3(s){for(var a=s;;){var u=a.tag;if((u===0||u===11||u===15)&&a.flags&16384&&(u=a.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var m=0;m<u.length;m++){var y=u[m],x=y.getSnapshot;y=y.value;try{if(!li(x(),y))return!1}catch{return!1}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Ko(s,a,u,m){a&=~h_,a&=~qa,s.suspendedLanes|=a,s.pingedLanes&=~a,m&&(s.warmLanes|=a),m=s.expirationTimes;for(var y=a;0<y;){var x=31-Ve(y),T=1<<x;m[x]=-1,y&=~T}u!==0&&Cn(s,u,a)}function Lf(){return(Xt&6)===0?(Yu(0),!1):!0}function v_(){if(jt!==null){if(nn===0)var s=jt.return;else s=jt,Ks=Pa=null,Dv(s),Xl=null,Au=0,s=jt;for(;s!==null;)lC(s.alternate,s),s=s.return;jt=null}}function oc(s,a){var u=s.timeoutHandle;u!==-1&&(s.timeoutHandle=-1,dL(u)),u=s.cancelPendingCommit,u!==null&&(s.cancelPendingCommit=null,u()),io=0,v_(),gn=s,jt=u=Ws(s.current,null),zt=a,nn=0,hi=null,Uo=!1,rc=vt(s,a),d_=!1,ic=fi=h_=qa=Vo=jn=0,Jr=Ku=null,f_=!1,(a&8)!==0&&(a|=a&32);var m=s.entangledLanes;if(m!==0)for(s=s.entanglements,m&=a;0<m;){var y=31-Ve(m),x=1<<y;a|=s[y],m&=~x}return ro=a,tf(),u}function jC(s,a){pt=null,O.H=Bu,a===Yl||a===uf?(a=G1(),nn=3):a===xv?(a=G1(),nn=4):nn=a===Yv?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,hi=a,jt===null&&(jn=1,Cf(s,Ri(a,s.current)))}function DC(){var s=ui.current;return s===null?!0:(zt&4194048)===zt?Ai===null:(zt&62914560)===zt||(zt&536870912)!==0?s===Ai:!1}function OC(){var s=O.H;return O.H=Bu,s===null?Bu:s}function LC(){var s=O.A;return O.A=U3,s}function zf(){jn=4,Uo||(zt&4194048)!==zt&&ui.current!==null||(rc=!0),(Vo&134217727)===0&&(qa&134217727)===0||gn===null||Ko(gn,zt,fi,!1)}function __(s,a,u){var m=Xt;Xt|=2;var y=OC(),x=LC();(gn!==s||zt!==a)&&(Of=null,oc(s,a)),a=!1;var T=jn;e:do try{if(nn!==0&&jt!==null){var I=jt,Q=hi;switch(nn){case 8:v_(),T=6;break e;case 3:case 2:case 9:case 6:ui.current===null&&(a=!0);var le=nn;if(nn=0,hi=null,ac(s,I,Q,le),u&&rc){T=0;break e}break;default:le=nn,nn=0,hi=null,ac(s,I,Q,le)}}q3(),T=jn;break}catch(ge){jC(s,ge)}while(!0);return a&&s.shellSuspendCounter++,Ks=Pa=null,Xt=m,O.H=y,O.A=x,jt===null&&(gn=null,zt=0,tf()),T}function q3(){for(;jt!==null;)zC(jt)}function K3(s,a){var u=Xt;Xt|=2;var m=OC(),y=LC();gn!==s||zt!==a?(Of=null,Df=Ce()+500,oc(s,a)):rc=vt(s,a);e:do try{if(nn!==0&&jt!==null){a=jt;var x=hi;t:switch(nn){case 1:nn=0,hi=null,ac(s,a,x,1);break;case 2:case 9:if(q1(x)){nn=0,hi=null,PC(a);break}a=function(){nn!==2&&nn!==9||gn!==s||(nn=7),ys(s)},x.then(a,a);break e;case 3:nn=7;break e;case 4:nn=5;break e;case 7:q1(x)?(nn=0,hi=null,PC(a)):(nn=0,hi=null,ac(s,a,x,7));break;case 5:var T=null;switch(jt.tag){case 26:T=jt.memoizedState;case 5:case 27:var I=jt;if(T?wk(T):I.stateNode.complete){nn=0,hi=null;var Q=I.sibling;if(Q!==null)jt=Q;else{var le=I.return;le!==null?(jt=le,Pf(le)):jt=null}break t}}nn=0,hi=null,ac(s,a,x,5);break;case 6:nn=0,hi=null,ac(s,a,x,6);break;case 8:v_(),jn=6;break e;default:throw Error(r(462))}}G3();break}catch(ge){jC(s,ge)}while(!0);return Ks=Pa=null,O.H=m,O.A=y,Xt=u,jt!==null?0:(gn=null,zt=0,tf(),jn)}function G3(){for(;jt!==null&&!ot();)zC(jt)}function zC(s){var a=oC(s.alternate,s,ro);s.memoizedProps=s.pendingProps,a===null?Pf(s):jt=a}function PC(s){var a=s,u=a.alternate;switch(a.tag){case 15:case 0:a=eC(u,a,a.pendingProps,a.type,void 0,zt);break;case 11:a=eC(u,a,a.pendingProps,a.type.render,a.ref,zt);break;case 5:Dv(a);default:lC(u,a),a=jt=L1(a,ro),a=oC(u,a,ro)}s.memoizedProps=s.pendingProps,a===null?Pf(s):jt=a}function ac(s,a,u,m){Ks=Pa=null,Dv(a),Xl=null,Au=0;var y=a.return;try{if(z3(s,y,a,u,zt)){jn=1,Cf(s,Ri(u,s.current)),jt=null;return}}catch(x){if(y!==null)throw jt=y,x;jn=1,Cf(s,Ri(u,s.current)),jt=null;return}a.flags&32768?(It||m===1?s=!0:rc||(zt&536870912)!==0?s=!1:(Uo=s=!0,(m===2||m===9||m===3||m===6)&&(m=ui.current,m!==null&&m.tag===13&&(m.flags|=16384))),IC(a,s)):Pf(a)}function Pf(s){var a=s;do{if((a.flags&32768)!==0){IC(a,Uo);return}s=a.return;var u=B3(a.alternate,a,ro);if(u!==null){jt=u;return}if(a=a.sibling,a!==null){jt=a;return}jt=a=s}while(a!==null);jn===0&&(jn=5)}function IC(s,a){do{var u=F3(s.alternate,s);if(u!==null){u.flags&=32767,jt=u;return}if(u=s.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(s=s.sibling,s!==null)){jt=s;return}jt=s=u}while(s!==null);jn=6,jt=null}function BC(s,a,u,m,y,x,T,I,Q){s.cancelPendingCommit=null;do If();while(er!==0);if((Xt&6)!==0)throw Error(r(327));if(a!==null){if(a===s.current)throw Error(r(177));if(x=a.lanes|a.childLanes,x|=ov,yt(s,u,x,T,I,Q),s===gn&&(jt=gn=null,zt=0),sc=a,qo=s,io=u,m_=x,p_=y,TC=m,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,Q3(Ne,function(){return VC(),null})):(s.callbackNode=null,s.callbackPriority=0),m=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||m){m=O.T,O.T=null,y=$.p,$.p=2,T=Xt,Xt|=4;try{H3(s,a,u)}finally{Xt=T,$.p=y,O.T=m}}er=1,FC(),HC(),$C()}}function FC(){if(er===1){er=0;var s=qo,a=sc,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=O.T,O.T=null;var m=$.p;$.p=2;var y=Xt;Xt|=4;try{bC(a,s);var x=M_,T=E1(s.containerInfo),I=x.focusedElem,Q=x.selectionRange;if(T!==I&&I&&I.ownerDocument&&k1(I.ownerDocument.documentElement,I)){if(Q!==null&&tv(I)){var le=Q.start,ge=Q.end;if(ge===void 0&&(ge=le),"selectionStart"in I)I.selectionStart=le,I.selectionEnd=Math.min(ge,I.value.length);else{var ye=I.ownerDocument||document,ue=ye&&ye.defaultView||window;if(ue.getSelection){var de=ue.getSelection(),Ue=I.textContent.length,st=Math.min(Q.start,Ue),cn=Q.end===void 0?st:Math.min(Q.end,Ue);!de.extend&&st>cn&&(T=cn,cn=st,st=T);var se=C1(I,st),te=C1(I,cn);if(se&&te&&(de.rangeCount!==1||de.anchorNode!==se.node||de.anchorOffset!==se.offset||de.focusNode!==te.node||de.focusOffset!==te.offset)){var ae=ye.createRange();ae.setStart(se.node,se.offset),de.removeAllRanges(),st>cn?(de.addRange(ae),de.extend(te.node,te.offset)):(ae.setEnd(te.node,te.offset),de.addRange(ae))}}}}for(ye=[],de=I;de=de.parentNode;)de.nodeType===1&&ye.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;I<ye.length;I++){var _e=ye[I];_e.element.scrollLeft=_e.left,_e.element.scrollTop=_e.top}}Xf=!!N_,M_=N_=null}finally{Xt=y,$.p=m,O.T=u}}s.current=a,er=2}}function HC(){if(er===2){er=0;var s=qo,a=sc,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=O.T,O.T=null;var m=$.p;$.p=2;var y=Xt;Xt|=4;try{pC(s,a.alternate,a)}finally{Xt=y,$.p=m,O.T=u}}er=3}}function $C(){if(er===4||er===3){er=0,fn();var s=qo,a=sc,u=io,m=TC;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?er=5:(er=0,sc=qo=null,UC(s,s.pendingLanes));var y=s.pendingLanes;if(y===0&&(Wo=null),ut(u),a=a.stateNode,qe&&typeof qe.onCommitFiberRoot=="function")try{qe.onCommitFiberRoot(Oe,a,void 0,(a.current.flags&128)===128)}catch{}if(m!==null){a=O.T,y=$.p,$.p=2,O.T=null;try{for(var x=s.onRecoverableError,T=0;T<m.length;T++){var I=m[T];x(I.value,{componentStack:I.stack})}}finally{O.T=a,$.p=y}}(io&3)!==0&&If(),ys(s),y=s.pendingLanes,(u&261930)!==0&&(y&42)!==0?s===g_?Gu++:(Gu=0,g_=s):Gu=0,Yu(0)}}function UC(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,Nu(a)))}function If(){return FC(),HC(),$C(),VC()}function VC(){if(er!==5)return!1;var s=qo,a=m_;m_=0;var u=ut(io),m=O.T,y=$.p;try{$.p=32>u?32:u,O.T=null,u=p_,p_=null;var x=qo,T=io;if(er=0,sc=qo=null,io=0,(Xt&6)!==0)throw Error(r(331));var I=Xt;if(Xt|=4,kC(x.current),wC(x,x.current,T,u),Xt=I,Yu(0,!1),qe&&typeof qe.onPostCommitFiberRoot=="function")try{qe.onPostCommitFiberRoot(Oe,x)}catch{}return!0}finally{$.p=y,O.T=m,UC(s,a)}}function WC(s,a,u){a=Ri(u,a),a=Gv(s.stateNode,a,2),s=Bo(s,a,2),s!==null&&(_t(s,2),ys(s))}function rn(s,a,u){if(s.tag===3)WC(s,s,u);else for(;a!==null;){if(a.tag===3){WC(a,s,u);break}else if(a.tag===1){var m=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Wo===null||!Wo.has(m))){s=Ri(u,s),u=qS(2),m=Bo(a,u,2),m!==null&&(KS(u,m,a,s),_t(m,2),ys(m));break}}a=a.return}}function y_(s,a,u){var m=s.pingCache;if(m===null){m=s.pingCache=new V3;var y=new Set;m.set(a,y)}else y=m.get(a),y===void 0&&(y=new Set,m.set(a,y));y.has(u)||(d_=!0,y.add(u),s=Y3.bind(null,s,a,u),a.then(s,s))}function Y3(s,a,u){var m=s.pingCache;m!==null&&m.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,gn===s&&(zt&u)===u&&(jn===4||jn===3&&(zt&62914560)===zt&&300>Ce()-jf?(Xt&2)===0&&oc(s,0):h_|=u,ic===zt&&(ic=0)),ys(s)}function qC(s,a){a===0&&(a=Tt()),s=Oa(s,a),s!==null&&(_t(s,a),ys(s))}function X3(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),qC(s,u)}function Z3(s,a){var u=0;switch(s.tag){case 31:case 13:var m=s.stateNode,y=s.memoizedState;y!==null&&(u=y.retryLane);break;case 19:m=s.stateNode;break;case 22:m=s.stateNode._retryCache;break;default:throw Error(r(314))}m!==null&&m.delete(a),qC(s,u)}function Q3(s,a){return mt(s,a)}var Bf=null,lc=null,b_=!1,Ff=!1,x_=!1,Go=0;function ys(s){s!==lc&&s.next===null&&(lc===null?Bf=lc=s:lc=lc.next=s),Ff=!0,b_||(b_=!0,eL())}function Yu(s,a){if(!x_&&Ff){x_=!0;do for(var u=!1,m=Bf;m!==null;){if(s!==0){var y=m.pendingLanes;if(y===0)var x=0;else{var T=m.suspendedLanes,I=m.pingedLanes;x=(1<<31-Ve(42|s)+1)-1,x&=y&~(T&~I),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(u=!0,XC(m,x))}else x=zt,x=Be(m,m===gn?x:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(x&3)===0||vt(m,x)||(u=!0,XC(m,x));m=m.next}while(u);x_=!1}}function J3(){KC()}function KC(){Ff=b_=!1;var s=0;Go!==0&&uL()&&(s=Go);for(var a=Ce(),u=null,m=Bf;m!==null;){var y=m.next,x=GC(m,a);x===0?(m.next=null,u===null?Bf=y:u.next=y,y===null&&(lc=u)):(u=m,(s!==0||(x&3)!==0)&&(Ff=!0)),m=y}er!==0&&er!==5||Yu(s),Go!==0&&(Go=0)}function GC(s,a){for(var u=s.suspendedLanes,m=s.pingedLanes,y=s.expirationTimes,x=s.pendingLanes&-62914561;0<x;){var T=31-Ve(x),I=1<<T,Q=y[T];Q===-1?((I&u)===0||(I&m)!==0)&&(y[T]=wt(I,a)):Q<=a&&(s.expiredLanes|=I),x&=~I}if(a=gn,u=zt,u=Be(s,s===a?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),m=s.callbackNode,u===0||s===a&&(nn===2||nn===9)||s.cancelPendingCommit!==null)return m!==null&&m!==null&&ct(m),s.callbackNode=null,s.callbackPriority=0;if((u&3)===0||vt(s,u)){if(a=u&-u,a===s.callbackPriority)return a;switch(m!==null&&ct(m),ut(u)){case 2:case 8:u=ve;break;case 32:u=Ne;break;case 268435456:u=Qe;break;default:u=Ne}return m=YC.bind(null,s),u=mt(u,m),s.callbackPriority=a,s.callbackNode=u,a}return m!==null&&m!==null&&ct(m),s.callbackPriority=2,s.callbackNode=null,2}function YC(s,a){if(er!==0&&er!==5)return s.callbackNode=null,s.callbackPriority=0,null;var u=s.callbackNode;if(If()&&s.callbackNode!==u)return null;var m=zt;return m=Be(s,s===gn?m:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),m===0?null:(MC(s,m,a),GC(s,Ce()),s.callbackNode!=null&&s.callbackNode===u?YC.bind(null,s):null)}function XC(s,a){if(If())return null;MC(s,a,!0)}function eL(){hL(function(){(Xt&6)!==0?mt(oe,J3):KC()})}function w_(){if(Go===0){var s=Kl;s===0&&(s=tn,tn<<=1,(tn&261888)===0&&(tn=256)),Go=s}return Go}function ZC(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Kh(""+s)}function QC(s,a){var u=a.ownerDocument.createElement("input");return u.name=a.name,u.value=a.value,s.id&&u.setAttribute("form",s.id),a.parentNode.insertBefore(u,a),s=new FormData(s),u.parentNode.removeChild(u),s}function tL(s,a,u,m,y){if(a==="submit"&&u&&u.stateNode===y){var x=ZC((y[Yt]||null).action),T=m.submitter;T&&(a=(a=T[Yt]||null)?ZC(a.formAction):T.getAttribute("formAction"),a!==null&&(x=a,T=null));var I=new Zh("action","action",null,m,y);s.push({event:I,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(Go!==0){var Q=T?QC(y,T):new FormData(y);$v(u,{pending:!0,data:Q,method:y.method,action:x},null,Q)}}else typeof x=="function"&&(I.preventDefault(),Q=T?QC(y,T):new FormData(y),$v(u,{pending:!0,data:Q,method:y.method,action:x},x,Q))},currentTarget:y}]})}}for(var S_=0;S_<sv.length;S_++){var C_=sv[S_],nL=C_.toLowerCase(),rL=C_[0].toUpperCase()+C_.slice(1);Ji(nL,"on"+rL)}Ji(N1,"onAnimationEnd"),Ji(M1,"onAnimationIteration"),Ji(A1,"onAnimationStart"),Ji("dblclick","onDoubleClick"),Ji("focusin","onFocus"),Ji("focusout","onBlur"),Ji(y3,"onTransitionRun"),Ji(b3,"onTransitionStart"),Ji(x3,"onTransitionCancel"),Ji(j1,"onTransitionEnd"),Ao("onMouseEnter",["mouseout","mouseover"]),Ao("onMouseLeave",["mouseout","mouseover"]),Ao("onPointerEnter",["pointerout","pointerover"]),Ao("onPointerLeave",["pointerout","pointerover"]),$s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),$s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),$s("onBeforeInput",["compositionend","keypress","textInput","paste"]),$s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),$s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),$s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xu="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(" "),iL=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xu));function JC(s,a){a=(a&4)!==0;for(var u=0;u<s.length;u++){var m=s[u],y=m.event;m=m.listeners;e:{var x=void 0;if(a)for(var T=m.length-1;0<=T;T--){var I=m[T],Q=I.instance,le=I.currentTarget;if(I=I.listener,Q!==x&&y.isPropagationStopped())break e;x=I,y.currentTarget=le;try{x(y)}catch(ge){ef(ge)}y.currentTarget=null,x=Q}else for(T=0;T<m.length;T++){if(I=m[T],Q=I.instance,le=I.currentTarget,I=I.listener,Q!==x&&y.isPropagationStopped())break e;x=I,y.currentTarget=le;try{x(y)}catch(ge){ef(ge)}y.currentTarget=null,x=Q}}}}function Dt(s,a){var u=a[fs];u===void 0&&(u=a[fs]=new Set);var m=s+"__bubble";u.has(m)||(ek(a,s,2,!1),u.add(m))}function k_(s,a,u){var m=0;a&&(m|=4),ek(u,s,m,a)}var Hf="_reactListening"+Math.random().toString(36).slice(2);function E_(s){if(!s[Hf]){s[Hf]=!0,Fh.forEach(function(u){u!=="selectionchange"&&(iL.has(u)||k_(u,!1,s),k_(u,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[Hf]||(a[Hf]=!0,k_("selectionchange",!1,a))}}function ek(s,a,u,m){switch(Nk(a)){case 2:var y=jL;break;case 8:y=DL;break;default:y=H_}u=y.bind(null,a,u,s),y=void 0,!qg||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(y=!0),m?y!==void 0?s.addEventListener(a,u,{capture:!0,passive:y}):s.addEventListener(a,u,!0):y!==void 0?s.addEventListener(a,u,{passive:y}):s.addEventListener(a,u,!1)}function R_(s,a,u,m,y){var x=m;if((a&1)===0&&(a&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var I=m.stateNode.containerInfo;if(I===y)break;if(T===4)for(T=m.return;T!==null;){var Q=T.tag;if((Q===3||Q===4)&&T.stateNode.containerInfo===y)return;T=T.return}for(;I!==null;){if(T=ki(I),T===null)return;if(Q=T.tag,Q===5||Q===6||Q===26||Q===27){m=x=T;continue e}I=I.parentNode}}m=m.return}s1(function(){var le=x,ge=Vg(u),ye=[];e:{var ue=D1.get(s);if(ue!==void 0){var de=Zh,Ue=s;switch(s){case"keypress":if(Yh(u)===0)break e;case"keydown":case"keyup":de=Z4;break;case"focusin":Ue="focus",de=Xg;break;case"focusout":Ue="blur",de=Xg;break;case"beforeblur":case"afterblur":de=Xg;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":de=l1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=B4;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=e3;break;case N1:case M1:case A1:de=$4;break;case j1:de=n3;break;case"scroll":case"scrollend":de=P4;break;case"wheel":de=i3;break;case"copy":case"cut":case"paste":de=V4;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=u1;break;case"toggle":case"beforetoggle":de=o3}var st=(a&4)!==0,cn=!st&&(s==="scroll"||s==="scrollend"),se=st?ue!==null?ue+"Capture":null:ue;st=[];for(var te=le,ae;te!==null;){var _e=te;if(ae=_e.stateNode,_e=_e.tag,_e!==5&&_e!==26&&_e!==27||ae===null||se===null||(_e=_u(te,se),_e!=null&&st.push(Zu(te,_e,ae))),cn)break;te=te.return}0<st.length&&(ue=new de(ue,Ue,null,u,ge),ye.push({event:ue,listeners:st}))}}if((a&7)===0){e:{if(ue=s==="mouseover"||s==="pointerover",de=s==="mouseout"||s==="pointerout",ue&&u!==Ug&&(Ue=u.relatedTarget||u.fromElement)&&(ki(Ue)||Ue[Mr]))break e;if((de||ue)&&(ue=ge.window===ge?ge:(ue=ge.ownerDocument)?ue.defaultView||ue.parentWindow:window,de?(Ue=u.relatedTarget||u.toElement,de=le,Ue=Ue?ki(Ue):null,Ue!==null&&(cn=o(Ue),st=Ue.tag,Ue!==cn||st!==5&&st!==27&&st!==6)&&(Ue=null)):(de=null,Ue=le),de!==Ue)){if(st=l1,_e="onMouseLeave",se="onMouseEnter",te="mouse",(s==="pointerout"||s==="pointerover")&&(st=u1,_e="onPointerLeave",se="onPointerEnter",te="pointer"),cn=de==null?ue:Pn(de),ae=Ue==null?ue:Pn(Ue),ue=new st(_e,te+"leave",de,u,ge),ue.target=cn,ue.relatedTarget=ae,_e=null,ki(ge)===le&&(st=new st(se,te+"enter",Ue,u,ge),st.target=ae,st.relatedTarget=cn,_e=st),cn=_e,de&&Ue)t:{for(st=sL,se=de,te=Ue,ae=0,_e=se;_e;_e=st(_e))ae++;_e=0;for(var nt=te;nt;nt=st(nt))_e++;for(;0<ae-_e;)se=st(se),ae--;for(;0<_e-ae;)te=st(te),_e--;for(;ae--;){if(se===te||te!==null&&se===te.alternate){st=se;break t}se=st(se),te=st(te)}st=null}else st=null;de!==null&&tk(ye,ue,de,st,!1),Ue!==null&&cn!==null&&tk(ye,cn,Ue,st,!0)}}e:{if(ue=le?Pn(le):window,de=ue.nodeName&&ue.nodeName.toLowerCase(),de==="select"||de==="input"&&ue.type==="file")var Vt=_1;else if(g1(ue))if(y1)Vt=g3;else{Vt=m3;var Ye=f3}else de=ue.nodeName,!de||de.toLowerCase()!=="input"||ue.type!=="checkbox"&&ue.type!=="radio"?le&&$g(le.elementType)&&(Vt=_1):Vt=p3;if(Vt&&(Vt=Vt(s,le))){v1(ye,Vt,u,ge);break e}Ye&&Ye(s,ue,le),s==="focusout"&&le&&ue.type==="number"&&le.memoizedProps.value!=null&&$e(ue,"number",ue.value)}switch(Ye=le?Pn(le):window,s){case"focusin":(g1(Ye)||Ye.contentEditable==="true")&&(Bl=Ye,nv=le,Eu=null);break;case"focusout":Eu=nv=Bl=null;break;case"mousedown":rv=!0;break;case"contextmenu":case"mouseup":case"dragend":rv=!1,R1(ye,u,ge);break;case"selectionchange":if(_3)break;case"keydown":case"keyup":R1(ye,u,ge)}var bt;if(Qg)e:{switch(s){case"compositionstart":var Pt="onCompositionStart";break e;case"compositionend":Pt="onCompositionEnd";break e;case"compositionupdate":Pt="onCompositionUpdate";break e}Pt=void 0}else Il?m1(s,u)&&(Pt="onCompositionEnd"):s==="keydown"&&u.keyCode===229&&(Pt="onCompositionStart");Pt&&(d1&&u.locale!=="ko"&&(Il||Pt!=="onCompositionStart"?Pt==="onCompositionEnd"&&Il&&(bt=o1()):(jo=ge,Kg="value"in jo?jo.value:jo.textContent,Il=!0)),Ye=$f(le,Pt),0<Ye.length&&(Pt=new c1(Pt,s,null,u,ge),ye.push({event:Pt,listeners:Ye}),bt?Pt.data=bt:(bt=p1(u),bt!==null&&(Pt.data=bt)))),(bt=l3?c3(s,u):u3(s,u))&&(Pt=$f(le,"onBeforeInput"),0<Pt.length&&(Ye=new c1("onBeforeInput","beforeinput",null,u,ge),ye.push({event:Ye,listeners:Pt}),Ye.data=bt)),tL(ye,s,le,u,ge)}JC(ye,a)})}function Zu(s,a,u){return{instance:s,listener:a,currentTarget:u}}function $f(s,a){for(var u=a+"Capture",m=[];s!==null;){var y=s,x=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||x===null||(y=_u(s,u),y!=null&&m.unshift(Zu(s,y,x)),y=_u(s,a),y!=null&&m.push(Zu(s,y,x))),s.tag===3)return m;s=s.return}return[]}function sL(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function tk(s,a,u,m,y){for(var x=a._reactName,T=[];u!==null&&u!==m;){var I=u,Q=I.alternate,le=I.stateNode;if(I=I.tag,Q!==null&&Q===m)break;I!==5&&I!==26&&I!==27||le===null||(Q=le,y?(le=_u(u,x),le!=null&&T.unshift(Zu(u,le,Q))):y||(le=_u(u,x),le!=null&&T.push(Zu(u,le,Q)))),u=u.return}T.length!==0&&s.push({event:a,listeners:T})}var oL=/\r\n?/g,aL=/\u0000|\uFFFD/g;function nk(s){return(typeof s=="string"?s:""+s).replace(oL,`
49
+ `).replace(aL,"")}function rk(s,a){return a=nk(a),nk(s)===a}function ln(s,a,u,m,y,x){switch(u){case"children":typeof m=="string"?a==="body"||a==="textarea"&&m===""||Gr(s,m):(typeof m=="number"||typeof m=="bigint")&&a!=="body"&&Gr(s,""+m);break;case"className":Ll(s,"class",m);break;case"tabIndex":Ll(s,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":Ll(s,u,m);break;case"style":r1(s,m,x);break;case"data":if(a!=="object"){Ll(s,"data",m);break}case"src":case"href":if(m===""&&(a!=="a"||u!=="href")){s.removeAttribute(u);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){s.removeAttribute(u);break}m=Kh(""+m),s.setAttribute(u,m);break;case"action":case"formAction":if(typeof m=="function"){s.setAttribute(u,"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"&&(u==="formAction"?(a!=="input"&&ln(s,a,"name",y.name,y,null),ln(s,a,"formEncType",y.formEncType,y,null),ln(s,a,"formMethod",y.formMethod,y,null),ln(s,a,"formTarget",y.formTarget,y,null)):(ln(s,a,"encType",y.encType,y,null),ln(s,a,"method",y.method,y,null),ln(s,a,"target",y.target,y,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){s.removeAttribute(u);break}m=Kh(""+m),s.setAttribute(u,m);break;case"onClick":m!=null&&(s.onclick=Us);break;case"onScroll":m!=null&&Dt("scroll",s);break;case"onScrollEnd":m!=null&&Dt("scrollend",s);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(u=m.__html,u!=null){if(y.children!=null)throw Error(r(60));s.innerHTML=u}}break;case"multiple":s.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":s.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"){s.removeAttribute("xlink:href");break}u=Kh(""+m),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);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"?s.setAttribute(u,""+m):s.removeAttribute(u);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"?s.setAttribute(u,""):s.removeAttribute(u);break;case"capture":case"download":m===!0?s.setAttribute(u,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(u,m):s.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?s.setAttribute(u,m):s.removeAttribute(u);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?s.removeAttribute(u):s.setAttribute(u,m);break;case"popover":Dt("beforetoggle",s),Dt("toggle",s),Ol(s,"popover",m);break;case"xlinkActuate":Qi(s,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":Qi(s,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":Qi(s,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":Qi(s,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":Qi(s,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":Qi(s,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":Qi(s,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":Qi(s,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":Qi(s,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":Ol(s,"is",m);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=L4.get(u)||u,Ol(s,u,m))}}function T_(s,a,u,m,y,x){switch(u){case"style":r1(s,m,x);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(u=m.__html,u!=null){if(y.children!=null)throw Error(r(60));s.innerHTML=u}}break;case"children":typeof m=="string"?Gr(s,m):(typeof m=="number"||typeof m=="bigint")&&Gr(s,""+m);break;case"onScroll":m!=null&&Dt("scroll",s);break;case"onScrollEnd":m!=null&&Dt("scrollend",s);break;case"onClick":m!=null&&(s.onclick=Us);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Hh.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(y=u.endsWith("Capture"),a=u.slice(2,y?u.length-7:void 0),x=s[Yt]||null,x=x!=null?x[u]:null,typeof x=="function"&&s.removeEventListener(a,x,y),typeof m=="function")){typeof x!="function"&&x!==null&&(u in s?s[u]=null:s.hasAttribute(u)&&s.removeAttribute(u)),s.addEventListener(a,m,y);break e}u in s?s[u]=m:m===!0?s.setAttribute(u,""):Ol(s,u,m)}}}function kr(s,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Dt("error",s),Dt("load",s);var m=!1,y=!1,x;for(x in u)if(u.hasOwnProperty(x)){var T=u[x];if(T!=null)switch(x){case"src":m=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:ln(s,a,x,T,u,null)}}y&&ln(s,a,"srcSet",u.srcSet,u,null),m&&ln(s,a,"src",u.src,u,null);return;case"input":Dt("invalid",s);var I=x=T=y=null,Q=null,le=null;for(m in u)if(u.hasOwnProperty(m)){var ge=u[m];if(ge!=null)switch(m){case"name":y=ge;break;case"type":T=ge;break;case"checked":Q=ge;break;case"defaultChecked":le=ge;break;case"value":x=ge;break;case"defaultValue":I=ge;break;case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(r(137,a));break;default:ln(s,a,m,ge,u,null)}}we(s,x,I,Q,le,T,y,!1);return;case"select":Dt("invalid",s),m=T=x=null;for(y in u)if(u.hasOwnProperty(y)&&(I=u[y],I!=null))switch(y){case"value":x=I;break;case"defaultValue":T=I;break;case"multiple":m=I;default:ln(s,a,y,I,u,null)}a=x,u=T,s.multiple=!!m,a!=null?Bt(s,!!m,a,!1):u!=null&&Bt(s,!!m,u,!0);return;case"textarea":Dt("invalid",s),x=y=m=null;for(T in u)if(u.hasOwnProperty(T)&&(I=u[T],I!=null))switch(T){case"value":m=I;break;case"defaultValue":y=I;break;case"children":x=I;break;case"dangerouslySetInnerHTML":if(I!=null)throw Error(r(91));break;default:ln(s,a,T,I,u,null)}xr(s,m,y,x);return;case"option":for(Q in u)if(u.hasOwnProperty(Q)&&(m=u[Q],m!=null))switch(Q){case"selected":s.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:ln(s,a,Q,m,u,null)}return;case"dialog":Dt("beforetoggle",s),Dt("toggle",s),Dt("cancel",s),Dt("close",s);break;case"iframe":case"object":Dt("load",s);break;case"video":case"audio":for(m=0;m<Xu.length;m++)Dt(Xu[m],s);break;case"image":Dt("error",s),Dt("load",s);break;case"details":Dt("toggle",s);break;case"embed":case"source":case"link":Dt("error",s),Dt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(le in u)if(u.hasOwnProperty(le)&&(m=u[le],m!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:ln(s,a,le,m,u,null)}return;default:if($g(a)){for(ge in u)u.hasOwnProperty(ge)&&(m=u[ge],m!==void 0&&T_(s,a,ge,m,u,void 0));return}}for(I in u)u.hasOwnProperty(I)&&(m=u[I],m!=null&&ln(s,a,I,m,u,null))}function lL(s,a,u,m){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,x=null,T=null,I=null,Q=null,le=null,ge=null;for(de in u){var ye=u[de];if(u.hasOwnProperty(de)&&ye!=null)switch(de){case"checked":break;case"value":break;case"defaultValue":Q=ye;default:m.hasOwnProperty(de)||ln(s,a,de,null,m,ye)}}for(var ue in m){var de=m[ue];if(ye=u[ue],m.hasOwnProperty(ue)&&(de!=null||ye!=null))switch(ue){case"type":x=de;break;case"name":y=de;break;case"checked":le=de;break;case"defaultChecked":ge=de;break;case"value":T=de;break;case"defaultValue":I=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(r(137,a));break;default:de!==ye&&ln(s,a,ue,de,m,ye)}}ne(s,T,I,Q,le,ge,x,y);return;case"select":de=T=I=ue=null;for(x in u)if(Q=u[x],u.hasOwnProperty(x)&&Q!=null)switch(x){case"value":break;case"multiple":de=Q;default:m.hasOwnProperty(x)||ln(s,a,x,null,m,Q)}for(y in m)if(x=m[y],Q=u[y],m.hasOwnProperty(y)&&(x!=null||Q!=null))switch(y){case"value":ue=x;break;case"defaultValue":I=x;break;case"multiple":T=x;default:x!==Q&&ln(s,a,y,x,m,Q)}a=I,u=T,m=de,ue!=null?Bt(s,!!u,ue,!1):!!m!=!!u&&(a!=null?Bt(s,!!u,a,!0):Bt(s,!!u,u?[]:"",!1));return;case"textarea":de=ue=null;for(I in u)if(y=u[I],u.hasOwnProperty(I)&&y!=null&&!m.hasOwnProperty(I))switch(I){case"value":break;case"children":break;default:ln(s,a,I,null,m,y)}for(T in m)if(y=m[T],x=u[T],m.hasOwnProperty(T)&&(y!=null||x!=null))switch(T){case"value":ue=y;break;case"defaultValue":de=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(r(91));break;default:y!==x&&ln(s,a,T,y,m,x)}kn(s,ue,de);return;case"option":for(var Ue in u)if(ue=u[Ue],u.hasOwnProperty(Ue)&&ue!=null&&!m.hasOwnProperty(Ue))switch(Ue){case"selected":s.selected=!1;break;default:ln(s,a,Ue,null,m,ue)}for(Q in m)if(ue=m[Q],de=u[Q],m.hasOwnProperty(Q)&&ue!==de&&(ue!=null||de!=null))switch(Q){case"selected":s.selected=ue&&typeof ue!="function"&&typeof ue!="symbol";break;default:ln(s,a,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 st in u)ue=u[st],u.hasOwnProperty(st)&&ue!=null&&!m.hasOwnProperty(st)&&ln(s,a,st,null,m,ue);for(le in m)if(ue=m[le],de=u[le],m.hasOwnProperty(le)&&ue!==de&&(ue!=null||de!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(r(137,a));break;default:ln(s,a,le,ue,m,de)}return;default:if($g(a)){for(var cn in u)ue=u[cn],u.hasOwnProperty(cn)&&ue!==void 0&&!m.hasOwnProperty(cn)&&T_(s,a,cn,void 0,m,ue);for(ge in m)ue=m[ge],de=u[ge],!m.hasOwnProperty(ge)||ue===de||ue===void 0&&de===void 0||T_(s,a,ge,ue,m,de);return}}for(var se in u)ue=u[se],u.hasOwnProperty(se)&&ue!=null&&!m.hasOwnProperty(se)&&ln(s,a,se,null,m,ue);for(ye in m)ue=m[ye],de=u[ye],!m.hasOwnProperty(ye)||ue===de||ue==null&&de==null||ln(s,a,ye,ue,m,de)}function ik(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function cL(){if(typeof performance.getEntriesByType=="function"){for(var s=0,a=0,u=performance.getEntriesByType("resource"),m=0;m<u.length;m++){var y=u[m],x=y.transferSize,T=y.initiatorType,I=y.duration;if(x&&I&&ik(T)){for(T=0,I=y.responseEnd,m+=1;m<u.length;m++){var Q=u[m],le=Q.startTime;if(le>I)break;var ge=Q.transferSize,ye=Q.initiatorType;ge&&ik(ye)&&(Q=Q.responseEnd,T+=ge*(Q<I?1:(I-le)/(Q-le)))}if(--m,a+=8*(x+T)/(y.duration/1e3),s++,10<s)break}}if(0<s)return a/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var N_=null,M_=null;function Uf(s){return s.nodeType===9?s:s.ownerDocument}function sk(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ok(s,a){if(s===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&a==="foreignObject"?0:s}function A_(s,a){return s==="textarea"||s==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var j_=null;function uL(){var s=window.event;return s&&s.type==="popstate"?s===j_?!1:(j_=s,!0):(j_=null,!1)}var ak=typeof setTimeout=="function"?setTimeout:void 0,dL=typeof clearTimeout=="function"?clearTimeout:void 0,lk=typeof Promise=="function"?Promise:void 0,hL=typeof queueMicrotask=="function"?queueMicrotask:typeof lk<"u"?function(s){return lk.resolve(null).then(s).catch(fL)}:ak;function fL(s){setTimeout(function(){throw s})}function Yo(s){return s==="head"}function ck(s,a){var u=a,m=0;do{var y=u.nextSibling;if(s.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(m===0){s.removeChild(y),hc(a);return}m--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")m++;else if(u==="html")Qu(s.ownerDocument.documentElement);else if(u==="head"){u=s.ownerDocument.head,Qu(u);for(var x=u.firstChild;x;){var T=x.nextSibling,I=x.nodeName;x[Un]||I==="SCRIPT"||I==="STYLE"||I==="LINK"&&x.rel.toLowerCase()==="stylesheet"||u.removeChild(x),x=T}}else u==="body"&&Qu(s.ownerDocument.body);u=y}while(u);hc(a)}function uk(s,a){var u=s;s=0;do{var m=u.nextSibling;if(u.nodeType===1?a?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(a?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),m&&m.nodeType===8)if(u=m.data,u==="/$"){if(s===0)break;s--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||s++;u=m}while(u)}function D_(s){var a=s.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var u=a;switch(a=a.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":D_(u),ms(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}s.removeChild(u)}}function mL(s,a,u,m){for(;s.nodeType===1;){var y=u;if(s.nodeName.toLowerCase()!==a.toLowerCase()){if(!m&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(m){if(!s[Un])switch(a){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(x=s.getAttribute("rel"),x==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(x!==y.rel||s.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||s.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||s.getAttribute("title")!==(y.title==null?null:y.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(x=s.getAttribute("src"),(x!==(y.src==null?null:y.src)||s.getAttribute("type")!==(y.type==null?null:y.type)||s.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&x&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(a==="input"&&s.type==="hidden"){var x=y.name==null?null:""+y.name;if(y.type==="hidden"&&s.getAttribute("name")===x)return s}else return s;if(s=ji(s.nextSibling),s===null)break}return null}function pL(s,a,u){if(a==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!u||(s=ji(s.nextSibling),s===null))return null;return s}function dk(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=ji(s.nextSibling),s===null))return null;return s}function O_(s){return s.data==="$?"||s.data==="$~"}function L_(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function gL(s,a){var u=s.ownerDocument;if(s.data==="$~")s._reactRetry=a;else if(s.data!=="$?"||u.readyState!=="loading")a();else{var m=function(){a(),u.removeEventListener("DOMContentLoaded",m)};u.addEventListener("DOMContentLoaded",m),s._reactRetry=m}}function ji(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return s}var z_=null;function hk(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var u=s.data;if(u==="/$"||u==="/&"){if(a===0)return ji(s.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}s=s.nextSibling}return null}function fk(s){s=s.previousSibling;for(var a=0;s;){if(s.nodeType===8){var u=s.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(a===0)return s;a--}else u!=="/$"&&u!=="/&"||a++}s=s.previousSibling}return null}function mk(s,a,u){switch(a=Uf(u),s){case"html":if(s=a.documentElement,!s)throw Error(r(452));return s;case"head":if(s=a.head,!s)throw Error(r(453));return s;case"body":if(s=a.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function Qu(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);ms(s)}var Di=new Map,pk=new Set;function Vf(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var so=$.d;$.d={f:vL,r:_L,D:yL,C:bL,L:xL,m:wL,X:CL,S:SL,M:kL};function vL(){var s=so.f(),a=Lf();return s||a}function _L(s){var a=Ht(s);a!==null&&a.tag===5&&a.type==="form"?jS(a):so.r(s)}var cc=typeof document>"u"?null:document;function gk(s,a,u){var m=cc;if(m&&typeof a=="string"&&a){var y=X(a);y='link[rel="'+s+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),pk.has(y)||(pk.add(y),s={rel:s,crossOrigin:u,href:a},m.querySelector(y)===null&&(a=m.createElement("link"),kr(a,"link",s),Vn(a),m.head.appendChild(a)))}}function yL(s){so.D(s),gk("dns-prefetch",s,null)}function bL(s,a){so.C(s,a),gk("preconnect",s,a)}function xL(s,a,u){so.L(s,a,u);var m=cc;if(m&&s&&a){var y='link[rel="preload"][as="'+X(a)+'"]';a==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+X(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+X(u.imageSizes)+'"]')):y+='[href="'+X(s)+'"]';var x=y;switch(a){case"style":x=uc(s);break;case"script":x=dc(s)}Di.has(x)||(s=p({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:s,as:a},u),Di.set(x,s),m.querySelector(y)!==null||a==="style"&&m.querySelector(Ju(x))||a==="script"&&m.querySelector(ed(x))||(a=m.createElement("link"),kr(a,"link",s),Vn(a),m.head.appendChild(a)))}}function wL(s,a){so.m(s,a);var u=cc;if(u&&s){var m=a&&typeof a.as=="string"?a.as:"script",y='link[rel="modulepreload"][as="'+X(m)+'"][href="'+X(s)+'"]',x=y;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=dc(s)}if(!Di.has(x)&&(s=p({rel:"modulepreload",href:s},a),Di.set(x,s),u.querySelector(y)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(ed(x)))return}m=u.createElement("link"),kr(m,"link",s),Vn(m),u.head.appendChild(m)}}}function SL(s,a,u){so.S(s,a,u);var m=cc;if(m&&s){var y=ps(m).hoistableStyles,x=uc(s);a=a||"default";var T=y.get(x);if(!T){var I={loading:0,preload:null};if(T=m.querySelector(Ju(x)))I.loading=5;else{s=p({rel:"stylesheet",href:s,"data-precedence":a},u),(u=Di.get(x))&&P_(s,u);var Q=T=m.createElement("link");Vn(Q),kr(Q,"link",s),Q._p=new Promise(function(le,ge){Q.onload=le,Q.onerror=ge}),Q.addEventListener("load",function(){I.loading|=1}),Q.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Wf(T,a,m)}T={type:"stylesheet",instance:T,count:1,state:I},y.set(x,T)}}}function CL(s,a){so.X(s,a);var u=cc;if(u&&s){var m=ps(u).hoistableScripts,y=dc(s),x=m.get(y);x||(x=u.querySelector(ed(y)),x||(s=p({src:s,async:!0},a),(a=Di.get(y))&&I_(s,a),x=u.createElement("script"),Vn(x),kr(x,"link",s),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},m.set(y,x))}}function kL(s,a){so.M(s,a);var u=cc;if(u&&s){var m=ps(u).hoistableScripts,y=dc(s),x=m.get(y);x||(x=u.querySelector(ed(y)),x||(s=p({src:s,async:!0,type:"module"},a),(a=Di.get(y))&&I_(s,a),x=u.createElement("script"),Vn(x),kr(x,"link",s),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},m.set(y,x))}}function vk(s,a,u,m){var y=(y=ee.current)?Vf(y):null;if(!y)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(a=uc(u.href),u=ps(y).hoistableStyles,m=u.get(a),m||(m={type:"style",instance:null,count:0,state:null},u.set(a,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){s=uc(u.href);var x=ps(y).hoistableStyles,T=x.get(s);if(T||(y=y.ownerDocument||y,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(s,T),(x=y.querySelector(Ju(s)))&&!x._p&&(T.instance=x,T.state.loading=5),Di.has(s)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Di.set(s,u),x||EL(y,s,u,T.state))),a&&m===null)throw Error(r(528,""));return T}if(a&&m!==null)throw Error(r(529,""));return null;case"script":return a=u.async,u=u.src,typeof u=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=dc(u),u=ps(y).hoistableScripts,m=u.get(a),m||(m={type:"script",instance:null,count:0,state:null},u.set(a,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function uc(s){return'href="'+X(s)+'"'}function Ju(s){return'link[rel="stylesheet"]['+s+"]"}function _k(s){return p({},s,{"data-precedence":s.precedence,precedence:null})}function EL(s,a,u,m){s.querySelector('link[rel="preload"][as="style"]['+a+"]")?m.loading=1:(a=s.createElement("link"),m.preload=a,a.addEventListener("load",function(){return m.loading|=1}),a.addEventListener("error",function(){return m.loading|=2}),kr(a,"link",u),Vn(a),s.head.appendChild(a))}function dc(s){return'[src="'+X(s)+'"]'}function ed(s){return"script[async]"+s}function yk(s,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var m=s.querySelector('style[data-href~="'+X(u.href)+'"]');if(m)return a.instance=m,Vn(m),m;var y=p({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return m=(s.ownerDocument||s).createElement("style"),Vn(m),kr(m,"style",y),Wf(m,u.precedence,s),a.instance=m;case"stylesheet":y=uc(u.href);var x=s.querySelector(Ju(y));if(x)return a.state.loading|=4,a.instance=x,Vn(x),x;m=_k(u),(y=Di.get(y))&&P_(m,y),x=(s.ownerDocument||s).createElement("link"),Vn(x);var T=x;return T._p=new Promise(function(I,Q){T.onload=I,T.onerror=Q}),kr(x,"link",m),a.state.loading|=4,Wf(x,u.precedence,s),a.instance=x;case"script":return x=dc(u.src),(y=s.querySelector(ed(x)))?(a.instance=y,Vn(y),y):(m=u,(y=Di.get(x))&&(m=p({},u),I_(m,y)),s=s.ownerDocument||s,y=s.createElement("script"),Vn(y),kr(y,"link",m),s.head.appendChild(y),a.instance=y);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(m=a.instance,a.state.loading|=4,Wf(m,u.precedence,s));return a.instance}function Wf(s,a,u){for(var m=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=m.length?m[m.length-1]:null,x=y,T=0;T<m.length;T++){var I=m[T];if(I.dataset.precedence===a)x=I;else if(x!==y)break}x?x.parentNode.insertBefore(s,x.nextSibling):(a=u.nodeType===9?u.head:u,a.insertBefore(s,a.firstChild))}function P_(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function I_(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var qf=null;function bk(s,a,u){if(qf===null){var m=new Map,y=qf=new Map;y.set(u,m)}else y=qf,m=y.get(u),m||(m=new Map,y.set(u,m));if(m.has(s))return m;for(m.set(s,null),u=u.getElementsByTagName(s),y=0;y<u.length;y++){var x=u[y];if(!(x[Un]||x[Gt]||s==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var T=x.getAttribute(a)||"";T=s+T;var I=m.get(T);I?I.push(x):m.set(T,[x])}}return m}function xk(s,a,u){s=s.ownerDocument||s,s.head.insertBefore(u,a==="title"?s.querySelector("head > title"):null)}function RL(s,a,u){if(u===1||a.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return s=a.disabled,typeof a.precedence=="string"&&s==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function wk(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function TL(s,a,u,m){if(u.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=uc(m.href),x=a.querySelector(Ju(y));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=Kf.bind(s),a.then(s,s)),u.state.loading|=4,u.instance=x,Vn(x);return}x=a.ownerDocument||a,m=_k(m),(y=Di.get(y))&&P_(m,y),x=x.createElement("link"),Vn(x);var T=x;T._p=new Promise(function(I,Q){T.onload=I,T.onerror=Q}),kr(x,"link",m),u.instance=x}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(s.count++,u=Kf.bind(s),a.addEventListener("load",u),a.addEventListener("error",u))}}var B_=0;function NL(s,a){return s.stylesheets&&s.count===0&&Yf(s,s.stylesheets),0<s.count||0<s.imgCount?function(u){var m=setTimeout(function(){if(s.stylesheets&&Yf(s,s.stylesheets),s.unsuspend){var x=s.unsuspend;s.unsuspend=null,x()}},6e4+a);0<s.imgBytes&&B_===0&&(B_=62500*cL());var y=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Yf(s,s.stylesheets),s.unsuspend)){var x=s.unsuspend;s.unsuspend=null,x()}},(s.imgBytes>B_?50:800)+a);return s.unsuspend=u,function(){s.unsuspend=null,clearTimeout(m),clearTimeout(y)}}:null}function Kf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Yf(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Gf=null;function Yf(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Gf=new Map,a.forEach(ML,s),Gf=null,Kf.call(s))}function ML(s,a){if(!(a.state.loading&4)){var u=Gf.get(s);if(u)var m=u.get(null);else{u=new Map,Gf.set(s,u);for(var y=s.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<y.length;x++){var T=y[x];(T.nodeName==="LINK"||T.getAttribute("media")!=="not all")&&(u.set(T.dataset.precedence,T),m=T)}m&&u.set(null,m)}y=a.instance,T=y.getAttribute("data-precedence"),x=u.get(T)||m,x===m&&u.set(null,y),u.set(T,y),this.count++,m=Kf.bind(this),y.addEventListener("load",m),y.addEventListener("error",m),x?x.parentNode.insertBefore(y,x.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(y,s.firstChild)),a.state.loading|=4}}var td={$$typeof:E,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function AL(s,a,u,m,y,x,T,I,Q){this.tag=1,this.containerInfo=s,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=en(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=en(0),this.hiddenUpdates=en(null),this.identifierPrefix=m,this.onUncaughtError=y,this.onCaughtError=x,this.onRecoverableError=T,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function Sk(s,a,u,m,y,x,T,I,Q,le,ge,ye){return s=new AL(s,a,u,T,Q,le,ge,ye,I),a=1,x===!0&&(a|=24),x=ci(3,null,null,a),s.current=x,x.stateNode=s,a=_v(),a.refCount++,s.pooledCache=a,a.refCount++,x.memoizedState={element:m,isDehydrated:u,cache:a},wv(x),s}function Ck(s){return s?(s=$l,s):$l}function kk(s,a,u,m,y,x){y=Ck(y),m.context===null?m.context=y:m.pendingContext=y,m=Io(a),m.payload={element:u},x=x===void 0?null:x,x!==null&&(m.callback=x),u=Bo(s,m,a),u!==null&&(ei(u,s,a),Du(u,s,a))}function Ek(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u<a?u:a}}function F_(s,a){Ek(s,a),(s=s.alternate)&&Ek(s,a)}function Rk(s){if(s.tag===13||s.tag===31){var a=Oa(s,67108864);a!==null&&ei(a,s,67108864),F_(s,67108864)}}function Tk(s){if(s.tag===13||s.tag===31){var a=mi();a=Nt(a);var u=Oa(s,a);u!==null&&ei(u,s,a),F_(s,a)}}var Xf=!0;function jL(s,a,u,m){var y=O.T;O.T=null;var x=$.p;try{$.p=2,H_(s,a,u,m)}finally{$.p=x,O.T=y}}function DL(s,a,u,m){var y=O.T;O.T=null;var x=$.p;try{$.p=8,H_(s,a,u,m)}finally{$.p=x,O.T=y}}function H_(s,a,u,m){if(Xf){var y=$_(m);if(y===null)R_(s,a,m,Zf,u),Mk(s,m);else if(LL(y,s,a,u,m))m.stopPropagation();else if(Mk(s,m),a&4&&-1<OL.indexOf(s)){for(;y!==null;){var x=Ht(y);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var T=Kt(x.pendingLanes);if(T!==0){var I=x;for(I.pendingLanes|=2,I.entangledLanes|=2;T;){var Q=1<<31-Ve(T);I.entanglements[1]|=Q,T&=~Q}ys(x),(Xt&6)===0&&(Df=Ce()+500,Yu(0))}}break;case 31:case 13:I=Oa(x,2),I!==null&&ei(I,x,2),Lf(),F_(x,2)}if(x=$_(m),x===null&&R_(s,a,m,Zf,u),x===y)break;y=x}y!==null&&m.stopPropagation()}else R_(s,a,m,null,u)}}function $_(s){return s=Vg(s),U_(s)}var Zf=null;function U_(s){if(Zf=null,s=ki(s),s!==null){var a=o(s);if(a===null)s=null;else{var u=a.tag;if(u===13){if(s=l(a),s!==null)return s;s=null}else if(u===31){if(s=c(a),s!==null)return s;s=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null)}}return Zf=s,null}function Nk(s){switch(s){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(tt()){case oe:return 2;case ve:return 8;case Ne:case Ae:return 32;case Qe:return 268435456;default:return 32}default:return 32}}var V_=!1,Xo=null,Zo=null,Qo=null,nd=new Map,rd=new Map,Jo=[],OL="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 Mk(s,a){switch(s){case"focusin":case"focusout":Xo=null;break;case"dragenter":case"dragleave":Zo=null;break;case"mouseover":case"mouseout":Qo=null;break;case"pointerover":case"pointerout":nd.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":rd.delete(a.pointerId)}}function id(s,a,u,m,y,x){return s===null||s.nativeEvent!==x?(s={blockedOn:a,domEventName:u,eventSystemFlags:m,nativeEvent:x,targetContainers:[y]},a!==null&&(a=Ht(a),a!==null&&Rk(a)),s):(s.eventSystemFlags|=m,a=s.targetContainers,y!==null&&a.indexOf(y)===-1&&a.push(y),s)}function LL(s,a,u,m,y){switch(a){case"focusin":return Xo=id(Xo,s,a,u,m,y),!0;case"dragenter":return Zo=id(Zo,s,a,u,m,y),!0;case"mouseover":return Qo=id(Qo,s,a,u,m,y),!0;case"pointerover":var x=y.pointerId;return nd.set(x,id(nd.get(x)||null,s,a,u,m,y)),!0;case"gotpointercapture":return x=y.pointerId,rd.set(x,id(rd.get(x)||null,s,a,u,m,y)),!0}return!1}function Ak(s){var a=ki(s.target);if(a!==null){var u=o(a);if(u!==null){if(a=u.tag,a===13){if(a=l(u),a!==null){s.blockedOn=a,bn(s.priority,function(){Tk(u)});return}}else if(a===31){if(a=c(u),a!==null){s.blockedOn=a,bn(s.priority,function(){Tk(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){s.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Qf(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var u=$_(s.nativeEvent);if(u===null){u=s.nativeEvent;var m=new u.constructor(u.type,u);Ug=m,u.target.dispatchEvent(m),Ug=null}else return a=Ht(u),a!==null&&Rk(a),s.blockedOn=u,!1;a.shift()}return!0}function jk(s,a,u){Qf(s)&&u.delete(a)}function zL(){V_=!1,Xo!==null&&Qf(Xo)&&(Xo=null),Zo!==null&&Qf(Zo)&&(Zo=null),Qo!==null&&Qf(Qo)&&(Qo=null),nd.forEach(jk),rd.forEach(jk)}function Jf(s,a){s.blockedOn===a&&(s.blockedOn=null,V_||(V_=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,zL)))}var em=null;function Dk(s){em!==s&&(em=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){em===s&&(em=null);for(var a=0;a<s.length;a+=3){var u=s[a],m=s[a+1],y=s[a+2];if(typeof m!="function"){if(U_(m||u)===null)continue;break}var x=Ht(u);x!==null&&(s.splice(a,3),a-=3,$v(x,{pending:!0,data:y,method:u.method,action:m},m,y))}}))}function hc(s){function a(Q){return Jf(Q,s)}Xo!==null&&Jf(Xo,s),Zo!==null&&Jf(Zo,s),Qo!==null&&Jf(Qo,s),nd.forEach(a),rd.forEach(a);for(var u=0;u<Jo.length;u++){var m=Jo[u];m.blockedOn===s&&(m.blockedOn=null)}for(;0<Jo.length&&(u=Jo[0],u.blockedOn===null);)Ak(u),u.blockedOn===null&&Jo.shift();if(u=(s.ownerDocument||s).$$reactFormReplay,u!=null)for(m=0;m<u.length;m+=3){var y=u[m],x=u[m+1],T=y[Yt]||null;if(typeof x=="function")T||Dk(u);else if(T){var I=null;if(x&&x.hasAttribute("formAction")){if(y=x,T=x[Yt]||null)I=T.formAction;else if(U_(y)!==null)continue}else I=T.action;typeof I=="function"?u[m+1]=I:(u.splice(m,3),m-=3),Dk(u)}}}function Ok(){function s(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(T){return y=T})},focusReset:"manual",scroll:"manual"})}function a(){y!==null&&(y(),y=null),m||setTimeout(u,20)}function u(){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,y=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(u,100),function(){m=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),y!==null&&(y(),y=null)}}}function W_(s){this._internalRoot=s}tm.prototype.render=W_.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(r(409));var u=a.current,m=mi();kk(u,m,s,a,null,null)},tm.prototype.unmount=W_.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;kk(s.current,2,null,s,null,null),Lf(),a[Mr]=null}};function tm(s){this._internalRoot=s}tm.prototype.unstable_scheduleHydration=function(s){if(s){var a=pn();s={blockedOn:null,target:s,priority:a};for(var u=0;u<Jo.length&&a!==0&&a<Jo[u].priority;u++);Jo.splice(u,0,s),u===0&&Ak(s)}};var Lk=t.version;if(Lk!=="19.2.1")throw Error(r(527,Lk,"19.2.1"));$.findDOMNode=function(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=d(a),s=s!==null?g(s):null,s=s===null?null:s.stateNode,s};var PL={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:O,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nm.isDisabled&&nm.supportsFiber)try{Oe=nm.inject(PL),qe=nm}catch{}}return ad.createRoot=function(s,a){if(!i(s))throw Error(r(299));var u=!1,m="",y=$S,x=US,T=VS;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(m=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(T=a.onRecoverableError)),a=Sk(s,1,!1,null,null,u,m,null,y,x,T,Ok),s[Mr]=a.current,E_(s),new W_(a)},ad.hydrateRoot=function(s,a,u){if(!i(s))throw Error(r(299));var m=!1,y="",x=$S,T=US,I=VS,Q=null;return u!=null&&(u.unstable_strictMode===!0&&(m=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(x=u.onUncaughtError),u.onCaughtError!==void 0&&(T=u.onCaughtError),u.onRecoverableError!==void 0&&(I=u.onRecoverableError),u.formState!==void 0&&(Q=u.formState)),a=Sk(s,1,!0,a,u??null,m,y,Q,x,T,I,Ok),a.context=Ck(null),u=a.current,m=mi(),m=Nt(m),y=Io(m),y.callback=null,Bo(u,y,m),u=m,a.current.lanes=u,_t(a,u),ys(a),s[Mr]=a.current,E_(s),new tm(a)},ad.version="19.2.1",ad}var Yk;function YL(){if(Yk)return G_.exports;Yk=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(),G_.exports=GL(),G_.exports}var XL=YL();/**
50
+ * react-router v7.13.2
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 Xk="popstate";function Zk(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function ZL(e={}){function t(r,i){var d;let o=(d=i.state)==null?void 0:d.masked,{pathname:l,search:c,hash:h}=o||r.location;return pb("",{pathname:l,search:c,hash:h},i.state&&i.state.usr||null,i.state&&i.state.key||"default",o?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,i){return typeof i=="string"?i:Kd(i)}return JL(t,n,null,e)}function Rn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ki(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function QL(){return Math.random().toString(36).substring(2,10)}function Qk(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 pb(e,t,n=null,r,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Xc(t):t,state:n,key:t&&t.key||r||QL(),unstable_mask:i}}function Kd({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 Xc(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 JL(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:o=!1}=r,l=i.history,c="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(){c="POP";let C=g(),k=C==null?null:C-d;d=C,h&&h({action:c,location:S.location,delta:k})}function v(C,k){c="PUSH";let R=Zk(C)?C:pb(S.location,C,k);d=g()+1;let E=Qk(R,d),N=S.createHref(R.unstable_mask||R);try{l.pushState(E,"",N)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;i.location.assign(N)}o&&h&&h({action:c,location:S.location,delta:1})}function b(C,k){c="REPLACE";let R=Zk(C)?C:pb(S.location,C,k);d=g();let E=Qk(R,d),N=S.createHref(R.unstable_mask||R);l.replaceState(E,"",N),o&&h&&h({action:c,location:S.location,delta:0})}function w(C){return ez(C)}let S={get action(){return c},get location(){return e(i,l)},listen(C){if(h)throw new Error("A history only accepts one active listener");return i.addEventListener(Xk,p),h=C,()=>{i.removeEventListener(Xk,p),h=null}},createHref(C){return t(i,C)},createURL:w,encodeLocation(C){let k=w(C);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:v,replace:b,go(C){return l.go(C)}};return S}function ez(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Rn(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Kd(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function xN(e,t,n="/"){return tz(e,t,n,!1)}function tz(e,t,n,r){let i=typeof t=="string"?Xc(t):t,o=go(i.pathname||"/",n);if(o==null)return null;let l=wN(e);nz(l);let c=null;for(let h=0;c==null&&h<l.length;++h){let d=fz(o);c=dz(l[h],d,r)}return c}function wN(e,t=[],n=[],r="",i=!1){let o=(l,c,h=i,d)=>{let g={relativePath:d===void 0?l.path||"":d,caseSensitive:l.caseSensitive===!0,childrenIndex:c,route:l};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(r)&&h)return;Rn(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=Os([r,g.relativePath]),v=n.concat(g);l.children&&l.children.length>0&&(Rn(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),wN(l.children,t,v,p,h)),!(l.path==null&&!l.index)&&t.push({path:p,score:cz(p,l.index),routesMeta:v})};return e.forEach((l,c)=>{var h;if(l.path===""||!((h=l.path)!=null&&h.includes("?")))o(l,c);else for(let d of SN(l.path))o(l,c,!0,d)}),t}function SN(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return i?[o,""]:[o];let l=SN(r.join("/")),c=[];return c.push(...l.map(h=>h===""?o:[o,h].join("/"))),i&&c.push(...l),c.map(h=>e.startsWith("/")&&h===""?"/":h)}function nz(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:uz(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var rz=/^:[\w-]+$/,iz=3,sz=2,oz=1,az=10,lz=-2,Jk=e=>e==="*";function cz(e,t){let n=e.split("/"),r=n.length;return n.some(Jk)&&(r+=lz),t&&(r+=sz),n.filter(i=>!Jk(i)).reduce((i,o)=>i+(rz.test(o)?iz:o===""?oz:az),r)}function uz(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function dz(e,t,n=!1){let{routesMeta:r}=e,i={},o="/",l=[];for(let c=0;c<r.length;++c){let h=r[c],d=c===r.length-1,g=o==="/"?t:t.slice(o.length)||"/",p=np({path:h.relativePath,caseSensitive:h.caseSensitive,end:d},g),v=h.route;if(!p&&d&&n&&!r[r.length-1].route.index&&(p=np({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},g)),!p)return null;Object.assign(i,p.params),l.push({params:i,pathname:Os([o,p.pathname]),pathnameBase:vz(Os([o,p.pathnameBase])),route:v}),p.pathnameBase!=="/"&&(o=Os([o,p.pathnameBase]))}return l}function np(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=hz(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let o=i[0],l=o.replace(/(.)\/+$/,"$1"),c=i.slice(1);return{params:r.reduce((d,{paramName:g,isOptional:p},v)=>{if(g==="*"){let w=c[v]||"";l=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const b=c[v];return p&&!b?d[g]=void 0:d[g]=(b||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:l,pattern:e}}function hz(e,t=!1,n=!0){Ki(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=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,c,h,d,g)=>{if(r.push({paramName:c,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:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function fz(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ki(!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 go(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 mz=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function pz(e,t="/"){let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Xc(e):e,o;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?o=e2(n.substring(1),"/"):o=e2(n,t)):o=t,{pathname:o,search:_z(r),hash:yz(i)}}function e2(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Q_(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 gz(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function c0(e){let t=gz(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Kp(e,t,n,r=!1){let i;typeof e=="string"?i=Xc(e):(i={...e},Rn(!i.pathname||!i.pathname.includes("?"),Q_("?","pathname","search",i)),Rn(!i.pathname||!i.pathname.includes("#"),Q_("#","pathname","hash",i)),Rn(!i.search||!i.search.includes("#"),Q_("#","search","hash",i)));let o=e===""||i.pathname==="",l=o?"/":i.pathname,c;if(l==null)c=n;else{let p=t.length-1;if(!r&&l.startsWith("..")){let v=l.split("/");for(;v[0]==="..";)v.shift(),p-=1;i.pathname=v.join("/")}c=p>=0?t[p]:"/"}let h=pz(i,c),d=l&&l!=="/"&&l.endsWith("/"),g=(o||l===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(d||g)&&(h.pathname+="/"),h}var Os=e=>e.join("/").replace(/\/\/+/g,"/"),vz=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),_z=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,yz=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,bz=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 xz(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function wz(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var CN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function kN(e,t){let n=e;if(typeof n!="string"||!mz.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(CN)try{let o=new URL(window.location.href),l=n.startsWith("//")?new URL(o.protocol+n):new URL(n),c=go(l.pathname,t);l.origin===o.origin&&c!=null?n=c+l.search+l.hash:i=!0}catch{Ki(!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:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var EN=["POST","PUT","PATCH","DELETE"];new Set(EN);var Sz=["GET",...EN];new Set(Sz);var Zc=_.createContext(null);Zc.displayName="DataRouter";var Gp=_.createContext(null);Gp.displayName="DataRouterState";var Cz=_.createContext(!1),RN=_.createContext({isTransitioning:!1});RN.displayName="ViewTransition";var kz=_.createContext(new Map);kz.displayName="Fetchers";var Ez=_.createContext(null);Ez.displayName="Await";var Ci=_.createContext(null);Ci.displayName="Navigation";var mh=_.createContext(null);mh.displayName="Location";var Gi=_.createContext({outlet:null,matches:[],isDataRoute:!1});Gi.displayName="Route";var u0=_.createContext(null);u0.displayName="RouteError";var TN="REACT_ROUTER_ERROR",Rz="REDIRECT",Tz="ROUTE_ERROR_RESPONSE";function Nz(e){if(e.startsWith(`${TN}:${Rz}:{`))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 Mz(e){if(e.startsWith(`${TN}:${Tz}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new bz(t.status,t.statusText,t.data)}catch{}}function Az(e,{relative:t}={}){Rn(Qc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=_.useContext(Ci),{hash:i,pathname:o,search:l}=ph(e,{relative:t}),c=o;return n!=="/"&&(c=o==="/"?n:Os([n,o])),r.createHref({pathname:c,search:l,hash:i})}function Qc(){return _.useContext(mh)!=null}function Yi(){return Rn(Qc(),"useLocation() may be used only in the context of a <Router> component."),_.useContext(mh).location}var NN="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function MN(e){_.useContext(Ci).static||_.useLayoutEffect(e)}function kl(){let{isDataRoute:e}=_.useContext(Gi);return e?Wz():jz()}function jz(){Rn(Qc(),"useNavigate() may be used only in the context of a <Router> component.");let e=_.useContext(Zc),{basename:t,navigator:n}=_.useContext(Ci),{matches:r}=_.useContext(Gi),{pathname:i}=Yi(),o=JSON.stringify(c0(r)),l=_.useRef(!1);return MN(()=>{l.current=!0}),_.useCallback((h,d={})=>{if(Ki(l.current,NN),!l.current)return;if(typeof h=="number"){n.go(h);return}let g=Kp(h,JSON.parse(o),i,d.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Os([t,g.pathname])),(d.replace?n.replace:n.push)(g,d.state,d)},[t,n,o,i,e])}var AN=_.createContext(null);function Yp(){return _.useContext(AN)}function Dz(e){let t=_.useContext(Gi).outlet;return _.useMemo(()=>t&&_.createElement(AN.Provider,{value:e},t),[t,e])}function jN(){let{matches:e}=_.useContext(Gi),t=e[e.length-1];return t?t.params:{}}function ph(e,{relative:t}={}){let{matches:n}=_.useContext(Gi),{pathname:r}=Yi(),i=JSON.stringify(c0(n));return _.useMemo(()=>Kp(e,JSON.parse(i),r,t==="path"),[e,i,r,t])}function Oz(e,t){return DN(e,t)}function DN(e,t,n){var C;Rn(Qc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=_.useContext(Ci),{matches:i}=_.useContext(Gi),o=i[i.length-1],l=o?o.params:{},c=o?o.pathname:"/",h=o?o.pathnameBase:"/",d=o&&o.route;{let k=d&&d.path||"";LN(c,!d||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (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=Yi(),p;if(t){let k=typeof t=="string"?Xc(t):t;Rn(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||"/",b=v;if(h!=="/"){let k=h.replace(/^\//,"").split("/");b="/"+v.replace(/^\//,"").split("/").slice(k.length).join("/")}let w=xN(e,{pathname:b});Ki(d||w!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Ki(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=Bz(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:Os([h,r.encodeLocation?r.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?h:Os([h,r.encodeLocation?r.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),i,n);return t&&S?_.createElement(mh.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...p},navigationType:"POP"}},S):S}function Lz(){let e=Vz(),t=xz(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)",i={padding:"0.5rem",backgroundColor:r},o={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:o},"ErrorBoundary")," or"," ",_.createElement("code",{style:o},"errorElement")," prop on your route.")),_.createElement(_.Fragment,null,_.createElement("h2",null,"Unexpected Application Error!"),_.createElement("h3",{style:{fontStyle:"italic"}},t),n?_.createElement("pre",{style:i},n):null,l)}var zz=_.createElement(Lz,null),ON=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=Mz(e.digest);n&&(e=n)}let t=e!==void 0?_.createElement(Gi.Provider,{value:this.props.routeContext},_.createElement(u0.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?_.createElement(Pz,{error:e},t):t}};ON.contextType=Cz;var J_=new WeakMap;function Pz({children:e,error:t}){let{basename:n}=_.useContext(Ci);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=Nz(t.digest);if(r){let i=J_.get(t);if(i)throw i;let o=kN(r.location,n);if(CN&&!J_.get(t))if(o.isExternal||r.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:r.replace}));throw J_.set(t,l),l}return _.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function Iz({routeContext:e,match:t,children:n}){let r=_.useContext(Zc);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),_.createElement(Gi.Provider,{value:e},n)}function Bz(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 i=e,o=r==null?void 0:r.errors;if(o!=null){let g=i.findIndex(p=>p.route.id&&(o==null?void 0:o[p.route.id])!==void 0);Rn(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),i=i.slice(0,Math.min(i.length,g+1))}let l=!1,c=-1;if(n&&r){l=r.renderFallback;for(let g=0;g<i.length;g++){let p=i[g];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(c=g),p.route.id){let{loaderData:v,errors:b}=r,w=p.route.loader&&!v.hasOwnProperty(p.route.id)&&(!b||b[p.route.id]===void 0);if(p.route.lazy||w){n.isStatic&&(l=!0),c>=0?i=i.slice(0,c+1):i=[i[0]];break}}}}let h=n==null?void 0:n.onError,d=r&&h?(g,p)=>{var v,b;h(g,{location:r.location,params:((b=(v=r.matches)==null?void 0:v[0])==null?void 0:b.params)??{},unstable_pattern:wz(r.matches),errorInfo:p})}:void 0;return i.reduceRight((g,p,v)=>{let b,w=!1,S=null,C=null;r&&(b=o&&p.route.id?o[p.route.id]:void 0,S=p.route.errorElement||zz,l&&(c<0&&v===0?(LN("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,C=null):c===v&&(w=!0,C=p.route.hydrateFallbackElement||null)));let k=t.concat(i.slice(0,v+1)),R=()=>{let E;return b?E=S:w?E=C:p.route.Component?E=_.createElement(p.route.Component,null):p.route.element?E=p.route.element:E=g,_.createElement(Iz,{match:p,routeContext:{outlet:g,matches:k,isDataRoute:r!=null},children:E})};return r&&(p.route.ErrorBoundary||p.route.errorElement||v===0)?_.createElement(ON,{location:r.location,revalidation:r.revalidation,component:S,error:b,children:R(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:d}):R()},null)}function d0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Fz(e){let t=_.useContext(Zc);return Rn(t,d0(e)),t}function Hz(e){let t=_.useContext(Gp);return Rn(t,d0(e)),t}function $z(e){let t=_.useContext(Gi);return Rn(t,d0(e)),t}function h0(e){let t=$z(e),n=t.matches[t.matches.length-1];return Rn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Uz(){return h0("useRouteId")}function Vz(){var r;let e=_.useContext(u0),t=Hz("useRouteError"),n=h0("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function Wz(){let{router:e}=Fz("useNavigate"),t=h0("useNavigate"),n=_.useRef(!1);return MN(()=>{n.current=!0}),_.useCallback(async(i,o={})=>{Ki(n.current,NN),n.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...o}))},[e,t])}var t2={};function LN(e,t,n){!t&&!t2[e]&&(t2[e]=!0,Ki(!1,n))}_.memo(qz);function qz({routes:e,future:t,state:n,isStatic:r,onError:i}){return DN(e,void 0,{state:n,isStatic:r,onError:i})}function Kz({to:e,replace:t,state:n,relative:r}){Rn(Qc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=_.useContext(Ci);Ki(!i,"<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:o}=_.useContext(Gi),{pathname:l}=Yi(),c=kl(),h=Kp(e,c0(o),l,r==="path"),d=JSON.stringify(h);return _.useEffect(()=>{c(JSON.parse(d),{replace:t,state:n,relative:r})},[c,d,r,t,n]),null}function Gz(e){return Dz(e.context)}function el(e){Rn(!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 Yz({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:i,static:o=!1,unstable_useTransitions:l}){Rn(!Qc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),h=_.useMemo(()=>({basename:c,navigator:i,static:o,unstable_useTransitions:l,future:{}}),[c,i,o,l]);typeof n=="string"&&(n=Xc(n));let{pathname:d="/",search:g="",hash:p="",state:v=null,key:b="default",unstable_mask:w}=n,S=_.useMemo(()=>{let C=go(d,c);return C==null?null:{location:{pathname:C,search:g,hash:p,state:v,key:b,unstable_mask:w},navigationType:r}},[c,d,g,p,v,b,r,w]);return Ki(S!=null,`<Router basename="${c}"> 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(Ci.Provider,{value:h},_.createElement(mh.Provider,{children:t,value:S}))}function Xz({children:e,location:t}){return Oz(gb(e),t)}function gb(e,t=[]){let n=[];return _.Children.forEach(e,(r,i)=>{if(!_.isValidElement(r))return;let o=[...t,i];if(r.type===_.Fragment){n.push.apply(n,gb(r.props.children,o));return}Rn(r.type===el,`[${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>`),Rn(!r.props.index||!r.props.children,"An index route cannot have child routes.");let l={id:r.props.id||o.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=gb(r.props.children,o)),n.push(l)}),n}var Bm="get",Fm="application/x-www-form-urlencoded";function Xp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Zz(e){return Xp(e)&&e.tagName.toLowerCase()==="button"}function Qz(e){return Xp(e)&&e.tagName.toLowerCase()==="form"}function Jz(e){return Xp(e)&&e.tagName.toLowerCase()==="input"}function eP(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function tP(e,t){return e.button===0&&(!t||t==="_self")&&!eP(e)}function vb(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(i=>[n,i]):[[n,r]])},[]))}function nP(e,t){let n=vb(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(o=>{n.append(i,o)})}),n}var rm=null;function rP(){if(rm===null)try{new FormData(document.createElement("form"),0),rm=!1}catch{rm=!0}return rm}var iP=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ey(e){return e!=null&&!iP.has(e)?(Ki(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Fm}"`),null):e}function sP(e,t){let n,r,i,o,l;if(Qz(e)){let c=e.getAttribute("action");r=c?go(c,t):null,n=e.getAttribute("method")||Bm,i=ey(e.getAttribute("enctype"))||Fm,o=new FormData(e)}else if(Zz(e)||Jz(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=e.getAttribute("formaction")||c.getAttribute("action");if(r=h?go(h,t):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||Bm,i=ey(e.getAttribute("formenctype"))||ey(c.getAttribute("enctype"))||Fm,o=new FormData(c,e),!rP()){let{name:d,type:g,value:p}=e;if(g==="image"){let v=d?`${d}.`:"";o.append(`${v}x`,"0"),o.append(`${v}y`,"0")}else d&&o.append(d,p)}}else{if(Xp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Bm,r=null,i=Fm,l=e}return o&&i==="text/plain"&&(l=o,o=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:o,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function f0(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function oP(e,t,n,r){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:t&&go(i.pathname,t)==="/"?i.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${r}`,i}async function aP(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 lP(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 cP(e,t,n){let r=await Promise.all(e.map(async i=>{let o=t.routes[i.route.id];if(o){let l=await aP(o,n);return l.links?l.links():[]}return[]}));return fP(r.flat(1).filter(lP).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function n2(e,t,n,r,i,o){let l=(h,d)=>n[d]?h.route.id!==n[d].route.id:!0,c=(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 o==="assets"?t.filter((h,d)=>l(h,d)||c(h,d)):o==="data"?t.filter((h,d)=>{var p;let g=r.routes[h.route.id];if(!g||!g.hasLoader)return!1;if(l(h,d)||c(h,d))return!0;if(h.route.shouldRevalidate){let v=h.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.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 uP(e,t,{includeHydrateFallback:n}={}){return dP(e.map(r=>{let i=t.routes[r.route.id];if(!i)return[];let o=[i.module];return i.clientActionModule&&(o=o.concat(i.clientActionModule)),i.clientLoaderModule&&(o=o.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(o=o.concat(i.hydrateFallbackModule)),i.imports&&(o=o.concat(i.imports)),o}).flat(1))}function dP(e){return[...new Set(e)]}function hP(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function fP(e,t){let n=new Set;return new Set(t),e.reduce((r,i)=>{let o=JSON.stringify(hP(i));return n.has(o)||(n.add(o),r.push({key:o,link:i})),r},[])}function zN(){let e=_.useContext(Zc);return f0(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function mP(){let e=_.useContext(Gp);return f0(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var m0=_.createContext(void 0);m0.displayName="FrameworkContext";function PN(){let e=_.useContext(m0);return f0(e,"You must render this element inside a <HydratedRouter> element"),e}function pP(e,t){let n=_.useContext(m0),[r,i]=_.useState(!1),[o,l]=_.useState(!1),{onFocus:c,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 b=()=>{i(!0)},w=()=>{i(!1),l(!1)};return n?e!=="intent"?[o,v,{}]:[o,v,{onFocus:ld(c,b),onBlur:ld(h,w),onMouseEnter:ld(d,b),onMouseLeave:ld(g,w),onTouchStart:ld(p,b)}]:[!1,v,{}]}function ld(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function gP({page:e,...t}){let{router:n}=zN(),r=_.useMemo(()=>xN(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?_.createElement(_P,{page:e,matches:r,...t}):null}function vP(e){let{manifest:t,routeModules:n}=PN(),[r,i]=_.useState([]);return _.useEffect(()=>{let o=!1;return cP(e,t,n).then(l=>{o||i(l)}),()=>{o=!0}},[e,t,n]),r}function _P({page:e,matches:t,...n}){let r=Yi(),{future:i,manifest:o,routeModules:l}=PN(),{basename:c}=zN(),{loaderData:h,matches:d}=mP(),g=_.useMemo(()=>n2(e,t,d,o,r,"data"),[e,t,d,o,r]),p=_.useMemo(()=>n2(e,t,d,o,r,"assets"),[e,t,d,o,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=o.routes[R.route.id];!E||!E.hasLoader||(!g.some(L=>L.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=oP(e,c,i.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]},[c,i.unstable_trailingSlashAwareDataRequests,h,r,o,g,t,e,l]),b=_.useMemo(()=>uP(p,o),[p,o]),w=vP(p);return _.createElement(_.Fragment,null,v.map(S=>_.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...n})),b.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 yP(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var bP=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{bP&&(window.__reactRouterVersion="7.13.2")}catch{}function xP({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=_.useRef();i.current==null&&(i.current=ZL({window:r,v5Compat:!0}));let o=i.current,[l,c]=_.useState({action:o.action,location:o.location}),h=_.useCallback(d=>{n===!1?c(d):_.startTransition(()=>c(d))},[n]);return _.useLayoutEffect(()=>o.listen(h),[o,h]),_.createElement(Yz,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:o,unstable_useTransitions:n})}var IN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,BN=_.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:i,reloadDocument:o,replace:l,unstable_mask:c,state:h,target:d,to:g,preventScrollReset:p,viewTransition:v,unstable_defaultShouldRevalidate:b,...w},S){let{basename:C,navigator:k,unstable_useTransitions:R}=_.useContext(Ci),E=typeof g=="string"&&IN.test(g),N=kN(g,C);g=N.to;let L=Az(g,{relative:i}),j=Yi(),D=null;if(c){let V=Kp(c,[],j.unstable_mask?j.unstable_mask.pathname:"/",!0);C!=="/"&&(V.pathname=V.pathname==="/"?C:Os([C,V.pathname])),D=k.createHref(V)}let[H,Y,P]=pP(r,w),q=kP(g,{replace:l,unstable_mask:c,state:h,target:d,preventScrollReset:p,relative:i,viewTransition:v,unstable_defaultShouldRevalidate:b,unstable_useTransitions:R});function F(V){t&&t(V),V.defaultPrevented||q(V)}let U=!(N.isExternal||o),W=_.createElement("a",{...w,...P,href:(U?D:void 0)||N.absoluteURL||L,onClick:U?F:t,ref:yP(S,Y),target:d,"data-discover":!E&&n==="render"?"true":void 0});return H&&!E?_.createElement(_.Fragment,null,W,_.createElement(gP,{page:L})):W});BN.displayName="Link";var wP=_.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:i=!1,style:o,to:l,viewTransition:c,children:h,...d},g){let p=ph(l,{relative:d.relative}),v=Yi(),b=_.useContext(Gp),{navigator:w,basename:S}=_.useContext(Ci),C=b!=null&&AP(p)&&c===!0,k=w.encodeLocation?w.encodeLocation(p).pathname:p.pathname,R=v.pathname,E=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(R=R.toLowerCase(),E=E?E.toLowerCase():null,k=k.toLowerCase()),E&&S&&(E=go(E,S)||E);const N=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let L=R===k||!i&&R.startsWith(k)&&R.charAt(N)==="/",j=E!=null&&(E===k||!i&&E.startsWith(k)&&E.charAt(k.length)==="/"),D={isActive:L,isPending:j,isTransitioning:C},H=L?t:void 0,Y;typeof r=="function"?Y=r(D):Y=[r,L?"active":null,j?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let P=typeof o=="function"?o(D):o;return _.createElement(BN,{...d,"aria-current":H,className:Y,ref:g,style:P,to:l,viewTransition:c},typeof h=="function"?h(D):h)});wP.displayName="NavLink";var SP=_.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:o,method:l=Bm,action:c,onSubmit:h,relative:d,preventScrollReset:g,viewTransition:p,unstable_defaultShouldRevalidate:v,...b},w)=>{let{unstable_useTransitions:S}=_.useContext(Ci),C=NP(),k=MP(c,{relative:d}),R=l.toLowerCase()==="get"?"get":"post",E=typeof c=="string"&&IN.test(c),N=L=>{if(h&&h(L),L.defaultPrevented)return;L.preventDefault();let j=L.nativeEvent.submitter,D=(j==null?void 0:j.getAttribute("formmethod"))||l,H=()=>C(j||L.currentTarget,{fetcherKey:t,method:D,navigate:n,replace:i,state:o,relative:d,preventScrollReset:g,viewTransition:p,unstable_defaultShouldRevalidate:v});S&&n!==!1?_.startTransition(()=>H()):H()};return _.createElement("form",{ref:w,method:R,action:k,onSubmit:r?h:N,...b,"data-discover":!E&&e==="render"?"true":void 0})});SP.displayName="Form";function CP(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function FN(e){let t=_.useContext(Zc);return Rn(t,CP(e)),t}function kP(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:o,relative:l,viewTransition:c,unstable_defaultShouldRevalidate:h,unstable_useTransitions:d}={}){let g=kl(),p=Yi(),v=ph(e,{relative:l});return _.useCallback(b=>{if(tP(b,t)){b.preventDefault();let w=n!==void 0?n:Kd(p)===Kd(v),S=()=>g(e,{replace:w,unstable_mask:r,state:i,preventScrollReset:o,relative:l,viewTransition:c,unstable_defaultShouldRevalidate:h});d?_.startTransition(()=>S()):S()}},[p,g,v,n,r,i,t,e,o,l,c,h,d])}function EP(e){Ki(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(vb(e)),n=_.useRef(!1),r=Yi(),i=_.useMemo(()=>nP(r.search,n.current?null:t.current),[r.search]),o=kl(),l=_.useCallback((c,h)=>{const d=vb(typeof c=="function"?c(new URLSearchParams(i)):c);n.current=!0,o("?"+d,h)},[o,i]);return[i,l]}var RP=0,TP=()=>`__${String(++RP)}__`;function NP(){let{router:e}=FN("useSubmit"),{basename:t}=_.useContext(Ci),n=Uz(),r=e.fetch,i=e.navigate;return _.useCallback(async(o,l={})=>{let{action:c,method:h,encType:d,formData:g,body:p}=sP(o,t);if(l.navigate===!1){let v=l.fetcherKey||TP();await r(v,n,l.action||c,{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 i(l.action||c,{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,i,t,n])}function MP(e,{relative:t}={}){let{basename:n}=_.useContext(Ci),r=_.useContext(Gi);Rn(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),o={...ph(e||".",{relative:t})},l=Yi();if(e==null){o.search=l.search;let c=new URLSearchParams(o.search),h=c.getAll("index");if(h.some(g=>g==="")){c.delete("index"),h.filter(p=>p).forEach(p=>c.append("index",p));let g=c.toString();o.search=g?`?${g}`:""}}return(!e||e===".")&&i.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Os([n,o.pathname])),Kd(o)}function AP(e,{relative:t}={}){let n=_.useContext(RN);Rn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=FN("useViewTransitionState"),i=ph(e,{relative:t});if(!n.isTransitioning)return!1;let o=go(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=go(n.nextLocation.pathname,r)||n.nextLocation.pathname;return np(i.pathname,l)!=null||np(i.pathname,o)!=null}var ss=bN();const HN=qp(ss);function jP(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 DP=e=>{switch(e){case"success":return zP;case"info":return IP;case"warning":return PP;case"error":return BP;default:return null}},OP=Array(12).fill(0),LP=({visible:e,className:t})=>xe.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},xe.createElement("div",{className:"sonner-spinner"},OP.map((n,r)=>xe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),zP=xe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},xe.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"})),PP=xe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},xe.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"})),IP=xe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},xe.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"})),BP=xe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},xe.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"})),FP=xe.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"},xe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),xe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),HP=()=>{const[e,t]=xe.useState(document.hidden);return xe.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let _b=1;class $P{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,...i}=t,o=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:_b++,l=this.toasts.find(h=>h.id===o),c=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),l?this.toasts=this.toasts.map(h=>h.id===o?(this.publish({...h,...t,id:o,title:r}),{...h,...t,id:o,dismissible:c,title:r}):h):this.addToast({title:r,...i,dismissible:c,id:o}),o},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 i=Promise.resolve(t instanceof Function?t():t);let o=r!==void 0,l;const c=i.then(async d=>{if(l=["resolve",d],xe.isValidElement(d))o=!1,this.create({id:r,type:"default",message:d});else if(VP(d)&&!d.ok){o=!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"&&!xe.isValidElement(p)?p:{message:p};this.create({id:r,type:"error",description:v,...w})}else if(d instanceof Error){o=!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"&&!xe.isValidElement(p)?p:{message:p};this.create({id:r,type:"error",description:v,...w})}else if(n.success!==void 0){o=!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"&&!xe.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){o=!1;const g=typeof n.error=="function"?await n.error(d):n.error,p=typeof n.description=="function"?await n.description(d):n.description,b=typeof g=="object"&&!xe.isValidElement(g)?g:{message:g};this.create({id:r,type:"error",description:p,...b})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),h=()=>new Promise((d,g)=>c.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)||_b++;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 ii=new $P,UP=(e,t)=>{const n=(t==null?void 0:t.id)||_b++;return ii.addToast({title:e,...t,id:n}),n},VP=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",WP=UP,qP=()=>ii.toasts,KP=()=>ii.getActiveToasts(),Ec=Object.assign(WP,{success:ii.success,info:ii.info,warning:ii.warning,error:ii.error,custom:ii.custom,message:ii.message,promise:ii.promise,dismiss:ii.dismiss,loading:ii.loading},{getHistory:qP,getToasts:KP});jP("[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 im(e){return e.label!==void 0}const GP=3,YP="24px",XP="16px",r2=4e3,ZP=356,QP=14,JP=45,eI=200;function bs(...e){return e.filter(Boolean).join(" ")}function tI(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const nI=e=>{var t,n,r,i,o,l,c,h,d;const{invert:g,toast:p,unstyled:v,interacting:b,setHeights:w,visibleToasts:S,heights:C,index:k,toasts:R,expanded:E,removeToast:N,defaultRichColors:L,closeButton:j,style:D,cancelButtonStyle:H,actionButtonStyle:Y,className:P="",descriptionClassName:q="",duration:F,position:U,gap:W,expandByDefault:V,classNames:O,icons:$,closeButtonAriaLabel:z="Close toast"}=e,[G,M]=xe.useState(null),[B,Z]=xe.useState(null),[A,ie]=xe.useState(!1),[J,ee]=xe.useState(!1),[re,ce]=xe.useState(!1),[he,pe]=xe.useState(!1),[Se,Re]=xe.useState(!1),[je,Xe]=xe.useState(0),[Et,Rt]=xe.useState(0),fe=xe.useRef(p.duration||F||r2),He=xe.useRef(null),De=xe.useRef(null),mt=k===0,ct=k+1<=S,ot=p.type,fn=p.dismissible!==!1,Ce=p.className||"",tt=p.descriptionClassName||"",oe=xe.useMemo(()=>C.findIndex(Be=>Be.toastId===p.id)||0,[C,p.id]),ve=xe.useMemo(()=>{var Be;return(Be=p.closeButton)!=null?Be:j},[p.closeButton,j]),Ne=xe.useMemo(()=>p.duration||F||r2,[p.duration,F]),Ae=xe.useRef(0),Qe=xe.useRef(0),At=xe.useRef(0),rt=xe.useRef(null),[Oe,qe]=U.split("-"),gt=xe.useMemo(()=>C.reduce((Be,vt,wt)=>wt>=oe?Be:Be+vt.height,0),[C,oe]),Ve=HP(),mn=p.invert||g,sn=ot==="loading";Qe.current=xe.useMemo(()=>oe*W+gt,[oe,gt]),xe.useEffect(()=>{fe.current=Ne},[Ne]),xe.useEffect(()=>{ie(!0)},[]),xe.useEffect(()=>{const Be=De.current;if(Be){const vt=Be.getBoundingClientRect().height;return Rt(vt),w(wt=>[{toastId:p.id,height:vt,position:p.position},...wt]),()=>w(wt=>wt.filter(Tt=>Tt.toastId!==p.id))}},[w,p.id]),xe.useLayoutEffect(()=>{if(!A)return;const Be=De.current,vt=Be.style.height;Be.style.height="auto";const wt=Be.getBoundingClientRect().height;Be.style.height=vt,Rt(wt),w(Tt=>Tt.find(_t=>_t.toastId===p.id)?Tt.map(_t=>_t.toastId===p.id?{..._t,height:wt}:_t):[{toastId:p.id,height:wt,position:p.position},...Tt])},[A,p.title,p.description,w,p.id,p.jsx,p.action,p.cancel]);const Je=xe.useCallback(()=>{ee(!0),Xe(Qe.current),w(Be=>Be.filter(vt=>vt.toastId!==p.id)),setTimeout(()=>{N(p)},eI)},[p,N,w,Qe]);xe.useEffect(()=>{if(p.promise&&ot==="loading"||p.duration===1/0||p.type==="loading")return;let Be;return E||b||Ve?(()=>{if(At.current<Ae.current){const Tt=new Date().getTime()-Ae.current;fe.current=fe.current-Tt}At.current=new Date().getTime()})():(()=>{fe.current!==1/0&&(Ae.current=new Date().getTime(),Be=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),Je()},fe.current))})(),()=>clearTimeout(Be)},[E,b,p,ot,Ve,Je]),xe.useEffect(()=>{p.delete&&(Je(),p.onDismiss==null||p.onDismiss.call(p,p))},[Je,p.delete]);function tn(){var Be;if($!=null&&$.loading){var vt;return xe.createElement("div",{className:bs(O==null?void 0:O.loader,p==null||(vt=p.classNames)==null?void 0:vt.loader,"sonner-loader"),"data-visible":ot==="loading"},$.loading)}return xe.createElement(LP,{className:bs(O==null?void 0:O.loader,p==null||(Be=p.classNames)==null?void 0:Be.loader),visible:ot==="loading"})}const $n=p.icon||($==null?void 0:$[ot])||DP(ot);var Jt,Kt;return xe.createElement("li",{tabIndex:0,ref:De,className:bs(P,Ce,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[ot],p==null||(n=p.classNames)==null?void 0:n[ot]),"data-sonner-toast":"","data-rich-colors":(Jt=p.richColors)!=null?Jt:L,"data-styled":!(p.jsx||p.unstyled||v),"data-mounted":A,"data-promise":!!p.promise,"data-swiped":Se,"data-removed":J,"data-visible":ct,"data-y-position":Oe,"data-x-position":qe,"data-index":k,"data-front":mt,"data-swiping":re,"data-dismissible":fn,"data-type":ot,"data-invert":mn,"data-swipe-out":he,"data-swipe-direction":B,"data-expanded":!!(E||V&&A),"data-testid":p.testId,style:{"--index":k,"--toasts-before":k,"--z-index":R.length-k,"--offset":`${J?je:Qe.current}px`,"--initial-height":V?"auto":`${Et}px`,...D,...p.style},onDragEnd:()=>{ce(!1),M(null),rt.current=null},onPointerDown:Be=>{Be.button!==2&&(sn||!fn||(He.current=new Date,Xe(Qe.current),Be.target.setPointerCapture(Be.pointerId),Be.target.tagName!=="BUTTON"&&(ce(!0),rt.current={x:Be.clientX,y:Be.clientY})))},onPointerUp:()=>{var Be,vt,wt;if(he||!fn)return;rt.current=null;const Tt=Number(((Be=De.current)==null?void 0:Be.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),en=Number(((vt=De.current)==null?void 0:vt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),_t=new Date().getTime()-((wt=He.current)==null?void 0:wt.getTime()),yt=G==="x"?Tt:en,Cn=Math.abs(yt)/_t;if(Math.abs(yt)>=JP||Cn>.11){Xe(Qe.current),p.onDismiss==null||p.onDismiss.call(p,p),Z(G==="x"?Tt>0?"right":"left":en>0?"down":"up"),Je(),pe(!0);return}else{var ke,Le;(ke=De.current)==null||ke.style.setProperty("--swipe-amount-x","0px"),(Le=De.current)==null||Le.style.setProperty("--swipe-amount-y","0px")}Re(!1),ce(!1),M(null)},onPointerMove:Be=>{var vt,wt,Tt;if(!rt.current||!fn||((vt=window.getSelection())==null?void 0:vt.toString().length)>0)return;const _t=Be.clientY-rt.current.y,yt=Be.clientX-rt.current.x;var Cn;const ke=(Cn=e.swipeDirections)!=null?Cn:tI(U);!G&&(Math.abs(yt)>1||Math.abs(_t)>1)&&M(Math.abs(yt)>Math.abs(_t)?"x":"y");let Le={x:0,y:0};const Nt=ut=>1/(1.5+Math.abs(ut)/20);if(G==="y"){if(ke.includes("top")||ke.includes("bottom"))if(ke.includes("top")&&_t<0||ke.includes("bottom")&&_t>0)Le.y=_t;else{const ut=_t*Nt(_t);Le.y=Math.abs(ut)<Math.abs(_t)?ut:_t}}else if(G==="x"&&(ke.includes("left")||ke.includes("right")))if(ke.includes("left")&&yt<0||ke.includes("right")&&yt>0)Le.x=yt;else{const ut=yt*Nt(yt);Le.x=Math.abs(ut)<Math.abs(yt)?ut:yt}(Math.abs(Le.x)>0||Math.abs(Le.y)>0)&&Re(!0),(wt=De.current)==null||wt.style.setProperty("--swipe-amount-x",`${Le.x}px`),(Tt=De.current)==null||Tt.style.setProperty("--swipe-amount-y",`${Le.y}px`)}},ve&&!p.jsx&&ot!=="loading"?xe.createElement("button",{"aria-label":z,"data-disabled":sn,"data-close-button":!0,onClick:sn||!fn?()=>{}:()=>{Je(),p.onDismiss==null||p.onDismiss.call(p,p)},className:bs(O==null?void 0:O.closeButton,p==null||(r=p.classNames)==null?void 0:r.closeButton)},(Kt=$==null?void 0:$.close)!=null?Kt:FP):null,(ot||p.icon||p.promise)&&p.icon!==null&&(($==null?void 0:$[ot])!==null||p.icon)?xe.createElement("div",{"data-icon":"",className:bs(O==null?void 0:O.icon,p==null||(i=p.classNames)==null?void 0:i.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||tn():null,p.type!=="loading"?$n:null):null,xe.createElement("div",{"data-content":"",className:bs(O==null?void 0:O.content,p==null||(o=p.classNames)==null?void 0:o.content)},xe.createElement("div",{"data-title":"",className:bs(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?xe.createElement("div",{"data-description":"",className:bs(q,tt,O==null?void 0:O.description,p==null||(c=p.classNames)==null?void 0:c.description)},typeof p.description=="function"?p.description():p.description):null),xe.isValidElement(p.cancel)?p.cancel:p.cancel&&im(p.cancel)?xe.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||H,onClick:Be=>{im(p.cancel)&&fn&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,Be),Je())},className:bs(O==null?void 0:O.cancelButton,p==null||(h=p.classNames)==null?void 0:h.cancelButton)},p.cancel.label):null,xe.isValidElement(p.action)?p.action:p.action&&im(p.action)?xe.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||Y,onClick:Be=>{im(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,Be),!Be.defaultPrevented&&Je())},className:bs(O==null?void 0:O.actionButton,p==null||(d=p.classNames)==null?void 0:d.actionButton)},p.action.label):null)};function i2(){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 rI(e,t){const n={};return[e,t].forEach((r,i)=>{const o=i===1,l=o?"--mobile-offset":"--offset",c=o?XP:YP;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}`]=c:n[`${l}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):h(c)}),n}const iI=xe.forwardRef(function(t,n){const{id:r,invert:i,position:o="bottom-right",hotkey:l=["altKey","KeyT"],expand:c,closeButton:h,className:d,offset:g,mobileOffset:p,theme:v="light",richColors:b,duration:w,style:S,visibleToasts:C=GP,toastOptions:k,dir:R=i2(),gap:E=QP,icons:N,containerAriaLabel:L="Notifications"}=t,[j,D]=xe.useState([]),H=xe.useMemo(()=>r?j.filter(A=>A.toasterId===r):j.filter(A=>!A.toasterId),[j,r]),Y=xe.useMemo(()=>Array.from(new Set([o].concat(H.filter(A=>A.position).map(A=>A.position)))),[H,o]),[P,q]=xe.useState([]),[F,U]=xe.useState(!1),[W,V]=xe.useState(!1),[O,$]=xe.useState(v!=="system"?v:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),z=xe.useRef(null),G=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=xe.useRef(null),B=xe.useRef(!1),Z=xe.useCallback(A=>{D(ie=>{var J;return(J=ie.find(ee=>ee.id===A.id))!=null&&J.delete||ii.dismiss(A.id),ie.filter(({id:ee})=>ee!==A.id)})},[]);return xe.useEffect(()=>ii.subscribe(A=>{if(A.dismiss){requestAnimationFrame(()=>{D(ie=>ie.map(J=>J.id===A.id?{...J,delete:!0}:J))});return}setTimeout(()=>{HN.flushSync(()=>{D(ie=>{const J=ie.findIndex(ee=>ee.id===A.id);return J!==-1?[...ie.slice(0,J),{...ie[J],...A},...ie.slice(J+1)]:[A,...ie]})})})}),[j]),xe.useEffect(()=>{if(v!=="system"){$(v);return}if(v==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?$("dark"):$("light")),typeof window>"u")return;const A=window.matchMedia("(prefers-color-scheme: dark)");try{A.addEventListener("change",({matches:ie})=>{$(ie?"dark":"light")})}catch{A.addListener(({matches:J})=>{try{$(J?"dark":"light")}catch(ee){console.error(ee)}})}},[v]),xe.useEffect(()=>{j.length<=1&&U(!1)},[j]),xe.useEffect(()=>{const A=ie=>{var J;if(l.every(ce=>ie[ce]||ie.code===ce)){var re;U(!0),(re=z.current)==null||re.focus()}ie.code==="Escape"&&(document.activeElement===z.current||(J=z.current)!=null&&J.contains(document.activeElement))&&U(!1)};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[l]),xe.useEffect(()=>{if(z.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,B.current=!1)}},[z.current]),xe.createElement("section",{ref:n,"aria-label":`${L} ${G}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},Y.map((A,ie)=>{var J;const[ee,re]=A.split("-");return H.length?xe.createElement("ol",{key:A,dir:R==="auto"?i2():R,tabIndex:-1,ref:z,className:d,"data-sonner-toaster":!0,"data-sonner-theme":O,"data-y-position":ee,"data-x-position":re,style:{"--front-toast-height":`${((J=P[0])==null?void 0:J.height)||0}px`,"--width":`${ZP}px`,"--gap":`${E}px`,...S,...rI(g,p)},onBlur:ce=>{B.current&&!ce.currentTarget.contains(ce.relatedTarget)&&(B.current=!1,M.current&&(M.current.focus({preventScroll:!0}),M.current=null))},onFocus:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||B.current||(B.current=!0,M.current=ce.relatedTarget)},onMouseEnter:()=>U(!0),onMouseMove:()=>U(!0),onMouseLeave:()=>{W||U(!1)},onDragEnd:()=>U(!1),onPointerDown:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||V(!0)},onPointerUp:()=>V(!1)},H.filter(ce=>!ce.position&&ie===0||ce.position===A).map((ce,he)=>{var pe,Se;return xe.createElement(nI,{key:ce.id,icons:N,index:he,toast:ce,defaultRichColors:b,duration:(pe=k==null?void 0:k.duration)!=null?pe:w,className:k==null?void 0:k.className,descriptionClassName:k==null?void 0:k.descriptionClassName,invert:i,visibleToasts:C,closeButton:(Se=k==null?void 0:k.closeButton)!=null?Se:h,interacting:W,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:Z,toasts:H.filter(Re=>Re.position==ce.position),heights:P.filter(Re=>Re.position==ce.position),setHeights:q,expandByDefault:c,gap:E,expanded:F,swipeDirections:t.swipeDirections})})):null}))});function $N(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=$N(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function UN(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=$N(e))&&(r&&(r+=" "),r+=t);return r}const s2=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,o2=UN,sI=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return o2(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=t,l=Object.keys(i).map(d=>{const g=n==null?void 0:n[d],p=o==null?void 0:o[d];if(g===null)return null;const v=s2(g)||s2(p);return i[d][v]}),c=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,...b}=g;return Object.entries(b).every(w=>{let[S,C]=w;return Array.isArray(C)?C.includes({...o,...c}[S]):{...o,...c}[S]===C})?[...d,p,v]:d},[]);return o2(e,l,h,n==null?void 0:n.class,n==null?void 0:n.className)},oI=(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},aI=(e,t)=>({classGroupId:e,validator:t}),VN=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),rp="-",a2=[],lI="arbitrary..",cI=e=>{const t=dI(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return uI(l);const c=l.split(rp),h=c[0]===""&&c.length>1?1:0;return WN(c,h,t)},getConflictingClassGroupIds:(l,c)=>{if(c){const h=r[l],d=n[l];return h?d?oI(d,h):h:d||a2}return n[l]||a2}}},WN=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],o=n.nextPart.get(i);if(o){const d=WN(e,t+1,o);if(d)return d}const l=n.validators;if(l===null)return;const c=t===0?e.join(rp):e.slice(t).join(rp),h=l.length;for(let d=0;d<h;d++){const g=l[d];if(g.validator(c))return g.classGroupId}},uI=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?lI+r:void 0})(),dI=e=>{const{theme:t,classGroups:n}=e;return hI(n,t)},hI=(e,t)=>{const n=VN();for(const r in e){const i=e[r];p0(i,n,r,t)}return n},p0=(e,t,n,r)=>{const i=e.length;for(let o=0;o<i;o++){const l=e[o];fI(l,t,n,r)}},fI=(e,t,n,r)=>{if(typeof e=="string"){mI(e,t,n);return}if(typeof e=="function"){pI(e,t,n,r);return}gI(e,t,n,r)},mI=(e,t,n)=>{const r=e===""?t:qN(t,e);r.classGroupId=n},pI=(e,t,n,r)=>{if(vI(e)){p0(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(aI(n,e))},gI=(e,t,n,r)=>{const i=Object.entries(e),o=i.length;for(let l=0;l<o;l++){const[c,h]=i[l];p0(h,qN(t,c),n,r)}},qN=(e,t)=>{let n=e;const r=t.split(rp),i=r.length;for(let o=0;o<i;o++){const l=r[o];let c=n.nextPart.get(l);c||(c=VN(),n.nextPart.set(l,c)),n=c}return n},vI=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,_I=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(o,l)=>{n[o]=l,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let l=n[o];if(l!==void 0)return l;if((l=r[o])!==void 0)return i(o,l),l},set(o,l){o in n?n[o]=l:i(o,l)}}},yb="!",l2=":",yI=[],c2=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),bI=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const o=[];let l=0,c=0,h=0,d;const g=i.length;for(let S=0;S<g;S++){const C=i[S];if(l===0&&c===0){if(C===l2){o.push(i.slice(h,S)),h=S+1;continue}if(C==="/"){d=S;continue}}C==="["?l++:C==="]"?l--:C==="("?c++:C===")"&&c--}const p=o.length===0?i:i.slice(h);let v=p,b=!1;p.endsWith(yb)?(v=p.slice(0,-1),b=!0):p.startsWith(yb)&&(v=p.slice(1),b=!0);const w=d&&d>h?d-h:void 0;return c2(o,b,v,w)};if(t){const i=t+l2,o=r;r=l=>l.startsWith(i)?o(l.slice(i.length)):c2(yI,!1,l,void 0,!0)}if(n){const i=r;r=o=>n({className:o,parseClassName:i})}return r},xI=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let o=0;o<n.length;o++){const l=n[o],c=l[0]==="[",h=t.has(l);c||h?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(l)):i.push(l)}return i.length>0&&(i.sort(),r.push(...i)),r}},wI=e=>({cache:_I(e.cacheSize),parseClassName:bI(e),sortModifiers:xI(e),...cI(e)}),SI=/\s+/,CI=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:o}=t,l=[],c=e.trim().split(SI);let h="";for(let d=c.length-1;d>=0;d-=1){const g=c[d],{isExternal:p,modifiers:v,hasImportantModifier:b,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]:o(v).join(":"),E=b?R+yb:R,N=E+k;if(l.indexOf(N)>-1)continue;l.push(N);const L=i(k,C);for(let j=0;j<L.length;++j){const D=L[j];l.push(E+D)}h=g+(h.length>0?" "+h:h)}return h},kI=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=KN(n))&&(i&&(i+=" "),i+=r);return i},KN=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=KN(e[r]))&&(n&&(n+=" "),n+=t);return n},EI=(e,...t)=>{let n,r,i,o;const l=h=>{const d=t.reduce((g,p)=>p(g),e());return n=wI(d),r=n.cache.get,i=n.cache.set,o=c,c(h)},c=h=>{const d=r(h);if(d)return d;const g=CI(h,n);return i(h,g),g};return o=l,(...h)=>o(kI(...h))},RI=[],nr=e=>{const t=n=>n[e]||RI;return t.isThemeGetter=!0,t},GN=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,YN=/^\((?:(\w[\w-]*):)?(.+)\)$/i,TI=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,NI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,MI=/\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$/,AI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,jI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,DI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ta=e=>TI.test(e),Ct=e=>!!e&&!Number.isNaN(Number(e)),na=e=>!!e&&Number.isInteger(Number(e)),ty=e=>e.endsWith("%")&&Ct(e.slice(0,-1)),oo=e=>NI.test(e),XN=()=>!0,OI=e=>MI.test(e)&&!AI.test(e),g0=()=>!1,LI=e=>jI.test(e),zI=e=>DI.test(e),PI=e=>!We(e)&&!Ke(e),II=e=>Ca(e,JN,g0),We=e=>GN.test(e),Ka=e=>Ca(e,eM,OI),u2=e=>Ca(e,qI,Ct),BI=e=>Ca(e,nM,XN),FI=e=>Ca(e,tM,g0),d2=e=>Ca(e,ZN,g0),HI=e=>Ca(e,QN,zI),sm=e=>Ca(e,rM,LI),Ke=e=>YN.test(e),cd=e=>El(e,eM),$I=e=>El(e,tM),h2=e=>El(e,ZN),UI=e=>El(e,JN),VI=e=>El(e,QN),om=e=>El(e,rM,!0),WI=e=>El(e,nM,!0),Ca=(e,t,n)=>{const r=GN.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},El=(e,t,n=!1)=>{const r=YN.exec(e);return r?r[1]?t(r[1]):n:!1},ZN=e=>e==="position"||e==="percentage",QN=e=>e==="image"||e==="url",JN=e=>e==="length"||e==="size"||e==="bg-size",eM=e=>e==="length",qI=e=>e==="number",tM=e=>e==="family-name",nM=e=>e==="number"||e==="weight",rM=e=>e==="shadow",KI=()=>{const e=nr("color"),t=nr("font"),n=nr("text"),r=nr("font-weight"),i=nr("tracking"),o=nr("leading"),l=nr("breakpoint"),c=nr("container"),h=nr("spacing"),d=nr("radius"),g=nr("shadow"),p=nr("inset-shadow"),v=nr("text-shadow"),b=nr("drop-shadow"),w=nr("blur"),S=nr("perspective"),C=nr("aspect"),k=nr("ease"),R=nr("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"],L=()=>[...N(),Ke,We],j=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],H=()=>[Ke,We,h],Y=()=>[ta,"full","auto",...H()],P=()=>[na,"none","subgrid",Ke,We],q=()=>["auto",{span:["full",na,Ke,We]},na,Ke,We],F=()=>[na,"auto",Ke,We],U=()=>["auto","min","max","fr",Ke,We],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],O=()=>["auto",...H()],$=()=>[ta,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],z=()=>[ta,"screen","full","dvw","lvw","svw","min","max","fit",...H()],G=()=>[ta,"screen","full","lh","dvh","lvh","svh","min","max","fit",...H()],M=()=>[e,Ke,We],B=()=>[...N(),h2,d2,{position:[Ke,We]}],Z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",UI,II,{size:[Ke,We]}],ie=()=>[ty,cd,Ka],J=()=>["","none","full",d,Ke,We],ee=()=>["",Ct,cd,Ka],re=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],he=()=>[Ct,ty,h2,d2],pe=()=>["","none",w,Ke,We],Se=()=>["none",Ct,Ke,We],Re=()=>["none",Ct,Ke,We],je=()=>[Ct,Ke,We],Xe=()=>[ta,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[oo],breakpoint:[oo],color:[XN],container:[oo],"drop-shadow":[oo],ease:["in","out","in-out"],font:[PI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[oo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[oo],shadow:[oo],spacing:["px",Ct],text:[oo],"text-shadow":[oo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ta,We,Ke,C]}],container:["container"],columns:[{columns:[Ct,We,Ke,c]}],"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:L()}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],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:[na,"auto",Ke,We]}],basis:[{basis:[ta,"full","auto",c,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ct,ta,"auto","initial","none",We]}],grow:[{grow:["",Ct,Ke,We]}],shrink:[{shrink:["",Ct,Ke,We]}],order:[{order:[na,"first","last","none",Ke,We]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:q()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:q()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":U()}],"auto-rows":[{"auto-rows":U()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:H()}],px:[{px:H()}],py:[{py:H()}],ps:[{ps:H()}],pe:[{pe:H()}],pbs:[{pbs:H()}],pbe:[{pbe:H()}],pt:[{pt:H()}],pr:[{pr:H()}],pb:[{pb:H()}],pl:[{pl:H()}],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":H()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":H()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],"inline-size":[{inline:["auto",...z()]}],"min-inline-size":[{"min-inline":["auto",...z()]}],"max-inline-size":[{"max-inline":["none",...z()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],w:[{w:[c,"screen",...$()]}],"min-w":[{"min-w":[c,"screen","none",...$()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",n,cd,Ka]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,WI,BI]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ty,We]}],"font-family":[{font:[$I,FI,t]}],"font-features":[{"font-features":[We]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Ke,We]}],"line-clamp":[{"line-clamp":[Ct,"none",Ke,u2]}],leading:[{leading:[o,...H()]}],"list-image":[{"list-image":["none",Ke,We]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ke,We]}],"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:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ct,"from-font","auto",Ke,Ka]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Ct,"auto",Ke,We]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ke,We]}],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,We]}],"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:Z()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},na,Ke,We],radial:["",Ke,We],conic:[na,Ke,We]},VI,HI]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:J()}],"rounded-s":[{"rounded-s":J()}],"rounded-e":[{"rounded-e":J()}],"rounded-t":[{"rounded-t":J()}],"rounded-r":[{"rounded-r":J()}],"rounded-b":[{"rounded-b":J()}],"rounded-l":[{"rounded-l":J()}],"rounded-ss":[{"rounded-ss":J()}],"rounded-se":[{"rounded-se":J()}],"rounded-ee":[{"rounded-ee":J()}],"rounded-es":[{"rounded-es":J()}],"rounded-tl":[{"rounded-tl":J()}],"rounded-tr":[{"rounded-tr":J()}],"rounded-br":[{"rounded-br":J()}],"rounded-bl":[{"rounded-bl":J()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-bs":[{"border-bs":ee()}],"border-w-be":[{"border-be":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"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:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ct,Ke,We]}],"outline-w":[{outline:["",Ct,cd,Ka]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",g,om,sm]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",p,om,sm]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Ct,Ka]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",v,om,sm]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Ct,Ke,We]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"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":[Ct]}],"mask-image-linear-from-pos":[{"mask-linear-from":he()}],"mask-image-linear-to-pos":[{"mask-linear-to":he()}],"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":he()}],"mask-image-t-to-pos":[{"mask-t-to":he()}],"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":he()}],"mask-image-r-to-pos":[{"mask-r-to":he()}],"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":he()}],"mask-image-b-to-pos":[{"mask-b-to":he()}],"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":he()}],"mask-image-l-to-pos":[{"mask-l-to":he()}],"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":he()}],"mask-image-x-to-pos":[{"mask-x-to":he()}],"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":he()}],"mask-image-y-to-pos":[{"mask-y-to":he()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Ke,We]}],"mask-image-radial-from-pos":[{"mask-radial-from":he()}],"mask-image-radial-to-pos":[{"mask-radial-to":he()}],"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":[Ct]}],"mask-image-conic-from-pos":[{"mask-conic-from":he()}],"mask-image-conic-to-pos":[{"mask-conic-to":he()}],"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:Z()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ke,We]}],filter:[{filter:["","none",Ke,We]}],blur:[{blur:pe()}],brightness:[{brightness:[Ct,Ke,We]}],contrast:[{contrast:[Ct,Ke,We]}],"drop-shadow":[{"drop-shadow":["","none",b,om,sm]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",Ct,Ke,We]}],"hue-rotate":[{"hue-rotate":[Ct,Ke,We]}],invert:[{invert:["",Ct,Ke,We]}],saturate:[{saturate:[Ct,Ke,We]}],sepia:[{sepia:["",Ct,Ke,We]}],"backdrop-filter":[{"backdrop-filter":["","none",Ke,We]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[Ct,Ke,We]}],"backdrop-contrast":[{"backdrop-contrast":[Ct,Ke,We]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ct,Ke,We]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ct,Ke,We]}],"backdrop-invert":[{"backdrop-invert":["",Ct,Ke,We]}],"backdrop-opacity":[{"backdrop-opacity":[Ct,Ke,We]}],"backdrop-saturate":[{"backdrop-saturate":[Ct,Ke,We]}],"backdrop-sepia":[{"backdrop-sepia":["",Ct,Ke,We]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":H()}],"border-spacing-x":[{"border-spacing-x":H()}],"border-spacing-y":[{"border-spacing-y":H()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ke,We]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ct,"initial",Ke,We]}],ease:[{ease:["linear","initial",k,Ke,We]}],delay:[{delay:[Ct,Ke,We]}],animate:[{animate:["none",R,Ke,We]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,Ke,We]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Se()}],"rotate-x":[{"rotate-x":Se()}],"rotate-y":[{"rotate-y":Se()}],"rotate-z":[{"rotate-z":Se()}],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,We,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"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,We]}],"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":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mbs":[{"scroll-mbs":H()}],"scroll-mbe":[{"scroll-mbe":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pbs":[{"scroll-pbs":H()}],"scroll-pbe":[{"scroll-pbe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"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,We]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[Ct,cd,Ka,u2]}],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"]}},GI=EI(KI);function me(...e){return GI(UN(e))}function Od(){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 f2(e){return e.startsWith("chatId:")?e.slice(7):e}const iM=sI("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"}}),et=_.forwardRef(({className:e,variant:t,size:n,...r},i)=>f.jsx("button",{className:me(iM({variant:t,size:n,className:e})),ref:i,...r}));et.displayName="Button";function Fe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function m2(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function v0(...e){return t=>{let n=!1;const r=e.map(i=>{const o=m2(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():m2(e[i],null)}}}}function Qt(...e){return _.useCallback(v0(...e),e)}function YI(e,t){const n=_.createContext(t),r=o=>{const{children:l,...c}=o,h=_.useMemo(()=>c,Object.values(c));return f.jsx(n.Provider,{value:h,children:l})};r.displayName=e+"Provider";function i(o){const l=_.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,i]}function So(e,t=[]){let n=[];function r(o,l){const c=_.createContext(l),h=n.length;n=[...n,l];const d=p=>{var k;const{scope:v,children:b,...w}=p,S=((k=v==null?void 0:v[e])==null?void 0:k[h])||c,C=_.useMemo(()=>w,Object.values(w));return f.jsx(S.Provider,{value:C,children:b})};d.displayName=o+"Provider";function g(p,v){var S;const b=((S=v==null?void 0:v[e])==null?void 0:S[h])||c,w=_.useContext(b);if(w)return w;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[d,g]}const i=()=>{const o=n.map(l=>_.createContext(l));return function(c){const h=(c==null?void 0:c[e])||o;return _.useMemo(()=>({[`__scope${e}`]:{...c,[e]:h}}),[c,h])}};return i.scopeName=e,[r,XI(i,...t)]}function XI(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const l=r.reduce((c,{useScope:h,scopeName:d})=>{const p=h(o)[`__scope${d}`];return{...c,...p}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var Pr=globalThis!=null&&globalThis.document?_.useLayoutEffect:()=>{},ZI=yN[" useId ".trim().toString()]||(()=>{}),QI=0;function po(e){const[t,n]=_.useState(ZI());return Pr(()=>{n(r=>r??String(QI++))},[e]),t?`radix-${t}`:""}var JI=yN[" useInsertionEffect ".trim().toString()]||Pr;function Ic({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,l]=eB({defaultProp:t,onChange:n}),c=e!==void 0,h=c?e:i;{const g=_.useRef(e!==void 0);_.useEffect(()=>{const p=g.current;p!==c&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${c?"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=c},[c,r])}const d=_.useCallback(g=>{var p;if(c){const v=tB(g)?g(e):g;v!==e&&((p=l.current)==null||p.call(l,v))}else o(g)},[c,e,o,l]);return[h,d]}function eB({defaultProp:e,onChange:t}){const[n,r]=_.useState(e),i=_.useRef(n),o=_.useRef(t);return JI(()=>{o.current=t},[t]),_.useEffect(()=>{var l;i.current!==n&&((l=o.current)==null||l.call(o,n),i.current=n)},[n,i]),[n,r,o]}function tB(e){return typeof e=="function"}function fl(e){const t=nB(e),n=_.forwardRef((r,i)=>{const{children:o,...l}=r,c=_.Children.toArray(o),h=c.find(iB);if(h){const d=h.props.children,g=c.map(p=>p===h?_.Children.count(d)>1?_.Children.only(null):_.isValidElement(d)?d.props.children:null:p);return f.jsx(t,{...l,ref:i,children:_.isValidElement(d)?_.cloneElement(d,void 0,g):null})}return f.jsx(t,{...l,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function nB(e){const t=_.forwardRef((n,r)=>{const{children:i,...o}=n;if(_.isValidElement(i)){const l=oB(i),c=sB(o,i.props);return i.type!==_.Fragment&&(c.ref=r?v0(r,l):l),_.cloneElement(i,c)}return _.Children.count(i)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var sM=Symbol("radix.slottable");function rB(e){const t=({children:n})=>f.jsx(f.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=sM,t}function iB(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===sM}function sB(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...c)=>{const h=o(...c);return i(...c),h}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function oB(e){var r,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var aB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Lt=aB.reduce((e,t)=>{const n=fl(`Primitive.${t}`),r=_.forwardRef((i,o)=>{const{asChild:l,...c}=i,h=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(h,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function oM(e,t){e&&ss.flushSync(()=>e.dispatchEvent(t))}function ls(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 lB(e,t=globalThis==null?void 0:globalThis.document){const n=ls(e);_.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var cB="DismissableLayer",bb="dismissableLayer.update",uB="dismissableLayer.pointerDownOutside",dB="dismissableLayer.focusOutside",p2,aM=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Jc=_.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:l,onDismiss:c,...h}=e,d=_.useContext(aM),[g,p]=_.useState(null),v=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=_.useState({}),w=Qt(t,D=>p(D)),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,L=mB(D=>{const H=D.target,Y=[...d.branches].some(P=>P.contains(H));!N||Y||(i==null||i(D),l==null||l(D),D.defaultPrevented||c==null||c())},v),j=pB(D=>{const H=D.target;[...d.branches].some(P=>P.contains(H))||(o==null||o(D),l==null||l(D),D.defaultPrevented||c==null||c())},v);return lB(D=>{R===d.layers.size-1&&(r==null||r(D),!D.defaultPrevented&&c&&(D.preventDefault(),c()))},v),_.useEffect(()=>{if(g)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(p2=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(g)),d.layers.add(g),g2(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=p2)}},[g,v,n,d]),_.useEffect(()=>()=>{g&&(d.layers.delete(g),d.layersWithOutsidePointerEventsDisabled.delete(g),g2())},[g,d]),_.useEffect(()=>{const D=()=>b({});return document.addEventListener(bb,D),()=>document.removeEventListener(bb,D)},[]),f.jsx(Lt.div,{...h,ref:w,style:{pointerEvents:E?N?"auto":"none":void 0,...e.style},onFocusCapture:Fe(e.onFocusCapture,j.onFocusCapture),onBlurCapture:Fe(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Fe(e.onPointerDownCapture,L.onPointerDownCapture)})});Jc.displayName=cB;var hB="DismissableLayerBranch",fB=_.forwardRef((e,t)=>{const n=_.useContext(aM),r=_.useRef(null),i=Qt(t,r);return _.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),f.jsx(Lt.div,{...e,ref:i})});fB.displayName=hB;function mB(e,t=globalThis==null?void 0:globalThis.document){const n=ls(e),r=_.useRef(!1),i=_.useRef(()=>{});return _.useEffect(()=>{const o=c=>{if(c.target&&!r.current){let h=function(){lM(uB,n,d,{discrete:!0})};const d={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=h,t.addEventListener("click",i.current,{once:!0})):h()}else t.removeEventListener("click",i.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function pB(e,t=globalThis==null?void 0:globalThis.document){const n=ls(e),r=_.useRef(!1);return _.useEffect(()=>{const i=o=>{o.target&&!r.current&&lM(dB,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function g2(){const e=new CustomEvent(bb);document.dispatchEvent(e)}function lM(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?oM(i,o):i.dispatchEvent(o)}var ny="focusScope.autoFocusOnMount",ry="focusScope.autoFocusOnUnmount",v2={bubbles:!1,cancelable:!0},gB="FocusScope",gh=_.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...l}=e,[c,h]=_.useState(null),d=ls(i),g=ls(o),p=_.useRef(null),v=Qt(t,S=>h(S)),b=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let S=function(E){if(b.paused||!c)return;const N=E.target;c.contains(N)?p.current=N:la(p.current,{select:!0})},C=function(E){if(b.paused||!c)return;const N=E.relatedTarget;N!==null&&(c.contains(N)||la(p.current,{select:!0}))},k=function(E){if(document.activeElement===document.body)for(const L of E)L.removedNodes.length>0&&la(c)};document.addEventListener("focusin",S),document.addEventListener("focusout",C);const R=new MutationObserver(k);return c&&R.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",C),R.disconnect()}}},[r,c,b.paused]),_.useEffect(()=>{if(c){y2.add(b);const S=document.activeElement;if(!c.contains(S)){const k=new CustomEvent(ny,v2);c.addEventListener(ny,d),c.dispatchEvent(k),k.defaultPrevented||(vB(wB(cM(c)),{select:!0}),document.activeElement===S&&la(c))}return()=>{c.removeEventListener(ny,d),setTimeout(()=>{const k=new CustomEvent(ry,v2);c.addEventListener(ry,g),c.dispatchEvent(k),k.defaultPrevented||la(S??document.body,{select:!0}),c.removeEventListener(ry,g),y2.remove(b)},0)}}},[c,d,g,b]);const w=_.useCallback(S=>{if(!n&&!r||b.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]=_B(R);E&&N?!S.shiftKey&&k===N?(S.preventDefault(),n&&la(E,{select:!0})):S.shiftKey&&k===E&&(S.preventDefault(),n&&la(N,{select:!0})):k===R&&S.preventDefault()}},[n,r,b.paused]);return f.jsx(Lt.div,{tabIndex:-1,...l,ref:v,onKeyDown:w})});gh.displayName=gB;function vB(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(la(r,{select:t}),document.activeElement!==n)return}function _B(e){const t=cM(e),n=_2(t,e),r=_2(t.reverse(),e);return[n,r]}function cM(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function _2(e,t){for(const n of e)if(!yB(n,{upTo:t}))return n}function yB(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 bB(e){return e instanceof HTMLInputElement&&"select"in e}function la(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&bB(e)&&t&&e.select()}}var y2=xB();function xB(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=b2(e,t),e.unshift(t)},remove(t){var n;e=b2(e,t),(n=e[0])==null||n.resume()}}}function b2(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function wB(e){return e.filter(t=>t.tagName!=="A")}var SB="Portal",eu=_.forwardRef((e,t)=>{var c;const{container:n,...r}=e,[i,o]=_.useState(!1);Pr(()=>o(!0),[]);const l=n||i&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?HN.createPortal(f.jsx(Lt.div,{...r,ref:t}),l):null});eu.displayName=SB;function CB(e,t){return _.useReducer((n,r)=>t[n][r]??n,e)}var Xi=e=>{const{present:t,children:n}=e,r=kB(t),i=typeof n=="function"?n({present:r.isPresent}):_.Children.only(n),o=Qt(r.ref,EB(i));return typeof n=="function"||r.isPresent?_.cloneElement(i,{ref:o}):null};Xi.displayName="Presence";function kB(e){const[t,n]=_.useState(),r=_.useRef(null),i=_.useRef(e),o=_.useRef("none"),l=e?"mounted":"unmounted",[c,h]=CB(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const d=am(r.current);o.current=c==="mounted"?d:"none"},[c]),Pr(()=>{const d=r.current,g=i.current;if(g!==e){const v=o.current,b=am(d);e?h("MOUNT"):b==="none"||(d==null?void 0:d.display)==="none"?h("UNMOUNT"):h(g&&v!==b?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,h]),Pr(()=>{if(t){let d;const g=t.ownerDocument.defaultView??window,p=b=>{const S=am(r.current).includes(CSS.escape(b.animationName));if(b.target===t&&S&&(h("ANIMATION_END"),!i.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",d=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},v=b=>{b.target===t&&(o.current=am(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(c),ref:_.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function am(e){return(e==null?void 0:e.animationName)||"none"}function EB(e){var r,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var iy=0;function Zp(){_.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??x2()),document.body.insertAdjacentElement("beforeend",e[1]??x2()),iy++,()=>{iy===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),iy--}},[])}function x2(){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 Ts=function(){return Ts=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Ts.apply(this,arguments)};function uM(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function RB(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Hm="right-scroll-bar-position",$m="width-before-scroll-bar",TB="with-scroll-bars-hidden",NB="--removed-body-scroll-bar-size";function sy(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function MB(e,t){var n=_.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var AB=typeof window<"u"?_.useLayoutEffect:_.useEffect,w2=new WeakMap;function jB(e,t){var n=MB(null,function(r){return e.forEach(function(i){return sy(i,r)})});return AB(function(){var r=w2.get(n);if(r){var i=new Set(r),o=new Set(e),l=n.current;i.forEach(function(c){o.has(c)||sy(c,null)}),o.forEach(function(c){i.has(c)||sy(c,l)})}w2.set(n,e)},[e]),n}function DB(e){return e}function OB(e,t){t===void 0&&(t=DB);var n=[],r=!1,i={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(o){var l=t(o,r);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(o){for(r=!0;n.length;){var l=n;n=[],l.forEach(o)}n={push:function(c){return o(c)},filter:function(){return n}}},assignMedium:function(o){r=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(o),l=n}var h=function(){var g=l;l=[],g.forEach(o)},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 i}function LB(e){e===void 0&&(e={});var t=OB(null);return t.options=Ts({async:!0,ssr:!1},e),t}var dM=function(e){var t=e.sideCar,n=uM(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,Ts({},n))};dM.isSideCarExport=!0;function zB(e,t){return e.useMedium(t),dM}var hM=LB(),oy=function(){},Qp=_.forwardRef(function(e,t){var n=_.useRef(null),r=_.useState({onScrollCapture:oy,onWheelCapture:oy,onTouchMoveCapture:oy}),i=r[0],o=r[1],l=e.forwardProps,c=e.children,h=e.className,d=e.removeScrollBar,g=e.enabled,p=e.shards,v=e.sideCar,b=e.noRelative,w=e.noIsolation,S=e.inert,C=e.allowPinchZoom,k=e.as,R=k===void 0?"div":k,E=e.gapMode,N=uM(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=v,j=jB([n,t]),D=Ts(Ts({},N),i);return _.createElement(_.Fragment,null,g&&_.createElement(L,{sideCar:hM,removeScrollBar:d,shards:p,noRelative:b,noIsolation:w,inert:S,setCallbacks:o,allowPinchZoom:!!C,lockRef:n,gapMode:E}),l?_.cloneElement(_.Children.only(c),Ts(Ts({},D),{ref:j})):_.createElement(R,Ts({},D,{className:h,ref:j}),c))});Qp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Qp.classNames={fullWidth:$m,zeroRight:Hm};var PB=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function IB(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=PB();return t&&e.setAttribute("nonce",t),e}function BB(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function FB(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var HB=function(){var e=0,t=null;return{add:function(n){e==0&&(t=IB())&&(BB(t,n),FB(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},$B=function(){var e=HB();return function(t,n){_.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},fM=function(){var e=$B(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},UB={left:0,top:0,right:0,gap:0},ay=function(e){return parseInt(e||"",10)||0},VB=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[ay(n),ay(r),ay(i)]},WB=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return UB;var t=VB(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])}},qB=fM(),jc="data-scroll-locked",KB=function(e,t,n,r){var i=e.left,o=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
61
+ .`.concat(TB,` {
62
+ overflow: hidden `).concat(r,`;
63
+ padding-right: `).concat(c,"px ").concat(r,`;
64
+ }
65
+ body[`).concat(jc,`] {
66
+ overflow: hidden `).concat(r,`;
67
+ overscroll-behavior: contain;
68
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
69
+ padding-left: `.concat(i,`px;
70
+ padding-top: `).concat(o,`px;
71
+ padding-right: `).concat(l,`px;
72
+ margin-left:0;
73
+ margin-top:0;
74
+ margin-right: `).concat(c,"px ").concat(r,`;
75
+ `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
76
+ }
77
+
78
+ .`).concat(Hm,` {
79
+ right: `).concat(c,"px ").concat(r,`;
80
+ }
81
+
82
+ .`).concat($m,` {
83
+ margin-right: `).concat(c,"px ").concat(r,`;
84
+ }
85
+
86
+ .`).concat(Hm," .").concat(Hm,` {
87
+ right: 0 `).concat(r,`;
88
+ }
89
+
90
+ .`).concat($m," .").concat($m,` {
91
+ margin-right: 0 `).concat(r,`;
92
+ }
93
+
94
+ body[`).concat(jc,`] {
95
+ `).concat(NB,": ").concat(c,`px;
96
+ }
97
+ `)},S2=function(){var e=parseInt(document.body.getAttribute(jc)||"0",10);return isFinite(e)?e:0},GB=function(){_.useEffect(function(){return document.body.setAttribute(jc,(S2()+1).toString()),function(){var e=S2()-1;e<=0?document.body.removeAttribute(jc):document.body.setAttribute(jc,e.toString())}},[])},YB=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;GB();var o=_.useMemo(function(){return WB(i)},[i]);return _.createElement(qB,{styles:KB(o,!t,i,n?"":"!important")})},xb=!1;if(typeof window<"u")try{var lm=Object.defineProperty({},"passive",{get:function(){return xb=!0,!0}});window.addEventListener("test",lm,lm),window.removeEventListener("test",lm,lm)}catch{xb=!1}var fc=xb?{passive:!1}:!1,XB=function(e){return e.tagName==="TEXTAREA"},mM=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!XB(e)&&n[t]==="visible")},ZB=function(e){return mM(e,"overflowY")},QB=function(e){return mM(e,"overflowX")},C2=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=pM(e,r);if(i){var o=gM(e,r),l=o[1],c=o[2];if(l>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},JB=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},e6=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},pM=function(e,t){return e==="v"?ZB(t):QB(t)},gM=function(e,t){return e==="v"?JB(t):e6(t)},t6=function(e,t){return e==="h"&&t==="rtl"?-1:1},n6=function(e,t,n,r,i){var o=t6(e,window.getComputedStyle(t).direction),l=o*r,c=n.target,h=t.contains(c),d=!1,g=l>0,p=0,v=0;do{if(!c)break;var b=gM(e,c),w=b[0],S=b[1],C=b[2],k=S-C-o*w;(w||k)&&pM(e,c)&&(p+=k,v+=w);var R=c.parentNode;c=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!h&&c!==document.body||h&&(t.contains(c)||t===c));return(g&&Math.abs(p)<1||!g&&Math.abs(v)<1)&&(d=!0),d},cm=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},k2=function(e){return[e.deltaX,e.deltaY]},E2=function(e){return e&&"current"in e?e.current:e},r6=function(e,t){return e[0]===t[0]&&e[1]===t[1]},i6=function(e){return`
98
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
99
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
100
+ `)},s6=0,mc=[];function o6(e){var t=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),i=_.useState(s6++)[0],o=_.useState(fM)[0],l=_.useRef(e);_.useEffect(function(){l.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var S=RB([e.lockRef.current],(e.shards||[]).map(E2),!0).filter(Boolean);return S.forEach(function(C){return C.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var c=_.useCallback(function(S,C){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!l.current.allowPinchZoom;var k=cm(S),R=n.current,E="deltaX"in S?S.deltaX:R[0]-k[0],N="deltaY"in S?S.deltaY:R[1]-k[1],L,j=S.target,D=Math.abs(E)>Math.abs(N)?"h":"v";if("touches"in S&&D==="h"&&j.type==="range")return!1;var H=window.getSelection(),Y=H&&H.anchorNode,P=Y?Y===j||Y.contains(j):!1;if(P)return!1;var q=C2(D,j);if(!q)return!0;if(q?L=D:(L=D==="v"?"h":"v",q=C2(D,j)),!q)return!1;if(!r.current&&"changedTouches"in S&&(E||N)&&(r.current=L),!L)return!0;var F=r.current||L;return n6(F,C,S,F==="h"?E:N)},[]),h=_.useCallback(function(S){var C=S;if(!(!mc.length||mc[mc.length-1]!==o)){var k="deltaY"in C?k2(C):cm(C),R=t.current.filter(function(L){return L.name===C.type&&(L.target===C.target||C.target===L.shadowParent)&&r6(L.delta,k)})[0];if(R&&R.should){C.cancelable&&C.preventDefault();return}if(!R){var E=(l.current.shards||[]).map(E2).filter(Boolean).filter(function(L){return L.contains(C.target)}),N=E.length>0?c(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:a6(k)};t.current.push(E),setTimeout(function(){t.current=t.current.filter(function(N){return N!==E})},1)},[]),g=_.useCallback(function(S){n.current=cm(S),r.current=void 0},[]),p=_.useCallback(function(S){d(S.type,k2(S),S.target,c(S,e.lockRef.current))},[]),v=_.useCallback(function(S){d(S.type,cm(S),S.target,c(S,e.lockRef.current))},[]);_.useEffect(function(){return mc.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:v}),document.addEventListener("wheel",h,fc),document.addEventListener("touchmove",h,fc),document.addEventListener("touchstart",g,fc),function(){mc=mc.filter(function(S){return S!==o}),document.removeEventListener("wheel",h,fc),document.removeEventListener("touchmove",h,fc),document.removeEventListener("touchstart",g,fc)}},[]);var b=e.removeScrollBar,w=e.inert;return _.createElement(_.Fragment,null,w?_.createElement(o,{styles:i6(i)}):null,b?_.createElement(YB,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function a6(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const l6=zB(hM,o6);var vh=_.forwardRef(function(e,t){return _.createElement(Qp,Ts({},e,{ref:t,sideCar:l6}))});vh.classNames=Qp.classNames;var c6=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},pc=new WeakMap,um=new WeakMap,dm={},ly=0,vM=function(e){return e&&(e.host||vM(e.parentNode))},u6=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=vM(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})},d6=function(e,t,n,r){var i=u6(t,Array.isArray(e)?e:[e]);dm[n]||(dm[n]=new WeakMap);var o=dm[n],l=[],c=new Set,h=new Set(i),d=function(p){!p||c.has(p)||(c.add(p),d(p.parentNode))};i.forEach(d);var g=function(p){!p||h.has(p)||Array.prototype.forEach.call(p.children,function(v){if(c.has(v))g(v);else try{var b=v.getAttribute(r),w=b!==null&&b!=="false",S=(pc.get(v)||0)+1,C=(o.get(v)||0)+1;pc.set(v,S),o.set(v,C),l.push(v),S===1&&w&&um.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),c.clear(),ly++,function(){l.forEach(function(p){var v=pc.get(p)-1,b=o.get(p)-1;pc.set(p,v),o.set(p,b),v||(um.has(p)||p.removeAttribute(r),um.delete(p)),b||p.removeAttribute(n)}),ly--,ly||(pc=new WeakMap,pc=new WeakMap,um=new WeakMap,dm={})}},Jp=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=c6(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),d6(r,i,n,"aria-hidden")):function(){return null}},eg="Dialog",[_M,Ose]=So(eg),[h6,hs]=_M(eg),yM=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,c=_.useRef(null),h=_.useRef(null),[d,g]=Ic({prop:r,defaultProp:i??!1,onChange:o,caller:eg});return f.jsx(h6,{scope:t,triggerRef:c,contentRef:h,contentId:po(),titleId:po(),descriptionId:po(),open:d,onOpenChange:g,onOpenToggle:_.useCallback(()=>g(p=>!p),[g]),modal:l,children:n})};yM.displayName=eg;var bM="DialogTrigger",f6=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=hs(bM,n),o=Qt(t,i.triggerRef);return f.jsx(Lt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":b0(i.open),...r,ref:o,onClick:Fe(e.onClick,i.onOpenToggle)})});f6.displayName=bM;var _0="DialogPortal",[m6,xM]=_M(_0,{forceMount:void 0}),wM=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=hs(_0,t);return f.jsx(m6,{scope:t,forceMount:n,children:_.Children.map(r,l=>f.jsx(Xi,{present:n||o.open,children:f.jsx(eu,{asChild:!0,container:i,children:l})}))})};wM.displayName=_0;var ip="DialogOverlay",SM=_.forwardRef((e,t)=>{const n=xM(ip,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=hs(ip,e.__scopeDialog);return o.modal?f.jsx(Xi,{present:r||o.open,children:f.jsx(g6,{...i,ref:t})}):null});SM.displayName=ip;var p6=fl("DialogOverlay.RemoveScroll"),g6=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=hs(ip,n);return f.jsx(vh,{as:p6,allowPinchZoom:!0,shards:[i.contentRef],children:f.jsx(Lt.div,{"data-state":b0(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ml="DialogContent",CM=_.forwardRef((e,t)=>{const n=xM(ml,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=hs(ml,e.__scopeDialog);return f.jsx(Xi,{present:r||o.open,children:o.modal?f.jsx(v6,{...i,ref:t}):f.jsx(_6,{...i,ref:t})})});CM.displayName=ml;var v6=_.forwardRef((e,t)=>{const n=hs(ml,e.__scopeDialog),r=_.useRef(null),i=Qt(t,n.contentRef,r);return _.useEffect(()=>{const o=r.current;if(o)return Jp(o)},[]),f.jsx(kM,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Fe(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Fe(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&o.preventDefault()}),onFocusOutside:Fe(e.onFocusOutside,o=>o.preventDefault())})}),_6=_.forwardRef((e,t)=>{const n=hs(ml,e.__scopeDialog),r=_.useRef(!1),i=_.useRef(!1);return f.jsx(kM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,c;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var h,d;(h=e.onInteractOutside)==null||h.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=o.target;((d=n.triggerRef.current)==null?void 0:d.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),kM=_.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...l}=e,c=hs(ml,n),h=_.useRef(null),d=Qt(t,h);return Zp(),f.jsxs(f.Fragment,{children:[f.jsx(gh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:f.jsx(Jc,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":b0(c.open),...l,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(y6,{titleId:c.titleId}),f.jsx(x6,{contentRef:h,descriptionId:c.descriptionId})]})]})}),y0="DialogTitle",EM=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=hs(y0,n);return f.jsx(Lt.h2,{id:i.titleId,...r,ref:t})});EM.displayName=y0;var RM="DialogDescription",TM=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=hs(RM,n);return f.jsx(Lt.p,{id:i.descriptionId,...r,ref:t})});TM.displayName=RM;var NM="DialogClose",MM=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=hs(NM,n);return f.jsx(Lt.button,{type:"button",...r,ref:t,onClick:Fe(e.onClick,()=>i.onOpenChange(!1))})});MM.displayName=NM;function b0(e){return e?"open":"closed"}var AM="DialogTitleWarning",[Lse,jM]=YI(AM,{contentName:ml,titleName:y0,docsSlug:"dialog"}),y6=({titleId:e})=>{const t=jM(AM),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},b6="DialogDescriptionWarning",x6=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jM(b6).contentName}}.`;return _.useEffect(()=>{var o;const i=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},w6=yM,S6=wM,DM=SM,OM=CM,C6=EM,k6=TM,E6=MM;/**
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 R6=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),T6=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),R2=e=>{const t=T6(e);return t.charAt(0).toUpperCase()+t.slice(1)},LM=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),N6=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 M6={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 A6=_.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:l,...c},h)=>_.createElement("svg",{ref:h,...M6,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:LM("lucide",i),...!o&&!N6(c)&&{"aria-hidden":"true"},...c},[...l.map(([d,g])=>_.createElement(d,g)),...Array.isArray(o)?o:[o]]));/**
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 ze=(e,t)=>{const n=_.forwardRef(({className:r,...i},o)=>_.createElement(A6,{ref:o,iconNode:t,className:LM(`lucide-${R6(R2(e))}`,`lucide-${e}`,r),...i}));return n.displayName=R2(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 j6=[["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"}]],D6=ze("archive",j6);/**
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 O6=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],L6=ze("arrow-down-to-line",O6);/**
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 z6=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],P6=ze("arrow-down",z6);/**
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 I6=[["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"}]],B6=ze("arrow-left-right",I6);/**
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 F6=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],H6=ze("arrow-left",F6);/**
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 $6=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],U6=ze("arrow-up",$6);/**
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 V6=[["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=ze("asterisk",V6);/**
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 q6=[["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"}]],vi=ze("brain",q6);/**
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 K6=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],G6=ze("check-check",K6);/**
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 Y6=[["path",{d:"M20 4L9 15",key:"1qkx8z"}],["path",{d:"M21 19L3 19",key:"100sma"}],["path",{d:"M9 15L4 10",key:"9zxff7"}]],X6=ze("check-line",Y6);/**
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 Z6=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Vi=ze("check",Z6);/**
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 Q6=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],tg=ze("chevron-down",Q6);/**
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 J6=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],zM=ze("chevron-left",J6);/**
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 e8=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Vr=ze("chevron-right",e8);/**
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 t8=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],n8=ze("chevron-up",t8);/**
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 r8=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],i8=ze("chevrons-up",r8);/**
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 s8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],o8=ze("circle-slash",s8);/**
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 a8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],l8=ze("circle",a8);/**
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 c8=[["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"}]],PM=ze("cloud-download",c8);/**
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 u8=[["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"}]],T2=ze("code-xml",u8);/**
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 d8=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],wb=ze("code",d8);/**
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 h8=[["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"}]],f8=ze("command",h8);/**
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 m8=[["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"}]],ul=ze("copy",m8);/**
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 p8=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],g8=ze("corner-down-left",p8);/**
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 v8=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],N2=ze("download",v8);/**
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 _8=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],y8=ze("ellipsis",_8);/**
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 b8=[["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"}]],x8=ze("eraser",b8);/**
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 w8=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],S8=ze("external-link",w8);/**
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 C8=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],M2=ze("eye",C8);/**
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 k8=[["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"}]],E8=ze("file-pen",k8);/**
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 R8=[["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"}]],T8=ze("file-plus-corner",R8);/**
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 N8=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],M8=ze("file-text",N8);/**
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 A8=[["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"}]],j8=ze("file",A8);/**
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 D8=[["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"}]],cy=ze("folder-git-2",D8);/**
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 O8=[["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"}]],IM=ze("folder-open",O8);/**
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 L8=[["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"}]],BM=ze("folder-plus",L8);/**
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 z8=[["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"}]],FM=ze("folder",z8);/**
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 P8=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],ao=ze("gauge",P8);/**
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 I8=[["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"}]],B8=ze("git-branch",I8);/**
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 F8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],H8=ze("info",F8);/**
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 $8=[["rect",{width:"7",height:"18",x:"3",y:"3",rx:"1",key:"2obqm"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]],U8=ze("layout-panel-left",$8);/**
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 V8=[["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"}]],W8=ze("list-checks",V8);/**
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 q8=[["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"}]],sp=ze("list-todo",q8);/**
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 K8=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Lr=ze("loader-circle",K8);/**
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 G8=[["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"}]],A2=ze("lock-open",G8);/**
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 Y8=[["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"}]],j2=ze("map",Y8);/**
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 X8=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Sb=ze("menu",X8);/**
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 Z8=[["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"}]],HM=ze("message-circle-question-mark",Z8);/**
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 Q8=[["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"}]],J8=ze("message-square-quote",Q8);/**
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 e9=[["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"}]],$M=ze("minimize",e9);/**
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 t9=[["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"}]],UM=ze("monitor",t9);/**
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 n9=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],r9=ze("palette",n9);/**
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 i9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Cb=ze("panel-left",i9);/**
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 s9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],o9=ze("panel-right",s9);/**
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 a9=[["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"}]],VM=ze("paperclip",a9);/**
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 l9=[["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"}]],Bc=ze("pencil",l9);/**
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 c9=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],x0=ze("plus",c9);/**
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 u9=[["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"}]],op=ze("refresh-cw",u9);/**
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 d9=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],uy=ze("search",d9);/**
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 h9=[["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"}]],f9=ze("send",h9);/**
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 m9=[["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"}]],p9=ze("settings",m9);/**
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 g9=[["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"}]],v9=ze("settings-2",g9);/**
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 _9=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],y9=ze("slash",_9);/**
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 b9=[["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"}]],Hn=ze("sparkles",b9);/**
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 x9=[["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"}]],D2=ze("square-menu",x9);/**
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 w9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]],O2=ze("square-minus",w9);/**
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 S9=[["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"}]],WM=ze("square-pen",S9);/**
460
+ * @license lucide-react v0.562.0 - ISC
461
+ *
462
+ * This source code is licensed under the ISC license.
463
+ * See the LICENSE file in the root directory of this source tree.
464
+ */const C9=[["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"}]],k9=ze("square-x",C9);/**
465
+ * @license lucide-react v0.562.0 - ISC
466
+ *
467
+ * This source code is licensed under the ISC license.
468
+ * See the LICENSE file in the root directory of this source tree.
469
+ */const E9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],R9=ze("square",E9);/**
470
+ * @license lucide-react v0.562.0 - ISC
471
+ *
472
+ * This source code is licensed under the ISC license.
473
+ * See the LICENSE file in the root directory of this source tree.
474
+ */const T9=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],w0=ze("terminal",T9);/**
475
+ * @license lucide-react v0.562.0 - ISC
476
+ *
477
+ * This source code is licensed under the ISC license.
478
+ * See the LICENSE file in the root directory of this source tree.
479
+ */const N9=[["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"}]],M9=ze("toy-brick",N9);/**
480
+ * @license lucide-react v0.562.0 - ISC
481
+ *
482
+ * This source code is licensed under the ISC license.
483
+ * See the LICENSE file in the root directory of this source tree.
484
+ */const A9=[["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"}]],Gd=ze("trash-2",A9);/**
485
+ * @license lucide-react v0.562.0 - ISC
486
+ *
487
+ * This source code is licensed under the ISC license.
488
+ * See the LICENSE file in the root directory of this source tree.
489
+ */const j9=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],S0=ze("user-round",j9);/**
490
+ * @license lucide-react v0.562.0 - ISC
491
+ *
492
+ * This source code is licensed under the ISC license.
493
+ * See the LICENSE file in the root directory of this source tree.
494
+ */const D9=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],vo=ze("x",D9);/**
495
+ * @license lucide-react v0.562.0 - ISC
496
+ *
497
+ * This source code is licensed under the ISC license.
498
+ * See the LICENSE file in the root directory of this source tree.
499
+ */const O9=[["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"}]],Rs=ze("zap",O9),Yd="data-focus-fallback-ignore",qM="data-allow-focus-retain",ap="kaizen:restore-chat-input-focus",C0="data-chat-input",lp="data-chat-selection-zone";function rl(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function kb(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:rl(e,qM):!1}function L9(e){const t=e;return t!=null&&t.matches?kb(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:rl(e,qM):!1}function L2(e){return!!e.querySelector(`[${Yd}][data-state='open']`)}function z9(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function P9(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${C0}]`)).filter(l=>!l.disabled);if(n.length===0)return!1;const r=n.indexOf(e),i=r>=0?(r+1)%n.length:0,o=n[i];return o?(o.focus({preventScroll:!0}),!0):!1}function z2(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||rl(t,C0)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:o,root:l,hasActiveSelection:c}=e,h=o??i;return!l||!h||!l.contains(h)||rl(h,Yd)||rl(t,Yd)||kb(h)||c&&(rl(i,lp)||rl(h,lp))||kb(t)?"none":t&&t===h?"restore":L9(t)?"none":"restore"}const ng=w6,I9=S6,KM=_.forwardRef(({className:e,...t},n)=>f.jsx(DM,{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}));KM.displayName=DM.displayName;const B9={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},_h=_.forwardRef(({className:e,children:t,size:n="md",...r},i)=>f.jsxs(I9,{children:[f.jsx(KM,{}),f.jsxs(OM,{ref:i,[Yd]:"",onCloseAutoFocus:o=>{var l;o.preventDefault(),window.dispatchEvent(new Event(ap)),(l=r.onCloseAutoFocus)==null||l.call(r,o)},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",B9[n],e),...r,children:[t,f.jsxs(E6,{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(vo,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_h.displayName=OM.displayName;function rg({className:e,...t}){return f.jsx(C6,{className:me("text-lg font-medium leading-none tracking-tight",e),...t})}function k0({className:e,...t}){return f.jsx(k6,{className:me("text-sm text-muted-foreground",e),...t})}function ig({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 sg({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 Bi=_.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}));Bi.displayName="Input";const GM=_.createContext(null);function F9({children:e}){const[t,n]=_.useState(null),[r,i]=_.useState(""),o=_.useRef(null);_.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(i(t.options.initialValue??""),setTimeout(()=>{var b,w;(b=o.current)==null||b.focus(),(w=o.current)==null||w.select()},0))},[t]);const l=_.useCallback(()=>{n(null),i("")},[]),c=_.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(b=>new Promise(w=>{n({kind:"confirm",options:b,resolve:w})}),[]),g=_.useCallback(b=>new Promise(w=>{n({kind:"prompt",options:b,resolve:w})}),[]),p=_.useCallback(b=>new Promise(w=>{n({kind:"alert",options:b,resolve:w})}),[]),v=_.useMemo(()=>({confirm:d,prompt:g,alert:p}),[p,d,g]);return f.jsxs(GM.Provider,{value:v,children:[e,f.jsx(ng,{open:t!==null,onOpenChange:b=>{b||!t||c()},children:f.jsx(_h,{size:"sm",onKeyDown:b=>{b.key!=="Enter"||b.shiftKey||!t||t.kind!=="confirm"||(b.preventDefault(),h())},children:t?f.jsxs(f.Fragment,{children:[f.jsxs(ig,{className:"space-y-4",children:[f.jsx(rg,{children:t.options.title}),t.options.description?f.jsx(k0,{children:t.options.description}):null,t.kind==="prompt"?f.jsx(Bi,{ref:o,type:"text",value:r,onChange:b=>i(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),h())},placeholder:t.options.placeholder}):null]}),f.jsxs(sg,{children:[f.jsx(et,{variant:"ghost",size:"sm",onClick:c,className:t.kind==="alert"?"hidden":void 0,children:"cancelLabel"in t.options?t.options.cancelLabel??"Cancel":"Cancel"}),f.jsx(et,{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 H9(){const e=_.useContext(GM);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const yh=_.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}));yh.displayName="Textarea";function $9(e){return e.trim().length>0}function U9({open:e,onOpenChange:t,onConfirm:n}){const[r,i]=_.useState(""),[o,l]=_.useState(""),c=_.useRef(null);_.useEffect(()=>{e&&(i(""),l(""),setTimeout(()=>{var g;return(g=c.current)==null?void 0:g.focus()},0))},[e]);const h=$9(r),d=()=>{h&&n({title:r.trim(),description:o.trim()})};return f.jsx(ng,{open:e,onOpenChange:t,children:f.jsx(_h,{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(ig,{className:"space-y-4",children:[f.jsx(rg,{children:"Create Feature"}),f.jsx(k0,{children:"Name the feature folder and optionally add a short description for the feature."}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("label",{htmlFor:"feature-title",className:"text-sm font-medium",children:"Feature name"}),f.jsx(Bi,{id:"feature-title",ref:c,type:"text",value:r,onChange:g=>i(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(yh,{id:"feature-description",value:o,onChange:g=>l(g.target.value),rows:5,placeholder:"Leave blank to add it later"})]})]}),f.jsxs(sg,{children:[f.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),f.jsx(et,{type:"submit",variant:"secondary",size:"sm",disabled:!h,children:"Create"})]})]})})})}const P2=`1. Sign in on the opened Cursor spending page.
500
+ 2. Open DevTools > Network.
501
+ 3. Refresh the page.
502
+ 4. Right-click the get-current-period-usage request.
503
+ 5. Copy > Copy as cURL.
504
+ 6. Paste it here.`;function V9({open:e,onOpenChange:t,onSubmit:n}){const r=_.useRef(null),[i,o]=_.useState(""),[l,c]=_.useState(!1);_.useEffect(()=>{e&&(o(""),setTimeout(()=>{var p;return(p=r.current)==null?void 0:p.focus()},0))},[e]);async function h(){const p=await navigator.clipboard.readText();o(p)}async function d(){await navigator.clipboard.writeText(P2),c(!0),setTimeout(()=>c(!1),2e3)}const g=i.trim().length>0;return f.jsx(ng,{open:e,onOpenChange:t,children:f.jsx(_h,{size:"lg",children:f.jsxs("form",{onSubmit:p=>{p.preventDefault(),g&&n(i.trim())},children:[f.jsxs(ig,{className:"space-y-4",children:[f.jsx(rg,{children:"Import Cursor Session"}),f.jsxs(k0,{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:P2}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:()=>void h(),children:"Paste Clipboard"}),f.jsxs(et,{type:"button",variant:"ghost",size:"sm",onClick:()=>void d(),children:[l?f.jsx(Vi,{className:"h-4 w-4"}):f.jsx(ul,{className:"h-4 w-4"}),f.jsx("span",{className:"ml-1",children:l?"Copied":"Copy Steps"})]})]}),f.jsx(yh,{ref:r,value:i,onChange:p=>o(p.target.value),rows:10,placeholder:"Paste the copied curl command here",className:"font-mono text-xs"})]}),f.jsxs(sg,{children:[f.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),f.jsx(et,{type:"submit",variant:"secondary",size:"sm",disabled:!g,children:"Import Session"})]})]})})})}const W9=["top","right","bottom","left"],ba=Math.min,bi=Math.max,cp=Math.round,hm=Math.floor,Ls=e=>({x:e,y:e}),q9={left:"right",right:"left",bottom:"top",top:"bottom"};function Eb(e,t,n){return bi(e,ba(t,n))}function _o(e,t){return typeof e=="function"?e(t):e}function yo(e){return e.split("-")[0]}function tu(e){return e.split("-")[1]}function E0(e){return e==="x"?"y":"x"}function R0(e){return e==="y"?"height":"width"}function Ns(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function T0(e){return E0(Ns(e))}function K9(e,t,n){n===void 0&&(n=!1);const r=tu(e),i=T0(e),o=R0(i);let l=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=up(l)),[l,up(l)]}function G9(e){const t=up(e);return[Rb(e),t,Rb(t)]}function Rb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const I2=["left","right"],B2=["right","left"],Y9=["top","bottom"],X9=["bottom","top"];function Z9(e,t,n){switch(e){case"top":case"bottom":return n?t?B2:I2:t?I2:B2;case"left":case"right":return t?Y9:X9;default:return[]}}function Q9(e,t,n,r){const i=tu(e);let o=Z9(yo(e),n==="start",r);return i&&(o=o.map(l=>l+"-"+i),t&&(o=o.concat(o.map(Rb)))),o}function up(e){const t=yo(e);return q9[t]+e.slice(t.length)}function J9(e){return{top:0,right:0,bottom:0,left:0,...e}}function YM(e){return typeof e!="number"?J9(e):{top:e,right:e,bottom:e,left:e}}function dp(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function F2(e,t,n){let{reference:r,floating:i}=e;const o=Ns(t),l=T0(t),c=R0(l),h=yo(t),d=o==="y",g=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,v=r[c]/2-i[c]/2;let b;switch(h){case"top":b={x:g,y:r.y-i.height};break;case"bottom":b={x:g,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:p};break;case"left":b={x:r.x-i.width,y:p};break;default:b={x:r.x,y:r.y}}switch(tu(t)){case"start":b[l]-=v*(n&&d?-1:1);break;case"end":b[l]+=v*(n&&d?-1:1);break}return b}async function e7(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:l,elements:c,strategy:h}=e,{boundary:d="clippingAncestors",rootBoundary:g="viewport",elementContext:p="floating",altBoundary:v=!1,padding:b=0}=_o(t,e),w=YM(b),C=c[v?p==="floating"?"reference":"floating":p],k=dp(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(C)))==null||n?C:C.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:d,rootBoundary:g,strategy:h})),R=p==="floating"?{x:r,y:i,width:l.floating.width,height:l.floating.height}:l.reference,E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),N=await(o.isElement==null?void 0:o.isElement(E))?await(o.getScale==null?void 0:o.getScale(E))||{x:1,y:1}:{x:1,y:1},L=dp(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:R,offsetParent:E,strategy:h}):R);return{top:(k.top-L.top+w.top)/N.y,bottom:(L.bottom-k.bottom+w.bottom)/N.y,left:(k.left-L.left+w.left)/N.x,right:(L.right-k.right+w.right)/N.x}}const t7=50,n7=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:l}=n,c=l.detectOverflow?l:{...l,detectOverflow:e7},h=await(l.isRTL==null?void 0:l.isRTL(t));let d=await l.getElementRects({reference:e,floating:t,strategy:i}),{x:g,y:p}=F2(d,r,h),v=r,b=0;const w={};for(let S=0;S<o.length;S++){const C=o[S];if(!C)continue;const{name:k,fn:R}=C,{x:E,y:N,data:L,reset:j}=await R({x:g,y:p,initialPlacement:r,placement:v,strategy:i,middlewareData:w,rects:d,platform:c,elements:{reference:e,floating:t}});g=E??g,p=N??p,w[k]={...w[k],...L},j&&b<t7&&(b++,typeof j=="object"&&(j.placement&&(v=j.placement),j.rects&&(d=j.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:i}):j.rects),{x:g,y:p}=F2(d,v,h)),S=-1)}return{x:g,y:p,placement:v,strategy:i,middlewareData:w}},r7=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:l,elements:c,middlewareData:h}=t,{element:d,padding:g=0}=_o(e,t)||{};if(d==null)return{};const p=YM(g),v={x:n,y:r},b=T0(i),w=R0(b),S=await l.getDimensions(d),C=b==="y",k=C?"top":"left",R=C?"bottom":"right",E=C?"clientHeight":"clientWidth",N=o.reference[w]+o.reference[b]-v[b]-o.floating[w],L=v[b]-o.reference[b],j=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d));let D=j?j[E]:0;(!D||!await(l.isElement==null?void 0:l.isElement(j)))&&(D=c.floating[E]||o.floating[w]);const H=N/2-L/2,Y=D/2-S[w]/2-1,P=ba(p[k],Y),q=ba(p[R],Y),F=P,U=D-S[w]-q,W=D/2-S[w]/2+H,V=Eb(F,W,U),O=!h.arrow&&tu(i)!=null&&W!==V&&o.reference[w]/2-(W<F?P:q)-S[w]/2<0,$=O?W<F?W-F:W-U:0;return{[b]:v[b]+$,data:{[b]:V,centerOffset:W-V-$,...O&&{alignmentOffset:$}},reset:O}}}),i7=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:l,initialPlacement:c,platform:h,elements:d}=t,{mainAxis:g=!0,crossAxis:p=!0,fallbackPlacements:v,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:S=!0,...C}=_o(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const k=yo(i),R=Ns(c),E=yo(c)===c,N=await(h.isRTL==null?void 0:h.isRTL(d.floating)),L=v||(E||!S?[up(c)]:G9(c)),j=w!=="none";!v&&j&&L.push(...Q9(c,S,w,N));const D=[c,...L],H=await h.detectOverflow(t,C),Y=[];let P=((r=o.flip)==null?void 0:r.overflows)||[];if(g&&Y.push(H[k]),p){const W=K9(i,l,N);Y.push(H[W[0]],H[W[1]])}if(P=[...P,{placement:i,overflows:Y}],!Y.every(W=>W<=0)){var q,F;const W=(((q=o.flip)==null?void 0:q.index)||0)+1,V=D[W];if(V&&(!(p==="alignment"?R!==Ns(V):!1)||P.every(z=>Ns(z.placement)===R?z.overflows[0]>0:!0)))return{data:{index:W,overflows:P},reset:{placement:V}};let O=(F=P.filter($=>$.overflows[0]<=0).sort(($,z)=>$.overflows[1]-z.overflows[1])[0])==null?void 0:F.placement;if(!O)switch(b){case"bestFit":{var U;const $=(U=P.filter(z=>{if(j){const G=Ns(z.placement);return G===R||G==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(G=>G>0).reduce((G,M)=>G+M,0)]).sort((z,G)=>z[1]-G[1])[0])==null?void 0:U[0];$&&(O=$);break}case"initialPlacement":O=c;break}if(i!==O)return{reset:{placement:O}}}return{}}}};function H2(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function $2(e){return W9.some(t=>e[t]>=0)}const s7=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...o}=_o(e,t);switch(i){case"referenceHidden":{const l=await r.detectOverflow(t,{...o,elementContext:"reference"}),c=H2(l,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:$2(c)}}}case"escaped":{const l=await r.detectOverflow(t,{...o,altBoundary:!0}),c=H2(l,n.floating);return{data:{escapedOffsets:c,escaped:$2(c)}}}default:return{}}}}},XM=new Set(["left","top"]);async function o7(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),l=yo(n),c=tu(n),h=Ns(n)==="y",d=XM.has(l)?-1:1,g=o&&h?-1:1,p=_o(t,e);let{mainAxis:v,crossAxis:b,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof w=="number"&&(b=c==="end"?w*-1:w),h?{x:b*g,y:v*d}:{x:v*d,y:b*g}}const a7=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:l,middlewareData:c}=t,h=await o7(t,e);return l===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+h.x,y:o+h.y,data:{...h,placement:l}}}}},l7=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:o}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:h={fn:k=>{let{x:R,y:E}=k;return{x:R,y:E}}},...d}=_o(e,t),g={x:n,y:r},p=await o.detectOverflow(t,d),v=Ns(yo(i)),b=E0(v);let w=g[b],S=g[v];if(l){const k=b==="y"?"top":"left",R=b==="y"?"bottom":"right",E=w+p[k],N=w-p[R];w=Eb(E,w,N)}if(c){const k=v==="y"?"top":"left",R=v==="y"?"bottom":"right",E=S+p[k],N=S-p[R];S=Eb(E,S,N)}const C=h.fn({...t,[b]:w,[v]:S});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[b]:l,[v]:c}}}}}},c7=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:l}=t,{offset:c=0,mainAxis:h=!0,crossAxis:d=!0}=_o(e,t),g={x:n,y:r},p=Ns(i),v=E0(p);let b=g[v],w=g[p];const S=_o(c,t),C=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const E=v==="y"?"height":"width",N=o.reference[v]-o.floating[E]+C.mainAxis,L=o.reference[v]+o.reference[E]-C.mainAxis;b<N?b=N:b>L&&(b=L)}if(d){var k,R;const E=v==="y"?"width":"height",N=XM.has(yo(i)),L=o.reference[p]-o.floating[E]+(N&&((k=l.offset)==null?void 0:k[p])||0)+(N?0:C.crossAxis),j=o.reference[p]+o.reference[E]+(N?0:((R=l.offset)==null?void 0:R[p])||0)-(N?C.crossAxis:0);w<L?w=L:w>j&&(w=j)}return{[v]:b,[p]:w}}}},u7=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:o,platform:l,elements:c}=t,{apply:h=()=>{},...d}=_o(e,t),g=await l.detectOverflow(t,d),p=yo(i),v=tu(i),b=Ns(i)==="y",{width:w,height:S}=o.floating;let C,k;p==="top"||p==="bottom"?(C=p,k=v===(await(l.isRTL==null?void 0:l.isRTL(c.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=ba(S-g[C],R),L=ba(w-g[k],E),j=!t.middlewareData.shift;let D=N,H=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(H=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=R),j&&!v){const P=bi(g.left,0),q=bi(g.right,0),F=bi(g.top,0),U=bi(g.bottom,0);b?H=w-2*(P!==0||q!==0?P+q:bi(g.left,g.right)):D=S-2*(F!==0||U!==0?F+U:bi(g.top,g.bottom))}await h({...t,availableWidth:H,availableHeight:D});const Y=await l.getDimensions(c.floating);return w!==Y.width||S!==Y.height?{reset:{rects:!0}}:{}}}};function og(){return typeof window<"u"}function nu(e){return ZM(e)?(e.nodeName||"").toLowerCase():"#document"}function xi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Fs(e){var t;return(t=(ZM(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ZM(e){return og()?e instanceof Node||e instanceof xi(e).Node:!1}function cs(e){return og()?e instanceof Element||e instanceof xi(e).Element:!1}function Co(e){return og()?e instanceof HTMLElement||e instanceof xi(e).HTMLElement:!1}function U2(e){return!og()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof xi(e).ShadowRoot}function bh(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=us(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function d7(e){return/^(table|td|th)$/.test(nu(e))}function ag(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const h7=/transform|translate|scale|rotate|perspective|filter/,f7=/paint|layout|strict|content/,Ga=e=>!!e&&e!=="none";let dy;function N0(e){const t=cs(e)?us(e):e;return Ga(t.transform)||Ga(t.translate)||Ga(t.scale)||Ga(t.rotate)||Ga(t.perspective)||!M0()&&(Ga(t.backdropFilter)||Ga(t.filter))||h7.test(t.willChange||"")||f7.test(t.contain||"")}function m7(e){let t=xa(e);for(;Co(t)&&!Fc(t);){if(N0(t))return t;if(ag(t))return null;t=xa(t)}return null}function M0(){return dy==null&&(dy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),dy}function Fc(e){return/^(html|body|#document)$/.test(nu(e))}function us(e){return xi(e).getComputedStyle(e)}function lg(e){return cs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xa(e){if(nu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||U2(e)&&e.host||Fs(e);return U2(t)?t.host:t}function QM(e){const t=xa(e);return Fc(t)?e.ownerDocument?e.ownerDocument.body:e.body:Co(t)&&bh(t)?t:QM(t)}function Xd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=QM(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),l=xi(i);if(o){const c=Tb(l);return t.concat(l,l.visualViewport||[],bh(i)?i:[],c&&n?Xd(c):[])}else return t.concat(i,Xd(i,[],n))}function Tb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function JM(e){const t=us(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Co(e),o=i?e.offsetWidth:n,l=i?e.offsetHeight:r,c=cp(n)!==o||cp(r)!==l;return c&&(n=o,r=l),{width:n,height:r,$:c}}function A0(e){return cs(e)?e:e.contextElement}function Dc(e){const t=A0(e);if(!Co(t))return Ls(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=JM(t);let l=(o?cp(n.width):n.width)/r,c=(o?cp(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const p7=Ls(0);function e5(e){const t=xi(e);return!M0()||!t.visualViewport?p7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function g7(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==xi(e)?!1:t}function pl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=A0(e);let l=Ls(1);t&&(r?cs(r)&&(l=Dc(r)):l=Dc(e));const c=g7(o,n,r)?e5(o):Ls(0);let h=(i.left+c.x)/l.x,d=(i.top+c.y)/l.y,g=i.width/l.x,p=i.height/l.y;if(o){const v=xi(o),b=r&&cs(r)?xi(r):r;let w=v,S=Tb(w);for(;S&&r&&b!==w;){const C=Dc(S),k=S.getBoundingClientRect(),R=us(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=xi(S),S=Tb(w)}}return dp({width:g,height:p,x:h,y:d})}function cg(e,t){const n=lg(e).scrollLeft;return t?t.left+n:pl(Fs(e)).left+n}function t5(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-cg(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function v7(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",l=Fs(r),c=t?ag(t.floating):!1;if(r===l||c&&o)return n;let h={scrollLeft:0,scrollTop:0},d=Ls(1);const g=Ls(0),p=Co(r);if((p||!p&&!o)&&((nu(r)!=="body"||bh(l))&&(h=lg(r)),p)){const b=pl(r);d=Dc(r),g.x=b.x+r.clientLeft,g.y=b.y+r.clientTop}const v=l&&!p&&!o?t5(l,h):Ls(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 _7(e){return Array.from(e.getClientRects())}function y7(e){const t=Fs(e),n=lg(e),r=e.ownerDocument.body,i=bi(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=bi(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+cg(e);const c=-n.scrollTop;return us(r).direction==="rtl"&&(l+=bi(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:l,y:c}}const V2=25;function b7(e,t){const n=xi(e),r=Fs(e),i=n.visualViewport;let o=r.clientWidth,l=r.clientHeight,c=0,h=0;if(i){o=i.width,l=i.height;const g=M0();(!g||g&&t==="fixed")&&(c=i.offsetLeft,h=i.offsetTop)}const d=cg(r);if(d<=0){const g=r.ownerDocument,p=g.body,v=getComputedStyle(p),b=g.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,w=Math.abs(r.clientWidth-p.clientWidth-b);w<=V2&&(o-=w)}else d<=V2&&(o+=d);return{width:o,height:l,x:c,y:h}}function x7(e,t){const n=pl(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Co(e)?Dc(e):Ls(1),l=e.clientWidth*o.x,c=e.clientHeight*o.y,h=i*o.x,d=r*o.y;return{width:l,height:c,x:h,y:d}}function W2(e,t,n){let r;if(t==="viewport")r=b7(e,n);else if(t==="document")r=y7(Fs(e));else if(cs(t))r=x7(t,n);else{const i=e5(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return dp(r)}function n5(e,t){const n=xa(e);return n===t||!cs(n)||Fc(n)?!1:us(n).position==="fixed"||n5(n,t)}function w7(e,t){const n=t.get(e);if(n)return n;let r=Xd(e,[],!1).filter(c=>cs(c)&&nu(c)!=="body"),i=null;const o=us(e).position==="fixed";let l=o?xa(e):e;for(;cs(l)&&!Fc(l);){const c=us(l),h=N0(l);!h&&c.position==="fixed"&&(i=null),(o?!h&&!i:!h&&c.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||bh(l)&&!h&&n5(e,l))?r=r.filter(g=>g!==l):i=c,l=xa(l)}return t.set(e,r),r}function S7(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const l=[...n==="clippingAncestors"?ag(t)?[]:w7(t,this._c):[].concat(n),r],c=W2(t,l[0],i);let h=c.top,d=c.right,g=c.bottom,p=c.left;for(let v=1;v<l.length;v++){const b=W2(t,l[v],i);h=bi(b.top,h),d=ba(b.right,d),g=ba(b.bottom,g),p=bi(b.left,p)}return{width:d-p,height:g-h,x:p,y:h}}function C7(e){const{width:t,height:n}=JM(e);return{width:t,height:n}}function k7(e,t,n){const r=Co(t),i=Fs(t),o=n==="fixed",l=pl(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const h=Ls(0);function d(){h.x=cg(i)}if(r||!r&&!o)if((nu(t)!=="body"||bh(i))&&(c=lg(t)),r){const b=pl(t,!0,o,t);h.x=b.x+t.clientLeft,h.y=b.y+t.clientTop}else i&&d();o&&!r&&i&&d();const g=i&&!r&&!o?t5(i,c):Ls(0),p=l.left+c.scrollLeft-h.x-g.x,v=l.top+c.scrollTop-h.y-g.y;return{x:p,y:v,width:l.width,height:l.height}}function hy(e){return us(e).position==="static"}function q2(e,t){if(!Co(e)||us(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Fs(e)===n&&(n=n.ownerDocument.body),n}function r5(e,t){const n=xi(e);if(ag(e))return n;if(!Co(e)){let i=xa(e);for(;i&&!Fc(i);){if(cs(i)&&!hy(i))return i;i=xa(i)}return n}let r=q2(e,t);for(;r&&d7(r)&&hy(r);)r=q2(r,t);return r&&Fc(r)&&hy(r)&&!N0(r)?n:r||m7(e)||n}const E7=async function(e){const t=this.getOffsetParent||r5,n=this.getDimensions,r=await n(e.floating);return{reference:k7(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function R7(e){return us(e).direction==="rtl"}const T7={convertOffsetParentRelativeRectToViewportRelativeRect:v7,getDocumentElement:Fs,getClippingRect:S7,getOffsetParent:r5,getElementRects:E7,getClientRects:_7,getDimensions:C7,getScale:Dc,isElement:cs,isRTL:R7};function i5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function N7(e,t){let n=null,r;const i=Fs(e);function o(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function l(c,h){c===void 0&&(c=!1),h===void 0&&(h=1),o();const d=e.getBoundingClientRect(),{left:g,top:p,width:v,height:b}=d;if(c||t(),!v||!b)return;const w=hm(p),S=hm(i.clientWidth-(g+v)),C=hm(i.clientHeight-(p+b)),k=hm(g),E={rootMargin:-w+"px "+-S+"px "+-C+"px "+-k+"px",threshold:bi(0,ba(1,h))||1};let N=!0;function L(j){const D=j[0].intersectionRatio;if(D!==h){if(!N)return l();D?l(!1,D):r=setTimeout(()=>{l(!1,1e-7)},1e3)}D===1&&!i5(d,e.getBoundingClientRect())&&l(),N=!1}try{n=new IntersectionObserver(L,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(L,E)}n.observe(e)}return l(!0),o}function M7(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,d=A0(e),g=i||o?[...d?Xd(d):[],...t?Xd(t):[]]:[];g.forEach(k=>{i&&k.addEventListener("scroll",n,{passive:!0}),o&&k.addEventListener("resize",n)});const p=d&&c?N7(d,n):null;let v=-1,b=null;l&&(b=new ResizeObserver(k=>{let[R]=k;R&&R.target===d&&b&&t&&(b.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var E;(E=b)==null||E.observe(t)})),n()}),d&&!h&&b.observe(d),t&&b.observe(t));let w,S=h?pl(e):null;h&&C();function C(){const k=pl(e);S&&!i5(S,k)&&n(),S=k,w=requestAnimationFrame(C)}return n(),()=>{var k;g.forEach(R=>{i&&R.removeEventListener("scroll",n),o&&R.removeEventListener("resize",n)}),p==null||p(),(k=b)==null||k.disconnect(),b=null,h&&cancelAnimationFrame(w)}}const A7=a7,j7=l7,D7=i7,O7=u7,L7=s7,K2=r7,z7=c7,P7=(e,t,n)=>{const r=new Map,i={platform:T7,...n},o={...i.platform,_c:r};return n7(e,t,{...i,platform:o})};var I7=typeof document<"u",B7=function(){},Um=I7?_.useLayoutEffect:B7;function hp(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!hp(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!hp(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function s5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function G2(e,t){const n=s5(e);return Math.round(t*n)/n}function fy(e){const t=_.useRef(e);return Um(()=>{t.current=e}),t}function F7(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:l}={},transform:c=!0,whileElementsMounted:h,open:d}=e,[g,p]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,b]=_.useState(r);hp(v,r)||b(r);const[w,S]=_.useState(null),[C,k]=_.useState(null),R=_.useCallback(z=>{z!==j.current&&(j.current=z,S(z))},[]),E=_.useCallback(z=>{z!==D.current&&(D.current=z,k(z))},[]),N=o||w,L=l||C,j=_.useRef(null),D=_.useRef(null),H=_.useRef(g),Y=h!=null,P=fy(h),q=fy(i),F=fy(d),U=_.useCallback(()=>{if(!j.current||!D.current)return;const z={placement:t,strategy:n,middleware:v};q.current&&(z.platform=q.current),P7(j.current,D.current,z).then(G=>{const M={...G,isPositioned:F.current!==!1};W.current&&!hp(H.current,M)&&(H.current=M,ss.flushSync(()=>{p(M)}))})},[v,t,n,q,F]);Um(()=>{d===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,p(z=>({...z,isPositioned:!1})))},[d]);const W=_.useRef(!1);Um(()=>(W.current=!0,()=>{W.current=!1}),[]),Um(()=>{if(N&&(j.current=N),L&&(D.current=L),N&&L){if(P.current)return P.current(N,L,U);U()}},[N,L,U,P,Y]);const V=_.useMemo(()=>({reference:j,floating:D,setReference:R,setFloating:E}),[R,E]),O=_.useMemo(()=>({reference:N,floating:L}),[N,L]),$=_.useMemo(()=>{const z={position:n,left:0,top:0};if(!O.floating)return z;const G=G2(O.floating,g.x),M=G2(O.floating,g.y);return c?{...z,transform:"translate("+G+"px, "+M+"px)",...s5(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:M}},[n,c,O.floating,g.x,g.y]);return _.useMemo(()=>({...g,update:U,refs:V,elements:O,floatingStyles:$}),[g,U,V,O,$])}const H7=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?K2({element:r.current,padding:i}).fn(n):{}:r?K2({element:r,padding:i}).fn(n):{}}}},$7=(e,t)=>{const n=A7(e);return{name:n.name,fn:n.fn,options:[e,t]}},U7=(e,t)=>{const n=j7(e);return{name:n.name,fn:n.fn,options:[e,t]}},V7=(e,t)=>({fn:z7(e).fn,options:[e,t]}),W7=(e,t)=>{const n=D7(e);return{name:n.name,fn:n.fn,options:[e,t]}},q7=(e,t)=>{const n=O7(e);return{name:n.name,fn:n.fn,options:[e,t]}},K7=(e,t)=>{const n=L7(e);return{name:n.name,fn:n.fn,options:[e,t]}},G7=(e,t)=>{const n=H7(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Y7="Arrow",o5=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...o}=e;return f.jsx(Lt.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});o5.displayName=Y7;var X7=o5;function Z7(e){const[t,n]=_.useState(void 0);return Pr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let l,c;if("borderBoxSize"in o){const h=o.borderBoxSize,d=Array.isArray(h)?h[0]:h;l=d.inlineSize,c=d.blockSize}else l=e.offsetWidth,c=e.offsetHeight;n({width:l,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var j0="Popper",[a5,ka]=So(j0),[Q7,l5]=a5(j0),c5=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return f.jsx(Q7,{scope:t,anchor:r,onAnchorChange:i,children:n})};c5.displayName=j0;var u5="PopperAnchor",d5=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,o=l5(u5,n),l=_.useRef(null),c=Qt(t,l),h=_.useRef(null);return _.useEffect(()=>{const d=h.current;h.current=(r==null?void 0:r.current)||l.current,d!==h.current&&o.onAnchorChange(h.current)}),r?null:f.jsx(Lt.div,{...i,ref:c})});d5.displayName=u5;var D0="PopperContent",[J7,eF]=a5(D0),h5=_.forwardRef((e,t)=>{var re,ce,he,pe,Se,Re;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:h=!0,collisionBoundary:d=[],collisionPadding:g=0,sticky:p="partial",hideWhenDetached:v=!1,updatePositionStrategy:b="optimized",onPlaced:w,...S}=e,C=l5(D0,n),[k,R]=_.useState(null),E=Qt(t,je=>R(je)),[N,L]=_.useState(null),j=Z7(N),D=(j==null?void 0:j.width)??0,H=(j==null?void 0:j.height)??0,Y=r+(o!=="center"?"-"+o:""),P=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},q=Array.isArray(d)?d:[d],F=q.length>0,U={padding:P,boundary:q.filter(nF),altBoundary:F},{refs:W,floatingStyles:V,placement:O,isPositioned:$,middlewareData:z}=F7({strategy:"fixed",placement:Y,whileElementsMounted:(...je)=>M7(...je,{animationFrame:b==="always"}),elements:{reference:C.anchor},middleware:[$7({mainAxis:i+H,alignmentAxis:l}),h&&U7({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?V7():void 0,...U}),h&&W7({...U}),q7({...U,apply:({elements:je,rects:Xe,availableWidth:Et,availableHeight:Rt})=>{const{width:fe,height:He}=Xe.reference,De=je.floating.style;De.setProperty("--radix-popper-available-width",`${Et}px`),De.setProperty("--radix-popper-available-height",`${Rt}px`),De.setProperty("--radix-popper-anchor-width",`${fe}px`),De.setProperty("--radix-popper-anchor-height",`${He}px`)}}),N&&G7({element:N,padding:c}),rF({arrowWidth:D,arrowHeight:H}),v&&K7({strategy:"referenceHidden",...U})]}),[G,M]=p5(O),B=ls(w);Pr(()=>{$&&(B==null||B())},[$,B]);const Z=(re=z.arrow)==null?void 0:re.x,A=(ce=z.arrow)==null?void 0:ce.y,ie=((he=z.arrow)==null?void 0:he.centerOffset)!==0,[J,ee]=_.useState();return Pr(()=>{k&&ee(window.getComputedStyle(k).zIndex)},[k]),f.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:$?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[(pe=z.transformOrigin)==null?void 0:pe.x,(Se=z.transformOrigin)==null?void 0:Se.y].join(" "),...((Re=z.hide)==null?void 0:Re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(J7,{scope:n,placedSide:G,onArrowChange:L,arrowX:Z,arrowY:A,shouldHideArrow:ie,children:f.jsx(Lt.div,{"data-side":G,"data-align":M,...S,ref:E,style:{...S.style,animation:$?void 0:"none"}})})})});h5.displayName=D0;var f5="PopperArrow",tF={top:"bottom",right:"left",bottom:"top",left:"right"},m5=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,o=eF(f5,r),l=tF[o.placedSide];return f.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:f.jsx(X7,{...i,ref:n,style:{...i.style,display:"block"}})})});m5.displayName=f5;function nF(e){return e!==null}var rF=e=>({name:"transformOrigin",options:e,fn(t){var C,k,R;const{placement:n,rects:r,middlewareData:i}=t,l=((C=i.arrow)==null?void 0:C.centerOffset)!==0,c=l?0:e.arrowWidth,h=l?0:e.arrowHeight,[d,g]=p5(n),p={start:"0%",center:"50%",end:"100%"}[g],v=(((k=i.arrow)==null?void 0:k.x)??0)+c/2,b=(((R=i.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:`${b}px`):d==="left"&&(w=`${r.floating.width+h}px`,S=l?p:`${b}px`),{data:{x:w,y:S}}}});function p5(e){const[t,n="center"]=e.split("-");return[t,n]}var ug=c5,xh=d5,dg=h5,hg=m5,g5=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"}),iF="VisuallyHidden",v5=_.forwardRef((e,t)=>f.jsx(Lt.span,{...e,ref:t,style:{...g5,...e.style}}));v5.displayName=iF;var sF=v5,[fg,zse]=So("Tooltip",[ka]),mg=ka(),_5="TooltipProvider",oF=700,Nb="tooltip.open",[aF,O0]=fg(_5),y5=e=>{const{__scopeTooltip:t,delayDuration:n=oF,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=e,l=_.useRef(!0),c=_.useRef(!1),h=_.useRef(0);return _.useEffect(()=>{const d=h.current;return()=>window.clearTimeout(d)},[]),f.jsx(aF,{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:c,onPointerInTransitChange:_.useCallback(d=>{c.current=d},[]),disableHoverableContent:i,children:o})};y5.displayName=_5;var Zd="Tooltip",[lF,wh]=fg(Zd),b5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:o,disableHoverableContent:l,delayDuration:c}=e,h=O0(Zd,e.__scopeTooltip),d=mg(t),[g,p]=_.useState(null),v=po(),b=_.useRef(0),w=l??h.disableHoverableContent,S=c??h.delayDuration,C=_.useRef(!1),[k,R]=Ic({prop:r,defaultProp:i??!1,onChange:D=>{D?(h.onOpen(),document.dispatchEvent(new CustomEvent(Nb))):h.onClose(),o==null||o(D)},caller:Zd}),E=_.useMemo(()=>k?C.current?"delayed-open":"instant-open":"closed",[k]),N=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,C.current=!1,R(!0)},[R]),L=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,R(!1)},[R]),j=_.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{C.current=!0,R(!0),b.current=0},S)},[S,R]);return _.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),f.jsx(ug,{...d,children:f.jsx(lF,{scope:t,contentId:v,open:k,stateAttribute:E,trigger:g,onTriggerChange:p,onTriggerEnter:_.useCallback(()=>{h.isOpenDelayedRef.current?j():N()},[h.isOpenDelayedRef,j,N]),onTriggerLeave:_.useCallback(()=>{w?L():(window.clearTimeout(b.current),b.current=0)},[L,w]),onOpen:N,onClose:L,disableHoverableContent:w,children:n})})};b5.displayName=Zd;var Mb="TooltipTrigger",x5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=wh(Mb,n),o=O0(Mb,n),l=mg(n),c=_.useRef(null),h=Qt(t,c,i.onTriggerChange),d=_.useRef(!1),g=_.useRef(!1),p=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),f.jsx(xh,{asChild:!0,...l,children:f.jsx(Lt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:h,onPointerMove:Fe(e.onPointerMove,v=>{v.pointerType!=="touch"&&!g.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),g.current=!0)}),onPointerLeave:Fe(e.onPointerLeave,()=>{i.onTriggerLeave(),g.current=!1}),onPointerDown:Fe(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Fe(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Fe(e.onBlur,i.onClose),onClick:Fe(e.onClick,i.onClose)})})});x5.displayName=Mb;var L0="TooltipPortal",[cF,uF]=fg(L0,{forceMount:void 0}),w5=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,o=wh(L0,t);return f.jsx(cF,{scope:t,forceMount:n,children:f.jsx(Xi,{present:n||o.open,children:f.jsx(eu,{asChild:!0,container:i,children:r})})})};w5.displayName=L0;var Hc="TooltipContent",S5=_.forwardRef((e,t)=>{const n=uF(Hc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=e,l=wh(Hc,e.__scopeTooltip);return f.jsx(Xi,{present:r||l.open,children:l.disableHoverableContent?f.jsx(C5,{side:i,...o,ref:t}):f.jsx(dF,{side:i,...o,ref:t})})}),dF=_.forwardRef((e,t)=>{const n=wh(Hc,e.__scopeTooltip),r=O0(Hc,e.__scopeTooltip),i=_.useRef(null),o=Qt(t,i),[l,c]=_.useState(null),{trigger:h,onClose:d}=n,g=i.current,{onPointerInTransitChange:p}=r,v=_.useCallback(()=>{c(null),p(!1)},[p]),b=_.useCallback((w,S)=>{const C=w.currentTarget,k={x:w.clientX,y:w.clientY},R=gF(k,C.getBoundingClientRect()),E=vF(k,R),N=_F(S.getBoundingClientRect()),L=bF([...E,...N]);c(L),p(!0)},[p]);return _.useEffect(()=>()=>v(),[v]),_.useEffect(()=>{if(h&&g){const w=C=>b(C,g),S=C=>b(C,h);return h.addEventListener("pointerleave",w),g.addEventListener("pointerleave",S),()=>{h.removeEventListener("pointerleave",w),g.removeEventListener("pointerleave",S)}}},[h,g,b,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=!yF(k,l);R?v():E&&(v(),d())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[h,g,l,d,v]),f.jsx(C5,{...e,ref:o})}),[hF,fF]=fg(Zd,{isInside:!1}),mF=rB("TooltipContent"),C5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:l,...c}=e,h=wh(Hc,n),d=mg(n),{onClose:g}=h;return _.useEffect(()=>(document.addEventListener(Nb,g),()=>document.removeEventListener(Nb,g)),[g]),_.useEffect(()=>{if(h.trigger){const p=v=>{const b=v.target;b!=null&&b.contains(h.trigger)&&g()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[h.trigger,g]),f.jsx(Jc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:g,children:f.jsxs(dg,{"data-state":h.stateAttribute,...d,...c,ref:t,style:{...c.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(mF,{children:r}),f.jsx(hF,{scope:n,isInside:!0,children:f.jsx(sF,{id:h.contentId,role:"tooltip",children:i||r})})]})})});S5.displayName=Hc;var k5="TooltipArrow",pF=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=mg(n);return fF(k5,n).isInside?null:f.jsx(hg,{...i,...r,ref:t})});pF.displayName=k5;function gF(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function vF(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 _F(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function yF(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,l=t.length-1;o<t.length;l=o++){const c=t[o],h=t[l],d=c.x,g=c.y,p=h.x,v=h.y;g>r!=v>r&&n<(p-d)*(r-g)/(v-g)+d&&(i=!i)}return i}function bF(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),xF(t)}function xF(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const o=t[t.length-1],l=t[t.length-2];if((o.x-l.x)*(i.y-l.y)>=(o.y-l.y)*(i.x-l.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const o=n[n.length-1],l=n[n.length-2];if((o.x-l.x)*(i.y-l.y)>=(o.y-l.y)*(i.x-l.x))n.pop();else break}n.push(i)}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 wF=y5,E5=b5,R5=x5,T5=w5,z0=S5;function SF({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 CF({className:e,...t}){return f.jsx("span",{className:me("inline-flex items-center gap-0.5",e),...t})}const kF="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",EF=wF,Ms=E5,As=R5,os=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>f.jsx(T5,{children:f.jsx(z0,{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})}));os.displayName=z0.displayName;const bd=E5,xd=R5;function N5(e){return e.toUpperCase()}function RF(e){const t=e.split("+");return f.jsx(CF,{children:t.map((n,r)=>f.jsx(SF,{children:N5(n)},`${n}-${r}`))})}const Rc=_.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...i},o)=>{const l=r===void 0?null:Array.isArray(r)?r[0]??null:r;return f.jsx(T5,{children:f.jsx(z0,{ref:o,sideOffset:t,className:me(kF,e),...i,children:l?RF(l):f.jsx("span",{children:typeof n=="string"?N5(n):n})})})});Rc.displayName="HotkeyTooltipContent";const TF="0.5.0",NF={version:TF},Zn="Kaizen",Y2="kaizen",MF=".kaizen",AF=".kaizen-dev",my=".kaizen",jF="KAIZEN_RUNTIME_PROFILE",P0=`kaizen/${NF.version}`,DF="[kaizen]",OF=`~/${Zn}`,pg="kaizen:";function ru(){var t;return(t=globalThis.process)==null?void 0:t.env}function LF(e=ru()){const t=e==null?void 0:e[jF];return(t==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function zF(e=ru()){return LF(e)==="dev"?AF:MF}function M5(e=ru()){return`~/${zF(e)}`}function PF(e=ru()){return`${M5(e)}/keybindings.json`}function IF(e=ru()){return`${M5(e)}/themes`}function BF(e=ru()){return`${IF(e)}/THEME_README.md`}function fm(e){return e?`${Y2} ${e}`:Y2}const fp=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"max",label:"Max"}],Ab=[{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"}],Db="claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]",A5=[{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}],FF={"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 HF(e){return e?A5.some(t=>t.id===e)?e:FF[e]??Db:Db}function X2(e){const t=e.indexOf("[");return t>=0?e.slice(0,t):e}function Sc(e){const t=e.match(/\bfast=(true|false)\b/);return t?t[1]==="true"?"fast":"standard":null}function Z2(e){return fp.some(t=>t.id===e)}function Q2(e){return Ab.some(t=>t.id===e)}const Ob=[{id:"200k",label:"200k"},{id:"1m",label:"1M"}];function $F(e){return jb.some(t=>t.id===e)}const ma=[{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:[...Ob]},{id:"sonnet",label:"Sonnet",supportsEffort:!0,contextWindowOptions:[...Ob]},{id:"haiku",label:"Haiku",supportsEffort:!0}],efforts:[...fp]},{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:Db,defaultModelOptions:{},supportsPlanMode:!0,models:[...A5],efforts:[]}],sr={claude:{active:!0},codex:{active:!0},gemini:{active:!0},cursor:{active:!0}};function dn(e){const t=ma.find(n=>n.id===e);if(!t)throw new Error(`Unknown provider: ${e}`);return t}function I0(e,t){const n=sr[t],r=e==null?void 0:e[t];return{active:(r==null?void 0:r.active)??n.active}}function UF(e,t){const n=dn(e),r=I0(t,e);return n.systemActive&&r.active?null:`Provider ${n.label} is currently not active.`}function J2(e,t){const n=dn(e),r=I0(t,e);return n.systemActive&&r.active}function VF(e){return ma.map(t=>{const n=I0(e,t.id),r=t.systemActive&&n.active;return{...t,active:n.active,isSelectable:r,isUsageEnabled:r,isInactive:!r,inactiveMessage:UF(t.id,e)}})}function B0(e){return VF(e).filter(t=>t.isSelectable).map(({active:t,isSelectable:n,isUsageEnabled:r,isInactive:i,inactiveMessage:o,...l})=>l)}function Ui(e){return dn(e).defaultModelOptions}const j5=Ui("claude");Ui("codex");Ui("gemini");Ui("cursor");function WF(e){return dn("claude").models.find(t=>t.id===e)}function qF(e){var t;return((t=WF(e))==null?void 0:t.contextWindowOptions)??[]}function KF(e,t){const n=qF(e);if(n.length!==0)return n.some(r=>r.id===t)?t:j5.contextWindow}const GF=["idea","todo","progress","testing","done"],eE={idea:"IDEA",todo:"TODO",progress:"PROGRESS",testing:"TESTING",done:"DONE"},ks={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+/"]},mp=8,D5=10*1024*1024,pp=["image/png","image/jpeg","image/webp","image/gif"],YF="/assets/icon-4rSnra9R.svg";function Ld({alt:e="",className:t,...n}){return f.jsx("img",{alt:e,src:YF,className:me("shrink-0 object-contain",t),...n})}var gg="Popover",[O5,Pse]=So(gg,[ka]),Sh=ka(),[XF,Ea]=O5(gg),L5=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:l=!1}=e,c=Sh(t),h=_.useRef(null),[d,g]=_.useState(!1),[p,v]=Ic({prop:r,defaultProp:i??!1,onChange:o,caller:gg});return f.jsx(ug,{...c,children:f.jsx(XF,{scope:t,contentId:po(),triggerRef:h,open:p,onOpenChange:v,onOpenToggle:_.useCallback(()=>v(b=>!b),[v]),hasCustomAnchor:d,onCustomAnchorAdd:_.useCallback(()=>g(!0),[]),onCustomAnchorRemove:_.useCallback(()=>g(!1),[]),modal:l,children:n})})};L5.displayName=gg;var z5="PopoverAnchor",P5=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Ea(z5,n),o=Sh(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=i;return _.useEffect(()=>(l(),()=>c()),[l,c]),f.jsx(xh,{...o,...r,ref:t})});P5.displayName=z5;var I5="PopoverTrigger",B5=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Ea(I5,n),o=Sh(n),l=Qt(t,i.triggerRef),c=f.jsx(Lt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":V5(i.open),...r,ref:l,onClick:Fe(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?c:f.jsx(xh,{asChild:!0,...o,children:c})});B5.displayName=I5;var F0="PopoverPortal",[ZF,QF]=O5(F0,{forceMount:void 0}),F5=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,o=Ea(F0,t);return f.jsx(ZF,{scope:t,forceMount:n,children:f.jsx(Xi,{present:n||o.open,children:f.jsx(eu,{asChild:!0,container:i,children:r})})})};F5.displayName=F0;var $c="PopoverContent",H5=_.forwardRef((e,t)=>{const n=QF($c,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,o=Ea($c,e.__scopePopover);return f.jsx(Xi,{present:r||o.open,children:o.modal?f.jsx(eH,{...i,ref:t}):f.jsx(tH,{...i,ref:t})})});H5.displayName=$c;var JF=fl("PopoverContent.RemoveScroll"),eH=_.forwardRef((e,t)=>{const n=Ea($c,e.__scopePopover),r=_.useRef(null),i=Qt(t,r),o=_.useRef(!1);return _.useEffect(()=>{const l=r.current;if(l)return Jp(l)},[]),f.jsx(vh,{as:JF,allowPinchZoom:!0,children:f.jsx($5,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Fe(e.onCloseAutoFocus,l=>{var c;l.preventDefault(),o.current||(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Fe(e.onPointerDownOutside,l=>{const c=l.detail.originalEvent,h=c.button===0&&c.ctrlKey===!0,d=c.button===2||h;o.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:Fe(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),tH=_.forwardRef((e,t)=>{const n=Ea($c,e.__scopePopover),r=_.useRef(!1),i=_.useRef(!1);return f.jsx($5,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,c;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var h,d;(h=e.onInteractOutside)==null||h.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=o.target;((d=n.triggerRef.current)==null?void 0:d.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),$5=_.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:h,onFocusOutside:d,onInteractOutside:g,...p}=e,v=Ea($c,n),b=Sh(n);return Zp(),f.jsx(gh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:f.jsx(Jc,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:g,onEscapeKeyDown:c,onPointerDownOutside:h,onFocusOutside:d,onDismiss:()=>v.onOpenChange(!1),children:f.jsx(dg,{"data-state":V5(v.open),role:"dialog",id:v.contentId,...b,...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)"}})})})}),U5="PopoverClose",nH=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Ea(U5,n);return f.jsx(Lt.button,{type:"button",...r,ref:t,onClick:Fe(e.onClick,()=>i.onOpenChange(!1))})});nH.displayName=U5;var rH="PopoverArrow",iH=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Sh(n);return f.jsx(hg,{...i,...r,ref:t})});iH.displayName=rH;function V5(e){return e?"open":"closed"}var W5=L5,sH=P5,oH=B5,q5=F5,H0=H5;const K5=W5,G5=oH,$0=_.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>f.jsx(q5,{children:f.jsx(H0,{ref:i,align:t,sideOffset:n,[Yd]:"",onCloseAutoFocus:o=>{var l;o.preventDefault(),window.dispatchEvent(new Event(ap)),(l=r.onCloseAutoFocus)==null||l.call(r,o)},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})}));$0.displayName=H0.displayName;function aH({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 lH({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 cH({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 uH({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 dH(e){return!(e.startsWith("gemini-3")||e==="auto-gemini-3")}const hH=["Composer","GPT","Claude","Gemini","Grok","Kimi"];function fH(e){return e.startsWith("composer-")?"Composer":e.startsWith("gpt-")?"GPT":e.startsWith("claude-")?"Claude":e.startsWith("gemini-")?"Gemini":e.startsWith("grok-")?"Grok":"Kimi"}function py(e,t){const n=Sc(t);return!n||n==="standard"?e:`${e} (${n==="fast"?"Fast":"Standard"})`}const gp={claude:aH,codex:lH,gemini:cH,cursor:uH},mm={auto:Hn,opus:vi,sonnet:Hn,haiku:Rs,"gpt-5.4":vi,"gpt-5.4[reasoning=medium,context=272k,fast=false]":vi,"gpt-5.4-mini[reasoning=medium]":Hn,"gpt-5.4-nano[reasoning=medium]":Rs,"gpt-5.3-codex":Hn,"gpt-5.3-codex[reasoning=medium,fast=false]":Hn,"gpt-5.3-codex-spark[reasoning=medium]":Rs,"gpt-5.2[reasoning=medium,fast=false]":Hn,"gpt-5.2-codex[reasoning=medium,fast=false]":Hn,"gpt-5.3-codex-spark":Rs,"gemini-2.5-pro":vi,"gemini-2.5-flash":Hn,"gemini-2.5-flash-lite":Rs,"auto-gemini-3":vi,"auto-gemini-2.5":Hn,"gemini-3.1-pro-preview":vi,"gemini-3.1-pro[]":vi,"gemini-3-flash[]":Hn,"gemini-3-pro-preview":vi,"gemini-3-flash-preview":Hn,"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]":vi,"claude-opus-4-5[thinking=true]":vi,"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]":Hn,"claude-sonnet-4-5[thinking=true,context=200k]":Hn,"claude-sonnet-4[thinking=false,context=200k]":Hn,"claude-haiku-4-5[thinking=true]":Rs,"grok-4-20[thinking=true]":vi,"kimi-k2.5[]":Hn,"composer-2[fast=true]":vi,"composer-1.5[]":Hn};function ti({onClick:e,selected:t,icon:n,label:r,description:i,disabled:o}){return f.jsxs("button",{onClick:e,disabled:o,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",o&&"opacity-40 cursor-not-allowed"),children:[n,f.jsxs("div",{children:[f.jsx("div",{className:"text-sm font-medium",children:r}),i?f.jsx("div",{className:"text-xs text-muted-foreground",children:i}):null]})]})}function ra({trigger:e,triggerClassName:t,disabled:n=!1,children:r}){const[i,o]=_.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(K5,{open:i,onOpenChange:o,children:[f.jsx(G5,{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($0,{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(()=>o(!1)):r})})]})}function wd({availableProviders:e,selectedProvider:t,disabled:n=!1,showProviderPicker:r=!0,providerLocked:i=!1,model:o,modelOptions:l,onProviderChange:c,onModelChange:h,onClaudeReasoningEffortChange:d,onClaudeContextWindowChange:g,onCodexReasoningEffortChange:p,onGeminiThinkingModeChange:v,onCodexFastModeChange:b,planMode:w=!1,onPlanModeChange:S,includePlanMode:C=!0,className:k}){var G,M,B,Z,A,ie,J;const[R,E]=_.useState(null),N=e.find(ee=>ee.id===t)??dn(t),L=gp[t],j=mm[o]??Hn,D=C&&(N==null?void 0:N.supportsPlanMode)&&S,H=t==="claude"?l:null,Y=t==="codex"?l:null,P=t==="gemini"?l:null,q=((G=N.models.find(ee=>ee.id===o))==null?void 0:G.contextWindowOptions)??[],F=(H==null?void 0:H.contextWindow)??Ob[0].id,U=F==="1m"?D2:O2,W=t==="claude"||t==="codex",V=t==="cursor"?Sc(o):null,O=N.id==="cursor"?N.models.filter(ee=>X2(ee.id)===X2(o)):[],$=t==="cursor"&&O.some(ee=>Sc(ee.id)==="fast")&&O.some(ee=>Sc(ee.id)==="standard"),z=N.id==="cursor"?hH.map(ee=>({family:ee,models:N.models.filter(re=>fH(re.id)===ee)})).filter(ee=>ee.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(ra,{disabled:i||!c,trigger:f.jsxs(f.Fragment,{children:[f.jsx(L,{className:"h-3.5 w-3.5"}),f.jsx("span",{className:"hidden md:inline",children:(N==null?void 0:N.label)??t})]}),children:ee=>e.map(re=>{const ce=gp[re.id];return f.jsx(ti,{onClick:()=>{c==null||c(re.id),ee()},selected:t===re.id,icon:f.jsx(ce,{className:"h-4 w-4 text-muted-foreground"}),label:re.label},re.id)})}):null,f.jsx(ra,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(j,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:N.id==="cursor"?py(((M=N.models.find(ee=>ee.id===o))==null?void 0:M.label)??o,o):((B=N.models.find(ee=>ee.id===o))==null?void 0:B.label)??o})]}),children:ee=>{var re;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(zM,{className:"h-4 w-4"}),f.jsx("span",{children:R})]}),(re=z.find(ce=>ce.family===R))==null?void 0:re.models.map(ce=>{const he=mm[ce.id]??Hn;return f.jsx(ti,{onClick:()=>{h(t,ce.id),E(null),ee()},selected:o===ce.id,icon:f.jsx(he,{className:"h-4 w-4 text-muted-foreground"}),label:py(ce.label,ce.id)},ce.id)})]}):z.map(ce=>{var Se;const he=ce.models.some(Re=>Re.id===o),pe=mm[((Se=ce.models[0])==null?void 0:Se.id)??""]??Hn;return f.jsxs("div",{className:"relative",children:[f.jsx(ti,{onClick:()=>E(ce.family),selected:he,icon:f.jsx(pe,{className:"h-4 w-4 text-muted-foreground"}),label:ce.family,description:`${ce.models.length} model${ce.models.length===1?"":"s"}`}),f.jsx(Vr,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"})]},ce.family)}):N.models.map(ce=>{const he=mm[ce.id]??Hn;return f.jsx(ti,{onClick:()=>{h(t,ce.id),ee()},selected:o===ce.id,icon:f.jsx(he,{className:"h-4 w-4 text-muted-foreground"}),label:N.id==="cursor"?py(ce.label,ce.id):ce.label},ce.id)})}}),$?f.jsx(ra,{trigger:f.jsxs(f.Fragment,{children:[V==="fast"?f.jsx(Rs,{className:"h-3.5 w-3.5"}):f.jsx(ao,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:V==="fast"?"Fast":"Standard"})]}),triggerClassName:V==="fast"?"text-emerald-500 dark:text-emerald-400":void 0,children:ee=>f.jsxs(f.Fragment,{children:[O.filter(re=>Sc(re.id)==="standard").map(re=>f.jsx(ti,{onClick:()=>{h(t,re.id),ee()},selected:o===re.id,icon:f.jsx(ao,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"},re.id)),O.filter(re=>Sc(re.id)==="fast").map(re=>f.jsx(ti,{onClick:()=>{h(t,re.id),ee()},selected:o===re.id,icon:f.jsx(Rs,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast"},re.id))]})}):null,W?f.jsx(ra,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(ao,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:t==="claude"?((Z=fp.find(ee=>ee.id===l.reasoningEffort))==null?void 0:Z.label)??l.reasoningEffort:((A=Ab.find(ee=>ee.id===l.reasoningEffort))==null?void 0:A.label)??l.reasoningEffort})]}),children:ee=>t==="claude"?fp.map(re=>f.jsx(ti,{onClick:()=>{d(re.id),ee()},selected:l.reasoningEffort===re.id,icon:f.jsx(ao,{className:"h-4 w-4 text-muted-foreground"}),label:re.label,disabled:re.id==="max"&&o!=="opus"},re.id)):Ab.map(re=>f.jsx(ti,{onClick:()=>{p(re.id),ee()},selected:l.reasoningEffort===re.id,icon:f.jsx(ao,{className:"h-4 w-4 text-muted-foreground"}),label:re.label},re.id))}):null,t==="claude"&&q.length>1?f.jsx(ra,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(U,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:((ie=q.find(ee=>ee.id===F))==null?void 0:ie.label)??F})]}),children:ee=>q.map(re=>f.jsx(ti,{onClick:()=>{g(re.id),ee()},selected:F===re.id,icon:re.id==="1m"?f.jsx(D2,{className:"h-4 w-4 text-muted-foreground"}):f.jsx(O2,{className:"h-4 w-4 text-muted-foreground"}),label:re.label,description:re.id==="1m"?"Expanded context window":"Standard context window"},re.id))}):null,t==="gemini"?f.jsx(ra,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(ao,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:((J=jb.find(ee=>ee.id===(P==null?void 0:P.thinkingMode)))==null?void 0:J.label)??(P==null?void 0:P.thinkingMode)??"Standard"})]}),children:ee=>jb.map(re=>f.jsx(ti,{onClick:()=>{v(re.id),ee()},selected:(P==null?void 0:P.thinkingMode)===re.id,icon:f.jsx(ao,{className:"h-4 w-4 text-muted-foreground"}),label:re.label,disabled:re.id==="off"&&!dH(o)},re.id))}):null,t==="codex"?f.jsx(ra,{trigger:f.jsxs(f.Fragment,{children:[Y!=null&&Y.fastMode?f.jsx(Rs,{className:"h-3.5 w-3.5"}):f.jsx(ao,{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:ee=>f.jsxs(f.Fragment,{children:[f.jsx(ti,{onClick:()=>{b(!1),ee()},selected:!(Y!=null&&Y.fastMode),icon:f.jsx(ao,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"}),f.jsx(ti,{onClick:()=>{b(!0),ee()},selected:!!(Y!=null&&Y.fastMode),icon:f.jsx(Rs,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast Mode"})]})}):null,D?f.jsx(ra,{trigger:f.jsxs(f.Fragment,{children:[w?f.jsx(sp,{className:"h-3.5 w-3.5"}):f.jsx(A2,{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:ee=>f.jsxs(f.Fragment,{children:[f.jsx(ti,{onClick:()=>{S(!1),ee()},selected:!w,icon:f.jsx(A2,{className:"h-4 w-4 text-muted-foreground"}),label:"Implement",description:"Start execution"}),f.jsx(ti,{onClick:()=>{S(!0),ee()},selected:w,icon:f.jsx(sp,{className:"h-4 w-4 text-muted-foreground"}),label:"Plan",description:"Review a plan before execution"})]})}):null]})})}const vg=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...i})=>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),...i,children:e});function Lb(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const mH=[/^(?:\/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 pH(e){const t=e.trim();for(const n of mH){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function vp(e){return e.split("/").pop()||e}function gH(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,o=24*i,l=7*o;return n<r?"now":n<i?`${Math.floor(n/r)}m`:n<o?`${Math.floor(n/i)}h`:n<l?`${Math.floor(n/o)}d`:`${Math.floor(n/l)}w`}const vH='button, select, input, textarea, [role="combobox"], [role="listbox"], [data-no-touch-drag]';function tE(e){var t;try{(t=navigator.vibrate)==null||t.call(navigator,e)}catch{}}function U0({enabled:e,visualElementRef:t,onTap:n,onContextMenu:r,onDragStart:i,onDragMove:o,onDragEnd:l,holdDelay:c=300,contextMenuDelay:h=2500,scrollThreshold:d=8,dragMoveThreshold:g=5}){const[p,v]=_.useState(!1),[b,w]=_.useState(!1),[S,C]=_.useState(null),[k,R]=_.useState(null),E=_.useCallback(O=>{R(O)},[]),N=_.useRef("idle"),L=_.useRef({x:0,y:0}),j=_.useRef(null),D=_.useRef(null),H=_.useRef(n),Y=_.useRef(r),P=_.useRef(i),q=_.useRef(o),F=_.useRef(l);H.current=n,Y.current=r,P.current=i,q.current=o,F.current=l;const U=_.useCallback((O,$)=>{const z=(t==null?void 0:t.current)??k;if(!z)return document.elementFromPoint(O,$);const G=z.style.pointerEvents;z.style.pointerEvents="none";const M=document.elementFromPoint(O,$);return z.style.pointerEvents=G,M},[t,k]),W=_.useCallback(()=>{j.current&&(clearTimeout(j.current),j.current=null),D.current&&(clearTimeout(D.current),D.current=null)},[]),V=_.useCallback(()=>{W(),N.current="idle",w(!1),v(!1),C(null)},[W]);return _.useEffect(()=>{if(!k||!e)return;const O=M=>{if(M.target.closest(vH))return;const B=M.touches[0];B&&(L.current={x:B.clientX,y:B.clientY},N.current="holding",j.current=setTimeout(()=>{j.current=null,N.current==="holding"&&(N.current="armed",w(!0),tE(30),D.current=setTimeout(()=>{var A;if(D.current=null,N.current!=="armed")return;tE(100);const Z={...L.current};N.current="idle",w(!1),(A=Y.current)==null||A.call(Y,Z)},h))},c))},$=M=>{var ee,re;const B=N.current;if(B==="idle")return;const Z=M.touches[0];if(!Z)return;const A=Z.clientX-L.current.x,ie=Z.clientY-L.current.y,J=Math.sqrt(A*A+ie*ie);if(B==="holding"){J>d&&(W(),N.current="idle");return}if(B==="armed"){J>g&&(D.current&&(clearTimeout(D.current),D.current=null),N.current="dragging",w(!1),v(!0),C({x:Z.clientX,y:Z.clientY}),M.preventDefault(),(ee=P.current)==null||ee.call(P,{x:Z.clientX,y:Z.clientY}));return}if(B==="dragging"){M.preventDefault(),C({x:Z.clientX,y:Z.clientY});const ce=U(Z.clientX,Z.clientY);(re=q.current)==null||re.call(q,{x:Z.clientX,y:Z.clientY,elementBelow:ce})}},z=M=>{var Z,A;const B=N.current;if(B==="holding"){W(),N.current="idle",w(!1),v(!1),M.preventDefault(),(Z=H.current)==null||Z.call(H);return}if(B==="armed"){V();return}if(B==="dragging"){const ie=M.changedTouches[0];if(ie){const J=U(ie.clientX,ie.clientY);(A=F.current)==null||A.call(F,{x:ie.clientX,y:ie.clientY,elementBelow:J})}V()}},G=()=>{var M;N.current==="dragging"&&((M=F.current)==null||M.call(F,{x:0,y:0,elementBelow:null})),V()};return k.addEventListener("touchstart",O,{passive:!1}),k.addEventListener("touchmove",$,{passive:!1}),k.addEventListener("touchend",z),k.addEventListener("touchcancel",G),()=>{k.removeEventListener("touchstart",O),k.removeEventListener("touchmove",$),k.removeEventListener("touchend",z),k.removeEventListener("touchcancel",G),W(),N.current="idle"}},[k,e,c,h,d,g,W,V,U]),{touchRef:E,isDragging:p,isArmed:b,dragPosition:S}}function Y5({position:e,children:t,className:n}){return e?ss.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 _H=new Set(["starting","running"]);function yH({chat:e,activeChatId:t,nowMs:n,showProviderIcon:r=!1,isCompleted:i=!1,onSelectChat:o,onDeleteChat:l,draggable:c=!1,onDragStart:h,onDragEnd:d,isTouchDevice:g=!1,onTouchDragMove:p,onTouchDragEnd:v}){const b=gH(e.lastMessageAt,n),w=g&&c,S=e.provider?gp[e.provider]:null,{touchRef:C,isArmed:k,isDragging:R,dragPosition:E}=U0({enabled:w,onTap:()=>o(e.chatId),onDragStart:()=>h==null?void 0:h(e),onDragMove:({x:N,y:L,elementBelow:j})=>p==null?void 0:p(N,L,j),onDragEnd:({x:N,y:L,elementBelow:j})=>{v==null||v(N,L,j),d==null||d()}});return f.jsxs(f.Fragment,{children:[f.jsxs("div",{ref:w?C:void 0,"data-chat-id":f2(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===f2(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:c&&!g,onDragStart:c&&!g?()=>h==null?void 0:h(e):void 0,onDragEnd:c&&!g?d:void 0,onClick:g?void 0:()=>o(e.chatId),children:[_H.has(e.status)?f.jsx(Lr,{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"})]})}):i?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(vg,{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:[b?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:b}):null,f.jsx(et,{variant:"ghost",size:"icon",className:me("absolute inset-0 h-7 w-7 opacity-100 cursor-pointer rounded-sm hover:!bg-transparent !border-0",b?"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(D6,{className:"size-3.5"})})]})]},e._id),f.jsx(Y5,{position:E,children:f.jsx("span",{className:"text-sm font-medium truncate",children:e.title})})]})}function bH(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const _g=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function iu(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function V0(e){return"nodeType"in e}function oi(e){var t,n;return e?iu(e)?e:V0(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function W0(e){const{Document:t}=oi(e);return e instanceof t}function Ch(e){return iu(e)?!1:e instanceof oi(e).HTMLElement}function X5(e){return e instanceof oi(e).SVGElement}function su(e){return e?iu(e)?e.document:V0(e)?W0(e)?e:Ch(e)||X5(e)?e.ownerDocument:document:document:document}const Is=_g?_.useLayoutEffect:_.useEffect;function q0(e){const t=_.useRef(e);return Is(()=>{t.current=e}),_.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function xH(){const e=_.useRef(null),t=_.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=_.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Qd(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return Is(()=>{n.current!==e&&(n.current=e)},t),n}function kh(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function _p(e){const t=q0(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function zb(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let gy={};function Eh(e,t){return _.useMemo(()=>{if(t)return t;const n=gy[e]==null?0:gy[e]+1;return gy[e]=n,e+"-"+n},[e,t])}function Z5(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((o,l)=>{const c=Object.entries(l);for(const[h,d]of c){const g=o[h];g!=null&&(o[h]=g+e*d)}return o},{...t})}}const Oc=Z5(1),yp=Z5(-1);function wH(e){return"clientX"in e&&"clientY"in e}function K0(e){if(!e)return!1;const{KeyboardEvent:t}=oi(e.target);return t&&e instanceof t}function SH(e){if(!e)return!1;const{TouchEvent:t}=oi(e.target);return t&&e instanceof t}function Pb(e){if(SH(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 wH(e)?{x:e.clientX,y:e.clientY}:null}const Jd=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[Jd.Translate.toString(e),Jd.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),nE="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function CH(e){return e.matches(nE)?e:e.querySelector(nE)}const kH={display:"none"};function EH(e){let{id:t,value:n}=e;return xe.createElement("div",{id:t,style:kH},n)}function RH(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={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 xe.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function TH(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Q5=_.createContext(null);function NH(e){const t=_.useContext(Q5);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function MH(){const[e]=_.useState(()=>new Set),t=_.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[_.useCallback(r=>{let{type:i,event:o}=r;e.forEach(l=>{var c;return(c=l[i])==null?void 0:c.call(l,o)})},[e]),t]}const AH={draggable:`
505
+ To pick up a draggable item, press the space bar.
506
+ While dragging, use the arrow keys to move the item.
507
+ Press space again to drop the item in its new position, or press escape to cancel.
508
+ `},jH={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 DH(e){let{announcements:t=jH,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=AH}=e;const{announce:o,announcement:l}=TH(),c=Eh("DndLiveRegion"),[h,d]=_.useState(!1);if(_.useEffect(()=>{d(!0)},[]),NH(_.useMemo(()=>({onDragStart(p){let{active:v}=p;o(t.onDragStart({active:v}))},onDragMove(p){let{active:v,over:b}=p;t.onDragMove&&o(t.onDragMove({active:v,over:b}))},onDragOver(p){let{active:v,over:b}=p;o(t.onDragOver({active:v,over:b}))},onDragEnd(p){let{active:v,over:b}=p;o(t.onDragEnd({active:v,over:b}))},onDragCancel(p){let{active:v,over:b}=p;o(t.onDragCancel({active:v,over:b}))}}),[o,t])),!h)return null;const g=xe.createElement(xe.Fragment,null,xe.createElement(EH,{id:r,value:i.draggable}),xe.createElement(RH,{id:c,announcement:l}));return n?ss.createPortal(g,n):g}var or;(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"})(or||(or={}));function bp(){}function vy(e,t){return _.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function OH(){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 ds=Object.freeze({x:0,y:0});function LH(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zH(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function PH(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function IH(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function rE(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 BH=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=rE(t,t.left,t.top),o=[];for(const l of r){const{id:c}=l,h=n.get(c);if(h){const d=LH(rE(h),i);o.push({id:c,data:{droppableContainer:l,value:d}})}}return o.sort(zH)};function FH(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),l=i-r,c=o-n;if(r<i&&n<o){const h=t.width*t.height,d=e.width*e.height,g=l*c,p=g/(h+d-g);return Number(p.toFixed(4))}return 0}const HH=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const h=FH(c,t);h>0&&i.push({id:l,data:{droppableContainer:o,value:h}})}}return i.sort(PH)};function $H(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function J5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ds}function UH(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i.reduce((l,c)=>({...l,top:l.top+e*c.y,bottom:l.bottom+e*c.y,left:l.left+e*c.x,right:l.right+e*c.x}),{...n})}}const VH=UH(1);function WH(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 qH(e,t,n){const r=WH(t);if(!r)return e;const{scaleX:i,scaleY:o,x:l,y:c}=r,h=e.left-l-(1-i)*parseFloat(n),d=e.top-c-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),g=i?e.width/i:e.width,p=o?e.height/o:e.height;return{width:g,height:p,top:d,right:h+g,bottom:d+p,left:h}}const KH={ignoreTransform:!1};function ou(e,t){t===void 0&&(t=KH);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=oi(e).getComputedStyle(e);d&&(n=qH(n,d,g))}const{top:r,left:i,width:o,height:l,bottom:c,right:h}=n;return{top:r,left:i,width:o,height:l,bottom:c,right:h}}function iE(e){return ou(e,{ignoreTransform:!0})}function GH(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function YH(e,t){return t===void 0&&(t=oi(e).getComputedStyle(e)),t.position==="fixed"}function XH(e,t){t===void 0&&(t=oi(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function G0(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(W0(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Ch(i)||X5(i)||n.includes(i))return n;const o=oi(e).getComputedStyle(i);return i!==e&&XH(i,o)&&n.push(i),YH(i,o)?n:r(i.parentNode)}return e?r(e):n}function eA(e){const[t]=G0(e,1);return t??null}function _y(e){return!_g||!e?null:iu(e)?e:V0(e)?W0(e)||e===su(e).scrollingElement?window:Ch(e)?e:null:null}function tA(e){return iu(e)?e.scrollX:e.scrollLeft}function nA(e){return iu(e)?e.scrollY:e.scrollTop}function Ib(e){return{x:tA(e),y:nA(e)}}var hr;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(hr||(hr={}));function rA(e){return!_g||!e?!1:e===document.scrollingElement}function iA(e){const t={x:0,y:0},n=rA(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,l=e.scrollTop>=r.y,c=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:l,isRight:c,maxScroll:r,minScroll:t}}const ZH={x:.2,y:.2};function QH(e,t,n,r,i){let{top:o,left:l,right:c,bottom:h}=n;r===void 0&&(r=10),i===void 0&&(i=ZH);const{isTop:d,isBottom:g,isLeft:p,isRight:v}=iA(e),b={x:0,y:0},w={x:0,y:0},S={height:t.height*i.y,width:t.width*i.x};return!d&&o<=t.top+S.height?(b.y=hr.Backward,w.y=r*Math.abs((t.top+S.height-o)/S.height)):!g&&h>=t.bottom-S.height&&(b.y=hr.Forward,w.y=r*Math.abs((t.bottom-S.height-h)/S.height)),!v&&c>=t.right-S.width?(b.x=hr.Forward,w.x=r*Math.abs((t.right-S.width-c)/S.width)):!p&&l<=t.left+S.width&&(b.x=hr.Backward,w.x=r*Math.abs((t.left+S.width-l)/S.width)),{direction:b,speed:w}}function JH(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:l}=window;return{top:0,left:0,right:o,bottom:l,width:o,height:l}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function sA(e){return e.reduce((t,n)=>Oc(t,Ib(n)),ds)}function e$(e){return e.reduce((t,n)=>t+tA(n),0)}function t$(e){return e.reduce((t,n)=>t+nA(n),0)}function n$(e,t){if(t===void 0&&(t=ou),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);eA(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const r$=[["x",["left","right"],e$],["y",["top","bottom"],t$]];class Y0{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=G0(n),i=sA(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,l,c]of r$)for(const h of l)Object.defineProperty(this,h,{get:()=>{const d=c(r),g=i[o]-d;return this.rect[h]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class zd{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 i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function i$(e){const{EventTarget:t}=oi(e);return e instanceof t?e:su(e)}function yy(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 Fi;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Fi||(Fi={}));function sE(e){e.preventDefault()}function s$(e){e.stopPropagation()}var Zt;(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"})(Zt||(Zt={}));const oA={start:[Zt.Space,Zt.Enter],cancel:[Zt.Esc],end:[Zt.Space,Zt.Enter,Zt.Tab]},o$=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Zt.Right:return{...n,x:n.x+25};case Zt.Left:return{...n,x:n.x-25};case Zt.Down:return{...n,y:n.y+25};case Zt.Up:return{...n,y:n.y-25}}};class X0{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 zd(su(n)),this.windowListeners=new zd(oi(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Fi.Resize,this.handleCancel),this.windowListeners.add(Fi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Fi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&n$(r),n(ds)}handleKeyDown(t){if(K0(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=oA,coordinateGetter:l=o$,scrollBehavior:c="smooth"}=i,{code:h}=t;if(o.end.includes(h)){this.handleEnd(t);return}if(o.cancel.includes(h)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:ds;this.referenceCoordinates||(this.referenceCoordinates=g);const p=l(t,{active:n,context:r.current,currentCoordinates:g});if(p){const v=yp(p,g),b={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:L,minScroll:j}=iA(S),D=JH(S),H={x:Math.min(C===Zt.Right?D.right-D.width/2:D.right,Math.max(C===Zt.Right?D.left:D.left+D.width/2,p.x)),y:Math.min(C===Zt.Down?D.bottom-D.height/2:D.bottom,Math.max(C===Zt.Down?D.top:D.top+D.height/2,p.y))},Y=C===Zt.Right&&!R||C===Zt.Left&&!E,P=C===Zt.Down&&!N||C===Zt.Up&&!k;if(Y&&H.x!==p.x){const q=S.scrollLeft+v.x,F=C===Zt.Right&&q<=L.x||C===Zt.Left&&q>=j.x;if(F&&!v.y){S.scrollTo({left:q,behavior:c});return}F?b.x=S.scrollLeft-q:b.x=C===Zt.Right?S.scrollLeft-L.x:S.scrollLeft-j.x,b.x&&S.scrollBy({left:-b.x,behavior:c});break}else if(P&&H.y!==p.y){const q=S.scrollTop+v.y,F=C===Zt.Down&&q<=L.y||C===Zt.Up&&q>=j.y;if(F&&!v.x){S.scrollTo({top:q,behavior:c});return}F?b.y=S.scrollTop-q:b.y=C===Zt.Down?S.scrollTop-L.y:S.scrollTop-j.y,b.y&&S.scrollBy({top:-b.y,behavior:c});break}}this.handleMove(t,Oc(yp(p,this.referenceCoordinates),b))}}}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()}}X0.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=oA,onActivation:i}=t,{active:o}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const c=o.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function oE(e){return!!(e&&"distance"in e)}function aE(e){return!!(e&&"delay"in e)}class Z0{constructor(t,n,r){var i;r===void 0&&(r=i$(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:o}=t,{target:l}=o;this.props=t,this.events=n,this.document=su(l),this.documentListeners=new zd(this.document),this.listeners=new zd(r),this.windowListeners=new zd(oi(l)),this.initialCoordinates=(i=Pb(o))!=null?i:ds,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(Fi.Resize,this.handleCancel),this.windowListeners.add(Fi.DragStart,sE),this.windowListeners.add(Fi.VisibilityChange,this.handleCancel),this.windowListeners.add(Fi.ContextMenu,sE),this.documentListeners.add(Fi.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(aE(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(oE(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:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Fi.Click,s$,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Fi.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:l,options:{activationConstraint:c}}=o;if(!i)return;const h=(n=Pb(t))!=null?n:ds,d=yp(i,h);if(!r&&c){if(oE(c)){if(c.tolerance!=null&&yy(d,c.tolerance))return this.handleCancel();if(yy(d,c.distance))return this.handleStart()}if(aE(c)&&yy(d,c.tolerance))return this.handleCancel();this.handlePending(c,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===Zt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const a$={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Q0 extends Z0{constructor(t){const{event:n}=t,r=su(n.target);super(t,a$,r)}}Q0.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 l$={move:{name:"mousemove"},end:{name:"mouseup"}};var Bb;(function(e){e[e.RightClick=2]="RightClick"})(Bb||(Bb={}));class c$ extends Z0{constructor(t){super(t,l$,su(t.event.target))}}c$.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Bb.RightClick?!1:(r==null||r({event:n}),!0)}}];const by={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class aA extends Z0{constructor(t){super(t,by)}static setup(){return window.addEventListener(by.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(by.move.name,t)};function t(){}}}aA.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var Pd;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Pd||(Pd={}));var xp;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(xp||(xp={}));function u$(e){let{acceleration:t,activator:n=Pd.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:l=5,order:c=xp.TreeOrder,pointerCoordinates:h,scrollableAncestors:d,scrollableAncestorRects:g,delta:p,threshold:v}=e;const b=h$({delta:p,disabled:!o}),[w,S]=xH(),C=_.useRef({x:0,y:0}),k=_.useRef({x:0,y:0}),R=_.useMemo(()=>{switch(n){case Pd.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case Pd.DraggableRect:return i}},[n,i,h]),E=_.useRef(null),N=_.useCallback(()=>{const j=E.current;if(!j)return;const D=C.current.x*k.current.x,H=C.current.y*k.current.y;j.scrollBy(D,H)},[]),L=_.useMemo(()=>c===xp.TreeOrder?[...d].reverse():d,[c,d]);_.useEffect(()=>{if(!o||!d.length||!R){S();return}for(const j of L){if((r==null?void 0:r(j))===!1)continue;const D=d.indexOf(j),H=g[D];if(!H)continue;const{direction:Y,speed:P}=QH(j,H,R,t,v);for(const q of["x","y"])b[q][Y[q]]||(P[q]=0,Y[q]=0);if(P.x>0||P.y>0){S(),E.current=j,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,o,l,JSON.stringify(R),JSON.stringify(b),w,d,L,g,JSON.stringify(v)])}const d$={x:{[hr.Backward]:!1,[hr.Forward]:!1},y:{[hr.Backward]:!1,[hr.Forward]:!1}};function h$(e){let{delta:t,disabled:n}=e;const r=zb(t);return kh(i=>{if(n||!r||!i)return d$;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[hr.Backward]:i.x[hr.Backward]||o.x===-1,[hr.Forward]:i.x[hr.Forward]||o.x===1},y:{[hr.Backward]:i.y[hr.Backward]||o.y===-1,[hr.Forward]:i.y[hr.Forward]||o.y===1}}},[n,t,r])}function f$(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return kh(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function m$(e,t){return _.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,r)}));return[...n,...o]},[]),[e,t])}var eh;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(eh||(eh={}));var Fb;(function(e){e.Optimized="optimized"})(Fb||(Fb={}));const lE=new Map;function p$(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,l]=_.useState(null),{frequency:c,measure:h,strategy:d}=i,g=_.useRef(e),p=C(),v=Qd(p),b=_.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=kh(k=>{if(p&&!n)return lE;if(!k||k===lE||g.current!==e||o!=null){const R=new Map;for(let E of e){if(!E)continue;if(o&&o.length>0&&!o.includes(E.id)&&E.rect.current){R.set(E.id,E.rect.current);continue}const N=E.node.current,L=N?new Y0(h(N),N):null;E.rect.current=L,L&&R.set(E.id,L)}return R}return k},[e,o,n,p,h]);return _.useEffect(()=>{g.current=e},[e]),_.useEffect(()=>{p||b()},[n,p]),_.useEffect(()=>{o&&o.length>0&&l(null)},[JSON.stringify(o)]),_.useEffect(()=>{p||typeof c!="number"||w.current!==null||(w.current=setTimeout(()=>{b(),w.current=null},c))},[c,p,b,...r]),{droppableRects:S,measureDroppableContainers:b,measuringScheduled:o!=null};function C(){switch(d){case eh.Always:return!1;case eh.BeforeDragging:return n;default:return!n}}}function lA(e,t){return kh(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function g$(e,t){return lA(e,t)}function v$(e){let{callback:t,disabled:n}=e;const r=q0(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return _.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function yg(e){let{callback:t,disabled:n}=e;const r=q0(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return _.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function _$(e){return new Y0(ou(e),e)}function cE(e,t,n){t===void 0&&(t=_$);const[r,i]=_.useState(null);function o(){i(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=v$({callback(h){if(e)for(const d of h){const{type:g,target:p}=d;if(g==="childList"&&p instanceof HTMLElement&&p.contains(e)){o();break}}}}),c=yg({callback:o});return Is(()=>{o(),e?(c==null||c.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(c==null||c.disconnect(),l==null||l.disconnect())},[e]),r}function y$(e){const t=lA(e);return J5(e,t)}const uE=[];function b$(e){const t=_.useRef(e),n=kh(r=>e?r&&r!==uE&&e&&t.current&&e.parentNode===t.current.parentNode?r:G0(e):uE,[e]);return _.useEffect(()=>{t.current=e},[e]),n}function x$(e){const[t,n]=_.useState(null),r=_.useRef(e),i=_.useCallback(o=>{const l=_y(o.target);l&&n(c=>c?(c.set(l,Ib(l)),new Map(c)):null)},[]);return _.useEffect(()=>{const o=r.current;if(e!==o){l(o);const c=e.map(h=>{const d=_y(h);return d?(d.addEventListener("scroll",i,{passive:!0}),[d,Ib(d)]):null}).filter(h=>h!=null);n(c.length?new Map(c):null),r.current=e}return()=>{l(e),l(o)};function l(c){c.forEach(h=>{const d=_y(h);d==null||d.removeEventListener("scroll",i)})}},[i,e]),_.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,l)=>Oc(o,l),ds):sA(e):ds,[e,t])}function dE(e,t){t===void 0&&(t=[]);const n=_.useRef(null);return _.useEffect(()=>{n.current=null},t),_.useEffect(()=>{const r=e!==ds;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?yp(e,n.current):ds}function w$(e){_.useEffect(()=>{if(!_g)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 S$(e,t){return _.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=l=>{o(l,t)},n},{}),[e,t])}function cA(e){return _.useMemo(()=>e?GH(e):null,[e])}const hE=[];function C$(e,t){t===void 0&&(t=ou);const[n]=e,r=cA(n?oi(n):null),[i,o]=_.useState(hE);function l(){o(()=>e.length?e.map(h=>rA(h)?r:new Y0(t(h),h)):hE)}const c=yg({callback:l});return Is(()=>{c==null||c.disconnect(),l(),e.forEach(h=>c==null?void 0:c.observe(h))},[e]),i}function k$(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ch(t)?t:e}function E$(e){let{measure:t}=e;const[n,r]=_.useState(null),i=_.useCallback(d=>{for(const{target:g}of d)if(Ch(g)){r(p=>{const v=t(g);return p?{...p,width:v.width,height:v.height}:v});break}},[t]),o=yg({callback:i}),l=_.useCallback(d=>{const g=k$(d);o==null||o.disconnect(),g&&(o==null||o.observe(g)),r(g?t(g):null)},[t,o]),[c,h]=_p(l);return _.useMemo(()=>({nodeRef:c,rect:n,setRef:h}),[n,c,h])}const R$=[{sensor:Q0,options:{}},{sensor:X0,options:{}}],T$={current:{}},Vm={draggable:{measure:iE},droppable:{measure:iE,strategy:eh.WhileDragging,frequency:Fb.Optimized},dragOverlay:{measure:ou}};class Id 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 N$={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Id,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:bp},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Vm,measureDroppableContainers:bp,windowRect:null,measuringScheduled:!1},M$={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:bp,draggableNodes:new Map,over:null,measureDroppableContainers:bp},bg=_.createContext(M$),uA=_.createContext(N$);function A$(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Id}}}function j$(e,t){switch(t.type){case or.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case or.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 or.DragEnd:case or.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case or.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Id(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case or.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const l=new Id(e.droppable.containers);return l.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:l}}}case or.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Id(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function D$(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=_.useContext(bg),o=zb(r),l=zb(n==null?void 0:n.id);return _.useEffect(()=>{if(!t&&!r&&o&&l!=null){if(!K0(o)||document.activeElement===o.target)return;const c=i.get(l);if(!c)return;const{activatorNode:h,node:d}=c;if(!h.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[h.current,d.current]){if(!g)continue;const p=CH(g);if(p){p.focus();break}}})}},[r,t,i,l,o]),null}function O$(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function L$(e){return _.useMemo(()=>({draggable:{...Vm.draggable,...e==null?void 0:e.draggable},droppable:{...Vm.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Vm.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 z$(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=_.useRef(!1),{x:l,y:c}=typeof i=="boolean"?{x:i,y:i}:i;Is(()=>{if(!l&&!c||!t){o.current=!1;return}if(o.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const g=n(d),p=J5(g,r);if(l||(p.x=0),c||(p.y=0),o.current=!0,Math.abs(p.x)>0||Math.abs(p.y)>0){const v=eA(d);v&&v.scrollBy({top:p.y,left:p.x})}},[t,l,c,r,n])}const dA=_.createContext({...ds,scaleX:1,scaleY:1});var ua;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ua||(ua={}));const P$=_.memo(function(t){var n,r,i,o;let{id:l,accessibility:c,autoScroll:h=!0,children:d,sensors:g=R$,collisionDetection:p=HH,measuring:v,modifiers:b,...w}=t;const S=_.useReducer(j$,void 0,A$),[C,k]=S,[R,E]=MH(),[N,L]=_.useState(ua.Uninitialized),j=N===ua.Initialized,{draggable:{active:D,nodes:H,translate:Y},droppable:{containers:P}}=C,q=D!=null?H.get(D):null,F=_.useRef({initial:null,translated:null}),U=_.useMemo(()=>{var Jt;return D!=null?{id:D,data:(Jt=q==null?void 0:q.data)!=null?Jt:T$,rect:F}:null},[D,q]),W=_.useRef(null),[V,O]=_.useState(null),[$,z]=_.useState(null),G=Qd(w,Object.values(w)),M=Eh("DndDescribedBy",l),B=_.useMemo(()=>P.getEnabled(),[P]),Z=L$(v),{droppableRects:A,measureDroppableContainers:ie,measuringScheduled:J}=p$(B,{dragging:j,dependencies:[Y.x,Y.y],config:Z.droppable}),ee=f$(H,D),re=_.useMemo(()=>$?Pb($):null,[$]),ce=$n(),he=g$(ee,Z.draggable.measure);z$({activeNode:D!=null?H.get(D):null,config:ce.layoutShiftCompensation,initialRect:he,measure:Z.draggable.measure});const pe=cE(ee,Z.draggable.measure,he),Se=cE(ee?ee.parentElement:null),Re=_.useRef({activatorEvent:null,active:null,activeNode:ee,collisionRect:null,collisions:null,droppableRects:A,draggableNodes:H,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),je=P.getNodeFor((n=Re.current.over)==null?void 0:n.id),Xe=E$({measure:Z.dragOverlay.measure}),Et=(r=Xe.nodeRef.current)!=null?r:ee,Rt=j?(i=Xe.rect)!=null?i:pe:null,fe=!!(Xe.nodeRef.current&&Xe.rect),He=y$(fe?null:pe),De=cA(Et?oi(Et):null),mt=b$(j?je??ee:null),ct=C$(mt),ot=O$(b,{transform:{x:Y.x-He.x,y:Y.y-He.y,scaleX:1,scaleY:1},activatorEvent:$,active:U,activeNodeRect:pe,containerNodeRect:Se,draggingNodeRect:Rt,over:Re.current.over,overlayNodeRect:Xe.rect,scrollableAncestors:mt,scrollableAncestorRects:ct,windowRect:De}),fn=re?Oc(re,Y):null,Ce=x$(mt),tt=dE(Ce),oe=dE(Ce,[pe]),ve=Oc(ot,tt),Ne=Rt?VH(Rt,ot):null,Ae=U&&Ne?p({active:U,collisionRect:Ne,droppableRects:A,droppableContainers:B,pointerCoordinates:fn}):null,Qe=IH(Ae,"id"),[At,rt]=_.useState(null),Oe=fe?ot:Oc(ot,oe),qe=$H(Oe,(o=At==null?void 0:At.rect)!=null?o:null,pe),gt=_.useRef(null),Ve=_.useCallback((Jt,Kt)=>{let{sensor:Be,options:vt}=Kt;if(W.current==null)return;const wt=H.get(W.current);if(!wt)return;const Tt=Jt.nativeEvent,en=new Be({active:W.current,activeNode:wt,event:Tt,options:vt,context:Re,onAbort(yt){if(!H.get(yt))return;const{onDragAbort:ke}=G.current,Le={id:yt};ke==null||ke(Le),R({type:"onDragAbort",event:Le})},onPending(yt,Cn,ke,Le){if(!H.get(yt))return;const{onDragPending:ut}=G.current,pn={id:yt,constraint:Cn,initialCoordinates:ke,offset:Le};ut==null||ut(pn),R({type:"onDragPending",event:pn})},onStart(yt){const Cn=W.current;if(Cn==null)return;const ke=H.get(Cn);if(!ke)return;const{onDragStart:Le}=G.current,Nt={activatorEvent:Tt,active:{id:Cn,data:ke.data,rect:F}};ss.unstable_batchedUpdates(()=>{Le==null||Le(Nt),L(ua.Initializing),k({type:or.DragStart,initialCoordinates:yt,active:Cn}),R({type:"onDragStart",event:Nt}),O(gt.current),z(Tt)})},onMove(yt){k({type:or.DragMove,coordinates:yt})},onEnd:_t(or.DragEnd),onCancel:_t(or.DragCancel)});gt.current=en;function _t(yt){return async function(){const{active:ke,collisions:Le,over:Nt,scrollAdjustedTranslate:ut}=Re.current;let pn=null;if(ke&&ut){const{cancelDrop:bn}=G.current;pn={activatorEvent:Tt,active:ke,collisions:Le,delta:ut,over:Nt},yt===or.DragEnd&&typeof bn=="function"&&await Promise.resolve(bn(pn))&&(yt=or.DragCancel)}W.current=null,ss.unstable_batchedUpdates(()=>{k({type:yt}),L(ua.Uninitialized),rt(null),O(null),z(null),gt.current=null;const bn=yt===or.DragEnd?"onDragEnd":"onDragCancel";if(pn){const on=G.current[bn];on==null||on(pn),R({type:bn,event:pn})}})}}},[H]),mn=_.useCallback((Jt,Kt)=>(Be,vt)=>{const wt=Be.nativeEvent,Tt=H.get(vt);if(W.current!==null||!Tt||wt.dndKit||wt.defaultPrevented)return;const en={active:Tt};Jt(Be,Kt.options,en)===!0&&(wt.dndKit={capturedBy:Kt.sensor},W.current=vt,Ve(Be,Kt))},[H,Ve]),sn=m$(g,mn);w$(g),Is(()=>{pe&&N===ua.Initializing&&L(ua.Initialized)},[pe,N]),_.useEffect(()=>{const{onDragMove:Jt}=G.current,{active:Kt,activatorEvent:Be,collisions:vt,over:wt}=Re.current;if(!Kt||!Be)return;const Tt={active:Kt,activatorEvent:Be,collisions:vt,delta:{x:ve.x,y:ve.y},over:wt};ss.unstable_batchedUpdates(()=>{Jt==null||Jt(Tt),R({type:"onDragMove",event:Tt})})},[ve.x,ve.y]),_.useEffect(()=>{const{active:Jt,activatorEvent:Kt,collisions:Be,droppableContainers:vt,scrollAdjustedTranslate:wt}=Re.current;if(!Jt||W.current==null||!Kt||!wt)return;const{onDragOver:Tt}=G.current,en=vt.get(Qe),_t=en&&en.rect.current?{id:en.id,rect:en.rect.current,data:en.data,disabled:en.disabled}:null,yt={active:Jt,activatorEvent:Kt,collisions:Be,delta:{x:wt.x,y:wt.y},over:_t};ss.unstable_batchedUpdates(()=>{rt(_t),Tt==null||Tt(yt),R({type:"onDragOver",event:yt})})},[Qe]),Is(()=>{Re.current={activatorEvent:$,active:U,activeNode:ee,collisionRect:Ne,collisions:Ae,droppableRects:A,draggableNodes:H,draggingNode:Et,draggingNodeRect:Rt,droppableContainers:P,over:At,scrollableAncestors:mt,scrollAdjustedTranslate:ve},F.current={initial:Rt,translated:Ne}},[U,ee,Ae,Ne,H,Et,Rt,A,P,At,mt,ve]),u$({...ce,delta:Y,draggingRect:Ne,pointerCoordinates:fn,scrollableAncestors:mt,scrollableAncestorRects:ct});const Je=_.useMemo(()=>({active:U,activeNode:ee,activeNodeRect:pe,activatorEvent:$,collisions:Ae,containerNodeRect:Se,dragOverlay:Xe,draggableNodes:H,droppableContainers:P,droppableRects:A,over:At,measureDroppableContainers:ie,scrollableAncestors:mt,scrollableAncestorRects:ct,measuringConfiguration:Z,measuringScheduled:J,windowRect:De}),[U,ee,pe,$,Ae,Se,Xe,H,P,A,At,ie,mt,ct,Z,J,De]),tn=_.useMemo(()=>({activatorEvent:$,activators:sn,active:U,activeNodeRect:pe,ariaDescribedById:{draggable:M},dispatch:k,draggableNodes:H,over:At,measureDroppableContainers:ie}),[$,sn,U,pe,k,M,H,At,ie]);return xe.createElement(Q5.Provider,{value:E},xe.createElement(bg.Provider,{value:tn},xe.createElement(uA.Provider,{value:Je},xe.createElement(dA.Provider,{value:qe},d)),xe.createElement(D$,{disabled:(c==null?void 0:c.restoreFocus)===!1})),xe.createElement(DH,{...c,hiddenTextDescribedById:M}));function $n(){const Jt=(V==null?void 0:V.autoScrollEnabled)===!1,Kt=typeof h=="object"?h.enabled===!1:h===!1,Be=j&&!Jt&&!Kt;return typeof h=="object"?{...h,enabled:Be}:{enabled:Be}}}),I$=_.createContext(null),fE="button",B$="Draggable";function F$(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=Eh(B$),{activators:l,activatorEvent:c,active:h,activeNodeRect:d,ariaDescribedById:g,draggableNodes:p,over:v}=_.useContext(bg),{role:b=fE,roleDescription:w="draggable",tabIndex:S=0}=i??{},C=(h==null?void 0:h.id)===t,k=_.useContext(C?dA:I$),[R,E]=_p(),[N,L]=_p(),j=S$(l,t),D=Qd(n);Is(()=>(p.set(t,{id:t,key:o,node:R,activatorNode:N,data:D}),()=>{const Y=p.get(t);Y&&Y.key===o&&p.delete(t)}),[p,t]);const H=_.useMemo(()=>({role:b,tabIndex:S,"aria-disabled":r,"aria-pressed":C&&b===fE?!0:void 0,"aria-roledescription":w,"aria-describedby":g.draggable}),[r,b,S,C,w,g.draggable]);return{active:h,activatorEvent:c,activeNodeRect:d,attributes:H,isDragging:C,listeners:r?void 0:j,node:R,over:v,setNodeRef:E,setActivatorNodeRef:L,transform:k}}function H$(){return _.useContext(uA)}const $$="Droppable",U$={timeout:25};function V$(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=Eh($$),{active:l,dispatch:c,over:h,measureDroppableContainers:d}=_.useContext(bg),g=_.useRef({disabled:n}),p=_.useRef(!1),v=_.useRef(null),b=_.useRef(null),{disabled:w,updateMeasurementsFor:S,timeout:C}={...U$,...i},k=Qd(S??r),R=_.useCallback(()=>{if(!p.current){p.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{d(Array.isArray(k.current)?k.current:[k.current]),b.current=null},C)},[C]),E=yg({callback:R,disabled:w||!l}),N=_.useCallback((H,Y)=>{E&&(Y&&(E.unobserve(Y),p.current=!1),H&&E.observe(H))},[E]),[L,j]=_p(N),D=Qd(t);return _.useEffect(()=>{!E||!L.current||(E.disconnect(),p.current=!1,E.observe(L.current))},[L,E]),_.useEffect(()=>(c({type:or.RegisterDroppable,element:{id:r,key:o,disabled:n,node:L,rect:v,data:D}}),()=>c({type:or.UnregisterDroppable,key:o,id:r})),[r]),_.useEffect(()=>{n!==g.current.disabled&&(c({type:or.SetDroppableDisabled,id:r,key:o,disabled:n}),g.current.disabled=n)},[r,o,n,c]),{active:l,rect:v,isOver:(h==null?void 0:h.id)===r,node:L,over:h,setNodeRef:j}}function xg(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function W$(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function pm(e){return e!==null&&e>=0}function q$(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 K$(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const hA=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=xg(t,r,n),l=t[i],c=o[i];return!c||!l?null:{x:c.left-l.left,y:c.top-l.top,scaleX:c.width/l.width,scaleY:c.height/l.height}},gm={scaleX:1,scaleY:1},G$=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:l}=e;const c=(t=o[n])!=null?t:r;if(!c)return null;if(i===n){const d=o[l];return d?{x:0,y:n<l?d.top+d.height-(c.top+c.height):d.top-c.top,...gm}:null}const h=Y$(o,i,n);return i>n&&i<=l?{x:0,y:-c.height-h,...gm}:i<n&&i>=l?{x:0,y:c.height+h,...gm}:{x:0,y:0,...gm}};function Y$(e,t,n){const r=e[t],i=e[t-1],o=e[t+1];return r?n<t?i?r.top-(i.top+i.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const fA="Sortable",mA=xe.createContext({activeIndex:-1,containerId:fA,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:hA,disabled:{draggable:!1,droppable:!1}});function X$(e){let{children:t,id:n,items:r,strategy:i=hA,disabled:o=!1}=e;const{active:l,dragOverlay:c,droppableRects:h,over:d,measureDroppableContainers:g}=H$(),p=Eh(fA,n),v=c.rect!==null,b=_.useMemo(()=>r.map(j=>typeof j=="object"&&"id"in j?j.id:j),[r]),w=l!=null,S=l?b.indexOf(l.id):-1,C=d?b.indexOf(d.id):-1,k=_.useRef(b),R=!q$(b,k.current),E=C!==-1&&S===-1||R,N=K$(o);Is(()=>{R&&w&&g(b)},[R,b,w,g]),_.useEffect(()=>{k.current=b},[b]);const L=_.useMemo(()=>({activeIndex:S,containerId:p,disabled:N,disableTransforms:E,items:b,overIndex:C,useDragOverlay:v,sortedRects:W$(b,h),strategy:i}),[S,p,N.draggable,N.droppable,E,b,C,h,v,i]);return xe.createElement(mA.Provider,{value:L},t)}const Z$=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return xg(n,r,i).indexOf(t)},Q$=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:l,previousItems:c,previousContainerId:h,transition:d}=e;return!d||!r||c!==o&&i===l?!1:n?!0:l!==i&&t===h},J$={duration:200,easing:"ease"},pA="transform",eU=Jd.Transition.toString({property:pA,duration:0,easing:"linear"}),tU={roleDescription:"sortable"};function nU(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,l]=_.useState(null),c=_.useRef(n);return Is(()=>{if(!t&&n!==c.current&&r.current){const h=i.current;if(h){const d=ou(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!==c.current&&(c.current=n)},[t,n,r,i]),_.useEffect(()=>{o&&l(null)},[o]),o}function rU(e){let{animateLayoutChanges:t=Q$,attributes:n,disabled:r,data:i,getNewIndex:o=Z$,id:l,strategy:c,resizeObserverConfig:h,transition:d=J$}=e;const{items:g,containerId:p,activeIndex:v,disabled:b,disableTransforms:w,sortedRects:S,overIndex:C,useDragOverlay:k,strategy:R}=_.useContext(mA),E=iU(r,b),N=g.indexOf(l),L=_.useMemo(()=>({sortable:{containerId:p,index:N,items:g},...i}),[p,i,N,g]),j=_.useMemo(()=>g.slice(g.indexOf(l)),[g,l]),{rect:D,node:H,isOver:Y,setNodeRef:P}=V$({id:l,data:L,disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...h}}),{active:q,activatorEvent:F,activeNodeRect:U,attributes:W,setNodeRef:V,listeners:O,isDragging:$,over:z,setActivatorNodeRef:G,transform:M}=F$({id:l,data:L,attributes:{...tU,...n},disabled:E.draggable}),B=bH(P,V),Z=!!q,A=Z&&!w&&pm(v)&&pm(C),ie=!k&&$,J=ie&&A?M:null,re=A?J??(c??R)({rects:S,activeNodeRect:U,activeIndex:v,overIndex:C,index:N}):null,ce=pm(v)&&pm(C)?o({id:l,items:g,activeIndex:v,overIndex:C}):N,he=q==null?void 0:q.id,pe=_.useRef({activeId:he,items:g,newIndex:ce,containerId:p}),Se=g!==pe.current.items,Re=t({active:q,containerId:p,isDragging:$,isSorting:Z,id:l,index:N,items:g,newIndex:pe.current.newIndex,previousItems:pe.current.items,previousContainerId:pe.current.containerId,transition:d,wasDragging:pe.current.activeId!=null}),je=nU({disabled:!Re,index:N,node:H,rect:D});return _.useEffect(()=>{Z&&pe.current.newIndex!==ce&&(pe.current.newIndex=ce),p!==pe.current.containerId&&(pe.current.containerId=p),g!==pe.current.items&&(pe.current.items=g)},[Z,ce,p,g]),_.useEffect(()=>{if(he===pe.current.activeId)return;if(he!=null&&pe.current.activeId==null){pe.current.activeId=he;return}const Et=setTimeout(()=>{pe.current.activeId=he},50);return()=>clearTimeout(Et)},[he]),{active:q,activeIndex:v,attributes:W,data:L,rect:D,index:N,newIndex:ce,items:g,isOver:Y,isSorting:Z,isDragging:$,listeners:O,node:H,overIndex:C,over:z,setNodeRef:B,setActivatorNodeRef:G,setDroppableNodeRef:P,setDraggableNodeRef:V,transform:je??re,transition:Xe()};function Xe(){if(je||Se&&pe.current.newIndex===N)return eU;if(!(ie&&!K0(F)||!d)&&(Z||Re))return Jd.Transition.toString({...d,property:pA})}}function iU(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}}Zt.Down,Zt.Right,Zt.Up,Zt.Left;const mE={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 pE(e,[t,n]){return Math.min(n,Math.max(t,e))}function J0(e){const t=e+"CollectionProvider",[n,r]=So(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=S=>{const{scope:C,children:k}=S,R=xe.useRef(null),E=xe.useRef(new Map).current;return f.jsx(i,{scope:C,itemMap:E,collectionRef:R,children:k})};l.displayName=t;const c=e+"CollectionSlot",h=fl(c),d=xe.forwardRef((S,C)=>{const{scope:k,children:R}=S,E=o(c,k),N=Qt(C,E.collectionRef);return f.jsx(h,{ref:N,children:R})});d.displayName=c;const g=e+"CollectionItemSlot",p="data-radix-collection-item",v=fl(g),b=xe.forwardRef((S,C)=>{const{scope:k,children:R,...E}=S,N=xe.useRef(null),L=Qt(C,N),j=o(g,k);return xe.useEffect(()=>(j.itemMap.set(N,{ref:N,...E}),()=>void j.itemMap.delete(N))),f.jsx(v,{[p]:"",ref:L,children:R})});b.displayName=g;function w(S){const C=o(e+"CollectionConsumer",S);return xe.useCallback(()=>{const R=C.collectionRef.current;if(!R)return[];const E=Array.from(R.querySelectorAll(`[${p}]`));return Array.from(C.itemMap.values()).sort((j,D)=>E.indexOf(j.ref.current)-E.indexOf(D.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:l,Slot:d,ItemSlot:b},w,r]}var sU=_.createContext(void 0);function ew(e){const t=_.useContext(sU);return e||t||"ltr"}function oU(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 aU=[" ","Enter","ArrowUp","ArrowDown"],lU=[" ","Enter"],gl="Select",[wg,Sg,cU]=J0(gl),[au,Ise]=So(gl,[cU,ka]),Cg=ka(),[uU,Ra]=au(gl),[dU,hU]=au(gl),gA=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:o,value:l,defaultValue:c,onValueChange:h,dir:d,name:g,autoComplete:p,disabled:v,required:b,form:w}=e,S=Cg(t),[C,k]=_.useState(null),[R,E]=_.useState(null),[N,L]=_.useState(!1),j=ew(d),[D,H]=Ic({prop:r,defaultProp:i??!1,onChange:o,caller:gl}),[Y,P]=Ic({prop:l,defaultProp:c,onChange:h,caller:gl}),q=_.useRef(null),F=C?w||!!C.closest("form"):!0,[U,W]=_.useState(new Set),V=Array.from(U).map(O=>O.props.value).join(";");return f.jsx(ug,{...S,children:f.jsxs(uU,{required:b,scope:t,trigger:C,onTriggerChange:k,valueNode:R,onValueNodeChange:E,valueNodeHasChildren:N,onValueNodeHasChildrenChange:L,contentId:po(),value:Y,onValueChange:P,open:D,onOpenChange:H,dir:j,triggerPointerDownPosRef:q,disabled:v,children:[f.jsx(wg.Provider,{scope:t,children:f.jsx(dU,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(O=>{W($=>new Set($).add(O))},[]),onNativeOptionRemove:_.useCallback(O=>{W($=>{const z=new Set($);return z.delete(O),z})},[]),children:n})}),F?f.jsxs(HA,{"aria-hidden":!0,required:b,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(U)]},V):null]})})};gA.displayName=gl;var vA="SelectTrigger",_A=_.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,o=Cg(n),l=Ra(vA,n),c=l.disabled||r,h=Qt(t,l.onTriggerChange),d=Sg(n),g=_.useRef("touch"),[p,v,b]=UA(S=>{const C=d().filter(E=>!E.disabled),k=C.find(E=>E.value===l.value),R=VA(C,S,k);R!==void 0&&l.onValueChange(R.value)}),w=S=>{c||(l.onOpenChange(!0),b()),S&&(l.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return f.jsx(xh,{asChild:!0,...o,children:f.jsx(Lt.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:c,"data-disabled":c?"":void 0,"data-placeholder":$A(l.value)?"":void 0,...i,ref:h,onClick:Fe(i.onClick,S=>{S.currentTarget.focus(),g.current!=="mouse"&&w(S)}),onPointerDown:Fe(i.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:Fe(i.onKeyDown,S=>{const C=p.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&v(S.key),!(C&&S.key===" ")&&aU.includes(S.key)&&(w(),S.preventDefault())})})})});_A.displayName=vA;var yA="SelectValue",bA=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:l="",...c}=e,h=Ra(yA,n),{onValueNodeHasChildrenChange:d}=h,g=o!==void 0,p=Qt(t,h.onValueNodeChange);return Pr(()=>{d(g)},[d,g]),f.jsx(Lt.span,{...c,ref:p,style:{pointerEvents:"none"},children:$A(h.value)?f.jsx(f.Fragment,{children:l}):o})});bA.displayName=yA;var fU="SelectIcon",xA=_.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return f.jsx(Lt.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});xA.displayName=fU;var mU="SelectPortal",wA=e=>f.jsx(eu,{asChild:!0,...e});wA.displayName=mU;var vl="SelectContent",SA=_.forwardRef((e,t)=>{const n=Ra(vl,e.__scopeSelect),[r,i]=_.useState();if(Pr(()=>{i(new DocumentFragment)},[]),!n.open){const o=r;return o?ss.createPortal(f.jsx(CA,{scope:e.__scopeSelect,children:f.jsx(wg.Slot,{scope:e.__scopeSelect,children:f.jsx("div",{children:e.children})})}),o):null}return f.jsx(kA,{...e,ref:t})});SA.displayName=vl;var is=10,[CA,Ta]=au(vl),pU="SelectContentImpl",gU=fl("SelectContent.RemoveScroll"),kA=_.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:l,side:c,sideOffset:h,align:d,alignOffset:g,arrowPadding:p,collisionBoundary:v,collisionPadding:b,sticky:w,hideWhenDetached:S,avoidCollisions:C,...k}=e,R=Ra(vl,n),[E,N]=_.useState(null),[L,j]=_.useState(null),D=Qt(t,re=>N(re)),[H,Y]=_.useState(null),[P,q]=_.useState(null),F=Sg(n),[U,W]=_.useState(!1),V=_.useRef(!1);_.useEffect(()=>{if(E)return Jp(E)},[E]),Zp();const O=_.useCallback(re=>{const[ce,...he]=F().map(Re=>Re.ref.current),[pe]=he.slice(-1),Se=document.activeElement;for(const Re of re)if(Re===Se||(Re==null||Re.scrollIntoView({block:"nearest"}),Re===ce&&L&&(L.scrollTop=0),Re===pe&&L&&(L.scrollTop=L.scrollHeight),Re==null||Re.focus(),document.activeElement!==Se))return},[F,L]),$=_.useCallback(()=>O([H,E]),[O,H,E]);_.useEffect(()=>{U&&$()},[U,$]);const{onOpenChange:z,triggerPointerDownPosRef:G}=R;_.useEffect(()=>{if(E){let re={x:0,y:0};const ce=pe=>{var Se,Re;re={x:Math.abs(Math.round(pe.pageX)-(((Se=G.current)==null?void 0:Se.x)??0)),y:Math.abs(Math.round(pe.pageY)-(((Re=G.current)==null?void 0:Re.y)??0))}},he=pe=>{re.x<=10&&re.y<=10?pe.preventDefault():E.contains(pe.target)||z(!1),document.removeEventListener("pointermove",ce),G.current=null};return G.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",he,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",he,{capture:!0})}}},[E,z,G]),_.useEffect(()=>{const re=()=>z(!1);return window.addEventListener("blur",re),window.addEventListener("resize",re),()=>{window.removeEventListener("blur",re),window.removeEventListener("resize",re)}},[z]);const[M,B]=UA(re=>{const ce=F().filter(Se=>!Se.disabled),he=ce.find(Se=>Se.ref.current===document.activeElement),pe=VA(ce,re,he);pe&&setTimeout(()=>pe.ref.current.focus())}),Z=_.useCallback((re,ce,he)=>{const pe=!V.current&&!he;(R.value!==void 0&&R.value===ce||pe)&&(Y(re),pe&&(V.current=!0))},[R.value]),A=_.useCallback(()=>E==null?void 0:E.focus(),[E]),ie=_.useCallback((re,ce,he)=>{const pe=!V.current&&!he;(R.value!==void 0&&R.value===ce||pe)&&q(re)},[R.value]),J=r==="popper"?Hb:EA,ee=J===Hb?{side:c,sideOffset:h,align:d,alignOffset:g,arrowPadding:p,collisionBoundary:v,collisionPadding:b,sticky:w,hideWhenDetached:S,avoidCollisions:C}:{};return f.jsx(CA,{scope:n,content:E,viewport:L,onViewportChange:j,itemRefCallback:Z,selectedItem:H,onItemLeave:A,itemTextRefCallback:ie,focusSelectedItem:$,selectedItemText:P,position:r,isPositioned:U,searchRef:M,children:f.jsx(vh,{as:gU,allowPinchZoom:!0,children:f.jsx(gh,{asChild:!0,trapped:R.open,onMountAutoFocus:re=>{re.preventDefault()},onUnmountAutoFocus:Fe(i,re=>{var ce;(ce=R.trigger)==null||ce.focus({preventScroll:!0}),re.preventDefault()}),children:f.jsx(Jc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:re=>re.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:f.jsx(J,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:re=>re.preventDefault(),...k,...ee,onPlaced:()=>W(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:Fe(k.onKeyDown,re=>{const ce=re.ctrlKey||re.altKey||re.metaKey;if(re.key==="Tab"&&re.preventDefault(),!ce&&re.key.length===1&&B(re.key),["ArrowUp","ArrowDown","Home","End"].includes(re.key)){let pe=F().filter(Se=>!Se.disabled).map(Se=>Se.ref.current);if(["ArrowUp","End"].includes(re.key)&&(pe=pe.slice().reverse()),["ArrowUp","ArrowDown"].includes(re.key)){const Se=re.target,Re=pe.indexOf(Se);pe=pe.slice(Re+1)}setTimeout(()=>O(pe)),re.preventDefault()}})})})})})})});kA.displayName=pU;var vU="SelectItemAlignedPosition",EA=_.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,o=Ra(vl,n),l=Ta(vl,n),[c,h]=_.useState(null),[d,g]=_.useState(null),p=Qt(t,D=>g(D)),v=Sg(n),b=_.useRef(!1),w=_.useRef(!0),{viewport:S,selectedItem:C,selectedItemText:k,focusSelectedItem:R}=l,E=_.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&d&&S&&C&&k){const D=o.trigger.getBoundingClientRect(),H=d.getBoundingClientRect(),Y=o.valueNode.getBoundingClientRect(),P=k.getBoundingClientRect();if(o.dir!=="rtl"){const Se=P.left-H.left,Re=Y.left-Se,je=D.left-Re,Xe=D.width+je,Et=Math.max(Xe,H.width),Rt=window.innerWidth-is,fe=pE(Re,[is,Math.max(is,Rt-Et)]);c.style.minWidth=Xe+"px",c.style.left=fe+"px"}else{const Se=H.right-P.right,Re=window.innerWidth-Y.right-Se,je=window.innerWidth-D.right-Re,Xe=D.width+je,Et=Math.max(Xe,H.width),Rt=window.innerWidth-is,fe=pE(Re,[is,Math.max(is,Rt-Et)]);c.style.minWidth=Xe+"px",c.style.right=fe+"px"}const q=v(),F=window.innerHeight-is*2,U=S.scrollHeight,W=window.getComputedStyle(d),V=parseInt(W.borderTopWidth,10),O=parseInt(W.paddingTop,10),$=parseInt(W.borderBottomWidth,10),z=parseInt(W.paddingBottom,10),G=V+O+U+z+$,M=Math.min(C.offsetHeight*5,G),B=window.getComputedStyle(S),Z=parseInt(B.paddingTop,10),A=parseInt(B.paddingBottom,10),ie=D.top+D.height/2-is,J=F-ie,ee=C.offsetHeight/2,re=C.offsetTop+ee,ce=V+O+re,he=G-ce;if(ce<=ie){const Se=q.length>0&&C===q[q.length-1].ref.current;c.style.bottom="0px";const Re=d.clientHeight-S.offsetTop-S.offsetHeight,je=Math.max(J,ee+(Se?A:0)+Re+$),Xe=ce+je;c.style.height=Xe+"px"}else{const Se=q.length>0&&C===q[0].ref.current;c.style.top="0px";const je=Math.max(ie,V+S.offsetTop+(Se?Z:0)+ee)+he;c.style.height=je+"px",S.scrollTop=ce-ie+S.offsetTop}c.style.margin=`${is}px 0`,c.style.minHeight=M+"px",c.style.maxHeight=F+"px",r==null||r(),requestAnimationFrame(()=>b.current=!0)}},[v,o.trigger,o.valueNode,c,d,S,C,k,o.dir,r]);Pr(()=>E(),[E]);const[N,L]=_.useState();Pr(()=>{d&&L(window.getComputedStyle(d).zIndex)},[d]);const j=_.useCallback(D=>{D&&w.current===!0&&(E(),R==null||R(),w.current=!1)},[E,R]);return f.jsx(yU,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:b,onScrollButtonChange:j,children:f.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:f.jsx(Lt.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});EA.displayName=vU;var _U="SelectPopperPosition",Hb=_.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=is,...o}=e,l=Cg(n);return f.jsx(dg,{...l,...o,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...o.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)"}})});Hb.displayName=_U;var[yU,tw]=au(vl,{}),$b="SelectViewport",RA=_.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,o=Ta($b,n),l=tw($b,n),c=Qt(t,o.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(wg.Slot,{scope:n,children:f.jsx(Lt.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Fe(i.onScroll,d=>{const g=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:v}=l;if(v!=null&&v.current&&p){const b=Math.abs(h.current-g.scrollTop);if(b>0){const w=window.innerHeight-is*2,S=parseFloat(p.style.minHeight),C=parseFloat(p.style.height),k=Math.max(S,C);if(k<w){const R=k+b,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})})})]})});RA.displayName=$b;var TA="SelectGroup",[bU,xU]=au(TA),NA=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=po();return f.jsx(bU,{scope:n,id:i,children:f.jsx(Lt.div,{role:"group","aria-labelledby":i,...r,ref:t})})});NA.displayName=TA;var MA="SelectLabel",AA=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=xU(MA,n);return f.jsx(Lt.div,{id:i.id,...r,ref:t})});AA.displayName=MA;var wp="SelectItem",[wU,jA]=au(wp),DA=_.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...l}=e,c=Ra(wp,n),h=Ta(wp,n),d=c.value===r,[g,p]=_.useState(o??""),[v,b]=_.useState(!1),w=Qt(t,R=>{var E;return(E=h.itemRefCallback)==null?void 0:E.call(h,R,r,i)}),S=po(),C=_.useRef("touch"),k=()=>{i||(c.onValueChange(r),c.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(wU,{scope:n,value:r,disabled:i,textId:S,isSelected:d,onItemTextChange:_.useCallback(R=>{p(E=>E||((R==null?void 0:R.textContent)??"").trim())},[]),children:f.jsx(wg.ItemSlot,{scope:n,value:r,disabled:i,textValue:g,children:f.jsx(Lt.div,{role:"option","aria-labelledby":S,"data-highlighted":v?"":void 0,"aria-selected":d&&v,"data-state":d?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...l,ref:w,onFocus:Fe(l.onFocus,()=>b(!0)),onBlur:Fe(l.onBlur,()=>b(!1)),onClick:Fe(l.onClick,()=>{C.current!=="mouse"&&k()}),onPointerUp:Fe(l.onPointerUp,()=>{C.current==="mouse"&&k()}),onPointerDown:Fe(l.onPointerDown,R=>{C.current=R.pointerType}),onPointerMove:Fe(l.onPointerMove,R=>{var E;C.current=R.pointerType,i?(E=h.onItemLeave)==null||E.call(h):C.current==="mouse"&&R.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Fe(l.onPointerLeave,R=>{var E;R.currentTarget===document.activeElement&&((E=h.onItemLeave)==null||E.call(h))}),onKeyDown:Fe(l.onKeyDown,R=>{var N;((N=h.searchRef)==null?void 0:N.current)!==""&&R.key===" "||(lU.includes(R.key)&&k(),R.key===" "&&R.preventDefault())})})})})});DA.displayName=wp;var Sd="SelectItemText",OA=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...o}=e,l=Ra(Sd,n),c=Ta(Sd,n),h=jA(Sd,n),d=hU(Sd,n),[g,p]=_.useState(null),v=Qt(t,k=>p(k),h.onItemTextChange,k=>{var R;return(R=c.itemTextRefCallback)==null?void 0:R.call(c,k,h.value,h.disabled)}),b=g==null?void 0:g.textContent,w=_.useMemo(()=>f.jsx("option",{value:h.value,disabled:h.disabled,children:b},h.value),[h.disabled,h.value,b]),{onNativeOptionAdd:S,onNativeOptionRemove:C}=d;return Pr(()=>(S(w),()=>C(w)),[S,C,w]),f.jsxs(f.Fragment,{children:[f.jsx(Lt.span,{id:h.textId,...o,ref:v}),h.isSelected&&l.valueNode&&!l.valueNodeHasChildren?ss.createPortal(o.children,l.valueNode):null]})});OA.displayName=Sd;var LA="SelectItemIndicator",zA=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return jA(LA,n).isSelected?f.jsx(Lt.span,{"aria-hidden":!0,...r,ref:t}):null});zA.displayName=LA;var Ub="SelectScrollUpButton",PA=_.forwardRef((e,t)=>{const n=Ta(Ub,e.__scopeSelect),r=tw(Ub,e.__scopeSelect),[i,o]=_.useState(!1),l=Qt(t,r.onScrollButtonChange);return Pr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const d=h.scrollTop>0;o(d)};const h=n.viewport;return c(),h.addEventListener("scroll",c),()=>h.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?f.jsx(BA,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:h}=n;c&&h&&(c.scrollTop=c.scrollTop-h.offsetHeight)}}):null});PA.displayName=Ub;var Vb="SelectScrollDownButton",IA=_.forwardRef((e,t)=>{const n=Ta(Vb,e.__scopeSelect),r=tw(Vb,e.__scopeSelect),[i,o]=_.useState(!1),l=Qt(t,r.onScrollButtonChange);return Pr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const d=h.scrollHeight-h.clientHeight,g=Math.ceil(h.scrollTop)<d;o(g)};const h=n.viewport;return c(),h.addEventListener("scroll",c),()=>h.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?f.jsx(BA,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:h}=n;c&&h&&(c.scrollTop=c.scrollTop+h.offsetHeight)}}):null});IA.displayName=Vb;var BA=_.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,o=Ta("SelectScrollButton",n),l=_.useRef(null),c=Sg(n),h=_.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return _.useEffect(()=>()=>h(),[h]),Pr(()=>{var g;const d=c().find(p=>p.ref.current===document.activeElement);(g=d==null?void 0:d.ref.current)==null||g.scrollIntoView({block:"nearest"})},[c]),f.jsx(Lt.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Fe(i.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:Fe(i.onPointerMove,()=>{var d;(d=o.onItemLeave)==null||d.call(o),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:Fe(i.onPointerLeave,()=>{h()})})}),SU="SelectSeparator",FA=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return f.jsx(Lt.div,{"aria-hidden":!0,...r,ref:t})});FA.displayName=SU;var Wb="SelectArrow",CU=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=Cg(n),o=Ra(Wb,n),l=Ta(Wb,n);return o.open&&l.position==="popper"?f.jsx(hg,{...i,...r,ref:t}):null});CU.displayName=Wb;var kU="SelectBubbleInput",HA=_.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=_.useRef(null),o=Qt(r,i),l=oU(t);return _.useEffect(()=>{const c=i.current;if(!c)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(c,t),c.dispatchEvent(p)}},[l,t]),f.jsx(Lt.select,{...n,style:{...g5,...n.style},ref:o,defaultValue:t})});HA.displayName=kU;function $A(e){return e===""||e===void 0}function UA(e){const t=ls(e),n=_.useRef(""),r=_.useRef(0),i=_.useCallback(l=>{const c=n.current+l;t(c),function h(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>h(""),1e3))}(c)},[t]),o=_.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function VA(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=EU(e,Math.max(o,0));i.length===1&&(l=l.filter(d=>d!==n));const h=l.find(d=>d.textValue.toLowerCase().startsWith(i.toLowerCase()));return h!==n?h:void 0}function EU(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var RU=gA,WA=_A,TU=bA,NU=xA,MU=wA,qA=SA,AU=RA,jU=NA,KA=AA,nw=DA,GA=OA,YA=zA,XA=PA,ZA=IA,QA=FA;const Er=RU,xy=jU,jr=TU,cr=_.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(WA,{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(NU,{asChild:!0,children:f.jsx(tg,{className:"h-4 w-4 shrink-0 opacity-50"})})]}));cr.displayName=WA.displayName;const JA=_.forwardRef(({className:e,...t},n)=>f.jsx(XA,{ref:n,className:me("flex cursor-default items-center justify-center py-1",e),...t,children:f.jsx(n8,{className:"h-4 w-4"})}));JA.displayName=XA.displayName;const ej=_.forwardRef(({className:e,...t},n)=>f.jsx(ZA,{ref:n,className:me("flex cursor-default items-center justify-center py-1",e),...t,children:f.jsx(tg,{className:"h-4 w-4"})}));ej.displayName=ZA.displayName;const ur=_.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>f.jsx(MU,{children:f.jsxs(qA,{ref:i,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(JA,{}),f.jsx(AU,{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(ej,{})]})}));ur.displayName=qA.displayName;const DU=_.forwardRef(({className:e,...t},n)=>f.jsx(KA,{ref:n,className:me("px-2 py-1.5 text-sm font-semibold",e),...t}));DU.displayName=KA.displayName;const $t=_.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(nw,{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(YA,{children:f.jsx(Vi,{className:"h-4 w-4"})})}),f.jsx(GA,{children:t})]}));$t.displayName=nw.displayName;const Wm=_.forwardRef(({className:e,children:t,thumbnail:n,thumbnailAlt:r="",...i},o)=>f.jsxs(nw,{ref:o,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),...i,children:[f.jsx("div",{className:"min-w-0 flex-1 truncate",children:f.jsx(GA,{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(YA,{children:f.jsx(Vi,{className:"h-4 w-4"})})})]})]}));Wm.displayName="SelectItemWithThumbnail";const OU=_.forwardRef(({className:e,...t},n)=>f.jsx(QA,{ref:n,className:me("-mx-1 my-1 h-px bg-border",e),...t}));OU.displayName=QA.displayName;var wy="rovingFocusGroup.onEntryFocus",LU={bubbles:!1,cancelable:!0},Rh="RovingFocusGroup",[qb,tj,zU]=J0(Rh),[PU,nj]=So(Rh,[zU]),[IU,BU]=PU(Rh),rj=_.forwardRef((e,t)=>f.jsx(qb.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(qb.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(FU,{...e,ref:t})})}));rj.displayName=Rh;var FU=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:h,onEntryFocus:d,preventScrollOnEntryFocus:g=!1,...p}=e,v=_.useRef(null),b=Qt(t,v),w=ew(o),[S,C]=Ic({prop:l,defaultProp:c??null,onChange:h,caller:Rh}),[k,R]=_.useState(!1),E=ls(d),N=tj(n),L=_.useRef(!1),[j,D]=_.useState(0);return _.useEffect(()=>{const H=v.current;if(H)return H.addEventListener(wy,E),()=>H.removeEventListener(wy,E)},[E]),f.jsx(IU,{scope:n,orientation:r,dir:w,loop:i,currentTabStopId:S,onItemFocus:_.useCallback(H=>C(H),[C]),onItemShiftTab:_.useCallback(()=>R(!0),[]),onFocusableItemAdd:_.useCallback(()=>D(H=>H+1),[]),onFocusableItemRemove:_.useCallback(()=>D(H=>H-1),[]),children:f.jsx(Lt.div,{tabIndex:k||j===0?-1:0,"data-orientation":r,...p,ref:b,style:{outline:"none",...e.style},onMouseDown:Fe(e.onMouseDown,()=>{L.current=!0}),onFocus:Fe(e.onFocus,H=>{const Y=!L.current;if(H.target===H.currentTarget&&Y&&!k){const P=new CustomEvent(wy,LU);if(H.currentTarget.dispatchEvent(P),!P.defaultPrevented){const q=N().filter(O=>O.focusable),F=q.find(O=>O.active),U=q.find(O=>O.id===S),V=[F,U,...q].filter(Boolean).map(O=>O.ref.current);oj(V,g)}}L.current=!1}),onBlur:Fe(e.onBlur,()=>R(!1))})})}),ij="RovingFocusGroupItem",sj=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:l,...c}=e,h=po(),d=o||h,g=BU(ij,n),p=g.currentTabStopId===d,v=tj(n),{onFocusableItemAdd:b,onFocusableItemRemove:w,currentTabStopId:S}=g;return _.useEffect(()=>{if(r)return b(),()=>w()},[r,b,w]),f.jsx(qb.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:f.jsx(Lt.span,{tabIndex:p?0:-1,"data-orientation":g.orientation,...c,ref:t,onMouseDown:Fe(e.onMouseDown,C=>{r?g.onItemFocus(d):C.preventDefault()}),onFocus:Fe(e.onFocus,()=>g.onItemFocus(d)),onKeyDown:Fe(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?VU(E,N+1):E.slice(N+1)}setTimeout(()=>oj(E))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:S!=null}):l})})});sj.displayName=ij;var HU={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $U(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function UU(e,t,n){const r=$U(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return HU[r]}function oj(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function VU(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var WU=rj,qU=sj,Kb=["Enter"," "],KU=["ArrowDown","PageUp","Home"],aj=["ArrowUp","PageDown","End"],GU=[...KU,...aj],YU={ltr:[...Kb,"ArrowRight"],rtl:[...Kb,"ArrowLeft"]},XU={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Th="Menu",[th,ZU,QU]=J0(Th),[Rl,lj]=So(Th,[QU,ka,nj]),kg=ka(),cj=nj(),[JU,Tl]=Rl(Th),[eV,Nh]=Rl(Th),uj=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:o,modal:l=!0}=e,c=kg(t),[h,d]=_.useState(null),g=_.useRef(!1),p=ls(o),v=ew(i);return _.useEffect(()=>{const b=()=>{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",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),f.jsx(ug,{...c,children:f.jsx(JU,{scope:t,open:n,onOpenChange:p,content:h,onContentChange:d,children:f.jsx(eV,{scope:t,onClose:_.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:g,dir:v,modal:l,children:r})})})};uj.displayName=Th;var tV="MenuAnchor",rw=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=kg(n);return f.jsx(xh,{...i,...r,ref:t})});rw.displayName=tV;var iw="MenuPortal",[nV,dj]=Rl(iw,{forceMount:void 0}),hj=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,o=Tl(iw,t);return f.jsx(nV,{scope:t,forceMount:n,children:f.jsx(Xi,{present:n||o.open,children:f.jsx(eu,{asChild:!0,container:i,children:r})})})};hj.displayName=iw;var Wi="MenuContent",[rV,sw]=Rl(Wi),fj=_.forwardRef((e,t)=>{const n=dj(Wi,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=Tl(Wi,e.__scopeMenu),l=Nh(Wi,e.__scopeMenu);return f.jsx(th.Provider,{scope:e.__scopeMenu,children:f.jsx(Xi,{present:r||o.open,children:f.jsx(th.Slot,{scope:e.__scopeMenu,children:l.modal?f.jsx(iV,{...i,ref:t}):f.jsx(sV,{...i,ref:t})})})})}),iV=_.forwardRef((e,t)=>{const n=Tl(Wi,e.__scopeMenu),r=_.useRef(null),i=Qt(t,r);return _.useEffect(()=>{const o=r.current;if(o)return Jp(o)},[]),f.jsx(ow,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Fe(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),sV=_.forwardRef((e,t)=>{const n=Tl(Wi,e.__scopeMenu);return f.jsx(ow,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),oV=fl("MenuContent.ScrollLock"),ow=_.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:h,onEscapeKeyDown:d,onPointerDownOutside:g,onFocusOutside:p,onInteractOutside:v,onDismiss:b,disableOutsideScroll:w,...S}=e,C=Tl(Wi,n),k=Nh(Wi,n),R=kg(n),E=cj(n),N=ZU(n),[L,j]=_.useState(null),D=_.useRef(null),H=Qt(t,D,C.onContentChange),Y=_.useRef(0),P=_.useRef(""),q=_.useRef(0),F=_.useRef(null),U=_.useRef("right"),W=_.useRef(0),V=w?vh:_.Fragment,O=w?{as:oV,allowPinchZoom:!0}:void 0,$=G=>{var re,ce;const M=P.current+G,B=N().filter(he=>!he.disabled),Z=document.activeElement,A=(re=B.find(he=>he.ref.current===Z))==null?void 0:re.textValue,ie=B.map(he=>he.textValue),J=_V(ie,M,A),ee=(ce=B.find(he=>he.textValue===J))==null?void 0:ce.ref.current;(function he(pe){P.current=pe,window.clearTimeout(Y.current),pe!==""&&(Y.current=window.setTimeout(()=>he(""),1e3))})(M),ee&&setTimeout(()=>ee.focus())};_.useEffect(()=>()=>window.clearTimeout(Y.current),[]),Zp();const z=_.useCallback(G=>{var B,Z;return U.current===((B=F.current)==null?void 0:B.side)&&bV(G,(Z=F.current)==null?void 0:Z.area)},[]);return f.jsx(rV,{scope:n,searchRef:P,onItemEnter:_.useCallback(G=>{z(G)&&G.preventDefault()},[z]),onItemLeave:_.useCallback(G=>{var M;z(G)||((M=D.current)==null||M.focus(),j(null))},[z]),onTriggerLeave:_.useCallback(G=>{z(G)&&G.preventDefault()},[z]),pointerGraceTimerRef:q,onPointerGraceIntentChange:_.useCallback(G=>{F.current=G},[]),children:f.jsx(V,{...O,children:f.jsx(gh,{asChild:!0,trapped:i,onMountAutoFocus:Fe(o,G=>{var M;G.preventDefault(),(M=D.current)==null||M.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:f.jsx(Jc,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:g,onFocusOutside:p,onInteractOutside:v,onDismiss:b,children:f.jsx(WU,{asChild:!0,...E,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:L,onCurrentTabStopIdChange:j,onEntryFocus:Fe(h,G=>{k.isUsingKeyboardRef.current||G.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(dg,{role:"menu","aria-orientation":"vertical","data-state":Nj(C.open),"data-radix-menu-content":"",dir:k.dir,...R,...S,ref:H,style:{outline:"none",...S.style},onKeyDown:Fe(S.onKeyDown,G=>{const B=G.target.closest("[data-radix-menu-content]")===G.currentTarget,Z=G.ctrlKey||G.altKey||G.metaKey,A=G.key.length===1;B&&(G.key==="Tab"&&G.preventDefault(),!Z&&A&&$(G.key));const ie=D.current;if(G.target!==ie||!GU.includes(G.key))return;G.preventDefault();const ee=N().filter(re=>!re.disabled).map(re=>re.ref.current);aj.includes(G.key)&&ee.reverse(),gV(ee)}),onBlur:Fe(e.onBlur,G=>{G.currentTarget.contains(G.target)||(window.clearTimeout(Y.current),P.current="")}),onPointerMove:Fe(e.onPointerMove,nh(G=>{const M=G.target,B=W.current!==G.clientX;if(G.currentTarget.contains(M)&&B){const Z=G.clientX>W.current?"right":"left";U.current=Z,W.current=G.clientX}}))})})})})})})});fj.displayName=Wi;var aV="MenuGroup",aw=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Lt.div,{role:"group",...r,ref:t})});aw.displayName=aV;var lV="MenuLabel",mj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Lt.div,{...r,ref:t})});mj.displayName=lV;var Sp="MenuItem",gE="menu.itemSelect",Eg=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,o=_.useRef(null),l=Nh(Sp,e.__scopeMenu),c=sw(Sp,e.__scopeMenu),h=Qt(t,o),d=_.useRef(!1),g=()=>{const p=o.current;if(!n&&p){const v=new CustomEvent(gE,{bubbles:!0,cancelable:!0});p.addEventListener(gE,b=>r==null?void 0:r(b),{once:!0}),oM(p,v),v.defaultPrevented?d.current=!1:l.onClose()}};return f.jsx(pj,{...i,ref:h,disabled:n,onClick:Fe(e.onClick,g),onPointerDown:p=>{var v;(v=e.onPointerDown)==null||v.call(e,p),d.current=!0},onPointerUp:Fe(e.onPointerUp,p=>{var v;d.current||(v=p.currentTarget)==null||v.click()}),onKeyDown:Fe(e.onKeyDown,p=>{const v=c.searchRef.current!=="";n||v&&p.key===" "||Kb.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Eg.displayName=Sp;var pj=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=e,l=sw(Sp,n),c=cj(n),h=_.useRef(null),d=Qt(t,h),[g,p]=_.useState(!1),[v,b]=_.useState("");return _.useEffect(()=>{const w=h.current;w&&b((w.textContent??"").trim())},[o.children]),f.jsx(th.ItemSlot,{scope:n,disabled:r,textValue:i??v,children:f.jsx(qU,{asChild:!0,...c,focusable:!r,children:f.jsx(Lt.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:d,onPointerMove:Fe(e.onPointerMove,nh(w=>{r?l.onItemLeave(w):(l.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Fe(e.onPointerLeave,nh(w=>l.onItemLeave(w))),onFocus:Fe(e.onFocus,()=>p(!0)),onBlur:Fe(e.onBlur,()=>p(!1))})})})}),cV="MenuCheckboxItem",gj=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return f.jsx(xj,{scope:e.__scopeMenu,checked:n,children:f.jsx(Eg,{role:"menuitemcheckbox","aria-checked":Cp(n)?"mixed":n,...i,ref:t,"data-state":cw(n),onSelect:Fe(i.onSelect,()=>r==null?void 0:r(Cp(n)?!0:!n),{checkForDefaultPrevented:!1})})})});gj.displayName=cV;var vj="MenuRadioGroup",[uV,dV]=Rl(vj,{value:void 0,onValueChange:()=>{}}),_j=_.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,o=ls(r);return f.jsx(uV,{scope:e.__scopeMenu,value:n,onValueChange:o,children:f.jsx(aw,{...i,ref:t})})});_j.displayName=vj;var yj="MenuRadioItem",bj=_.forwardRef((e,t)=>{const{value:n,...r}=e,i=dV(yj,e.__scopeMenu),o=n===i.value;return f.jsx(xj,{scope:e.__scopeMenu,checked:o,children:f.jsx(Eg,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":cw(o),onSelect:Fe(r.onSelect,()=>{var l;return(l=i.onValueChange)==null?void 0:l.call(i,n)},{checkForDefaultPrevented:!1})})})});bj.displayName=yj;var lw="MenuItemIndicator",[xj,hV]=Rl(lw,{checked:!1}),wj=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,o=hV(lw,n);return f.jsx(Xi,{present:r||Cp(o.checked)||o.checked===!0,children:f.jsx(Lt.span,{...i,ref:t,"data-state":cw(o.checked)})})});wj.displayName=lw;var fV="MenuSeparator",Sj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Lt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Sj.displayName=fV;var mV="MenuArrow",Cj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=kg(n);return f.jsx(hg,{...i,...r,ref:t})});Cj.displayName=mV;var pV="MenuSub",[Bse,kj]=Rl(pV),Cd="MenuSubTrigger",Ej=_.forwardRef((e,t)=>{const n=Tl(Cd,e.__scopeMenu),r=Nh(Cd,e.__scopeMenu),i=kj(Cd,e.__scopeMenu),o=sw(Cd,e.__scopeMenu),l=_.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:h}=o,d={__scopeMenu:e.__scopeMenu},g=_.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return _.useEffect(()=>g,[g]),_.useEffect(()=>{const p=c.current;return()=>{window.clearTimeout(p),h(null)}},[c,h]),f.jsx(rw,{asChild:!0,...d,children:f.jsx(pj,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Nj(n.open),...e,ref:v0(t,i.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:Fe(e.onPointerMove,nh(p=>{o.onItemEnter(p),!p.defaultPrevented&&!e.disabled&&!n.open&&!l.current&&(o.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),g()},100))})),onPointerLeave:Fe(e.onPointerLeave,nh(p=>{var b,w;g();const v=(b=n.content)==null?void 0:b.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"];o.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(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(p),p.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Fe(e.onKeyDown,p=>{var b;const v=o.searchRef.current!=="";e.disabled||v&&p.key===" "||YU[r.dir].includes(p.key)&&(n.onOpenChange(!0),(b=n.content)==null||b.focus(),p.preventDefault())})})})});Ej.displayName=Cd;var Rj="MenuSubContent",Tj=_.forwardRef((e,t)=>{const n=dj(Wi,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=Tl(Wi,e.__scopeMenu),l=Nh(Wi,e.__scopeMenu),c=kj(Rj,e.__scopeMenu),h=_.useRef(null),d=Qt(t,h);return f.jsx(th.Provider,{scope:e.__scopeMenu,children:f.jsx(Xi,{present:r||o.open,children:f.jsx(th.Slot,{scope:e.__scopeMenu,children:f.jsx(ow,{id:c.contentId,"aria-labelledby":c.triggerId,...i,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:Fe(e.onFocusOutside,g=>{g.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Fe(e.onEscapeKeyDown,g=>{l.onClose(),g.preventDefault()}),onKeyDown:Fe(e.onKeyDown,g=>{var b;const p=g.currentTarget.contains(g.target),v=XU[l.dir].includes(g.key);p&&v&&(o.onOpenChange(!1),(b=c.trigger)==null||b.focus(),g.preventDefault())})})})})})});Tj.displayName=Rj;function Nj(e){return e?"open":"closed"}function Cp(e){return e==="indeterminate"}function cw(e){return Cp(e)?"indeterminate":e?"checked":"unchecked"}function gV(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function vV(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function _V(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=vV(e,Math.max(o,0));i.length===1&&(l=l.filter(d=>d!==n));const h=l.find(d=>d.toLowerCase().startsWith(i.toLowerCase()));return h!==n?h:void 0}function yV(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,l=t.length-1;o<t.length;l=o++){const c=t[o],h=t[l],d=c.x,g=c.y,p=h.x,v=h.y;g>r!=v>r&&n<(p-d)*(r-g)/(v-g)+d&&(i=!i)}return i}function bV(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return yV(n,t)}function nh(e){return t=>t.pointerType==="mouse"?e(t):void 0}var xV=uj,wV=rw,SV=hj,CV=fj,kV=aw,EV=mj,RV=Eg,TV=gj,NV=_j,MV=bj,AV=wj,jV=Sj,DV=Cj,OV=Ej,LV=Tj,uw="ContextMenu",[zV,Fse]=So(uw,[lj]),Wr=lj(),[PV,Mj]=zV(uw),Aj=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:o=!0}=e,[l,c]=_.useState(!1),h=Wr(t),d=ls(r),g=_.useCallback(p=>{c(p),d(p)},[d]);return f.jsx(PV,{scope:t,open:l,onOpenChange:g,modal:o,children:f.jsx(xV,{...h,dir:i,open:l,onOpenChange:g,modal:o,children:n})})};Aj.displayName=uw;var jj="ContextMenuTrigger",Dj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=e,o=Mj(jj,n),l=Wr(n),c=_.useRef({x:0,y:0}),h=_.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...c.current})}),d=_.useRef(0),g=_.useCallback(()=>window.clearTimeout(d.current),[]),p=v=>{c.current={x:v.clientX,y:v.clientY},o.onOpenChange(!0)};return _.useEffect(()=>g,[g]),_.useEffect(()=>void(r&&g()),[r,g]),f.jsxs(f.Fragment,{children:[f.jsx(wV,{...l,virtualRef:h}),f.jsx(Lt.span,{"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Fe(e.onContextMenu,v=>{g(),p(v),v.preventDefault()}),onPointerDown:r?e.onPointerDown:Fe(e.onPointerDown,vm(v=>{g(),d.current=window.setTimeout(()=>p(v),700)})),onPointerMove:r?e.onPointerMove:Fe(e.onPointerMove,vm(g)),onPointerCancel:r?e.onPointerCancel:Fe(e.onPointerCancel,vm(g)),onPointerUp:r?e.onPointerUp:Fe(e.onPointerUp,vm(g))})]})});Dj.displayName=jj;var IV="ContextMenuPortal",Oj=e=>{const{__scopeContextMenu:t,...n}=e,r=Wr(t);return f.jsx(SV,{...r,...n})};Oj.displayName=IV;var Lj="ContextMenuContent",zj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Mj(Lj,n),o=Wr(n),l=_.useRef(!1);return f.jsx(CV,{...o,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:c=>{var h;(h=e.onCloseAutoFocus)==null||h.call(e,c),!c.defaultPrevented&&l.current&&c.preventDefault(),l.current=!1},onInteractOutside:c=>{var h;(h=e.onInteractOutside)==null||h.call(e,c),!c.defaultPrevented&&!i.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)"}})});zj.displayName=Lj;var BV="ContextMenuGroup",FV=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(kV,{...i,...r,ref:t})});FV.displayName=BV;var HV="ContextMenuLabel",$V=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(EV,{...i,...r,ref:t})});$V.displayName=HV;var UV="ContextMenuItem",Pj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(RV,{...i,...r,ref:t})});Pj.displayName=UV;var VV="ContextMenuCheckboxItem",WV=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(TV,{...i,...r,ref:t})});WV.displayName=VV;var qV="ContextMenuRadioGroup",KV=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(NV,{...i,...r,ref:t})});KV.displayName=qV;var GV="ContextMenuRadioItem",YV=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(MV,{...i,...r,ref:t})});YV.displayName=GV;var XV="ContextMenuItemIndicator",ZV=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(AV,{...i,...r,ref:t})});ZV.displayName=XV;var QV="ContextMenuSeparator",JV=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(jV,{...i,...r,ref:t})});JV.displayName=QV;var eW="ContextMenuArrow",tW=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(DV,{...i,...r,ref:t})});tW.displayName=eW;var nW="ContextMenuSubTrigger",rW=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(OV,{...i,...r,ref:t})});rW.displayName=nW;var iW="ContextMenuSubContent",sW=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(LV,{...i,...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)"}})});sW.displayName=iW;function vm(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var oW=Aj,aW=Dj,lW=Oj,Ij=zj,Bj=Pj;const Fj=oW,Hj=aW,dw=_.forwardRef(({className:e,...t},n)=>f.jsx(lW,{children:f.jsx(Ij,{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})}));dw.displayName=Ij.displayName;const kp=_.forwardRef(({className:e,...t},n)=>f.jsx(Bj,{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}));kp.displayName=Bj.displayName;function hw({open:e,onOpenChange:t,position:n,children:r}){return f.jsxs(W5,{open:e,onOpenChange:t,children:[f.jsx(sH,{style:n?{position:"fixed",left:n.x,top:n.y,width:0,height:0}:void 0}),f.jsx(q5,{children:f.jsx(H0,{side:"bottom",align:"start",sideOffset:4,onOpenAutoFocus:i=>i.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 rh({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 cW({onRemove:e,children:t,mobileMenuPosition:n,onMobileMenuClose:r,skipContextMenu:i}){return f.jsxs(f.Fragment,{children:[i?t:f.jsxs(Fj,{children:[f.jsx(Hj,{asChild:!0,children:t}),f.jsx(dw,{children:f.jsxs(kp,{onSelect:o=>{o.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(Gd,{className:"h-4 w-4"}),f.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})})]}),f.jsx(hw,{open:!!n,onOpenChange:o=>{o||r==null||r()},position:n??null,children:f.jsxs(rh,{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(Gd,{className:"h-4 w-4"}),f.jsx("span",{children:"Hide"})]})})]})}function uW({onRename:e,onDelete:t,children:n,mobileMenuPosition:r,onMobileMenuClose:i,skipContextMenu:o}){return f.jsxs(f.Fragment,{children:[o?n:f.jsxs(Fj,{children:[f.jsx(Hj,{asChild:!0,children:n}),f.jsxs(dw,{children:[f.jsxs(kp,{onSelect:l=>{l.stopPropagation(),e()},children:[f.jsx(Bc,{className:"h-4 w-4"}),f.jsx("span",{className:"text-xs font-medium",children:"Rename Feature"})]}),f.jsxs(kp,{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(Gd,{className:"h-4 w-4"}),f.jsx("span",{className:"text-xs font-medium",children:"Delete Feature"})]})]})]}),f.jsxs(hw,{open:!!r,onOpenChange:l=>{l||i==null||i()},position:r??null,children:[f.jsxs(rh,{onSelect:()=>{i==null||i(),e()},children:[f.jsx(Bc,{className:"h-4 w-4"}),f.jsx("span",{children:"Rename Feature"})]}),f.jsxs(rh,{onSelect:()=>{i==null||i(),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(Gd,{className:"h-4 w-4"}),f.jsx("span",{children:"Delete Feature"})]})]})]})}function Mh(e){const[t,n]=_.useState(()=>typeof window>"u"?!1:window.matchMedia(e).matches);return _.useEffect(()=>{const r=window.matchMedia(e),i=()=>n(r.matches);return i(),r.addEventListener?(r.addEventListener("change",i),()=>r.removeEventListener("change",i)):(r.addListener(i),()=>r.removeListener(i))},[e]),t}function $j({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 vE=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(b=>b(t,v))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>h,subscribe:d=>(n.add(d),()=>n.delete(d))},h=t=e(r,i,c);return c},dW=e=>e?vE(e):vE,hW=e=>e;function fW(e,t=hW){const n=xe.useSyncExternalStore(e.subscribe,xe.useCallback(()=>t(e.getState()),[e,t]),xe.useCallback(()=>t(e.getInitialState()),[e,t]));return xe.useDebugValue(n),n}const mW=e=>{const t=dW(e),n=r=>fW(t,r);return Object.assign(n,t),n},ko=e=>mW;function pW(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var o;const l=h=>h===null?null:JSON.parse(h,void 0),c=(o=n.getItem(i))!=null?o:null;return c instanceof Promise?c.then(l):l(c)},setItem:(i,o)=>n.setItem(i,JSON.stringify(o,void 0)),removeItem:i=>n.removeItem(i)}}const Gb=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Gb(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Gb(r)(n)}}}},gW=(e,t)=>(n,r,i)=>{let o={storage:pW(()=>window.localStorage),partialize:C=>C,version:0,merge:(C,k)=>({...k,...C}),...t},l=!1,c=0;const h=new Set,d=new Set;let g=o.storage;if(!g)return e((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...C)},r,i);const p=()=>{const C=o.partialize({...r()});return g.setItem(o.name,{state:C,version:o.version})},v=i.setState;i.setState=(C,k)=>(v(C,k),p());const b=e((...C)=>(n(...C),p()),r,i);i.getInitialState=()=>b;let w;const S=()=>{var C,k;if(!g)return;const R=++c;l=!1,h.forEach(N=>{var L;return N((L=r())!=null?L:b)});const E=((k=o.onRehydrateStorage)==null?void 0:k.call(o,(C=r())!=null?C:b))||void 0;return Gb(g.getItem.bind(g))(o.name).then(N=>{if(N)if(typeof N.version=="number"&&N.version!==o.version){if(o.migrate){const L=o.migrate(N.state,N.version);return L instanceof Promise?L.then(j=>[!0,j]):[!0,L]}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 L;if(R!==c)return;const[j,D]=N;if(w=o.merge(D,(L=r())!=null?L:b),n(w,!0),j)return p()}).then(()=>{R===c&&(E==null||E(r(),void 0),w=r(),l=!0,d.forEach(N=>N(w)))}).catch(N=>{R===c&&(E==null||E(void 0,N))})};return i.persist={setOptions:C=>{o={...o,...C},C.storage&&(g=C.storage)},clearStorage:()=>{g==null||g.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>S(),hasHydrated:()=>l,onHydrate:C=>(h.add(C),()=>{h.delete(C)}),onFinishHydration:C=>(d.add(C),()=>{d.delete(C)})},o.skipHydration||S(),w||b},Eo=gW,yn=ko()(Eo(e=>({themePreference:"system",themeId:"default",customAppearance:"system",backgroundImage:null,backgroundOpacity:1,backgroundBlur:0,showProjectIconsInSidebar:!0,availableThemes:[],themeCssText:"",setThemePreference:t=>e({themePreference:t}),setThemeId:t=>e({themeId: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}),setAvailableThemes:t=>e({availableThemes:t}),setThemeCssText:t=>e({themeCssText:t})}),{name:"theme-settings"})),Uj=8;function Yb(e,t){return!e.has(t)}function Sy(e,t,n){const r=e.map(l=>l.featureId),i=r.indexOf(t),o=r.indexOf(n);return i===-1||o===-1||i===o?null:xg(r,i,o)}function vW(e){return{activeFeatures:e.filter(t=>t.stage!=="done"),completedFeatures:e.filter(t=>t.stage==="done")}}function _W(e,t){return t?e:e.slice(0,Uj)}function yW(e,t){return e.map(n=>`feature:${n.featureId}`).filter(n=>!t.has(n))}function _E({feature:e,groupKey:t,collapsedSections:n,onToggleSection:r,renderChatRow:i,onNewLocalChat:o,onRenameFeature:l,onDeleteFeature:c,onSetFeatureBrowserState:h,onSetFeatureStage:d,kanbanStatusesEnabled:g=!0,showFeatureOverviewInSidebar:p=!1,activeOverviewFeatureId:v=null,onOpenFeatureOverview:b,showAllChats:w,onToggleShowAllChats:S,draggedFeatureId:C,draggedChatId:k,hoveredDropTarget:R,isTouchDevice:E,onFeatureDragStart:N,onFeatureDragEnd:L,onFeatureDrop:j,onChatDrop:D,onTouchDragMove:H,onTouchDragEnd:Y,onChatDragStart:P,onChatDragEnd:q}){const F=`feature:${e.featureId}`,U=Yb(n,F),W=k!==null,V=_W(e.chats,w),O=Math.max(0,e.chats.length-Uj),$=O>0,z=v===e.featureId,[G,M]=_.useState(null);function B(){r(F),h==null||h(e.featureId,U?"CLOSED":"OPEN")}const Z=_.useRef(null),{touchRef:A,isDragging:ie,isArmed:J,dragPosition:ee}=U0({enabled:E,visualElementRef:Z,onTap:B,onContextMenu:pe=>M(pe),onDragStart:()=>N(e.featureId),onDragMove:({x:pe,y:Se,elementBelow:Re})=>H(pe,Se,Re),onDragEnd:({x:pe,y:Se,elementBelow:Re})=>Y(pe,Se,Re)}),re=C===e.featureId||ie,ce=f.jsxs("div",{ref:Z,"data-feature-drop-target":e.featureId,onDragOver:E?void 0:pe=>{if(C&&C!==e.featureId){pe.preventDefault();return}W&&pe.preventDefault()},onDrop:E?void 0:pe=>{if(pe.preventDefault(),C&&C!==e.featureId){j(C,e.featureId);return}k&&D(k,e.featureId)},className:me("rounded-lg border border-border/60 bg-muted/10 transition-all duration-150 select-none",W&&!E&&"border-dashed hover:border-primary/60 hover:bg-primary/5",R===e.featureId&&"border-primary/60 bg-primary/5",J&&"scale-[1.03] shadow-md ring-2 ring-primary/50 bg-card",re&&!J&&"opacity-20 scale-[0.98]"),children:[f.jsxs("div",{ref:E?A:void 0,className:"flex items-center gap-2 px-2 py-1.5",children:[E?f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button","data-no-touch-drag":!0,onClick:B,className:"flex shrink-0 items-center",children:f.jsx(Vr,{className:me("size-3 transition-transform",U&&"rotate-90")})}),f.jsx(cy,{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:B,draggable:!0,"data-feature-drag-handle":e.featureId,onDragStart:()=>N(e.featureId),onDragEnd:L,className:"flex min-w-0 flex-1 basis-0 items-center gap-2 text-left",children:[f.jsx(Vr,{className:me("size-3 transition-transform",U&&"rotate-90")}),f.jsx(cy,{className:"size-3.5 text-muted-foreground"}),f.jsxs(Ms,{children:[f.jsx(As,{asChild:!0,children:f.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:e.title})}),f.jsx(os,{side:"right",sideOffset:4,children:e.title})]})]}),g?f.jsxs(Er,{value:e.stage,onValueChange:pe=>d==null?void 0:d(e.featureId,pe),children:[f.jsx(cr,{"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",mE[e.stage]),children:f.jsx(jr,{children:eE[e.stage]})}),f.jsx(ur,{children:GF.map(pe=>f.jsx($t,{value:pe,className:me("text-[11px] font-medium",pe===e.stage&&mE[pe]),children:eE[pe]},pe))})]}):null,o?f.jsx(et,{variant:"ghost",size:"icon",className:"h-6 w-6","data-no-touch-drag":!0,onClick:()=>o(t,e.featureId),title:"New chat in feature",children:f.jsx(WM,{className:"size-3.5"})}):null]}),U?f.jsxs("div",{className:"space-y-[2px] border-t border-border/50 p-1 pl-3",children:[p&&e.overviewRelativePath?f.jsxs("button",{type:"button",onClick:()=>b==null?void 0:b(e.featureId),className:me("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors",z?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted/70 hover:text-foreground"),children:[f.jsx(M8,{className:"size-3.5 shrink-0"}),f.jsx("span",{className:"truncate",children:"overview.md"})]}):null,V.map(pe=>i(pe,{draggable:!0,onDragStart:Se=>P(Se.chatId),onDragEnd:q,isTouchDevice:E,onTouchDragMove:H,onTouchDragEnd:Y})),$?f.jsx("div",{className:"pt-1",children:f.jsx(et,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground",onClick:S,children:w?"Show less":`Show ${O} more`})}):null]}):null]}),he=f.jsxs(Y5,{position:ee,children:[f.jsx(cy,{className:"size-3.5 shrink-0 text-primary"}),f.jsx("span",{className:"text-sm font-medium truncate",children:e.title})]});return c?f.jsxs(f.Fragment,{children:[f.jsx(uW,{onRename:()=>l==null?void 0:l(e.featureId),onDelete:()=>c(e.featureId),mobileMenuPosition:G,onMobileMenuClose:()=>M(null),skipContextMenu:E,children:ce}),he]}):f.jsxs(f.Fragment,{children:[ce,he]})}function bW({group:e,collapsedSections:t,onToggleSection:n,renderChatRow:r,onNewLocalChat:i,onCreateFeature:o,onRenameFeature:l,onDeleteFeature:c,onSetProjectBrowserState:h,onSetProjectGeneralChatsBrowserState:d,onSetFeatureBrowserState:g,onSetFeatureStage:p,onSetChatFeature:v,onReorderFeatures:b,onRemoveProject:w,isConnected:S,startingLocalPath:C,folderGroupsEnabled:k=!0,showFeatureOverviewInSidebar:R=!1,kanbanStatusesEnabled:E=!0,activeOverviewFeatureId:N=null,onOpenFeatureOverview:L}){const j=yn(Oe=>Oe.showProjectIconsInSidebar),{groupKey:D,localPath:H,features:Y,generalChats:P}=e,{activeFeatures:q,completedFeatures:F}=_.useMemo(()=>vW(Y),[Y]),U=`project:${D}`,W=`general:${D}`,V=Yb(t,U),O=Y.length===0||Yb(t,W),[$,z]=_.useState(null),[G,M]=_.useState(null),[B,Z]=_.useState(null),[A,ie]=_.useState(!1),[J,ee]=_.useState(!1),[re,ce]=_.useState({}),[he,pe]=_.useState(null),Se=Mh("(pointer: coarse)"),Re=k&&!A?P.slice(0,10):P,je=k&&P.length>10,{attributes:Xe,listeners:Et,setNodeRef:Rt,setActivatorNodeRef:fe,transform:He,transition:De,isDragging:mt}=rU({id:D}),ct=_.useRef(null),ot={transform:Jd.Translate.toString(He),transition:De};function fn(){n(U),h==null||h(D,V?"CLOSED":"OPEN")}function Ce(){n(W),d==null||d(D,O?"CLOSED":"OPEN")}function tt(Oe){ce(qe=>({...qe,[Oe]:!qe[Oe]}))}function oe(Oe){Oe.stopPropagation();for(const qe of yW(Y,t))n(qe);for(const qe of Y)g==null||g(qe.featureId,"CLOSED")}function ve(Oe){if(!Oe)return null;const qe=Oe.closest("[data-feature-drop-target]");return qe?{type:"feature",featureId:qe.getAttribute("data-feature-drop-target")}:Oe.closest(`[data-general-chats-drop-target="${D}"]`)?{type:"general"}:null}function Ne(Oe,qe,gt){const Ve=ct.current;if(Ve){const sn=Ve.getBoundingClientRect(),Je=60;qe<sn.top+Je?Ve.scrollBy(0,-6):qe>sn.bottom-Je&&Ve.scrollBy(0,6)}const mn=ve(gt);Z((mn==null?void 0:mn.type)==="feature"?mn.featureId:null)}function Ae(Oe,qe,gt){const Ve=ve(gt);if(G){if((Ve==null?void 0:Ve.type)==="feature"&&Ve.featureId!==G&&b){const mn=Sy(Y,G,Ve.featureId);mn&&b(D,mn)}M(null)}else $&&v&&((Ve==null?void 0:Ve.type)==="feature"?v($,Ve.featureId):(Ve==null?void 0:Ve.type)==="general"&&v($,null),z(null));Z(null)}const Qe=_.useRef(null),{touchRef:At}=U0({enabled:Se&&!!w,onTap:fn,onContextMenu:Oe=>pe(Oe)}),rt=f.jsxs("div",{ref:Oe=>{fe(Oe),Qe.current=Oe,Se&&w&&At(Oe)},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",mt&&"cursor-grabbing"),onClick:Se?void 0:fn,...Et,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(Vr,{className:me("translate-y-[1px] size-3.5 shrink-0 text-slate-400 transition-transform duration-200",V&&"rotate-90")})}),j?f.jsx($j,{iconDataUrl:e.iconDataUrl,alt:`${e.title||vp(H)} icon`,className:"size-5",fallback:f.jsx("span",{className:"size-5 shrink-0","aria-hidden":"true"})}):null,f.jsxs(Ms,{children:[f.jsx(As,{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||vp(H)})}),f.jsx(os,{side:"right",sideOffset:4,children:H})]})]}),f.jsxs("div",{className:"absolute right-2 flex items-center gap-1",children:[o?f.jsxs(Ms,{children:[f.jsx(As,{asChild:!0,children:f.jsx(et,{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:Oe=>{Oe.stopPropagation(),o(D)},children:f.jsx(BM,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),f.jsx(os,{side:"right",sideOffset:4,children:"New feature"})]}):null,Y.length>0?f.jsxs(Ms,{children:[f.jsx(As,{asChild:!0,children:f.jsx(et,{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:oe,children:f.jsx(i8,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),f.jsx(os,{side:"right",sideOffset:4,children:"Close all feature folders"})]}):null,i?f.jsxs(Ms,{children:[f.jsx(As,{asChild:!0,children:f.jsx(et,{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===H)&&"opacity-50 cursor-not-allowed"),disabled:!S||C===H,"data-no-touch-drag":!0,onClick:Oe=>{Oe.stopPropagation(),i(D)},children:C===H?f.jsx(Lr,{className:"size-4 text-slate-500 dark:text-slate-400 animate-spin"}):f.jsx(WM,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),f.jsx(os,{side:"right",sideOffset:4,children:S?"New general chat":`Start ${Zn} to connect`})]}):null]})]});return f.jsxs("div",{ref:Oe=>{Rt(Oe),ct.current=(Oe==null?void 0:Oe.closest("[data-sidebar-scroll]"))??null},style:ot,className:me("group/section",mt&&"opacity-50 shadow-lg z-50 relative"),...Xe,children:[w?f.jsx(cW,{onRemove:()=>w(D),mobileMenuPosition:he,onMobileMenuClose:()=>pe(null),skipContextMenu:Se,children:rt}):rt,V?f.jsxs("div",{className:"mb-2 space-y-2",children:[k&&q.length>0?f.jsx("section",{className:"space-y-2 pl-6",children:q.map(Oe=>f.jsx(_E,{feature:Oe,groupKey:D,collapsedSections:t,onToggleSection:n,renderChatRow:r,onNewLocalChat:i,onRenameFeature:l,onDeleteFeature:c,onSetFeatureBrowserState:g,onSetFeatureStage:p,kanbanStatusesEnabled:E,showFeatureOverviewInSidebar:R,activeOverviewFeatureId:N,onOpenFeatureOverview:L,showAllChats:!!re[Oe.featureId],onToggleShowAllChats:()=>tt(Oe.featureId),draggedFeatureId:G,draggedChatId:$,hoveredDropTarget:B,isTouchDevice:Se,onFeatureDragStart:qe=>M(qe),onFeatureDragEnd:()=>M(null),onFeatureDrop:(qe,gt)=>{const Ve=Sy(Y,qe,gt);M(null),Ve&&(b==null||b(D,Ve))},onChatDrop:(qe,gt)=>{v==null||v(qe,gt),z(null)},onTouchDragMove:Ne,onTouchDragEnd:Ae,onChatDragStart:qe=>z(qe),onChatDragEnd:()=>z(null)},Oe.featureId))}):null,k&&F.length>0?f.jsxs("section",{className:"pl-6",children:[f.jsxs("button",{type:"button",onClick:()=>ee(Oe=>!Oe),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(Vr,{className:me("size-3 transition-transform",J&&"rotate-90")}),f.jsx("span",{children:J?"Hide completed":"Show completed"}),f.jsx("span",{className:"ml-auto",children:F.length})]}),J?f.jsx("div",{className:"space-y-2 pt-1",children:F.map(Oe=>f.jsx(_E,{feature:Oe,groupKey:D,collapsedSections:t,onToggleSection:n,renderChatRow:r,onNewLocalChat:i,onRenameFeature:l,onDeleteFeature:c,onSetFeatureBrowserState:g,onSetFeatureStage:p,kanbanStatusesEnabled:E,showFeatureOverviewInSidebar:R,activeOverviewFeatureId:N,onOpenFeatureOverview:L,showAllChats:!!re[Oe.featureId],onToggleShowAllChats:()=>tt(Oe.featureId),draggedFeatureId:G,draggedChatId:$,hoveredDropTarget:B,isTouchDevice:Se,onFeatureDragStart:qe=>M(qe),onFeatureDragEnd:()=>M(null),onFeatureDrop:(qe,gt)=>{const Ve=Sy(Y,qe,gt);M(null),Ve&&(b==null||b(D,Ve))},onChatDrop:(qe,gt)=>{v==null||v(qe,gt),z(null)},onTouchDragMove:Ne,onTouchDragEnd:Ae,onChatDragStart:qe=>z(qe),onChatDragEnd:()=>z(null)},Oe.featureId))}):null]}):null,P.length>0?f.jsxs("section",{"data-general-chats-drop-target":D,onDragOver:$&&!Se?Oe=>Oe.preventDefault():void 0,onDrop:$&&!Se&&v?Oe=>{Oe.preventDefault(),v($,null),z(null)}:void 0,children:[k?f.jsxs("button",{type:"button",onClick:Ce,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(Vr,{className:me("size-3 transition-transform",O&&"rotate-90")}),f.jsx("span",{children:"General Chats"}),f.jsx("span",{className:"ml-auto",children:P.length})]}):null,!k||O?f.jsxs("div",{className:me("space-y-[2px]",k?"pl-7":"pl-4"),children:[Re.map(Oe=>r(Oe,{draggable:!0,onDragStart:qe=>z(qe.chatId),onDragEnd:()=>z(null),isTouchDevice:Se,onTouchDragMove:Ne,onTouchDragEnd:Ae})),je?f.jsx("div",{className:"pt-1",children:f.jsx(et,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground",onClick:()=>ie(Oe=>!Oe),children:A?"Show less":`Show ${P.length-10} more`})}):null]}):null]}):null]}):null]})}function xW({projectGroups:e,collapsedSections:t,onToggleSection:n,onSetProjectBrowserState:r,onSetProjectGeneralChatsBrowserState:i,renderChatRow:o,onNewLocalChat:l,onCreateFeature:c,onRenameFeature:h,onDeleteFeature:d,onSetFeatureBrowserState:g,onSetFeatureStage:p,onSetChatFeature:v,onReorderFeatures:b,onRemoveProject:w,onReorderGroups:S,isConnected:C,startingLocalPath:k,folderGroupsEnabled:R=!0,showFeatureOverviewInSidebar:E=!1,kanbanStatusesEnabled:N=!0,activeOverviewFeatureId:L=null,onOpenFeatureOverview:j}){const D=OH(vy(Q0,{activationConstraint:{distance:8}}),vy(aA,{activationConstraint:{delay:250,tolerance:5}}),vy(X0)),H=_.useMemo(()=>e.map(F=>F.groupKey),[e]),Y=_.useRef(null);function P(F){const U=F.active.id;t.has(U)?Y.current=null:(Y.current=U,n(U))}function q(F){const{active:U,over:W}=F;if(W&&U.id!==W.id&&S){const V=H.indexOf(U.id),O=H.indexOf(W.id);V!==-1&&O!==-1&&S(xg(H,V,O))}if(Y.current){const V=Y.current;Y.current=null,requestAnimationFrame(()=>n(V))}}return f.jsx(P$,{sensors:D,collisionDetection:BH,onDragStart:P,onDragEnd:q,children:f.jsx(X$,{items:H,strategy:G$,children:e.map(F=>f.jsx(bW,{group:F,collapsedSections:t,onToggleSection:n,onSetProjectBrowserState:r,onSetProjectGeneralChatsBrowserState:i,renderChatRow:o,onNewLocalChat:l,onCreateFeature:c,onRenameFeature:h,onDeleteFeature:d,onSetFeatureBrowserState:g,onSetFeatureStage:p,onSetChatFeature:v,onReorderFeatures:b,onRemoveProject:w,onReorderGroups:S,isConnected:C,startingLocalPath:k,folderGroupsEnabled:R,showFeatureOverviewInSidebar:E,kanbanStatusesEnabled:N,activeOverviewFeatureId:L,onOpenFeatureOverview:j},F.groupKey))})})}const Vj=`${pg}provider-usage-collapsed`,Wj=`${pg}provider-usage-mode`,wW=ma.map(e=>e.id),SW=["claude","codex"],Xb=Object.fromEntries(ma.map(e=>[e.id,e.label]));function yE(e){return e===null?"bg-muted":e>=90?"bg-red-500":e>=75?"bg-amber-500":"bg-emerald-500"}function Cy(e){return e===null?"N/A":`${e.toFixed(1)}%`}function bE(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,i=Math.ceil(r/6e4);return i<60?`Resets in ${i} min`:`Resets at ${new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}function CW(){try{return localStorage.getItem(Vj)==="true"}catch{return!1}}function kW(){try{return localStorage.getItem(Wj)==="weekly"?"weekly":"session"}catch{return"session"}}function EW(e){try{localStorage.setItem(Vj,String(e))}catch{}}function RW(e){try{localStorage.setItem(Wj,e)}catch{}}function xE(e){const{entry:t,mode:n,isPending:r,onRefreshProviderUsage:i,onOpenProviderLogin:o}=e,l=gp[t.provider],c=e.labelOverride??Xb[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,b=v,w=p?null:n==="weekly"?bE(t.weeklyRateLimitResetAt??null,t.weeklyRateLimitResetLabel??null):bE(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(`${Cy(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(Ms,{children:[f.jsx(As,{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:c}),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:b!==null?f.jsx("div",{className:me("h-full rounded-full transition-all",yE(b)),style:{width:`${Math.min(100,Math.max(0,b))}%`}}):null}),f.jsx("span",{className:"text-[10px] tabular-nums text-muted-foreground w-7 text-right shrink-0",children:Cy(b)})]}),C?f.jsx("button",{type:"button",disabled:r,onClick:R=>{R.stopPropagation(),o==null||o("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(),i==null||i("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(op,{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",yE(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:Cy(R.percent)})]})]},E))})]})}),f.jsx(os,{side:"right",className:"max-w-48",children:S.map((R,E)=>f.jsx("div",{className:"text-xs",children:R},E))})]})}function TW({providerUsage:e,visibleProviders:t=wW,onRefreshProviderUsage:n,onOpenProviderLogin:r}){const[i,o]=_.useState(CW),[l,c]=_.useState(kW),[h,d]=_.useState(null),g=()=>{o(v=>{const b=!v;return EW(b),b})},p=async()=>{d("all");try{await(n==null?void 0:n()),Ec("Usage checked successfully.")}catch{Ec("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:[i?f.jsx(Vr,{className:"h-3 w-3 text-muted-foreground/40 group-hover:text-muted-foreground transition-colors"}):f.jsx(tg,{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"})]}),!i&&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(op,{className:me("h-3 w-3",h==="all"&&"animate-spin")})}),f.jsx("button",{type:"button",onClick:()=>{c(v=>{const b=v==="session"?"weekly":"session";return RW(b),b})},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"})]})]}),!i&&(l==="weekly"?SW:t).flatMap(v=>{const b=(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)),Ec(`${Xb[C]??"Provider"} usage checked successfully.`)}catch{Ec(`Failed to check ${Xb[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(xE,{entry:b,mode:l,isPending:h==="cursor",bars:[{label:"API",percent:b.apiLimitUsedPercent??null},{label:"Composer",percent:b.sessionLimitUsedPercent}],onRefreshProviderUsage:w,onOpenProviderLogin:S},"cursor")]:[f.jsx(xE,{entry:b,mode:l,isPending:h===v||h==="all",onRefreshProviderUsage:w,onOpenProviderLogin:S},v)]})]})}function NW(e){return e==="gpt-5-codex"?"gpt-5.3-codex":e??"gpt-5.4"}function MW(e){return e==="claude"||e==="codex"||e==="gemini"||e==="cursor"?e:"last_used"}function ol(e){var o,l;const t=(o=e==null?void 0:e.modelOptions)==null?void 0:o.reasoningEffort,n=Z2(t)?t:Z2(e==null?void 0:e.effort)?e.effort:j5.reasoningEffort,r=(e==null?void 0:e.model)??dn("claude").defaultModel,i=KF(r,(l=e==null?void 0:e.modelOptions)==null?void 0:l.contextWindow);return{model:r,modelOptions:{reasoningEffort:r!=="opus"&&n==="max"?"high":n,...i?{contextWindow:i}:{}},planMode:!!(e!=null&&e.planMode)}}function al(e){var r,i;const t=Ui("codex"),n=(r=e==null?void 0:e.modelOptions)==null?void 0:r.reasoningEffort;return{model:NW((e==null?void 0:e.model)??dn("codex").defaultModel),modelOptions:{reasoningEffort:Q2(n)?n:Q2(e==null?void 0:e.effort)?e.effort:t.reasoningEffort,fastMode:typeof((i=e==null?void 0:e.modelOptions)==null?void 0:i.fastMode)=="boolean"?e.modelOptions.fastMode:t.fastMode},planMode:!!(e!=null&&e.planMode)}}function Tc(e){var n;const t=Ui("gemini");return{model:(e==null?void 0:e.model)??dn("gemini").defaultModel,modelOptions:{thinkingMode:$F((n=e==null?void 0:e.modelOptions)==null?void 0:n.thinkingMode)?e.modelOptions.thinkingMode:t.thinkingMode},planMode:!!(e!=null&&e.planMode)}}function ll(e){return e==null||e.modelOptions,{model:HF((e==null?void 0:e.model)??dn("cursor").defaultModel),modelOptions:{...Ui("cursor")},planMode:!!(e!=null&&e.planMode)}}function AW(){return{claude:{model:dn("claude").defaultModel,modelOptions:{...Ui("claude")},planMode:!1},codex:{model:dn("codex").defaultModel,modelOptions:{...Ui("codex")},planMode:!1},gemini:{model:dn("gemini").defaultModel,modelOptions:{...Ui("gemini")},planMode:!1},cursor:{model:dn("cursor").defaultModel,modelOptions:{...Ui("cursor")},planMode:!1}}}function jW(e){return{claude:ol(e==null?void 0:e.claude),codex:al(e==null?void 0:e.codex),gemini:Tc(e==null?void 0:e.gemini),cursor:ll(e==null?void 0:e.cursor)}}function wE(e,t){if(t===void 0){console.info(`[chat-preferences] ${e}`);return}console.info(`[chat-preferences] ${e}`,t)}function Zb(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 DW(e,t,n,r){if((e==null?void 0:e.provider)==="claude"){const i=ol(e);return{provider:"claude",model:i.model,modelOptions:i.modelOptions,planMode:i.planMode}}if((e==null?void 0:e.provider)==="codex"){const i=al(e);return{provider:"codex",model:i.model,modelOptions:i.modelOptions,planMode:i.planMode}}if((e==null?void 0:e.provider)==="gemini"){const i=Tc(e);return{provider:"gemini",model:i.model,modelOptions:i.modelOptions,planMode:i.planMode}}if((e==null?void 0:e.provider)==="cursor"){const i=ll(e);return{provider:"cursor",model:i.model,modelOptions:i.modelOptions,planMode:i.planMode}}if(n==="claude"){const i=ol(r==null?void 0:r.claude);return{provider:"claude",model:i.model,modelOptions:i.modelOptions,planMode:i.planMode}}if(n==="codex"){const i=al(r==null?void 0:r.codex);return{provider:"codex",model:i.model,modelOptions:i.modelOptions,planMode:i.planMode}}if(n==="cursor"){const i=ll(r==null?void 0:r.cursor);return{provider:"cursor",model:i.model,modelOptions:i.modelOptions,planMode:i.planMode}}return Zb("claude",t)}function OW(e){const t=jW(e==null?void 0:e.providerDefaults);return{defaultProvider:MW(e==null?void 0:e.defaultProvider),providerDefaults:t,showProviderIconsInSideTray:(e==null?void 0:e.showProviderIconsInSideTray)===!0,composerState:DW(e==null?void 0:e.composerState,t,e==null?void 0:e.liveProvider,e==null?void 0:e.livePreferences)}}const Pi=ko()(Eo(e=>({defaultProvider:"last_used",providerDefaults:AW(),showProviderIconsInSideTray:!1,composerState:{provider:"claude",model:dn("claude").defaultModel,modelOptions:{...Ui("claude")},planMode:!1},setDefaultProvider:t=>e({defaultProvider:t}),setShowProviderIconsInSideTray:t=>e({showProviderIconsInSideTray:t}),setProviderDefaultModel:(t,n)=>e(r=>({providerDefaults:{...r.providerDefaults,[t]:t==="claude"?ol({...r.providerDefaults.claude,model:n}):t==="gemini"?Tc({...r.providerDefaults.gemini,model:n}):t==="cursor"?ll({...r.providerDefaults.cursor,model:n}):al({...r.providerDefaults.codex,model:n})}})),setProviderDefaultModelOptions:(t,n)=>e(r=>({providerDefaults:{...r.providerDefaults,[t]:t==="claude"?ol({...r.providerDefaults.claude,modelOptions:{...r.providerDefaults.claude.modelOptions,...n}}):t==="gemini"?Tc({...r.providerDefaults.gemini,modelOptions:{...r.providerDefaults.gemini.modelOptions,...n}}):t==="cursor"?ll({...r.providerDefaults.cursor,modelOptions:{...r.providerDefaults.cursor.modelOptions,...n}}):al({...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:ol({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="gemini"?{composerState:{provider:"gemini",model:t,modelOptions:Tc({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="cursor"?{composerState:{provider:"cursor",model:t,modelOptions:ll({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}:{composerState:{provider:"codex",model:t,modelOptions:al({...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:ol({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="gemini"?{composerState:{provider:"gemini",model:n.composerState.model,modelOptions:Tc({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="cursor"?{composerState:{provider:"cursor",model:n.composerState.model,modelOptions:ll({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}:{composerState:{provider:"codex",model:n.composerState.model,modelOptions:al({...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:Zb(t,n.providerDefaults)})),initializeComposerForNewChat:()=>e(t=>{if(t.defaultProvider==="last_used")return wE("initializeComposerForNewChat:last_used",{defaultProvider:t.defaultProvider,composerState:t.composerState,providerDefaults:t.providerDefaults}),{composerState:{...t.composerState}};const n=Zb(t.defaultProvider,t.providerDefaults);return wE("initializeComposerForNewChat:explicit_default",{defaultProvider:t.defaultProvider,composerState:n,providerDefaults:t.providerDefaults}),{composerState:n}})}),{name:"chat-preferences",version:5,migrate:e=>OW(e)})),SE=ko()(Eo(e=>({order:[],setOrder:t=>e({order:t})}),{name:"project-group-order"})),Ep=315,LW=240,zW=520;function PW(e){return typeof e=="object"&&e!==null}function Rg(e){return Number.isFinite(e)?Math.min(zW,Math.max(LW,Math.round(e))):Ep}function IW(e){return PW(e)?{widthPx:Rg(typeof e.widthPx=="number"?e.widthPx:Ep)}:{widthPx:Ep}}const CE=ko()(Eo(e=>({widthPx:Ep,setWidth:t=>e({widthPx:Rg(t)})}),{name:"left-sidebar-layout",version:1,migrate:IW}));function qj(e,t){return e&&!t}function BW(e,t,n){if(qj(e,t))return{width:`${Rg(n)}px`}}function FW({data:e,completedChatIds:t,activeChatId:n,activeOverviewFeatureId:r,connectionStatus:i,ready:o,open:l,collapsed:c,isDesktopViewport:h,showMobileOpenButton:d,desktopWidth:g,onOpen:p,onClose:v,onToggle:b,onExpand:w,toggleShortcut:S,onResizeDesktopWidth:C,onCreateChat:k,onCreateFeature:R,onRenameFeature:E,onDeleteFeature:N,onSetProjectBrowserState:L,onSetProjectGeneralChatsBrowserState:j,onSetFeatureBrowserState:D,onSetFeatureStage:H,onSetChatFeature:Y,onReorderFeatures:P,folderGroupsEnabled:q,showFeatureOverviewInSidebar:F,kanbanStatusesEnabled:U,onOpenFeatureOverview:W,onDeleteChat:V,onRemoveProject:O,onRefreshProviderUsage:$,onOpenProviderLogin:z,providerSettings:G,startingLocalPath:M,updateSnapshot:B,onInstallUpdate:Z}){const A=Yi(),ie=kl(),J=_.useRef(null),ee=_.useRef(null),re=_.useRef(0),ce=_.useRef(null),he=_.useRef(null),pe=_.useRef({}),Se=_.useRef({}),Re=_.useRef({}),[je,Xe]=_.useState(new Set),[Et,Rt]=_.useState(!1),[fe,He]=_.useState(null),[De,mt]=_.useState(()=>Date.now()),ct=SE(ke=>ke.order),ot=SE(ke=>ke.setOrder),fn=_.useMemo(()=>B0((G==null?void 0:G.settings)??sr).map(ke=>ke.id),[G==null?void 0:G.settings]),Ce=_.useMemo(()=>{if(ct.length===0)return e.projectGroups;const ke=new Map(e.projectGroups.map(ut=>[ut.groupKey,ut])),Le=ct.filter(ut=>ke.has(ut)).map(ut=>ke.get(ut)),Nt=new Set(ct);for(const ut of e.projectGroups)Nt.has(ut.groupKey)||Le.push(ut);return Le},[e.projectGroups,ct]),tt=_.useCallback(()=>{ie({pathname:"/",search:"?newProject=1"}),v()},[ie,v]),oe=_.useMemo(()=>q?Ce:Ce.map(ke=>({...ke,features:[],generalChats:kE(ke)})),[q,Ce]),ve=_.useCallback(ke=>ot(ke),[ot]),Ne=_.useMemo(()=>oe.reduce((ke,Le)=>ke+kE(Le).length,0),[oe]),Ae=_.useCallback(ke=>{Xe(Le=>{const Nt=new Set(Le);return Nt.has(ke)?Nt.delete(ke):Nt.add(ke),Nt})},[]);_.useEffect(()=>{const ke=pe.current,Le=Se.current,Nt=Re.current;Xe(on=>{const Gt=new Set([...on].filter(Yt=>!Yt.startsWith("project:")&&!Yt.startsWith("general:")&&!Yt.startsWith("feature:")));for(const Yt of oe)(ke[Yt.groupKey]??Yt.browserState)==="CLOSED"&&Gt.add(`project:${Yt.groupKey}`),(Le[Yt.groupKey]??Yt.generalChatsBrowserState)==="CLOSED"&&Gt.add(`general:${Yt.groupKey}`);for(const Yt of oe)for(const Mr of Yt.features)(Nt[Mr.featureId]??Mr.browserState)==="CLOSED"&&Gt.add(`feature:${Mr.featureId}`);return Gt});const ut={...ke};for(const on of oe)ut[on.groupKey]===on.browserState&&delete ut[on.groupKey];pe.current=ut;const pn={...Le};for(const on of oe)pn[on.groupKey]===on.generalChatsBrowserState&&delete pn[on.groupKey];Se.current=pn;const bn={...Nt};for(const on of oe)for(const Gt of on.features)bn[Gt.featureId]===Gt.browserState&&delete bn[Gt.featureId];Re.current=bn},[oe]);const Qe=_.useCallback((ke,Le)=>{pe.current={...pe.current,[ke]:Le},L(ke,Le)},[L]),At=_.useCallback((ke,Le)=>{Se.current={...Se.current,[ke]:Le},j(ke,Le)},[j]),rt=_.useCallback((ke,Le)=>{Re.current={...Re.current,[ke]:Le},D(ke,Le)},[D]),Oe=_.useCallback(ke=>{ie(`/chat/${ke}`),l&&v()},[ie,v,l]),qe=Pi(ke=>ke.showProviderIconsInSideTray),gt=_.useCallback((ke,Le)=>f.jsx(yH,{chat:ke,activeChatId:n,nowMs:De,showProviderIcon:qe,isCompleted:t.has(ke.chatId),onSelectChat:Oe,onDeleteChat:()=>V(ke),draggable:Le==null?void 0:Le.draggable,onDragStart:Le==null?void 0:Le.onDragStart,onDragEnd:Le==null?void 0:Le.onDragEnd,isTouchDevice:Le==null?void 0:Le.isTouchDevice,onTouchDragMove:Le==null?void 0:Le.onTouchDragMove,onTouchDragEnd:Le==null?void 0:Le.onTouchDragEnd},ke._id),[n,t,Oe,De,V,qe]);_.useEffect(()=>{const ke=window.setInterval(()=>{mt(Date.now())},3e4);return()=>window.clearInterval(ke)},[]),_.useEffect(()=>{if(Et)return document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.body.style.cursor="",document.body.style.userSelect=""}},[Et]),_.useEffect(()=>()=>{he.current!==null&&window.cancelAnimationFrame(he.current)},[]),_.useEffect(()=>{!n||!ee.current||requestAnimationFrame(()=>{const ke=ee.current,Le=ke==null?void 0:ke.querySelector(`[data-chat-id="${n}"]`);if(!Le||!ke)return;const Nt=Le.getBoundingClientRect(),ut=ke.getBoundingClientRect();if(Nt.top<ut.top+38){const pn=Nt.top-ut.top+ke.scrollTop;ke.scrollTo({top:pn-38,behavior:"smooth"})}else if(Nt.bottom>ut.bottom){const pn=Nt.top+Nt.height/2-ut.top+ke.scrollTop,bn=ke.clientHeight/2;ke.scrollTo({top:pn-bn,behavior:"smooth"})}})},[n,Ne]);const Ve=Ne>0,mn=A.pathname==="/",sn=A.pathname.startsWith("/settings"),Je=mn||sn,tn=i==="connecting"||!o,$n=tn?"Connecting":i==="connected"?"Connected":"Disconnected",Jt=i==="connected"?"bg-emerald-500":"bg-amber-500",Kt=(B==null?void 0:B.updateAvailable)===!0,Be=B?B.latestVersion===`${B.currentVersion}-dev`:!1,vt=(B==null?void 0:B.status)==="updating"||(B==null?void 0:B.status)==="restart_pending",Tt=BW(h,c,fe??g),en=qj(h,c),_t=S&&S.length>0?`Toggle sidebar (${S[0]})`:"Toggle sidebar",yt=t.size>0,Cn=_.useCallback(ke=>{var pn;if(!en)return;ke.preventDefault(),Rt(!0),re.current=((pn=J.current)==null?void 0:pn.getBoundingClientRect().left)??0,He(g);const Le=bn=>{ce.current=Rg(bn-re.current),he.current===null&&(he.current=window.requestAnimationFrame(()=>{he.current=null,ce.current!==null&&He(ce.current)}))};Le(ke.clientX);const Nt=bn=>{Le(bn.clientX)},ut=()=>{Rt(!1),he.current!==null&&(window.cancelAnimationFrame(he.current),he.current=null);const bn=ce.current??g;ce.current=null,He(null),C(bn),window.removeEventListener("pointermove",Nt),window.removeEventListener("pointerup",ut),window.removeEventListener("pointercancel",ut)};window.addEventListener("pointermove",Nt),window.addEventListener("pointerup",ut),window.addEventListener("pointercancel",ut)},[g,C,en]);return f.jsxs(f.Fragment,{children:[!l&&d&&f.jsx("div",{className:me("fixed top-2 left-2.5 z-50 md:hidden","flex items-center gap-1 flex-shrink-0","bg-background/80 dark:bg-card/40 backdrop-blur-lg border border-border rounded-[20px] p-1"),children:f.jsxs(et,{variant:"ghost",size:"icon",className:"relative",onClick:p,children:[f.jsx(Sb,{className:"h-5 w-5"}),yt&&f.jsx("span",{className:"absolute top-0.5 right-0.5 size-2.5 rounded-full bg-emerald-400 ring-2 ring-background"})]})}),c&&Je&&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(Ld,{className:"size-6 text-logo"}),yt&&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(et,{variant:"ghost",size:"icon",onClick:w,title:"Expand sidebar",children:f.jsx(Cb,{className:"h-5 w-5"})})]})}),f.jsxs("div",{ref:J,"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",l?"flex":"hidden md:flex",c&&"md:hidden"),style:Tt,children:[en?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",Et&&"after:bg-logo/70"),onPointerDown:Cn,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",Et&&"bg-logo/70 opacity-100")})}):null,f.jsxs("div",{className:"relative pl-2.5 md: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.jsxs("div",{className:me("flex items-center gap-1 flex-shrink-0 z-10","bg-background/80 dark:bg-card/40 backdrop-blur-lg border border-border rounded-[20px] p-1","md:bg-transparent md:dark:bg-transparent md:backdrop-blur-none md:border-transparent md:p-0 md:rounded-none"),children:[f.jsxs(et,{variant:"ghost",size:"icon",className:"relative md:hidden",onClick:()=>b(h),children:[f.jsx(Sb,{className:"h-5 w-5"}),yt&&f.jsx("span",{className:"absolute top-0.5 right-0.5 size-2.5 rounded-full bg-emerald-400 ring-2 ring-background"})]}),f.jsxs("button",{type:"button",onClick:()=>b(h),title:_t,"aria-label":_t,className:"group/sidebar-collapse hidden md:flex relative items-center justify-center h-5 w-5",children:[f.jsx(Ld,{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(Cb,{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.jsx("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 md:hidden",children:f.jsx(Ld,{className:"h-6 w-6 text-logo"})}),f.jsxs("div",{className:"flex items-center z-10",children:[Be?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"}):Kt?f.jsxs(et,{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:Z,disabled:vt,title:B!=null&&B.latestVersion?`Update to ${B.latestVersion}`:"Update Kaizen",children:[vt?f.jsx(Lr,{className:"mr-1.5 h-3 w-3 animate-spin"}):null,"UPDATE"]}):null,f.jsx(et,{variant:"ghost",size:"icon",onClick:tt,className:"size-10 rounded-lg",title:"Add project",children:f.jsx(BM,{className:"size-5"})})]})]}),f.jsx("div",{ref:ee,"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:[!Ve&&tn?f.jsx("div",{className:"space-y-5 px-1 pt-3",children:[0,1,2].map(ke=>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(Le=>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",Le===0?"w-32":Le===1?"w-40":"w-28")})]},Le))})]},ke))}):null,!Ve&&!tn&&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(xW,{projectGroups:oe,onReorderGroups:ve,collapsedSections:je,onToggleSection:Ae,onSetProjectBrowserState:Qe,onSetProjectGeneralChatsBrowserState:At,onSetFeatureBrowserState:rt,renderChatRow:gt,onNewLocalChat:k,onCreateFeature:q?R:void 0,onRenameFeature:E,onDeleteFeature:N,onSetFeatureStage:U?H:void 0,onSetChatFeature:Y,onReorderFeatures:P,onRemoveProject:O,isConnected:i==="connected",startingLocalPath:M,folderGroupsEnabled:q,showFeatureOverviewInSidebar:F,kanbanStatusesEnabled:U,activeOverviewFeatureId:r,onOpenFeatureOverview:W})]})}),f.jsxs("div",{className:"border-t border-border p-2",children:[f.jsx(TW,{providerUsage:e.providerUsage,visibleProviders:fn,onRefreshProviderUsage:$,onOpenProviderLogin:z}),f.jsx("button",{type:"button",onClick:()=>{ie("/settings/general"),v()},className:me("w-full rounded-xl rounded-t-md border px-3 py-2 text-left transition-colors",sn?"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(p9,{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:$n}),tn?f.jsx(Lr,{className:"h-2 w-2 animate-spin"}):f.jsx("span",{className:me("h-2 w-2 rounded-full",Jt)})]})]})})]})]})]})}function kE(e){return[...e.features.flatMap(t=>t.chats),...e.generalChats]}const Kj={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 ky(e){return(e??[]).join(", ")}function Ya(e){return e.split(",").map(t=>t.trim()).map(t=>t.toLowerCase()).filter(Boolean)}const HW=new Map([["cmd","meta"],["meta","meta"],["ctrl","ctrl"],["control","ctrl"],["alt","alt"],["option","alt"],["shift","shift"]]);function $W(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 il(e,t,n){return((e==null?void 0:e.bindings[t])??ks[t]).some(i=>$W(i,n))}function fw(e){return{bindings:{submitChatMessage:(e==null?void 0:e.bindings.submitChatMessage)??ks.submitChatMessage,toggleProjectsSidebar:(e==null?void 0:e.bindings.toggleProjectsSidebar)??ks.toggleProjectsSidebar,toggleEmbeddedTerminal:(e==null?void 0:e.bindings.toggleEmbeddedTerminal)??ks.toggleEmbeddedTerminal,toggleRightSidebar:(e==null?void 0:e.bindings.toggleRightSidebar)??ks.toggleRightSidebar,openInFinder:(e==null?void 0:e.bindings.openInFinder)??ks.openInFinder,openInEditor:(e==null?void 0:e.bindings.openInEditor)??ks.openInEditor,addSplitTerminal:(e==null?void 0:e.bindings.addSplitTerminal)??ks.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 i=r.toLowerCase(),o=HW.get(i);if(o==="ctrl"){n.ctrl=!0;continue}if(o==="meta"){n.meta=!0;continue}if(o==="alt"){n.alt=!0;continue}if(o==="shift"){n.shift=!0;continue}if(n.key)return null;n.key=i}return n.key?n:null}function VW(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 WW(){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=i=>{t(i.matches||navigator.standalone===!0)};return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const qW=ko()(Eo((e,t)=>({drafts:{},setDraft:(n,r)=>e(i=>{if(!r){const{[n]:o,...l}=i.drafts;return{drafts:l}}return{drafts:{...i.drafts,[n]:r}}}),clearDraft:n=>e(r=>{const{[n]:i,...o}=r.drafts;return{drafts:o}}),getDraft:n=>t().drafts[n]??""}),{name:"chat-input-drafts"}));async function KW(e){const t=await new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{if(typeof i.result=="string"){n(i.result);return}r(new Error("Failed to read image attachment"))},i.onerror=()=>r(i.error??new Error("Failed to read image attachment")),i.readAsDataURL(e)});return{type:"image",name:e.name,mimeType:e.type,sizeBytes:e.size,dataUrl:t}}function EE(e,t){if(t===void 0){console.info(`[ChatInput] ${e}`);return}console.info(`[ChatInput] ${e}`,t)}function uo(e,t,n,r,i){return e==="claude"?t.provider==="claude"?{provider:"claude",model:r??t.model,modelOptions:{...t.modelOptions},planMode:i??t.planMode}:{provider:"claude",model:r??n.claude.model,modelOptions:{...n.claude.modelOptions},planMode:i??n.claude.planMode}:e==="gemini"?t.provider==="gemini"?{provider:"gemini",model:r??t.model,modelOptions:{...t.modelOptions},planMode:i??t.planMode}:{provider:"gemini",model:r??n.gemini.model,modelOptions:{...n.gemini.modelOptions},planMode:i??n.gemini.planMode}:e==="cursor"?t.provider==="cursor"?{provider:"cursor",model:r??t.model,modelOptions:{...t.modelOptions},planMode:i??t.planMode}:{provider:"cursor",model:r??n.cursor.model,modelOptions:{...n.cursor.modelOptions},planMode:i??n.cursor.planMode}:t.provider==="codex"?{provider:"codex",model:r??t.model,modelOptions:{...t.modelOptions},planMode:i??t.planMode}:{provider:"codex",model:r??n.codex.model,modelOptions:{...n.codex.modelOptions},planMode:i??n.codex.planMode}}function GW(e,t,n,r){return r&&e.key==="Enter"?!1:il(t,"submitChatMessage",e)&&!n&&!e.isComposing}function YW(e){if(!e.providerLocked)return{composerPlanMode:e.planMode,lockedComposerState:e.lockedComposerState};const t=e.lockedComposerState??uo(e.selectedProvider,e.composerState,e.providerDefaults);return{composerPlanMode:e.composerState.planMode,lockedComposerState:{...t,planMode:e.planMode}}}const XW=_.forwardRef(function({onSubmit:t,onCancel:n,disabled:r,canCancel:i,chatId:o,activeProvider:l,activeModel:c,activePlanMode:h,availableProviders:d,keybindings:g},p){const{getDraft:v,setDraft:b,clearDraft:w}=qW(),{composerState:S,providerDefaults:C,setComposerModel:k,setComposerModelOptions:R,setComposerPlanMode:E,resetComposerFromProvider:N}=Pi(),[L,j]=_.useState(()=>o?v(o):""),[D,H]=_.useState([]),[Y,P]=_.useState(null),[q,F]=_.useState(!1),U=_.useRef(null),W=_.useRef(null),V=WW(),O=Mh("(pointer: coarse)"),[$,z]=_.useState(()=>l?uo(l,S,C,c,h):null),G=l!==null,M=!G&&d.length===0,B=G?$??uo(l,S,C,c,h):S,Z=G?l:S.provider,A=d.find(fe=>fe.id===Z)??dn(Z),ie=(A==null?void 0:A.supportsPlanMode)??!1,J=r||M,ee=_.useCallback(()=>{const fe=U.current;fe&&(fe.style.height="auto",fe.style.height=`${fe.scrollHeight}px`)},[]),re=_.useCallback(fe=>{if(U.current=fe,!!p){if(typeof p=="function"){p(fe);return}p.current=fe}},[p]);_.useEffect(()=>{ee()},[L,ee]),_.useEffect(()=>(window.addEventListener("resize",ee),()=>window.removeEventListener("resize",ee)),[ee]),_.useEffect(()=>{var fe;(fe=U.current)==null||fe.focus()},[o]),_.useEffect(()=>()=>{for(const fe of D)URL.revokeObjectURL(fe.previewUrl)},[D]),_.useEffect(()=>{if(l===null){z(null);return}z(uo(l,S,C,c,h))},[c,h,l,o,S,C]),_.useEffect(()=>{G||d.length!==0&&(d.some(fe=>fe.id===S.provider)||N(d[0].id))},[d,S.provider,G,N]),_.useEffect(()=>{EE("resolved provider state",{chatId:o??null,activeProvider:l,composerProvider:S.provider,composerModel:S.model,effectiveProvider:B.provider,effectiveModel:B.model,selectedProvider:Z,providerLocked:G,lockedComposerProvider:($==null?void 0:$.provider)??null})},[l,o,S.model,S.provider,$==null?void 0:$.provider,G,B.model,B.provider,Z]);function ce(fe){if(G){z(He=>{const De=He??uo(Z,S,C);return De.provider==="claude"?{...De,modelOptions:{...De.modelOptions,reasoningEffort:fe}}:De.provider==="gemini"?De:{...De,modelOptions:{...De.modelOptions,reasoningEffort:fe}}});return}if(Z==="claude"){R({reasoningEffort:fe});return}R({reasoningEffort:fe})}function he(fe){if(G){z(He=>{const De=He??uo(Z,S,C);return De.provider!=="gemini"?De:{...De,modelOptions:{...De.modelOptions,thinkingMode:fe}}});return}Z==="gemini"&&R({thinkingMode:fe})}function pe(fe){if(G){z(He=>{const De=He??uo(Z,S,C);return De.provider!=="claude"?De:{...De,modelOptions:{...De.modelOptions,contextWindow:fe}}});return}Z==="claude"&&R({contextWindow:fe})}function Se(fe){const He=YW({providerLocked:G,planMode:fe,selectedProvider:Z,composerState:S,providerDefaults:C,lockedComposerState:$});He.lockedComposerState!==$&&z(He.lockedComposerState),He.composerPlanMode!==S.planMode&&E(He.composerPlanMode)}function Re(){Se(!B.planMode)}async function je(){if(J||!L.trim()&&D.length===0)return;const fe=L,He=D;let De;B.provider==="claude"?De={claude:{...B.modelOptions}}:B.provider==="gemini"?De={gemini:{...B.modelOptions}}:De={codex:{...B.modelOptions}};const mt={provider:Z,model:B.model,modelOptions:De,planMode:ie?B.planMode:!1};EE("submit settings",{chatId:o??null,activeProvider:l,composerProvider:B.provider,submitOptions:mt}),j(""),P(null),o&&w(o),U.current&&(U.current.style.height="auto");try{await t({text:fe.trim(),attachments:He.length?await Promise.all(He.map(ct=>KW(ct.file))):void 0},mt);for(const ct of He)URL.revokeObjectURL(ct.previewUrl);H([])}catch(ct){console.error("[ChatInput] Submit failed:",ct),j(fe),o&&b(o,fe)}}const Xe=_.useCallback(fe=>{if(J)return;const He=fe.filter(De=>De.type.startsWith("image/"));if(He.length===0){P("Only PNG, JPEG, WEBP, and GIF images are supported.");return}H(De=>{const mt=[...De];let ct=null;for(const ot of He){if(!pp.includes(ot.type)){ct=`Unsupported image type: ${ot.type||"unknown"}`;continue}if(ot.size<=0||ot.size>D5){ct=`${ot.name} is empty or larger than 10 MB.`;continue}if(mt.length>=mp){ct=`You can attach up to ${mp} images per message.`;break}mt.push({id:Od(),file:ot,name:ot.name||"image",mimeType:ot.type,sizeBytes:ot.size,previewUrl:URL.createObjectURL(ot)})}return P(ct),mt})},[J]),Et=_.useCallback(fe=>{H(He=>{const De=He.find(mt=>mt.id===fe);return De&&URL.revokeObjectURL(De.previewUrl),He.filter(mt=>mt.id!==fe)}),P(null)},[]);function Rt(fe){if(fe.key==="Tab"&&!fe.shiftKey){fe.preventDefault(),P9(U.current,document);return}if(fe.key==="Tab"&&fe.shiftKey&&ie){fe.preventDefault(),Re();return}if(fe.key==="Escape"&&i){fe.preventDefault(),n==null||n();return}GW(fe.nativeEvent,g,i,O)&&(fe.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",V&&"px-3"),style:V?{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",q&&"border-foreground/40 bg-muted/30"),onDragEnter:fe=>{r||!fe.dataTransfer.types.includes("Files")||(fe.preventDefault(),F(!0))},onDragOver:fe=>{r||!fe.dataTransfer.types.includes("Files")||(fe.preventDefault(),fe.dataTransfer.dropEffect="copy",F(!0))},onDragLeave:fe=>{if(!fe.dataTransfer.types.includes("Files"))return;fe.preventDefault();const He=fe.relatedTarget;He instanceof Node&&fe.currentTarget.contains(He)||F(!1)},onDrop:fe=>{var He;r||!fe.dataTransfer.types.includes("Files")||(fe.preventDefault(),F(!1),Xe(Array.from(fe.dataTransfer.files)),(He=U.current)==null||He.focus())},children:[f.jsx("input",{ref:W,type:"file",accept:pp.join(","),multiple:!0,className:"hidden",onChange:fe=>{Xe(Array.from(fe.target.files??[])),fe.target.value=""}}),D.length?f.jsx("div",{className:"grid grid-cols-2 gap-2 px-2 pt-2 sm:grid-cols-3",children:D.map(fe=>f.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border/80 bg-background/80",children:[f.jsx("img",{src:fe.previewUrl,alt:fe.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:fe.name}),f.jsxs("div",{className:"text-[11px] text-muted-foreground",children:[Math.max(1,Math.round(fe.sizeBytes/1024))," KB"]})]}),f.jsx(et,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:()=>Et(fe.id),disabled:J,children:f.jsx(vo,{className:"h-3.5 w-3.5"})})]})]},fe.id))}):null,f.jsxs("div",{className:"flex items-end gap-2",children:[f.jsx(et,{type:"button",variant:"ghost",size:"icon",className:"mt-1.5 md:mt-0 md:mb-1 h-10 w-10 shrink-0 rounded-full",disabled:J||i,onClick:()=>{var fe;return(fe=W.current)==null?void 0:fe.click()},children:f.jsx(VM,{className:"h-4.5 w-4.5"})}),f.jsx(yh,{ref:re,placeholder:"Build something...",value:L,autoFocus:!0,[C0]:"",rows:1,onChange:fe=>{j(fe.target.value),o&&b(o,fe.target.value),ee()},onPaste:fe=>{const He=Array.from(fe.clipboardData.files);He.some(De=>De.type.startsWith("image/"))&&(fe.preventDefault(),Xe(He))},onKeyDown:Rt,disabled:J,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(et,{type:"button",onPointerDown:fe=>{fe.preventDefault(),i?n==null||n():!J&&(L.trim()||D.length>0)&&je()},disabled:!i&&(J||!L.trim()&&D.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:i?f.jsx("div",{className:"w-3 h-3 md:w-4 md:h-4 rounded-xs bg-current"}):f.jsx(U6,{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",q&&"border-foreground/40 bg-muted/30"),children:[f.jsx("div",{className:"absolute top-0 left-0 right-0 h-[1px] bg-background"}),f.jsx(wd,{availableProviders:d,selectedProvider:Z,disabled:J,providerLocked:G,model:B.model,modelOptions:B.modelOptions,onProviderChange:fe=>{G||N(fe)},onModelChange:(fe,He)=>{if(G){z(De=>({...De??uo(Z,S,C),model:He}));return}k(He)},onClaudeReasoningEffortChange:fe=>ce(fe),onClaudeContextWindowChange:fe=>pe(fe),onCodexReasoningEffortChange:fe=>ce(fe),onGeminiThinkingModeChange:fe=>he(fe),onCodexFastModeChange:fe=>{if(G){z(He=>{const De=He??uo(Z,S,C);return De.provider!=="codex"?De:{...De,modelOptions:{...De.modelOptions,fastMode:fe}}});return}R({fastMode:fe})},planMode:B.planMode,onPlanModeChange:Se,includePlanMode:ie,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]})}),ZW=_.memo(XW);function RE({label:e,isCurrent:t,icon:n,onClick:r,className:i}){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",i),children:[f.jsx("span",{className:"flex-shrink-0 w-4 flex items-center justify-center",children:n??(t?f.jsx(Vi,{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 QW({projectId:e,socket:t}){const[n,r]=_.useState({phase:"loading"}),[i,o]=_.useState(!1),[l,c]=_.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(()=>{i&&(c(""),v())},[i,v]),_.useEffect(()=>{if(i&&n.phase==="ready"){const R=setTimeout(()=>{var E;return(E=p.current)==null?void 0:E.focus()},50);return()=>clearTimeout(R)}},[i,n.phase]);function b(R){n.phase!=="ready"||R===n.currentBranch||(o(!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()&&(o(!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(K5,{open:i,onOpenChange:o,children:[f.jsx(G5,{asChild:!0,children:f.jsxs(et,{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(Lr,{className:"h-4.5 w-4.5 flex-shrink-0 animate-spin"}):f.jsx(B8,{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($0,{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=>c(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(Lr,{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(RE,{label:R,isCurrent:R===n.currentBranch,onClick:()=>b(R)},R)),k&&f.jsx(RE,{label:`Create branch "${h.trim()}"`,icon:f.jsx(x0,{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 mw=_.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:me("bg-card text-card-foreground",e),...t}));mw.displayName="Card";const Gj=_.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:me("flex flex-col space-y-1.5 p-2",e),...t}));Gj.displayName="CardHeader";const JW=_.forwardRef(({className:e,...t},n)=>f.jsx("h3",{ref:n,className:me("text-2xl font-semibold leading-none tracking-tight",e),...t}));JW.displayName="CardTitle";const eq=_.forwardRef(({className:e,...t},n)=>f.jsx("p",{ref:n,className:me("text-sm text-muted-foreground",e),...t}));eq.displayName="CardDescription";const pw=_.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:me("p-6 pt-0",e),...t}));pw.displayName="CardContent";const tq=_.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:me("flex items-center p-6 pt-0",e),...t}));tq.displayName="CardFooter";function nq({sidebarCollapsed:e,hasCompletedChats:t=!1,onOpenSidebar:n,onExpandSidebar:r,usage:i,localPath:o,embeddedTerminalVisible:l=!1,onToggleEmbeddedTerminal:c,rightSidebarVisible:h=!1,onToggleRightSidebar:d,onOpenExternal:g,editorLabel:p="Editor",projectId:v,socket:b,finderShortcut:w,editorShortcut:S,terminalShortcut:C,rightSidebarShortcut:k}){const R=N=>N==null?"Unavailable":`${Math.round(N)}%`,E=i!=null&&i.warnings.includes("context_critical")||i!=null&&i.warnings.includes("rate_critical")?"text-amber-300 bg-amber-500/10":i!=null&&i.warnings.includes("context_warning")||i!=null&&i.warnings.includes("rate_warning")?"text-amber-100 bg-amber-500/5":"text-muted-foreground bg-background/70";return f.jsx(Gj,{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:[f.jsxs("div",{className:me("flex items-center gap-1 flex-shrink-0","bg-background/80 dark:bg-card/40 backdrop-blur-lg border border-border rounded-[20px] p-1",!e&&"md:bg-transparent md:dark:bg-transparent md:backdrop-blur-none md:border-transparent md:p-0"),children:[f.jsxs(et,{variant:"ghost",size:"icon",className:"relative md:hidden",onClick:n,children:[f.jsx(Sb,{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(Ld,{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(et,{variant:"ghost",size:"icon",className:"hidden md:flex",onClick:r,title:"Expand sidebar",children:f.jsx(Cb,{className:"size-4.5"})})]})]}),f.jsx("div",{className:"flex-1 min-w-0"}),f.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 bg-background/80 dark:bg-card/40 backdrop-blur-lg border border-border rounded-[20px] p-1",children:[v?f.jsxs("div",{className:"hidden md:flex items-center gap-1 mr-1",children:[f.jsxs(Ms,{children:[(i==null?void 0:i.contextUsedPercent)!==null&&(i==null?void 0:i.contextUsedPercent)!==void 0?f.jsx(As,{asChild:!0,children:f.jsxs("div",{className:me("px-2.5 py-1 rounded-lg text-[14px] font-medium",E),children:["Context: ",R(i.contextUsedPercent)]})}):null,f.jsx(os,{side:"bottom",children:(i==null?void 0:i.contextWindowTokens)!==null&&(i==null?void 0:i.contextWindowTokens)!==void 0&&(i==null?void 0:i.threadTokens)!==null&&(i==null?void 0:i.threadTokens)!==void 0?`${Math.round(i.threadTokens).toLocaleString()} of ${Math.round(i.contextWindowTokens).toLocaleString()} tokens`:"Context window unavailable for this chat yet"})]}),((i==null?void 0:i.sessionLimitUsedPercent)??0)>=75?f.jsxs(Ms,{children:[f.jsx(As,{asChild:!0,children:f.jsxs("div",{className:me("px-2.5 py-1 rounded-lg border text-[11px] font-medium",E),children:["Session: ",R(i==null?void 0:i.sessionLimitUsedPercent)]})}),f.jsx(os,{side:"bottom",children:i!=null&&i.rateLimitResetAt?`Resets ${new Date(i.rateLimitResetAt).toLocaleString()}`:"No reset time available yet"})]}):null]}):null,v?f.jsx(QW,{projectId:v,socket:b}):null,o&&(g||c)&&f.jsxs(f.Fragment,{children:[g?f.jsxs(bd,{children:[f.jsx(xd,{asChild:!0,children:f.jsx(et,{variant:"ghost",size:"icon",onClick:()=>g("open_finder"),title:"Open in Finder",className:"border border-border/0",children:f.jsx(IM,{className:"h-4.5 w-4.5"})})}),f.jsx(Rc,{side:"bottom",shortcut:w})]}):null,c?f.jsxs(bd,{children:[f.jsx(xd,{asChild:!0,children:f.jsx(et,{variant:"ghost",size:"icon",onClick:c,className:me("border border-border/0",l&&"text-white"),children:f.jsx(w0,{className:"h-4.5 w-4.5"})})}),f.jsx(Rc,{side:"bottom",shortcut:C})]}):null,g?f.jsxs(bd,{children:[f.jsx(xd,{asChild:!0,children:f.jsx(et,{variant:"ghost",size:"icon",onClick:()=>g("open_editor"),title:`Open in ${p}`,className:"border border-border/0",children:f.jsx(wb,{className:"h-4.5 w-4.5"})})}),f.jsx(Rc,{side:"bottom",shortcut:S})]}):null]}),d?f.jsxs(bd,{children:[f.jsx(xd,{asChild:!0,children:f.jsx(et,{variant:"ghost",size:"icon",onClick:d,className:me("border border-border/0",h&&"text-white"),children:f.jsx(o9,{className:"h-4.5 w-4.5"})})}),f.jsx(Rc,{side:"bottom",shortcut:k})]}):null]})]})})}function TE({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(vo,{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 rq(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function iq(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function sq(e){return e/100*window.innerHeight}function oq(e){return e/100*window.innerWidth}function aq(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 kd({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,o]=aq(n);switch(o){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=iq(t,i);break}case"em":{r=rq(t,i);break}case"vh":{r=sq(i);break}case"vw":{r=oq(i);break}}return r}function si(e){return parseFloat(e.toFixed(3))}function Uc({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,i)=>(r+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,r),0)}function Qb(e){const{panels:t}=e,n=Uc({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:i,panelConstraints:o}=r;let l=0;if(o.collapsedSize!==void 0){const g=kd({groupSize:n,panelElement:i,styleProp:o.collapsedSize});l=si(g/n*100)}let c;if(o.defaultSize!==void 0){const g=kd({groupSize:n,panelElement:i,styleProp:o.defaultSize});c=si(g/n*100)}let h=0;if(o.minSize!==void 0){const g=kd({groupSize:n,panelElement:i,styleProp:o.minSize});h=si(g/n*100)}let d=100;if(o.maxSize!==void 0){const g=kd({groupSize:n,panelElement:i,styleProp:o.maxSize});d=si(g/n*100)}return{groupResizeBehavior:o.groupResizeBehavior,collapsedSize:l,collapsible:o.collapsible===!0,defaultSize:c,disabled:o.disabled,minSize:h,maxSize:d,panelId:r.id}})}function hn(e,t="Assertion error"){if(!e)throw Error(t)}function Jb(e,t){return Array.from(t).sort(e==="horizontal"?lq:cq)}function lq(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function cq(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Yj(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Xj(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 uq({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let i,o=Number.MAX_VALUE;for(const l of t){const{x:c,y:h}=Xj(r,l),d=e==="horizontal"?c:h;d<o&&(o=d,i=l)}return hn(i,"No rect found"),i}let _m;function dq(){return _m===void 0&&(typeof matchMedia=="function"?_m=!!matchMedia("(pointer:coarse)").matches:_m=!1),_m}function Zj(e){const{element:t,orientation:n,panels:r,separators:i}=e,o=Jb(n,Array.from(t.children).filter(Yj).map(w=>({element:w}))).map(({element:w})=>w),l=[];let c=!1,h=!1,d=-1,g=-1,p=0,v,b=[];{let w=-1;for(const S of o)S.hasAttribute("data-panel")&&(w++,S.hasAttribute("data-disabled")||(p++,d===-1&&(d=w),g=w))}if(p>1){let w=-1;for(const S of o)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),L=n==="horizontal"?new DOMRect(R.left,R.top,0,R.height):new DOMRect(R.left,R.top,R.width,0);switch(b.length){case 0:{E=[N,L];break}case 1:{const j=b[0],D=uq({orientation:n,rects:[k,R],targetRect:j.element.getBoundingClientRect()});E=[j,D===k?L:N];break}default:{E=b;break}}}else b.length?E=b: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 L="width"in N?N:N.element.getBoundingClientRect();const j=dq()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(L.width<j){const H=j-L.width;L=new DOMRect(L.x-H/2,L.y,L.width+H,L.height)}if(L.height<j){const H=j-L.height;L=new DOMRect(L.x,L.y-H/2,L.width,L.height+H)}const D=w<=d||w>g;!c&&!D&&l.push({group:e,groupSize:Uc({group:e}),panels:[v,C],separator:"width"in N?void 0:N,rect:L}),c=!1}}h=!1,v=C,b=[]}}else if(S.hasAttribute("data-separator")){S.ariaDisabled!==null&&(c=!0);const C=i.find(k=>k.element===S);C?b.push(C):(v=void 0,b=[])}else h=!0}return l}var fa,pN;let Qj=(pN=class{constructor(){Ik(this,fa,{})}addListener(t,n){const r=sd(this,fa)[t];return r===void 0?sd(this,fa)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=sd(this,fa)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let i=!1,o=null;const l=Array.from(r);for(let c=0;c<l.length;c++){const h=l[c];try{h.call(null,n)}catch(d){o===null&&(i=!0,o=d)}}if(i)throw o}}removeAllListeners(){Bk(this,fa,{})}removeListener(t,n){const r=sd(this,fa)[t];if(r!==void 0){const i=r.indexOf(n);i>=0&&r.splice(i,1)}}},fa=new WeakMap,pN),js=new Map;const Jj=new Qj;function hq(e){js=new Map(js),js.delete(e)}function NE(e,t){for(const[n]of js)if(n.id===e)return n}function va(e,t){for(const[n,r]of js)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Nl(){return js}function gw(e,t){return Jj.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function bo(e,t){const n=js.get(e);js=new Map(js),js.set(e,t),Jj.emit("groupChange",{group:e,prev:n,next:t})}function fq(e,t,n){let r,i={x:1/0,y:1/0};for(const o of t){const l=Xj(n,o.rect);switch(e){case"horizontal":{l.x<=i.x&&(r=o,i=l);break}case"vertical":{l.y<=i.y&&(r=o,i=l);break}}}return r?{distance:i,hitRegion:r}:void 0}function mq(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function pq(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:jE(e),b:jE(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();hn(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:AE(ME(n.a)),b:AE(ME(n.b))};if(i.a===i.b){const o=r.childNodes,l={a:n.a.at(-1),b:n.b.at(-1)};let c=o.length;for(;c--;){const h=o[c];if(h===l.a)return 1;if(h===l.b)return-1}}return Math.sign(i.a-i.b)}const gq=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function vq(e){const t=getComputedStyle(eD(e)??e).display;return t==="flex"||t==="inline-flex"}function _q(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||vq(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"||gq.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function ME(e){let t=e.length;for(;t--;){const n=e[t];if(hn(n,"Missing node"),_q(n))return n}return null}function AE(e){return e&&Number(getComputedStyle(e).zIndex)||0}function jE(e){const t=[];for(;e;)t.push(e),e=eD(e);return t}function eD(e){const{parentNode:t}=e;return mq(t)?t.host:t}function yq(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 bq({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Yj(n)||n.contains(e)||e.contains(n))return!0;if(pq(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(yq(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function vw(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const o=Zj(i),l=fq(i.orientation,o,{x:e.clientX,y:e.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&bq({groupElement:i.element,hitRegion:l.hitRegion.rect,pointerEventTarget:e.target})&&n.push(l.hitRegion)}),n}function xq(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 $r(e,t,n=0){return Math.abs(si(e)-si(t))<=n}function Es(e,t){return $r(e,t)?0:e>t?1:-1}function Nc({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:i=0,collapsible:o,disabled:l,maxSize:c=100,minSize:h=0}=t;if(l&&!e)return n;if(Es(r,h)<0)if(o){const d=(i+h)/2;Es(r,d)<0?r=i:r=h}else r=h;return r=Math.min(c,r),r=si(r),r}function ih({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:o}){if($r(e,0))return t;const l=o==="imperative-api",c=Object.values(t),h=Object.values(i),d=[...c],[g,p]=r;hn(g!=null,"Invalid first pivot index"),hn(p!=null,"Invalid second pivot index");let v=0;switch(o){case"keyboard":{{const S=e<0?p:g,C=n[S];hn(C,`Panel constraints not found for index ${S}`);const{collapsedSize:k=0,collapsible:R,minSize:E=0}=C;if(R){const N=c[S];if(hn(N!=null,`Previous layout not found for panel index ${S}`),$r(N,k)){const L=E-N;Es(L,Math.abs(e))>0&&(e=e<0?0-L:L)}}}{const S=e<0?g:p,C=n[S];hn(C,`No panel constraints found for index ${S}`);const{collapsedSize:k=0,collapsible:R,minSize:E=0}=C;if(R){const N=c[S];if(hn(N!=null,`Previous layout not found for panel index ${S}`),$r(N,E)){const L=N-k;Es(L,Math.abs(e))>0&&(e=e<0?0-L:L)}}}break}default:{const S=e<0?p:g,C=n[S];hn(C,`Panel constraints not found for index ${S}`);const k=c[S],{collapsible:R,collapsedSize:E,minSize:N}=C;if(R&&Es(k,N)<0)if(e>0){const L=N-E,j=L/2,D=k+e;Es(D,N)<0&&(e=Es(e,j)<=0?0:L)}else{const L=N-E,j=100-L/2,D=k-e;Es(D,N)<0&&(e=Es(100+e,j)>0?0:-L)}break}}{const S=e<0?1:-1;let C=e<0?p:g,k=0;for(;;){const E=c[C];hn(E!=null,`Previous layout not found for panel index ${C}`);const N=Nc({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=c[S];hn(k!=null,`Previous layout not found for panel index ${S}`);const R=k-C,E=Nc({overrideDisabledPanels:l,panelConstraints:n[S],prevSize:k,size:R});if(!$r(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(xq(h,d))return i;{const S=e<0?p:g,C=c[S];hn(C!=null,`Previous layout not found for panel index ${S}`);const k=C+v,R=Nc({overrideDisabledPanels:l,panelConstraints:n[S],prevSize:C,size:k});if(d[S]=R,!$r(R,k)){let E=k-R,N=e<0?p:g;for(;N>=0&&N<n.length;){const L=d[N];hn(L!=null,`Previous layout not found for panel index ${N}`);const j=L+E,D=Nc({overrideDisabledPanels:l,panelConstraints:n[N],prevSize:L,size:j});if($r(L,D)||(E-=D-L,d[N]=D),$r(E,0))break;e>0?N--:N++}}}const b=Object.values(d).reduce((S,C)=>C+S,0);if(!$r(b,100,.1))return i;const w=Object.keys(i);return d.reduce((S,C,k)=>(S[w[k]]=C,S),{})}function _l(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||Es(e[n],t[n])!==0)return!1;return!0}function yl({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],i=r.reduce((c,h)=>c+h,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(c=>`${c}%`).join(", ")}`);if(!$r(i,100)&&r.length>0)for(let c=0;c<t.length;c++){const h=r[c];hn(h!=null,`No layout data found for index ${c}`);const d=100/i*h;r[c]=d}let o=0;for(let c=0;c<t.length;c++){const h=n[c];hn(h!=null,`No layout data found for index ${c}`);const d=r[c];hn(d!=null,`No layout data found for index ${c}`);const g=Nc({overrideDisabledPanels:!0,panelConstraints:t[c],prevSize:h,size:d});d!=g&&(o+=d-g,r[c]=g)}if(!$r(o,0))for(let c=0;c<t.length;c++){const h=r[c];hn(h!=null,`No layout data found for index ${c}`);const d=h+o,g=Nc({overrideDisabledPanels:!0,panelConstraints:t[c],prevSize:h,size:d});if(h!==g&&(o-=g-h,r[c]=g,$r(o,0)))break}const l=Object.keys(e);return r.reduce((c,h,d)=>(c[l[d]]=h,c),{})}function tD({groupId:e,panelId:t}){const n=()=>{const c=Nl();for(const[h,{defaultLayoutDeferred:d,derivedPanelConstraints:g,layout:p,groupSize:v,separatorToPanels:b}]of c)if(h.id===e)return{defaultLayoutDeferred:d,derivedPanelConstraints:g,group:h,groupSize:v,layout:p,separatorToPanels:b};throw Error(`Group ${e} not found`)},r=()=>{const c=n().derivedPanelConstraints.find(h=>h.panelId===t);if(c!==void 0)return c;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const c=n().group.panels.find(h=>h.id===t);if(c!==void 0)return c;throw Error(`Layout not found for Panel ${t}`)},o=()=>{const c=n().layout[t];if(c!==void 0)return c;throw Error(`Layout not found for Panel ${t}`)},l=c=>{const h=o();if(c===h)return;const{defaultLayoutDeferred:d,derivedPanelConstraints:g,group:p,groupSize:v,layout:b,separatorToPanels:w}=n(),S=p.panels.findIndex(E=>E.id===t),C=S===p.panels.length-1,k=ih({delta:C?h-c:c-h,initialLayout:b,panelConstraints:g,pivotIndices:C?[S-1,S]:[S,S+1],prevLayout:b,trigger:"imperative-api"}),R=yl({layout:k,panelConstraints:g});_l(b,R)||bo(p,{defaultLayoutDeferred:d,derivedPanelConstraints:g,groupSize:v,layout:R,separatorToPanels:w})};return{collapse:()=>{const{collapsible:c,collapsedSize:h}=r(),{mutableValues:d}=i(),g=o();c&&g!==h&&(d.expandToSize=g,l(h))},expand:()=>{const{collapsible:c,collapsedSize:h,minSize:d}=r(),{mutableValues:g}=i(),p=o();if(c&&p===h){let v=g.expandToSize??d;v===0&&(v=1),l(v)}},getSize:()=>{const{group:c}=n(),h=o(),{element:d}=i(),g=c.orientation==="horizontal"?d.offsetWidth:d.offsetHeight;return{asPercentage:h,inPixels:g}},isCollapsed:()=>{const{collapsible:c,collapsedSize:h}=r(),d=o();return c&&$r(h,d)},resize:c=>{const{group:h}=n(),{element:d}=i(),g=Uc({group:h}),p=kd({groupSize:g,panelElement:d,styleProp:c}),v=si(p/g*100);l(v)}}}function DE(e){if(e.defaultPrevented)return;const t=Nl();vw(e,t).forEach(n=>{if(n.separator){const r=n.panels.find(i=>i.panelConstraints.defaultSize!==void 0);if(r){const i=r.panelConstraints.defaultSize,o=tD({groupId:n.group.id,panelId:r.id});o&&i!==void 0&&(o.resize(i),e.preventDefault())}}})}function qm(e){const t=Nl();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 nD({groupId:e}){const t=()=>{const n=Nl();for(const[r,i]of n)if(r.id===e)return{group:r,...i};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:i,group:o,groupSize:l,layout:c,separatorToPanels:h}=t(),d=yl({layout:n,panelConstraints:i});return r?c:(_l(c,d)||bo(o,{defaultLayoutDeferred:r,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:h}),d)}}}function Xa(e,t){const n=qm(e),r=va(n.id,!0),i=n.separators.find(g=>g.element===e);hn(i,"Matching separator not found");const o=r.separatorToPanels.get(i);hn(o,"Matching panels not found");const l=o.map(g=>n.panels.indexOf(g)),c=nD({groupId:n.id}).getLayout(),h=ih({delta:t,initialLayout:c,panelConstraints:r.derivedPanelConstraints,pivotIndices:l,prevLayout:c,trigger:"keyboard"}),d=yl({layout:h,panelConstraints:r.derivedPanelConstraints});_l(c,d)||bo(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:d,separatorToPanels:r.separatorToPanels})}function OE(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=qm(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Xa(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Xa(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Xa(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Xa(t,-5);break}case"End":{e.preventDefault(),Xa(t,100);break}case"Enter":{e.preventDefault();const r=qm(t),i=va(r.id,!0),{derivedPanelConstraints:o,layout:l,separatorToPanels:c}=i,h=r.separators.find(v=>v.element===t);hn(h,"Matching separator not found");const d=c.get(h);hn(d,"Matching panels not found");const g=d[0],p=o.find(v=>v.panelId===g.id);if(hn(p,"Panel metadata not found"),p.collapsible){const v=l[g.id],b=p.collapsedSize===v?r.mutableState.expandedPanelSizes[g.id]??p.minSize:p.collapsedSize;Xa(t,b-v)}break}case"F6":{e.preventDefault();const r=qm(t).separators.map(l=>l.element),i=Array.from(r).findIndex(l=>l===e.currentTarget);hn(i!==null,"Index not found");const o=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[o].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),Xa(t,-100);break}}}let Lc={cursorFlags:0,state:"inactive"};const _w=new Qj;function bl(){return Lc}function wq(e){return _w.addListener("change",e)}function Sq(e){const t=Lc,n={...Lc};n.cursorFlags=e,Lc=n,_w.emit("change",{prev:t,next:n})}function zc(e){const t=Lc;Lc=e,_w.emit("change",{prev:t,next:e})}function LE(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Nl(),n=vw(e,t),r=new Map;let i=!1;n.forEach(o=>{o.separator&&(i||(i=!0,o.separator.element.focus({preventScroll:!0})));const l=t.get(o.group);l&&r.set(o.group,l.layout)}),zc({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const Cq=e=>e,Ey=()=>{},rD=1,iD=2,sD=4,oD=8,zE=3,PE=12;let ym;function IE(){return ym===void 0&&(ym=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(ym=!0)),ym}function kq({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(o=>{if(!o.mutableState.disableCursor)switch(o.orientation){case"horizontal":{r++;break}case"vertical":{i++;break}}})}if(!(r===0&&i===0)){switch(n){case"active":{if(e&&IE()){const o=(e&rD)!==0,l=(e&iD)!==0,c=(e&sD)!==0,h=(e&oD)!==0;if(o)return c?"se-resize":h?"ne-resize":"e-resize";if(l)return c?"sw-resize":h?"nw-resize":"w-resize";if(c)return"s-resize";if(h)return"n-resize"}break}}return IE()?r>0&&i>0?"move":r>0?"ew-resize":"ns-resize":r>0&&i>0?"grab":r>0?"col-resize":"row-resize"}}const BE=new WeakMap;function yw(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=BE.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const r=bl();switch(r.state){case"active":case"hover":{const i=kq({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(l=>l.group),state:r.state}),o=`*, *:hover {cursor: ${i} !important; }`;if(t===o)return;t=o,i?n.cssRules.length===0?n.insertRule(o):n.replaceSync(o):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}BE.set(e,{prevStyle:t,styleSheet:n})}function aD({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:o,prevCursorFlags:l}){let c=0;n.forEach(d=>{const{group:g,groupSize:p}=d,{orientation:v,panels:b}=g,{disableCursor:w}=g.mutableState;let S=0;o?v==="horizontal"?S=(t.clientX-o.x)/p*100:S=(t.clientY-o.y)/p*100:v==="horizontal"?S=t.clientX<0?-100:100:S=t.clientY<0?-100:100;const C=r.get(g),k=i.get(g);if(!C||!k)return;const{defaultLayoutDeferred:R,derivedPanelConstraints:E,groupSize:N,layout:L,separatorToPanels:j}=k;if(E&&L&&j){const D=ih({delta:S,initialLayout:C,panelConstraints:E,pivotIndices:d.panels.map(H=>b.indexOf(H)),prevLayout:L,trigger:"mouse-or-touch"});if(_l(D,L)){if(S!==0&&!w)switch(v){case"horizontal":{c|=S<0?rD:iD;break}case"vertical":{c|=S<0?sD:oD;break}}}else bo(d.group,{defaultLayoutDeferred:R,derivedPanelConstraints:E,groupSize:N,layout:D,separatorToPanels:j})}});let h=0;t.movementX===0?h|=l&zE:h|=c&zE,t.movementY===0?h|=l&PE:h|=c&PE,Sq(h),yw(e)}function FE(e){const t=Nl(),n=bl();switch(n.state){case"active":aD({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function HE(e){var r,i;if(e.defaultPrevented)return;const t=bl(),n=Nl();switch(t.state){case"active":{if(e.buttons===0){zc({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(o=>{const l=va(o.group.id,!0);bo(o.group,l)});return}for(const o of t.hitRegions)if(o.separator){const{element:l}=o.separator;(r=l.hasPointerCapture)!=null&&r.call(l,e.pointerId)||((i=l.setPointerCapture)==null||i.call(l,e.pointerId))}aD({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const o=vw(e,n);o.length===0?t.state!=="inactive"&&zc({cursorFlags:0,state:"inactive"}):zc({cursorFlags:0,hitRegions:o,state:"hover"}),yw(e.currentTarget);break}}}function $E(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(bl().state){case"hover":zc({cursorFlags:0,state:"inactive"})}}function UE(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=bl();switch(t.state){case"active":zc({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(yw(e.currentTarget),t.hitRegions.forEach(n=>{const r=va(n.group.id,!0);bo(n.group,r)}),e.preventDefault())}}function VE(e){let t=0,n=0;const r={};for(const o of e)if(o.defaultSize!==void 0){t++;const l=si(o.defaultSize);n+=l,r[o.panelId]=l}else r[o.panelId]=void 0;const i=e.length-t;if(i!==0){const o=si((100-n)/i);for(const l of e)l.defaultSize===void 0&&(r[l.panelId]=o)}return r}function Eq(e,t,n){if(!n[0])return;const r=e.panels.find(h=>h.element===t);if(!r||!r.onResize)return;const i=Uc({group:e}),o=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,l=r.mutableValues.prevSize,c={asPercentage:si(o/i*100),inPixels:o};r.mutableValues.prevSize=c,r.onResize(c,r.id,l)}function Rq(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 Tq({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,o=0,l=!1;const c=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 b=v/100*n,w=si(b/t*100);c.set(p.id,w),i+=w;break}case"preserve-relative-size":default:{h.push(p.id),o+=v;break}}}if(!l||h.length===0)return r;const d=100-i,g={...r};if(c.forEach((p,v)=>{g[v]=p}),o>0)for(const p of h){const v=r[p]??0;g[p]=si(v/o*d)}else{const p=si(d/h.length);for(const v of h)g[v]=p}return g}function Nq(e,t){const n=e.map(i=>i.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!r.includes(i))return!1;return!0}const gc=new Map;function Mq(e){let t=!0;hn(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,o=new n(w=>{for(const S of w){const{borderBoxSize:C,target:k}=S;if(k===e.element){if(t){const R=Uc({group:e});if(R===0)return;const E=va(e.id);if(!E)return;const N=Qb(e),L=E.defaultLayoutDeferred?VE(N):E.layout,j=Tq({group:e,nextGroupSize:R,prevGroupSize:E.groupSize,prevLayout:L}),D=yl({layout:j,panelConstraints:N});if(!E.defaultLayoutDeferred&&_l(E.layout,D)&&Rq(E.derivedPanelConstraints,N)&&E.groupSize===R)return;bo(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:N,groupSize:R,layout:D,separatorToPanels:E.separatorToPanels})}}else Eq(e,k,C)}});o.observe(e.element),e.panels.forEach(w=>{hn(!r.has(w.id),`Panel ids must be unique; id "${w.id}" was used more than once`),r.add(w.id),w.onResize&&o.observe(w.element)});const l=Uc({group:e}),c=Qb(e),h=e.panels.map(({id:w})=>w).join(",");let d=e.mutableState.defaultLayout;d&&(Nq(e.panels,d)||(d=void 0));const g=e.mutableState.layouts[h]??d??VE(c),p=yl({layout:g,panelConstraints:c}),v=e.element.ownerDocument;gc.set(v,(gc.get(v)??0)+1);const b=new Map;return Zj(e).forEach(w=>{w.separator&&b.set(w.separator,w.panels)}),bo(e,{defaultLayoutDeferred:l===0,derivedPanelConstraints:c,groupSize:l,layout:p,separatorToPanels:b}),e.separators.forEach(w=>{hn(!i.has(w.id),`Separator ids must be unique; id "${w.id}" was used more than once`),i.add(w.id),w.element.addEventListener("keydown",OE)}),gc.get(v)===1&&(v.addEventListener("dblclick",DE,!0),v.addEventListener("pointerdown",LE,!0),v.addEventListener("pointerleave",FE),v.addEventListener("pointermove",HE),v.addEventListener("pointerout",$E),v.addEventListener("pointerup",UE,!0)),function(){t=!1,gc.set(v,Math.max(0,(gc.get(v)??0)-1)),hq(e),e.separators.forEach(w=>{w.element.removeEventListener("keydown",OE)}),gc.get(v)||(v.removeEventListener("dblclick",DE,!0),v.removeEventListener("pointerdown",LE,!0),v.removeEventListener("pointerleave",FE),v.removeEventListener("pointermove",HE),v.removeEventListener("pointerout",$E),v.removeEventListener("pointerup",UE,!0)),o.disconnect()}}function Aq(){const[e,t]=_.useState({}),n=_.useCallback(()=>t({}),[]);return[e,n]}function bw(e){const t=_.useId();return`${e??t}`}const Ml=typeof window<"u"?_.useLayoutEffect:_.useEffect;function Bd(e){const t=_.useRef(e);return Ml(()=>{t.current=e},[e]),_.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function xw(...e){return Bd(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function ww(e){const t=_.useRef({...e});return Ml(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const lD=_.createContext(null);function jq(e,t){const n=_.useRef({getLayout:()=>({}),setLayout:Cq});_.useImperativeHandle(t,()=>n.current,[]),Ml(()=>{Object.assign(n.current,nD({groupId:e}))})}function cD({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:o,groupRef:l,id:c,onLayoutChange:h,onLayoutChanged:d,orientation:g="horizontal",resizeTargetMinimumSize:p={coarse:20,fine:10},style:v,...b}){const w=_.useRef({onLayoutChange:{},onLayoutChanged:{}}),S=Bd(q=>{_l(w.current.onLayoutChange,q)||(w.current.onLayoutChange=q,h==null||h(q))}),C=Bd(q=>{_l(w.current.onLayoutChanged,q)||(w.current.onLayoutChanged=q,d==null||d(q))}),k=bw(c),R=_.useRef(null),[E,N]=Aq(),L=_.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:p,separators:[]}),j=xw(R,o);jq(k,l);const D=Bd((q,F)=>{const U=bl(),W=NE(q),V=va(q);if(V){let O=!1;switch(U.state){case"active":{O=U.hitRegions.some($=>$.group===W);break}}return{flexGrow:V.layout[F]??1,pointerEvents:O?"none":void 0}}if(n!=null&&n[F])return{flexGrow:n==null?void 0:n[F]}}),H=ww({defaultLayout:n,disableCursor:r}),Y=_.useMemo(()=>({get disableCursor(){return!!H.disableCursor},getPanelStyles:D,id:k,orientation:g,registerPanel:q=>{const F=L.current;return F.panels=Jb(g,[...F.panels,q]),N(),()=>{F.panels=F.panels.filter(U=>U!==q),N()}},registerSeparator:q=>{const F=L.current;return F.separators=Jb(g,[...F.separators,q]),N(),()=>{F.separators=F.separators.filter(U=>U!==q),N()}},togglePanelDisabled:(q,F)=>{const U=L.current.panels.find(O=>O.id===q);U&&(U.panelConstraints.disabled=F);const W=NE(k),V=va(k);W&&V&&bo(W,{...V,derivedPanelConstraints:Qb(W)})},toggleSeparatorDisabled:(q,F)=>{const U=L.current.separators.find(W=>W.id===q);U&&(U.disabled=F)}}),[D,k,N,g,H]),P=_.useRef(null);return Ml(()=>{const q=R.current;if(q===null)return;const F=L.current;let U;if(H.defaultLayout!==void 0&&Object.keys(H.defaultLayout).length===F.panels.length){U={};for(const M of F.panels){const B=H.defaultLayout[M.id];B!==void 0&&(U[M.id]=B)}}const W={disabled:!!i,element:q,id:k,mutableState:{defaultLayout:U,disableCursor:!!H.disableCursor,expandedPanelSizes:L.current.lastExpandedPanelSizes,layouts:L.current.layouts},orientation:g,panels:F.panels,resizeTargetMinimumSize:F.resizeTargetMinimumSize,separators:F.separators};P.current=W;const V=Mq(W),{defaultLayoutDeferred:O,derivedPanelConstraints:$,layout:z}=va(W.id,!0);!O&&$.length>0&&(S(z),C(z));const G=gw(k,M=>{const{defaultLayoutDeferred:B,derivedPanelConstraints:Z,layout:A}=M.next;if(B||Z.length===0)return;const ie=W.panels.map(({id:ee})=>ee).join(",");W.mutableState.layouts[ie]=A,Z.forEach(ee=>{if(ee.collapsible){const{layout:re}=M.prev??{};if(re){const ce=$r(ee.collapsedSize,A[ee.panelId]),he=$r(ee.collapsedSize,re[ee.panelId]);ce&&!he&&(W.mutableState.expandedPanelSizes[ee.panelId]=re[ee.panelId])}}});const J=bl().state!=="active";S(A),J&&C(A)});return()=>{P.current=null,V(),G()}},[i,k,C,S,g,E,H]),_.useEffect(()=>{const q=P.current;q&&(q.mutableState.defaultLayout=n,q.mutableState.disableCursor=!!r)}),f.jsx(lD.Provider,{value:Y,children:f.jsx("div",{...b,className:t,"data-group":!0,"data-testid":k,id:k,ref:j,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})})}cD.displayName="Group";function Sw(){const e=_.useContext(lD);return hn(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Dq(e,t){const{id:n}=Sw(),r=_.useRef({collapse:Ey,expand:Ey,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Ey});_.useImperativeHandle(t,()=>r.current,[]),Ml(()=>{Object.assign(r.current,tD({groupId:n,panelId:e}))})}function uD({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,disabled:o,elementRef:l,groupResizeBehavior:c="preserve-relative-size",id:h,maxSize:d="100%",minSize:g="0%",onResize:p,panelRef:v,style:b,...w}){const S=!!h,C=bw(h),k=ww({disabled:o}),R=_.useRef(null),E=xw(R,l),{getPanelStyles:N,id:L,orientation:j,registerPanel:D,togglePanelDisabled:H}=Sw(),Y=p!==null,P=Bd((W,V,O)=>{p==null||p(W,h,O)});Ml(()=>{const W=R.current;if(W!==null){const V={element:W,id:C,idIsStable:S,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:Y?P:void 0,panelConstraints:{groupResizeBehavior:c,collapsedSize:n,collapsible:r,defaultSize:i,disabled:k.disabled,maxSize:d,minSize:g}};return D(V)}},[c,n,r,i,Y,C,S,d,g,P,D,k]),_.useEffect(()=>{H(C,!!o)},[o,C,H]),Dq(C,v);const q=()=>{const W=N(L,C);if(W)return JSON.stringify(W)},F=_.useSyncExternalStore(W=>gw(L,W),q,q);let U;return F?U=JSON.parse(F):i?U={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:U={flexGrow:1},f.jsx("div",{...w,"data-disabled":o||void 0,"data-panel":!0,"data-testid":C,id:C,ref:E,style:{...Oq,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...U},children:f.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...b,touchAction:j==="horizontal"?"pan-y":"pan-x"},children:e})})}uD.displayName="Panel";const Oq={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Lq({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,o;const l=e[n],c=t.find(h=>h.panelId===n);if(c){const h=c.maxSize,d=c.collapsible?c.collapsedSize:c.minSize,g=[r,r+1];o=yl({layout:ih({delta:d-l,initialLayout:e,panelConstraints:t,pivotIndices:g,prevLayout:e}),panelConstraints:t})[n],i=yl({layout:ih({delta:h-l,initialLayout:e,panelConstraints:t,pivotIndices:g,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:o,valueNow:l}}function dD({children:e,className:t,disabled:n,elementRef:r,id:i,style:o,...l}){const c=bw(i),h=ww({disabled:n}),[d,g]=_.useState({}),[p,v]=_.useState("inactive"),b=_.useRef(null),w=xw(b,r),{disableCursor:S,id:C,orientation:k,registerSeparator:R,toggleSeparatorDisabled:E}=Sw(),N=k==="horizontal"?"vertical":"horizontal";Ml(()=>{const j=b.current;if(j!==null){const D={disabled:h.disabled,element:j,id:c},H=R(D),Y=wq(q=>{v(q.next.state!=="inactive"&&q.next.hitRegions.some(F=>F.separator===D)?q.next.state:"inactive")}),P=gw(C,q=>{const{derivedPanelConstraints:F,layout:U,separatorToPanels:W}=q.next,V=W.get(D);if(V){const O=V[0],$=V.indexOf(O);g(Lq({layout:U,panelConstraints:F,panelId:O.id,panelIndex:$}))}});return()=>{Y(),P(),H()}}},[C,c,R,h]),_.useEffect(()=>{E(c,!!n)},[n,c,E]);let L;return n&&!S&&(L="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":c,id:c,ref:w,role:"separator",style:{flexBasis:"auto",cursor:L,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}dD.displayName="Separator";const Fd=({className:e,...t})=>f.jsx(cD,{className:me("flex h-full w-full",e),...t}),fo=e=>f.jsx(uD,{...e}),Hd=({withHandle:e,orientation:t,disabled:n,className:r,...i})=>f.jsx(dD,{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),...i,children:f.jsx("span",{className:"sr-only",children:t==="vertical"?"Resize rows":"Resize columns"})});/**
509
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
510
+ * @license MIT
511
+ *
512
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
513
+ * @license MIT
514
+ *
515
+ * Originally forked from (with the author's permission):
516
+ * Fabrice Bellard's javascript vt100 for jslinux:
517
+ * http://bellard.org/jslinux/
518
+ * Copyright (c) 2011 Fabrice Bellard
519
+ */var fr=0,mr=0,pr=0,On=0,Or;(e=>{function t(i,o,l,c){return c!==void 0?`#${Za(i)}${Za(o)}${Za(l)}${Za(c)}`:`#${Za(i)}${Za(o)}${Za(l)}`}e.toCss=t;function n(i,o,l,c=255){return(i<<24|o<<16|l<<8|c)>>>0}e.toRgba=n;function r(i,o,l,c){return{css:e.toCss(i,o,l,c),rgba:e.toRgba(i,o,l,c)}}e.toColor=r})(Or||(Or={}));var zq;(e=>{function t(h,d){if(On=(d.rgba&255)/255,On===1)return{css:d.css,rgba:d.rgba};let g=d.rgba>>24&255,p=d.rgba>>16&255,v=d.rgba>>8&255,b=h.rgba>>24&255,w=h.rgba>>16&255,S=h.rgba>>8&255;fr=b+Math.round((g-b)*On),mr=w+Math.round((p-w)*On),pr=S+Math.round((v-S)*On);let C=Or.toCss(fr,mr,pr),k=Or.toRgba(fr,mr,pr);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=Km.ensureContrastRatio(h.rgba,d.rgba,g);if(p)return Or.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=r;function i(h){let d=(h.rgba|255)>>>0;return[fr,mr,pr]=Km.toChannels(d),{css:Or.toCss(fr,mr,pr),rgba:d}}e.opaque=i;function o(h,d){return On=Math.round(d*255),[fr,mr,pr]=Km.toChannels(h.rgba),{css:Or.toCss(fr,mr,pr,On),rgba:Or.toRgba(fr,mr,pr,On)}}e.opacity=o;function l(h,d){return On=h.rgba&255,o(h,On*d/255)}e.multiplyOpacity=l;function c(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=c})(zq||(zq={}));var Rr;(e=>{let t,n;try{let i=document.createElement("canvas");i.width=1,i.height=1;let o=i.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return fr=parseInt(i.slice(1,2).repeat(2),16),mr=parseInt(i.slice(2,3).repeat(2),16),pr=parseInt(i.slice(3,4).repeat(2),16),Or.toColor(fr,mr,pr);case 5:return fr=parseInt(i.slice(1,2).repeat(2),16),mr=parseInt(i.slice(2,3).repeat(2),16),pr=parseInt(i.slice(3,4).repeat(2),16),On=parseInt(i.slice(4,5).repeat(2),16),Or.toColor(fr,mr,pr,On);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let o=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return fr=parseInt(o[1]),mr=parseInt(o[2]),pr=parseInt(o[3]),On=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Or.toColor(fr,mr,pr,On);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[fr,mr,pr,On]=t.getImageData(0,0,1,1).data,On!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Or.toRgba(fr,mr,pr,On),css:i}}e.toColor=r})(Rr||(Rr={}));var Fr;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,i,o){let l=r/255,c=i/255,h=o/255,d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),g=c<=.03928?c/12.92:Math.pow((c+.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})(Fr||(Fr={}));var Km;(e=>{function t(l,c){if(On=(c&255)/255,On===1)return c;let h=c>>24&255,d=c>>16&255,g=c>>8&255,p=l>>24&255,v=l>>16&255,b=l>>8&255;return fr=p+Math.round((h-p)*On),mr=v+Math.round((d-v)*On),pr=b+Math.round((g-b)*On),Or.toRgba(fr,mr,pr)}e.blend=t;function n(l,c,h){let d=Fr.relativeLuminance(l>>8),g=Fr.relativeLuminance(c>>8);if(lo(d,g)<h){if(g<d){let b=r(l,c,h),w=lo(d,Fr.relativeLuminance(b>>8));if(w<h){let S=i(l,c,h),C=lo(d,Fr.relativeLuminance(S>>8));return w>C?b:S}return b}let p=i(l,c,h),v=lo(d,Fr.relativeLuminance(p>>8));if(v<h){let b=r(l,c,h),w=lo(d,Fr.relativeLuminance(b>>8));return v>w?p:b}return p}}e.ensureContrastRatio=n;function r(l,c,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,v=c>>24&255,b=c>>16&255,w=c>>8&255,S=lo(Fr.relativeLuminance2(v,b,w),Fr.relativeLuminance2(d,g,p));for(;S<h&&(v>0||b>0||w>0);)v-=Math.max(0,Math.ceil(v*.1)),b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=lo(Fr.relativeLuminance2(v,b,w),Fr.relativeLuminance2(d,g,p));return(v<<24|b<<16|w<<8|255)>>>0}e.reduceLuminance=r;function i(l,c,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,v=c>>24&255,b=c>>16&255,w=c>>8&255,S=lo(Fr.relativeLuminance2(v,b,w),Fr.relativeLuminance2(d,g,p));for(;S<h&&(v<255||b<255||w<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=lo(Fr.relativeLuminance2(v,b,w),Fr.relativeLuminance2(d,g,p));return(v<<24|b<<16|w<<8|255)>>>0}e.increaseLuminance=i;function o(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=o})(Km||(Km={}));function Za(e){let t=e.toString(16);return t.length<2?"0"+t:t}function lo(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Pq=Object.freeze((()=>{let e=[Rr.toColor("#2e3436"),Rr.toColor("#cc0000"),Rr.toColor("#4e9a06"),Rr.toColor("#c4a000"),Rr.toColor("#3465a4"),Rr.toColor("#75507b"),Rr.toColor("#06989a"),Rr.toColor("#d3d7cf"),Rr.toColor("#555753"),Rr.toColor("#ef2929"),Rr.toColor("#8ae234"),Rr.toColor("#fce94f"),Rr.toColor("#729fcf"),Rr.toColor("#ad7fa8"),Rr.toColor("#34e2e2"),Rr.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],o=t[n%6];e.push({css:Or.toCss(r,i,o),rgba:Or.toRgba(r,i,o)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Or.toCss(r,r,r),rgba:Or.toRgba(r,r,r)})}return e})());function WE(e,t,n){return Math.max(t,Math.min(e,n))}function Iq(e){switch(e){case"&":return"&amp;";case"<":return"&lt;"}return e}var hD=class{constructor(t){this._buffer=t}serialize(t,n){let r=this._buffer.getNullCell(),i=this._buffer.getNullCell(),o=r,l=t.start.y,c=t.end.y,h=t.start.x,d=t.end.x;this._beforeSerialize(c-l,l,c);for(let g=l;g<=c;g++){let p=this._buffer.getLine(g);if(p){let v=g===t.start.y?h:0,b=g===t.end.y?d:p.length;for(let w=v;w<b;w++){let S=p.getCell(w,o===r?i:r);if(!S){console.warn(`Can't get cell at row=${g}, col=${w}`);continue}this._nextCell(S,o,g,w),o=S}}this._rowEnd(g,g===c)}return this._afterSerialize(),this._serializeString(n)}_nextCell(t,n,r,i){}_rowEnd(t,n){}_beforeSerialize(t,n,r){}_afterSerialize(){}_serializeString(t){return""}};function fD(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function ho(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function mD(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 Bq=class extends hD{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 i;this._nullCellCount>0&&!ho(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let r="";if(!n){t-this._firstRow>=this._terminal.rows&&((i=this._buffer.getLine(this._cursorStyleRow))==null||i.getCell(this._cursorStyleCol,this._backgroundCell));let o=this._buffer.getLine(t),l=this._buffer.getLine(t+1);if(!l.isWrapped)r=`\r
520
+ `,this._lastCursorRow=t+1,this._lastCursorCol=0;else{r="";let c=o.getCell(o.length-1,this._thisRowLastChar),h=o.getCell(o.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)&&((c.getChars()||c.getWidth()===0)&&ho(c,d)&&(p=!0),g&&(h.getChars()||h.getWidth()===0)&&ho(c,d)&&ho(h,d)&&(p=!0)),p||(r="-".repeat(this._nullCellCount+1),r+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(r+="\x1B[A",r+=`\x1B[${o.length-this._nullCellCount}C`,r+=`\x1B[${this._nullCellCount}X`,r+=`\x1B[${o.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=[],i=!fD(t,n),o=!ho(t,n),l=!mD(t,n);if(i||o||l)if(t.isAttributeDefault())n.isAttributeDefault()||r.push(0);else{if(i){let c=t.getFgColor();t.isFgRGB()?r.push(38,2,c>>>16&255,c>>>8&255,c&255):t.isFgPalette()?c>=16?r.push(38,5,c):r.push(c&8?90+(c&7):30+(c&7)):r.push(39)}if(o){let c=t.getBgColor();t.isBgRGB()?r.push(48,2,c>>>16&255,c>>>8&255,c&255):t.isBgPalette()?c>=16?r.push(48,5,c):r.push(c&8?100+(c&7):40+(c&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,i){if(t.getWidth()===0)return;let o=t.getChars()==="",l=this._diffStyle(t,this._cursorStyle);if(o?!ho(this._cursorStyle,t):l.length>0){this._nullCellCount>0&&(ho(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=i,this._currentRow+=`\x1B[${l.join(";")}m`;let c=this._buffer.getLine(r);c!==void 0&&(c.getCell(i,this._cursorStyle),this._cursorStyleRow=r,this._cursorStyleCol=i)}o?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(ho(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=i+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,c=this._buffer.cursorX,h=l!==this._lastCursorRow||c!==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(c-this._lastCursorCol))}let i=this._terminal._core._inputHandler._curAttrData,o=this._diffStyle(i,this._cursorStyle);return o.length>0&&(r+=`\x1B[${o.join(";")}m`),r}},Fq=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,n,r){let i=n.length,o=r===void 0?i:WE(r+t.rows,0,i);return this._serializeBufferByRange(t,n,{start:i-o,end:i-1},!1)}_serializeBufferByRange(t,n,r,i){return new Bq(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}},i)}_serializeBufferAsHTML(t,n){var h;let r=t.buffer.active,i=new Hq(r,t,n),o=n.onlySelection??!1,l=n.range;if(l)return i.serialize({start:{x:l.startCol,y:(l.startLine,l.startLine)},end:{x:t.cols,y:(l.endLine,l.endLine)}});if(!o){let d=r.length,g=n.scrollback,p=g===void 0?d:WE(g+t.rows,0,d);return i.serialize({start:{x:0,y:d-p},end:{x:t.cols,y:d-1}})}let c=(h=this._terminal)==null?void 0:h.getSelectionPosition();return c!==void 0?i.serialize({start:{x:c.start.x,y:c.start.y},end:{x:c.end.x,y:c.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(){}},Hq=class extends hD{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=Pq}_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 c,h;this._htmlContent+="<html><body><!--StartFragment--><pre>";let i="#000000",o="#ffffff";(this._options.includeGlobalBackground??!1)&&(i=((c=this._terminal.options.theme)==null?void 0:c.foreground)??"#ffffff",o=((h=this._terminal.options.theme)==null?void 0:h.background)??"#000000");let l=[];l.push("color: "+i+";"),l.push("background-color: "+o+";"),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(i=>this._padStart(i.toString(16),2,"0")).join("");if(n?t.isFgPalette():t.isBgPalette())return this._ansiColors[r].css}_diffStyle(t,n){let r=[],i=!fD(t,n),o=!ho(t,n),l=!mD(t,n);if(i||o||l){let c=this._getHexColor(t,!0);c&&r.push("color: "+c+";");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,i){if(t.getWidth()===0)return;let o=t.getChars()==="",l=this._diffStyle(t,n);l&&(this._currentRow+=l.length===0?"</span><span>":"</span><span style='"+l.join(" ")+"'>"),o?this._currentRow+=" ":this._currentRow+=Iq(t.getChars())}_serializeString(){return this._htmlContent}};/**
521
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
522
+ * @license MIT
523
+ *
524
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
525
+ * @license MIT
526
+ *
527
+ * Originally forked from (with the author's permission):
528
+ * Fabrice Bellard's javascript vt100 for jslinux:
529
+ * http://bellard.org/jslinux/
530
+ * Copyright (c) 2011 Fabrice Bellard
531
+ */var $q=class{constructor(t,n,r,i={}){this._terminal=t,this._regex=n,this._handler=r,this._options=i}provideLinks(t,n){let r=Vq.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,i)=>{if(this._options.hover){let{range:o}=n;this._options.hover(r,i,o)}},n))}};function Uq(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 Vq=class Gm{static computeLink(t,n,r,i){let o=new RegExp(n.source,(n.flags||"")+"g"),[l,c]=Gm._getWindowedLineStrings(t-1,r),h=l.join(""),d,g=[];for(;d=o.exec(h);){let p=d[0];if(!Uq(p))continue;let[v,b]=Gm._mapStrIdx(r,c,0,d.index),[w,S]=Gm._mapStrIdx(r,v,b,p.length);if(v===-1||b===-1||w===-1||S===-1)continue;let C={start:{x:b+1,y:v+1},end:{x:S,y:w+1}};g.push({range:C,text:p,activate:i})}return g}static _getWindowedLineStrings(t,n){let r,i=t,o=t,l=0,c="",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(--i))&&l<2048&&(c=r.translateToString(!0),l+=c.length,h.push(c),!(!r.isWrapped||c.indexOf(" ")!==-1)););h.reverse()}for(h.push(d),l=0;(r=n.buffer.active.getLine(++o))&&r.isWrapped&&l<2048&&(c=r.translateToString(!0),l+=c.length,h.push(c),c.indexOf(" ")===-1););}return[h,i]}static _mapStrIdx(t,n,r,i){let o=t.buffer.active,l=o.getNullCell(),c=r;for(;i;){let h=o.getLine(n);if(!h)return[-1,-1];for(let d=c;d<h.length;++d){h.getCell(d,l);let g=l.getChars();if(l.getWidth()&&(i-=g.length||1,d===h.length-1&&g==="")){let p=o.getLine(n+1);p&&p.isWrapped&&(p.getCell(0,l),l.getWidth()===2&&(i+=1))}if(i<0)return[n,d]}n++,c=0}return[n,c]}},Wq=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function qq(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 Kq=class{constructor(t=qq,n={}){this._handler=t,this._options=n}activate(t){this._terminal=t;let n=this._options,r=n.urlRegex||Wq;this._linkProvider=this._terminal.registerLinkProvider(new $q(this._terminal,r,this._handler,n))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};/**
532
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
533
+ * @license MIT
534
+ *
535
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
536
+ * @license MIT
537
+ *
538
+ * Originally forked from (with the author's permission):
539
+ * Fabrice Bellard's javascript vt100 for jslinux:
540
+ * http://bellard.org/jslinux/
541
+ * Copyright (c) 2011 Fabrice Bellard
542
+ */var pD=Object.defineProperty,Gq=Object.getOwnPropertyDescriptor,Yq=(e,t)=>{for(var n in t)pD(e,n,{get:t[n],enumerable:!0})},zn=(e,t,n,r)=>{for(var i=r>1?void 0:r?Gq(t,n):t,o=e.length-1,l;o>=0;o--)(l=e[o])&&(i=(r?l(t,n,i):l(i))||i);return r&&i&&pD(t,n,i),i},Pe=(e,t)=>(n,r)=>t(n,r,e),qE="Terminal input",ex={get:()=>qE,set:e=>qE=e},KE="Too much output to announce, navigate to rows manually to read",tx={get:()=>KE,set:e=>KE=e};function Xq(e){return e.replace(/\r?\n/g,"\r")}function Zq(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Qq(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function Jq(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");gD(i,t,n,r)}}function gD(e,t,n,r){e=Xq(e),e=Zq(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function vD(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,o=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function GE(e,t,n,r,i){vD(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function da(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Tg(e,t=0,n=e.length){let r="";for(let i=t;i<n;++i){let o=e[i];o>65535?(o-=65536,r+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):r+=String.fromCharCode(o)}return r}var eK=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let o=e.charCodeAt(i++);56320<=o&&o<=57343?t[r++]=(this._interim-55296)*1024+o-56320+65536:(t[r++]=this._interim,t[r++]=o),this._interim=0}for(let o=i;o<n;++o){let l=e.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=n)return this._interim=l,r;let c=e.charCodeAt(o);56320<=c&&c<=57343?t[r++]=(l-55296)*1024+c-56320+65536:(t[r++]=l,t[r++]=c);continue}l!==65279&&(t[r++]=l)}return r}},tK=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,o,l,c,h=0,d=0;if(this.interim[0]){let v=!1,b=this.interim[0];b&=(b&224)===192?31:(b&240)===224?15:7;let w=0,S;for(;(S=this.interim[++w]&63)&&w<4;)b<<=6,b|=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,b<<=6,b|=S&63}v||(C===2?b<128?d--:t[r++]=b:C===3?b<2048||b>=55296&&b<=57343||b===65279||(t[r++]=b):b<65536||b>1114111||(t[r++]=b)),this.interim.fill(0)}let g=n-4,p=d;for(;p<n;){for(;p<g&&!((i=e[p])&128)&&!((o=e[p+1])&128)&&!((l=e[p+2])&128)&&!((c=e[p+3])&128);)t[r++]=i,t[r++]=o,t[r++]=l,t[r++]=c,p+=4;if(i=e[p++],i<128)t[r++]=i;else if((i&224)===192){if(p>=n)return this.interim[0]=i,r;if(o=e[p++],(o&192)!==128){p--;continue}if(h=(i&31)<<6|o&63,h<128){p--;continue}t[r++]=h}else if((i&240)===224){if(p>=n)return this.interim[0]=i,r;if(o=e[p++],(o&192)!==128){p--;continue}if(p>=n)return this.interim[0]=i,this.interim[1]=o,r;if(l=e[p++],(l&192)!==128){p--;continue}if(h=(i&15)<<12|(o&63)<<6|l&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[r++]=h}else if((i&248)===240){if(p>=n)return this.interim[0]=i,r;if(o=e[p++],(o&192)!==128){p--;continue}if(p>=n)return this.interim[0]=i,this.interim[1]=o,r;if(l=e[p++],(l&192)!==128){p--;continue}if(p>=n)return this.interim[0]=i,this.interim[1]=o,this.interim[2]=l,r;if(c=e[p++],(c&192)!==128){p--;continue}if(h=(i&7)<<18|(o&63)<<12|(l&63)<<6|c&63,h<65536||h>1114111)continue;t[r++]=h}}return r}},_D="",pa=" ",Ah=class yD{constructor(){this.fg=0,this.bg=0,this.extended=new Rp}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 yD;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}},Rp=class bD{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 bD(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},qi=class xD extends Ah{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Rp,this.combinedData=""}static fromCharData(t){let n=new xD;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?da(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 i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(r-55296)*1024+i-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()]}},YE="di$target",nx="di$dependencies",Ry=new Map;function nK(e){return e[nx]||[]}function yr(e){if(Ry.has(e))return Ry.get(e);let t=function(n,r,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");rK(t,n,i)};return t._id=e,Ry.set(e,t),t}function rK(e,t,n){t[YE]===t?t[nx].push({id:e,index:n}):(t[nx]=[{id:e,index:n}],t[YE]=t)}var qr=yr("BufferService"),wD=yr("CoreMouseService"),Al=yr("CoreService"),iK=yr("CharsetService"),Cw=yr("InstantiationService"),SD=yr("LogService"),Kr=yr("OptionsService"),CD=yr("OscLinkService"),sK=yr("UnicodeService"),jh=yr("DecorationService"),rx=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=[],i=this._optionsService.rawOptions.linkHandler,o=new qi,l=n.getTrimmedLength(),c=-1,h=-1,d=!1;for(let p=0;p<l;p++)if(!(h===-1&&!n.hasContent(p))){if(n.loadCell(p,o),o.hasExtendedAttrs()&&o.extended.urlId)if(h===-1){h=p,c=o.extended.urlId;continue}else d=o.extended.urlId!==c;else h!==-1&&(d=!0);if(d||h!==-1&&p===l-1){let v=(g=this._oscLinkService.getLinkData(c))==null?void 0:g.uri;if(v){let b={start:{x:h+1,y:e},end:{x:p+(!d&&p===l-1?1:0),y:e}},w=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let S=new URL(v);["http:","https:"].includes(S.protocol)||(w=!0)}catch{w=!0}w||r.push({text:v,range:b,activate:(S,C)=>i?i.activate(S,C,b):oK(S,C),hover:(S,C)=>{var k;return(k=i==null?void 0:i.hover)==null?void 0:k.call(i,S,C,b)},leave:(S,C)=>{var k;return(k=i==null?void 0:i.leave)==null?void 0:k.call(i,S,C,b)}})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(h=p,c=o.extended.urlId):(h=-1,c=-1)}}t(r)}};rx=zn([Pe(0,qr),Pe(1,Kr),Pe(2,CD)],rx);function oK(e,t){if(confirm(`Do you want to navigate to ${t}?
543
+
544
+ 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 Ng=yr("CharSizeService"),Ro=yr("CoreBrowserService"),kw=yr("MouseService"),To=yr("RenderService"),aK=yr("SelectionService"),kD=yr("CharacterJoinerService"),lu=yr("ThemeService"),ED=yr("LinkProviderService"),lK=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?XE.isErrorNoTelemetry(e)?new XE(e.message+`
545
+
546
+ `+e.stack):new Error(e.message+`
547
+
548
+ `+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)}},cK=new lK;function Ym(e){uK(e)||cK.onUnexpectedError(e)}var ix="Canceled";function uK(e){return e instanceof dK?!0:e instanceof Error&&e.name===ix&&e.message===ix}var dK=class extends Error{constructor(){super(ix),this.name=this.message}};function hK(e){return new Error(`Illegal argument: ${e}`)}var XE=class sx extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof sx)return t;let n=new sx;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},ox=class RD extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,RD.prototype)}};function pi(e,t=0){return e[e.length-(1+t)]}var fK;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function r(o){return o>0}e.isGreaterThan=r;function i(o){return o===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(fK||(fK={}));function mK(e,t){let n=this,r=!1,i;return function(){return r||(r=!0,t||(i=e.apply(n,arguments))),i}}var TD;(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*i(N){yield N}e.single=i;function o(N){return t(N)?N:i(N)}e.wrap=o;function l(N){return N||n}e.from=l;function*c(N){for(let L=N.length-1;L>=0;L--)yield N[L]}e.reverse=c;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,L){let j=0;for(let D of N)if(L(D,j++))return!0;return!1}e.some=g;function p(N,L){for(let j of N)if(L(j))return j}e.find=p;function*v(N,L){for(let j of N)L(j)&&(yield j)}e.filter=v;function*b(N,L){let j=0;for(let D of N)yield L(D,j++)}e.map=b;function*w(N,L){let j=0;for(let D of N)yield*L(D,j++)}e.flatMap=w;function*S(...N){for(let L of N)yield*L}e.concat=S;function C(N,L,j){let D=j;for(let H of N)D=L(D,H);return D}e.reduce=C;function*k(N,L,j=N.length){for(L<0&&(L+=N.length),j<0?j+=N.length:j>N.length&&(j=N.length);L<j;L++)yield N[L]}e.slice=k;function R(N,L=Number.POSITIVE_INFINITY){let j=[];if(L===0)return[j,N];let D=N[Symbol.iterator]();for(let H=0;H<L;H++){let Y=D.next();if(Y.done)return[j,e.empty()];j.push(Y.value)}return[j,{[Symbol.iterator](){return D}}]}e.consume=R;async function E(N){let L=[];for await(let j of N)L.push(j);return Promise.resolve(L)}e.asyncToArray=E})(TD||(TD={}));function xl(e){if(TD.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 pK(...e){return Tn(()=>xl(e))}function Tn(e){return{dispose:mK(()=>{e()})}}var ND=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{xl(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)}};ND.DISABLE_DISPOSED_WARNING=!1;var _a=ND,kt=class{constructor(){this._store=new _a,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)}};kt.None=Object.freeze({dispose(){}});var Vc=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}},mo=typeof window=="object"?window:globalThis,ax=class lx{constructor(t){this.element=t,this.next=lx.Undefined,this.prev=lx.Undefined}};ax.Undefined=new ax(void 0);var Nn=ax,ZE=class{constructor(){this._first=Nn.Undefined,this._last=Nn.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Nn.Undefined}clear(){let e=this._first;for(;e!==Nn.Undefined;){let t=e.next;e.prev=Nn.Undefined,e.next=Nn.Undefined,e=t}this._first=Nn.Undefined,this._last=Nn.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Nn(e);if(this._first===Nn.Undefined)this._first=n,this._last=n;else if(t){let i=this._last;this._last=n,n.prev=i,i.next=n}else{let i=this._first;this._first=n,n.next=i,i.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==Nn.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Nn.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Nn.Undefined&&e.next!==Nn.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Nn.Undefined&&e.next===Nn.Undefined?(this._first=Nn.Undefined,this._last=Nn.Undefined):e.next===Nn.Undefined?(this._last=this._last.prev,this._last.next=Nn.Undefined):e.prev===Nn.Undefined&&(this._first=this._first.next,this._first.prev=Nn.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Nn.Undefined;)yield e.element,e=e.next}},gK=globalThis.performance&&typeof globalThis.performance.now=="function",vK=class AD{static create(t){return new AD(t)}constructor(t){this._now=gK&&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}},Nr;(e=>{e.None=()=>kt.None;function t(F,U){return p(F,()=>{},0,void 0,!0,void 0,U)}e.defer=t;function n(F){return(U,W=null,V)=>{let O=!1,$;return $=F(z=>{if(!O)return $?$.dispose():O=!0,U.call(W,z)},null,V),O&&$.dispose(),$}}e.once=n;function r(F,U,W){return d((V,O=null,$)=>F(z=>V.call(O,U(z)),null,$),W)}e.map=r;function i(F,U,W){return d((V,O=null,$)=>F(z=>{U(z),V.call(O,z)},null,$),W)}e.forEach=i;function o(F,U,W){return d((V,O=null,$)=>F(z=>U(z)&&V.call(O,z),null,$),W)}e.filter=o;function l(F){return F}e.signal=l;function c(...F){return(U,W=null,V)=>{let O=pK(...F.map($=>$(z=>U.call(W,z))));return g(O,V)}}e.any=c;function h(F,U,W,V){let O=W;return r(F,$=>(O=U(O,$),O),V)}e.reduce=h;function d(F,U){let W,V={onWillAddFirstListener(){W=F(O.fire,O)},onDidRemoveLastListener(){W==null||W.dispose()}},O=new Me(V);return U==null||U.add(O),O.event}function g(F,U){return U instanceof Array?U.push(F):U&&U.add(F),F}function p(F,U,W=100,V=!1,O=!1,$,z){let G,M,B,Z=0,A,ie={leakWarningThreshold:$,onWillAddFirstListener(){G=F(ee=>{Z++,M=U(M,ee),V&&!B&&(J.fire(M),M=void 0),A=()=>{let re=M;M=void 0,B=void 0,(!V||Z>1)&&J.fire(re),Z=0},typeof W=="number"?(clearTimeout(B),B=setTimeout(A,W)):B===void 0&&(B=0,queueMicrotask(A))})},onWillRemoveListener(){O&&Z>0&&(A==null||A())},onDidRemoveLastListener(){A=void 0,G.dispose()}},J=new Me(ie);return z==null||z.add(J),J.event}e.debounce=p;function v(F,U=0,W){return e.debounce(F,(V,O)=>V?(V.push(O),V):[O],U,void 0,!0,void 0,W)}e.accumulate=v;function b(F,U=(V,O)=>V===O,W){let V=!0,O;return o(F,$=>{let z=V||!U($,O);return V=!1,O=$,z},W)}e.latch=b;function w(F,U,W){return[e.filter(F,U,W),e.filter(F,V=>!U(V),W)]}e.split=w;function S(F,U=!1,W=[],V){let O=W.slice(),$=F(M=>{O?O.push(M):G.fire(M)});V&&V.add($);let z=()=>{O==null||O.forEach(M=>G.fire(M)),O=null},G=new Me({onWillAddFirstListener(){$||($=F(M=>G.fire(M)),V&&V.add($))},onDidAddFirstListener(){O&&(U?setTimeout(z):z())},onDidRemoveLastListener(){$&&$.dispose(),$=null}});return V&&V.add(G),G.event}e.buffer=S;function C(F,U){return(W,V,O)=>{let $=U(new R);return F(function(z){let G=$.evaluate(z);G!==k&&W.call(V,G)},void 0,O)}}e.chain=C;let k=Symbol("HaltChainable");class R{constructor(){this.steps=[]}map(U){return this.steps.push(U),this}forEach(U){return this.steps.push(W=>(U(W),W)),this}filter(U){return this.steps.push(W=>U(W)?W:k),this}reduce(U,W){let V=W;return this.steps.push(O=>(V=U(V,O),V)),this}latch(U=(W,V)=>W===V){let W=!0,V;return this.steps.push(O=>{let $=W||!U(O,V);return W=!1,V=O,$?O:k}),this}evaluate(U){for(let W of this.steps)if(U=W(U),U===k)break;return U}}function E(F,U,W=V=>V){let V=(...G)=>z.fire(W(...G)),O=()=>F.on(U,V),$=()=>F.removeListener(U,V),z=new Me({onWillAddFirstListener:O,onDidRemoveLastListener:$});return z.event}e.fromNodeEventEmitter=E;function N(F,U,W=V=>V){let V=(...G)=>z.fire(W(...G)),O=()=>F.addEventListener(U,V),$=()=>F.removeEventListener(U,V),z=new Me({onWillAddFirstListener:O,onDidRemoveLastListener:$});return z.event}e.fromDOMEventEmitter=N;function L(F){return new Promise(U=>n(F)(U))}e.toPromise=L;function j(F){let U=new Me;return F.then(W=>{U.fire(W)},()=>{U.fire(void 0)}).finally(()=>{U.dispose()}),U.event}e.fromPromise=j;function D(F,U){return F(W=>U.fire(W))}e.forward=D;function H(F,U,W){return U(W),F(V=>U(V))}e.runAndSubscribe=H;class Y{constructor(U,W){this._observable=U,this._counter=0,this._hasChanged=!1;let V={onWillAddFirstListener:()=>{U.addObserver(this)},onDidRemoveLastListener:()=>{U.removeObserver(this)}};this.emitter=new Me(V),W&&W.add(this.emitter)}beginUpdate(U){this._counter++}handlePossibleChange(U){}handleChange(U,W){this._hasChanged=!0}endUpdate(U){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function P(F,U){return new Y(F,U).emitter.event}e.fromObservable=P;function q(F){return(U,W,V)=>{let O=0,$=!1,z={beginUpdate(){O++},endUpdate(){O--,O===0&&(F.reportChanges(),$&&($=!1,U.call(W)))},handlePossibleChange(){},handleChange(){$=!0}};F.addObserver(z),F.reportChanges();let G={dispose(){F.removeObserver(z)}};return V instanceof _a?V.add(G):Array.isArray(V)&&V.push(G),G}}e.fromObservableLight=q})(Nr||(Nr={}));var cx=class ux{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${ux._idPool++}`,ux.all.add(this)}start(t){this._stopWatch=new vK,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}}};cx.all=new Set,cx._idPool=0;var _K=cx,yK=-1,jD=class DD{constructor(t,n,r=(DD._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 i=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[o,l]=this.getMostFrequentStack(),c=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${l}):`;console.warn(c),console.warn(o);let h=new wK(c,o);this._errorHandler(h)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,i]of this._stacks)(!t||n<i)&&(t=[r,i],n=i);return t}};jD._idPool=1;var bK=jD,xK=class OD{constructor(t){this.value=t}static create(){let t=new Error;return new OD(t.stack??"")}print(){console.warn(this.value.split(`
549
+ `).slice(2).join(`
550
+ `))}},wK=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},SK=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},CK=0,Ty=class{constructor(e){this.value=e,this.id=CK++}},kK=2,EK,Me=class{constructor(e){var t,n,r,i;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new bK((e==null?void 0:e.onListenerError)??Ym,((n=this._options)==null?void 0:n.leakWarningThreshold)??yK):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new _K(this._options._profName):void 0,this._deliveryQueue=(i=this._options)==null?void 0:i.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,c,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],b=new SK(`${p}. HINT: Stack shows most frequent listener (${v[1]}-times)`,v[0]);return(((l=this._options)==null?void 0:l.onListenerError)||Ym)(b),kt.None}if(this._disposed)return kt.None;t&&(e=e.bind(t));let r=new Ty(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=xK.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Ty?(this._deliveryQueue??(this._deliveryQueue=new RK),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(c=this._options)==null?void 0:c.onWillAddFirstListener)==null||h.call(c,this),this._listeners=r,(g=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||g.call(d,this)),this._size++;let o=Tn(()=>{i==null||i(),this._removeListener(r)});return n instanceof _a?n.add(o):Array.isArray(n)&&n.push(o),o}),this._event}_removeListener(e){var i,o,l,c;if((o=(i=this._options)==null?void 0:i.onWillRemoveListener)==null||o.call(i,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(c=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||c.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*kK<=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)||Ym;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}_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,i;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 Ty)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(i=this._perfMon)==null||i.stop()}hasListeners(){return this._size>0}},RK=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}},dx=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Me,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Me,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}};dx.INSTANCE=new dx;var Ew=dx;function TK(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Ew.INSTANCE.onDidChangeZoomLevel;function NK(e){return Ew.INSTANCE.getZoomFactor(e)}Ew.INSTANCE.onDidChangeFullscreen;var cu=typeof navigator=="object"?navigator.userAgent:"",hx=cu.indexOf("Firefox")>=0,MK=cu.indexOf("AppleWebKit")>=0,Rw=cu.indexOf("Chrome")>=0,AK=!Rw&&cu.indexOf("Safari")>=0;cu.indexOf("Electron/")>=0;cu.indexOf("Android")>=0;var Ny=!1;if(typeof mo.matchMedia=="function"){let e=mo.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=mo.matchMedia("(display-mode: fullscreen)");Ny=e.matches,TK(mo,e,({matches:n})=>{Ny&&t.matches||(Ny=n)})}var Mc="en",fx=!1,mx=!1,Xm=!1,LD=!1,bm,Zm=Mc,QE=Mc,jK,rs,dl=globalThis,Tr,gN;typeof dl.vscode<"u"&&typeof dl.vscode.process<"u"?Tr=dl.vscode.process:typeof process<"u"&&typeof((gN=process==null?void 0:process.versions)==null?void 0:gN.node)=="string"&&(Tr=process);var vN,DK=typeof((vN=Tr==null?void 0:Tr.versions)==null?void 0:vN.electron)=="string",OK=DK&&(Tr==null?void 0:Tr.type)==="renderer",_N;if(typeof Tr=="object"){fx=Tr.platform==="win32",mx=Tr.platform==="darwin",Xm=Tr.platform==="linux",Xm&&Tr.env.SNAP&&Tr.env.SNAP_REVISION,Tr.env.CI||Tr.env.BUILD_ARTIFACTSTAGINGDIRECTORY,bm=Mc,Zm=Mc;let e=Tr.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);bm=t.userLocale,QE=t.osLocale,Zm=t.resolvedLanguage||Mc,jK=(_N=t.languagePack)==null?void 0:_N.translationsConfigFile}catch{}LD=!0}else typeof navigator=="object"&&!OK?(rs=navigator.userAgent,fx=rs.indexOf("Windows")>=0,mx=rs.indexOf("Macintosh")>=0,(rs.indexOf("Macintosh")>=0||rs.indexOf("iPad")>=0||rs.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Xm=rs.indexOf("Linux")>=0,(rs==null?void 0:rs.indexOf("Mobi"))>=0,Zm=globalThis._VSCODE_NLS_LANGUAGE||Mc,bm=navigator.language.toLowerCase(),QE=bm):console.error("Unable to resolve platform.");var zD=fx,zs=mx,LK=Xm,JE=LD,Bs=rs,ia=Zm,zK;(e=>{function t(){return ia}e.value=t;function n(){return ia.length===2?ia==="en":ia.length>=3?ia[0]==="e"&&ia[1]==="n"&&ia[2]==="-":!1}e.isDefaultVariant=n;function r(){return ia==="en"}e.isDefault=r})(zK||(zK={}));var PK=typeof dl.postMessage=="function"&&!dl.importScripts;(()=>{if(PK){let e=[];dl.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,i=e.length;r<i;r++){let o=e[r];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),o.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),dl.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var IK=!!(Bs&&Bs.indexOf("Chrome")>=0);Bs&&Bs.indexOf("Firefox")>=0;!IK&&Bs&&Bs.indexOf("Safari")>=0;Bs&&Bs.indexOf("Edg/")>=0;Bs&&Bs.indexOf("Android")>=0;var vc=typeof navigator=="object"?navigator:{};JE||document.queryCommandSupported&&document.queryCommandSupported("copy")||vc&&vc.clipboard&&vc.clipboard.writeText,JE||vc&&vc.clipboard&&vc.clipboard.readText;var Tw=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}},My=new Tw,eR=new Tw,tR=new Tw,BK=new Array(230),PD;(e=>{function t(c){return My.keyCodeToStr(c)}e.toString=t;function n(c){return My.strToKeyCode(c)}e.fromString=n;function r(c){return eR.keyCodeToStr(c)}e.toUserSettingsUS=r;function i(c){return tR.keyCodeToStr(c)}e.toUserSettingsGeneral=i;function o(c){return eR.strToKeyCode(c)||tR.strToKeyCode(c)}e.fromUserSettings=o;function l(c){if(c>=98&&c<=113)return null;switch(c){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return My.keyCodeToStr(c)}e.toElectronAccelerator=l})(PD||(PD={}));var FK=class ID{constructor(t,n,r,i,o){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=i,this.keyCode=o}equals(t){return t instanceof ID&&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",i=this.metaKey?"1":"0";return`K${t}${n}${r}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new HK([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},HK=class{constructor(e){if(e.length===0)throw hK("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 $K(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return PD.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(hx)switch(t){case 59:return 85;case 60:if(LK)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(zs)return 57;break}else if(MK&&(zs&&t===93||!zs&&t===92))return 57;return BK[t]||0}var UK=zs?256:2048,VK=512,WK=1024,qK=zs?2048:256,nR=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=$K(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|=UK),this.altKey&&(t|=VK),this.shiftKey&&(t|=WK),this.metaKey&&(t|=qK),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new FK(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},rR=new WeakMap;function KK(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 GK=class{static getSameOriginWindowChain(e){let t=rR.get(e);if(!t){t=[],rR.set(e,t);let n=e,r;do r=KK(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let o of i){let l=o.window.deref();if(n+=(l==null?void 0:l.scrollY)??0,r+=(l==null?void 0:l.scrollX)??0,l===t||!o.iframeElement)break;let c=o.iframeElement.getBoundingClientRect();n+=c.top,r+=c.left}return{top:n,left:r}}},xm=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=GK.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},iR=class{constructor(e,t=0,n=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(Rw){let o=navigator.userAgent.match(/Chrome\/(\d+)/);r=(o?parseInt(o[1]):123)<=122}if(e){let o=e,l=e,c=((i=e.view)==null?void 0:i.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")r?this.deltaY=o.wheelDeltaY/(120*c):this.deltaY=o.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?hx&&!zs?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")AK&&zD?this.deltaX=-(o.wheelDeltaX/120):r?this.deltaX=o.wheelDeltaX/(120*c):this.deltaX=o.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?hx&&!zs?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*c):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},BD=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),YK;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof XK?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Nr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:BD})})(YK||(YK={}));var XK=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?BD:(this._emitter||(this._emitter=new Me),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Nw=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 ox("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new ox("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},ZK=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 ox("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=Tn(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},QK;(e=>{async function t(r){let i,o=await Promise.all(r.map(l=>l.then(c=>c,c=>{i||(i=c)})));if(typeof i<"u")throw i;return o}e.settled=t;function n(r){return new Promise(async(i,o)=>{try{await r(i,o)}catch(l){o(l)}})}e.withAsyncBody=n})(QK||(QK={}));var sR=class zi{static fromArray(t){return new zi(n=>{n.emitMany(t)})}static fromPromise(t){return new zi(async n=>{n.emitMany(await t)})}static fromPromises(t){return new zi(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new zi(async n=>{await Promise.all(t.map(async r=>{for await(let i of r)n.emitOne(i)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new Me,queueMicrotask(async()=>{let r={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(r)),this.resolve()}catch(i){this.reject(i)}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 Nr.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 zi(async r=>{for await(let i of t)r.emitOne(n(i))})}map(t){return zi.map(this,t)}static filter(t,n){return new zi(async r=>{for await(let i of t)n(i)&&r.emitOne(i)})}filter(t){return zi.filter(this,t)}static coalesce(t){return zi.filter(t,n=>!!n)}coalesce(){return zi.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return zi.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())}};sR.EMPTY=sR.fromArray([]);var{getWindow:Ds,getWindowId:JK,onDidRegisterWindow:eG}=function(){let e=new Map,t={window:mo,disposables:new _a};e.set(mo.vscodeWindowId,t);let n=new Me,r=new Me,i=new Me;function o(l,c){return(typeof l=="number"?e.get(l):void 0)??(c?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(l){if(e.has(l.vscodeWindowId))return kt.None;let c=new _a,h={window:l,disposables:c.add(new _a)};return e.set(l.vscodeWindowId,h),c.add(Tn(()=>{e.delete(l.vscodeWindowId),r.fire(l)})),c.add(lt(l,dr.BEFORE_UNLOAD,()=>{i.fire(l)})),n.fire(h),c},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(l){return l.vscodeWindowId},hasWindow(l){return e.has(l)},getWindowById:o,getWindow(l){var d;let c=l;if((d=c==null?void 0:c.ownerDocument)!=null&&d.defaultView)return c.ownerDocument.defaultView.window;let h=l;return h!=null&&h.view?h.view.window:mo},getDocument(l){return Ds(l).document}}}(),tG=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 lt(e,t,n,r){return new tG(e,t,n,r)}var oR=function(e,t,n,r){return lt(e,t,n,r)},Mw,nG=class extends ZK{constructor(e){super(),this.defaultTarget=e&&Ds(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},aR=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){Ym(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=o=>{n.set(o,!1);let l=e.get(o)??[];for(t.set(o,l),e.set(o,[]),r.set(o,!0);l.length>0;)l.sort(aR.sort),l.shift().execute();r.set(o,!1)};Mw=(o,l,c=0)=>{let h=JK(o),d=new aR(l,c),g=e.get(h);return g||(g=[],e.set(h,g)),g.push(d),n.get(h)||(n.set(h,!0),o.requestAnimationFrame(()=>i(h))),d}})();function rG(e){let t=e.getBoundingClientRect(),n=Ds(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var dr={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"},iG=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=ni(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=ni(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=ni(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=ni(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=ni(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=ni(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=ni(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=ni(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=ni(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=ni(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=ni(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=ni(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=ni(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=ni(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 ni(e){return typeof e=="number"?`${e}px`:e}function $d(e){return new iG(e)}var FD=class{constructor(){this._hooks=new _a,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let o=e;try{e.setPointerCapture(t),this._hooks.add(Tn(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=Ds(e)}this._hooks.add(lt(o,dr.POINTER_MOVE,l=>{if(l.buttons!==n){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(lt(o,dr.POINTER_UP,l=>this.stopMonitoring(!0)))}};function sG(e,t,n){let r=null,i=null;if(typeof n.value=="function"?(r="value",i=n.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",i=n.get),!i)throw new Error("not supported");let o=`$memoize$${t}`;n[r]=function(...l){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,l)}),this[o]}}var Ss;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ss||(Ss={}));var Ed=class Dr extends kt{constructor(){super(),this.dispatched=!1,this.targets=new ZE,this.ignoreTargets=new ZE,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Nr.runAndSubscribe(eG,({window:t,disposables:n})=>{n.add(lt(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(lt(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(lt(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:mo,disposables:this._store}))}static addTarget(t){if(!Dr.isTouchDevice())return kt.None;Dr.INSTANCE||(Dr.INSTANCE=new Dr);let n=Dr.INSTANCE.targets.push(t);return Tn(n)}static ignoreTarget(t){if(!Dr.isTouchDevice())return kt.None;Dr.INSTANCE||(Dr.INSTANCE=new Dr);let n=Dr.INSTANCE.ignoreTargets.push(t);return Tn(n)}static isTouchDevice(){return"ontouchstart"in mo||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,i=t.targetTouches.length;r<i;r++){let o=t.targetTouches.item(r);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:n,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[n],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let l=this.newGestureEvent(Ss.Start,o.target);l.pageX=o.pageX,l.pageY=o.pageY,this.dispatchEvent(l)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let o=0,l=n.changedTouches.length;o<l;o++){let c=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(c.identifier))){console.warn("move of an UNKNOWN touch",c);continue}let h=this.activeTouches[c.identifier],d=Date.now()-h.initialTimeStamp;if(d<Dr.HOLD_DELAY&&Math.abs(h.initialPageX-pi(h.rollingPageX))<30&&Math.abs(h.initialPageY-pi(h.rollingPageY))<30){let g=this.newGestureEvent(Ss.Tap,h.initialTarget);g.pageX=pi(h.rollingPageX),g.pageY=pi(h.rollingPageY),this.dispatchEvent(g)}else if(d>=Dr.HOLD_DELAY&&Math.abs(h.initialPageX-pi(h.rollingPageX))<30&&Math.abs(h.initialPageY-pi(h.rollingPageY))<30){let g=this.newGestureEvent(Ss.Contextmenu,h.initialTarget);g.pageX=pi(h.rollingPageX),g.pageY=pi(h.rollingPageY),this.dispatchEvent(g)}else if(i===1){let g=pi(h.rollingPageX),p=pi(h.rollingPageY),v=pi(h.rollingTimestamps)-h.rollingTimestamps[0],b=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(b)/v,b>0?1:-1,g,Math.abs(w)/v,w>0?1:-1,p)}this.dispatchEvent(this.newGestureEvent(Ss.End,h.initialTarget)),delete this.activeTouches[c.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===Ss.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>Dr.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===Ss.Change||t.type===Ss.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 i=0,o=t.initialTarget;for(;o&&o!==r;)i++,o=o.parentElement;n.push([i,r])}n.sort((r,i)=>r[0]-i[0]);for(let[r,i]of n)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,o,l,c,h,d){this.handle=Mw(t,()=>{let g=Date.now(),p=g-r,v=0,b=0,w=!0;i+=Dr.SCROLL_FRICTION*p,c+=Dr.SCROLL_FRICTION*p,i>0&&(w=!1,v=o*i*p),c>0&&(w=!1,b=h*c*p);let S=this.newGestureEvent(Ss.Change);S.translationX=v,S.translationY=b,n.forEach(C=>C.dispatchEvent(S)),w||this.inertia(t,n,g,i,o,l+v,c,h,d+b)})}onTouchMove(t){let n=Date.now();for(let r=0,i=t.changedTouches.length;r<i;r++){let o=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let l=this.activeTouches[o.identifier],c=this.newGestureEvent(Ss.Change,l.initialTarget);c.translationX=o.pageX-pi(l.rollingPageX),c.translationY=o.pageY-pi(l.rollingPageY),c.pageX=o.pageX,c.pageY=o.pageY,this.dispatchEvent(c),l.rollingPageX.length>3&&(l.rollingPageX.shift(),l.rollingPageY.shift(),l.rollingTimestamps.shift()),l.rollingPageX.push(o.pageX),l.rollingPageY.push(o.pageY),l.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Ed.SCROLL_FRICTION=-.005,Ed.HOLD_DELAY=700,Ed.CLEAR_TAP_COUNT_TIME=400,zn([sG],Ed,"isTouchDevice",1);var oG=Ed,Aw=class extends kt{onclick(e,t){this._register(lt(e,dr.CLICK,n=>t(new xm(Ds(e),n))))}onmousedown(e,t){this._register(lt(e,dr.MOUSE_DOWN,n=>t(new xm(Ds(e),n))))}onmouseover(e,t){this._register(lt(e,dr.MOUSE_OVER,n=>t(new xm(Ds(e),n))))}onmouseleave(e,t){this._register(lt(e,dr.MOUSE_LEAVE,n=>t(new xm(Ds(e),n))))}onkeydown(e,t){this._register(lt(e,dr.KEY_DOWN,n=>t(new nR(n))))}onkeyup(e,t){this._register(lt(e,dr.KEY_UP,n=>t(new nR(n))))}oninput(e,t){this._register(lt(e,dr.INPUT,t))}onblur(e,t){this._register(lt(e,dr.BLUR,t))}onfocus(e,t){this._register(lt(e,dr.FOCUS,t))}onchange(e,t){this._register(lt(e,dr.CHANGE,t))}ignoreGesture(e){return oG.ignoreTarget(e)}},lR=11,aG=class extends Aw{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=lR+"px",this.domNode.style.height=lR+"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 FD),this._register(oR(this.bgDomNode,dr.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(oR(this.domNode,dr.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new nG),this._pointerdownScheduleRepeatTimer=this._register(new Nw)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Ds(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()}},lG=class px{constructor(t,n,r,i,o,l,c){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,i=i|0,o=o|0,l=l|0,c=c|0),this.rawScrollLeft=i,this.rawScrollTop=c,n<0&&(n=0),i+n>r&&(i=r-n),i<0&&(i=0),o<0&&(o=0),c+o>l&&(c=l-o),c<0&&(c=0),this.width=n,this.scrollWidth=r,this.scrollLeft=i,this.height=o,this.scrollHeight=l,this.scrollTop=c}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 px(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 px(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,i=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,l=this.height!==t.height,c=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:i,scrollLeftChanged:o,heightChanged:l,scrollHeightChanged:c,scrollTopChanged:h}}},cG=class extends kt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Me),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new lG(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 uR(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=uR.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)))}},cR=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Ay(e,t){let n=t-e;return function(r){return e+n*hG(r)}}function uG(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var uR=class gx{constructor(t,n,r,i){this.from=t,this.to=n,this.duration=i,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 i,o;return t<n?(i=t+.75*r,o=n-.75*r):(i=t-.75*r,o=n+.75*r),uG(Ay(t,i),Ay(o,n),.33)}return Ay(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),i=this.scrollTop(n);return new cR(r,i,!1)}return new cR(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return gx.start(t,n,r)}static start(t,n,r){r=r+10;let i=Date.now()-10;return new gx(t,n,i,r)}};function dG(e){return Math.pow(e,3)}function hG(e){return 1-dG(1-e)}var fG=class extends kt{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 Nw)}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":"")))}},mG=140,HD=class extends Aw{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 fG(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new FD),this._shouldRender=!0,this.domNode=$d(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(lt(this.domNode.domNode,dr.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new aG(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=$d(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(lt(this.slider.domNode,dr.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let i=rG(this.domNode.domNode);t=e.pageX-i.left,n=e.pageY-i.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,i=>{let o=this._sliderOrthogonalPointerPosition(i),l=Math.abs(o-n);if(zD&&l>mG){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let c=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(c))},()=>{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()}},$D=class vx{constructor(t,n,r,i,o,l){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=i,this._scrollSize=o,this._scrollPosition=l,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new vx(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,i,o){let l=Math.max(0,r-t),c=Math.max(0,l-2*n),h=i>0&&i>r;if(!h)return{computedAvailableSize:Math.round(l),computedIsNeeded:h,computedSliderSize:Math.round(c),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(r*c/i))),g=(c-d)/(i-r),p=o*g;return{computedAvailableSize:Math.round(l),computedIsNeeded:h,computedSliderSize:Math.round(d),computedSliderRatio:g,computedSliderPosition:Math.round(p)}}_refreshComputedValues(){let t=vx._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)}},pG=class extends HD{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new $D(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw 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}},gG=class extends HD{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new $D(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw 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}},vG=500,dR=50,_G=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},_x=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,i=this._rear;do{let o=i===this._front?t:Math.pow(2,-r);if(t-=o,n+=this._memory[i].score*o,i===this._front)break;i=(this._capacity+i-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(Rw){let n=Ds(t.browserEvent),r=NK(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 i=null,o=new _G(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(i=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]=o),o.score=this._computeScore(o,i)}_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 i=Math.abs(t.deltaX),o=Math.abs(t.deltaY),l=Math.abs(n.deltaX),c=Math.abs(n.deltaY),h=Math.max(Math.min(i,l),1),d=Math.max(Math.min(o,c),1),g=Math.max(i,l),p=Math.max(o,c);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}};_x.INSTANCE=new _x;var yG=_x,bG=class extends Aw{constructor(e,t,n){super(),this._onScroll=this._register(new Me),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Me),this.onWillScroll=this._onWillScroll.event,this._options=wG(t),this._scrollable=n,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let r={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new gG(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new pG(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=$d(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=$d(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=$d(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,i=>this._onMouseOver(i)),this.onmouseleave(this._listenOnDomNode,i=>this._onMouseLeave(i)),this._hideTimeout=this._register(new Nw),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=xl(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,zs&&(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 iR(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=xl(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new iR(n))};this._mouseWheelToDispose.push(lt(this._listenOnDomNode,dr.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=yG.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,l=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&l+o===0?l=o=0:Math.abs(o)>=Math.abs(l)?l=0:o=0),this._options.flipAxes&&([o,l]=[l,o]);let c=!zs&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||c)&&!l&&(l=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),d={};if(o){let g=dR*o,p=h.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(d,p)}if(l){let g=dR*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":"",i=t?" top":"",o=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),vG)}},xG=class extends bG{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 wG(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,zs&&(t.className+=" mac"),t}var yx=class extends kt{constructor(e,t,n,r,i,o,l,c){super(),this._bufferService=n,this._optionsService=l,this._renderService=c,this._onRequestScrollLines=this._register(new Me),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let h=this._register(new cG({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>Mw(r.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new xG(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(i.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Nr.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Tn(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Tn(()=>this._styleElement.remove())),this._register(Nr.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
551
+ `)})),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}};yx=zn([Pe(2,qr),Pe(3,Ro),Pe(4,wD),Pe(5,lu),Pe(6,Kr),Pe(7,To)],yx);var bx=class extends kt{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(Tn(()=>{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()}};bx=zn([Pe(1,qr),Pe(2,Ro),Pe(3,jh),Pe(4,To)],bx);var SG=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)}},xs={full:0,left:0,center:0,right:0},sa={full:0,left:0,center:0,right:0},ud={full:0,left:0,center:0,right:0},Tp=class extends kt{constructor(e,t,n,r,i,o,l,c){var d;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=o,this._themeService=l,this._coreBrowserService=c,this._colorZoneStore=new SG,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(Tn(()=>{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);sa.full=this._canvas.width,sa.left=e,sa.center=t,sa.right=e,this._refreshDrawHeightConstants(),ud.full=1,ud.left=1,ud.center=1+sa.left,ud.right=1+sa.left+sa.center}_refreshDrawHeightConstants(){xs.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);xs.left=t,xs.center=t,xs.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*xs.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*xs.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*xs.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*xs.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(ud[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-xs[e.position||"full"]/2),sa[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+xs[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}))}};Tp=zn([Pe(2,qr),Pe(3,jh),Pe(4,To),Pe(5,Kr),Pe(6,lu),Pe(7,Ro)],Tp);var be;(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=`
552
+ `,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=""))(be||(be={}));var Qm;(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="Ÿ"))(Qm||(Qm={}));var UD;(e=>e.ST=`${be.ESC}\\`)(UD||(UD={}));var xx=class{constructor(e,t,n,r,i,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=o,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(`${be.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,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"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 o=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};xx=zn([Pe(2,qr),Pe(3,Kr),Pe(4,Al),Pe(5,To)],xx);var gr=0,vr=0,_r=0,Ln=0,hR={css:"#00000000",rgba:0},Jn;(e=>{function t(i,o,l,c){return c!==void 0?`#${Qa(i)}${Qa(o)}${Qa(l)}${Qa(c)}`:`#${Qa(i)}${Qa(o)}${Qa(l)}`}e.toCss=t;function n(i,o,l,c=255){return(i<<24|o<<16|l<<8|c)>>>0}e.toRgba=n;function r(i,o,l,c){return{css:e.toCss(i,o,l,c),rgba:e.toRgba(i,o,l,c)}}e.toColor=r})(Jn||(Jn={}));var Sn;(e=>{function t(h,d){if(Ln=(d.rgba&255)/255,Ln===1)return{css:d.css,rgba:d.rgba};let g=d.rgba>>24&255,p=d.rgba>>16&255,v=d.rgba>>8&255,b=h.rgba>>24&255,w=h.rgba>>16&255,S=h.rgba>>8&255;gr=b+Math.round((g-b)*Ln),vr=w+Math.round((p-w)*Ln),_r=S+Math.round((v-S)*Ln);let C=Jn.toCss(gr,vr,_r),k=Jn.toRgba(gr,vr,_r);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=Jm.ensureContrastRatio(h.rgba,d.rgba,g);if(p)return Jn.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=r;function i(h){let d=(h.rgba|255)>>>0;return[gr,vr,_r]=Jm.toChannels(d),{css:Jn.toCss(gr,vr,_r),rgba:d}}e.opaque=i;function o(h,d){return Ln=Math.round(d*255),[gr,vr,_r]=Jm.toChannels(h.rgba),{css:Jn.toCss(gr,vr,_r,Ln),rgba:Jn.toRgba(gr,vr,_r,Ln)}}e.opacity=o;function l(h,d){return Ln=h.rgba&255,o(h,Ln*d/255)}e.multiplyOpacity=l;function c(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=c})(Sn||(Sn={}));var Mn;(e=>{let t,n;try{let i=document.createElement("canvas");i.width=1,i.height=1;let o=i.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return gr=parseInt(i.slice(1,2).repeat(2),16),vr=parseInt(i.slice(2,3).repeat(2),16),_r=parseInt(i.slice(3,4).repeat(2),16),Jn.toColor(gr,vr,_r);case 5:return gr=parseInt(i.slice(1,2).repeat(2),16),vr=parseInt(i.slice(2,3).repeat(2),16),_r=parseInt(i.slice(3,4).repeat(2),16),Ln=parseInt(i.slice(4,5).repeat(2),16),Jn.toColor(gr,vr,_r,Ln);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let o=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return gr=parseInt(o[1]),vr=parseInt(o[2]),_r=parseInt(o[3]),Ln=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Jn.toColor(gr,vr,_r,Ln);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[gr,vr,_r,Ln]=t.getImageData(0,0,1,1).data,Ln!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Jn.toRgba(gr,vr,_r,Ln),css:i}}e.toColor=r})(Mn||(Mn={}));var Hr;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,i,o){let l=r/255,c=i/255,h=o/255,d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),g=c<=.03928?c/12.92:Math.pow((c+.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})(Hr||(Hr={}));var Jm;(e=>{function t(l,c){if(Ln=(c&255)/255,Ln===1)return c;let h=c>>24&255,d=c>>16&255,g=c>>8&255,p=l>>24&255,v=l>>16&255,b=l>>8&255;return gr=p+Math.round((h-p)*Ln),vr=v+Math.round((d-v)*Ln),_r=b+Math.round((g-b)*Ln),Jn.toRgba(gr,vr,_r)}e.blend=t;function n(l,c,h){let d=Hr.relativeLuminance(l>>8),g=Hr.relativeLuminance(c>>8);if(co(d,g)<h){if(g<d){let b=r(l,c,h),w=co(d,Hr.relativeLuminance(b>>8));if(w<h){let S=i(l,c,h),C=co(d,Hr.relativeLuminance(S>>8));return w>C?b:S}return b}let p=i(l,c,h),v=co(d,Hr.relativeLuminance(p>>8));if(v<h){let b=r(l,c,h),w=co(d,Hr.relativeLuminance(b>>8));return v>w?p:b}return p}}e.ensureContrastRatio=n;function r(l,c,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,v=c>>24&255,b=c>>16&255,w=c>>8&255,S=co(Hr.relativeLuminance2(v,b,w),Hr.relativeLuminance2(d,g,p));for(;S<h&&(v>0||b>0||w>0);)v-=Math.max(0,Math.ceil(v*.1)),b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=co(Hr.relativeLuminance2(v,b,w),Hr.relativeLuminance2(d,g,p));return(v<<24|b<<16|w<<8|255)>>>0}e.reduceLuminance=r;function i(l,c,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,v=c>>24&255,b=c>>16&255,w=c>>8&255,S=co(Hr.relativeLuminance2(v,b,w),Hr.relativeLuminance2(d,g,p));for(;S<h&&(v<255||b<255||w<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=co(Hr.relativeLuminance2(v,b,w),Hr.relativeLuminance2(d,g,p));return(v<<24|b<<16|w<<8|255)>>>0}e.increaseLuminance=i;function o(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=o})(Jm||(Jm={}));function Qa(e){let t=e.toString(16);return t.length<2?"0"+t:t}function co(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var CG=class extends Ah{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()]}},Np=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new qi}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,o=0,l=0,c=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!==c||this._workCell.bg!==h){if(d-i>1){let g=this._getJoinedRanges(r,l,o,t,i);for(let p=0;p<g.length;p++)n.push(g[p])}i=d,l=o,c=this._workCell.fg,h=this._workCell.bg}o+=this._workCell.getChars().length||pa.length}if(this._bufferService.cols-i>1){let d=this._getJoinedRanges(r,l,o,t,i);for(let g=0;g<d.length;g++)n.push(d[g])}return n}_getJoinedRanges(e,t,n,r,i){let o=e.substring(t,n),l=[];try{l=this._characterJoiners[0].handler(o)}catch(c){console.error(c)}for(let c=1;c<this._characterJoiners.length;c++)try{let h=this._characterJoiners[c].handler(o);for(let d=0;d<h.length;d++)Np._mergeRanges(l,h[d])}catch(h){console.error(h)}return this._stringRangesToCellRanges(l,r,i),l}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,o=0,l=e[r];if(l){for(let c=n;c<this._bufferService.cols;c++){let h=t.getWidth(c),d=t.getString(c).length||pa.length;if(h!==0){if(!i&&l[0]<=o&&(l[0]=c,i=!0),l[1]<=o){if(l[1]=c,l=e[++r],!l)break;l[0]<=o?(l[0]=c,i=!0):i=!1}o+=d}}l&&(l[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Np=zn([Pe(0,qr)],Np);function kG(e){return 57508<=e&&e<=57558}function EG(e){return 9472<=e&&e<=9631}function RG(e){return kG(e)||EG(e)}function TG(){return{css:{canvas:wm(),cell:wm()},device:{canvas:wm(),cell:wm(),char:{width:0,height:0,left:0,top:0}}}}function wm(){return{width:0,height:0}}var wx=class{constructor(e,t,n,r,i,o,l){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=o,this._themeService=l,this._workCell=new qi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,o,l,c,h,d,g){let p=[],v=this._characterJoinerService.getJoinedCharacters(t),b=this._themeService.colors,w=e.getNoBgTrimmedLength();n&&w<o+1&&(w=o+1);let S,C=0,k="",R=0,E=0,N=0,L=0,j=!1,D=0,H=!1,Y=0,P=0,q=[],F=d!==-1&&g!==-1;for(let U=0;U<w;U++){e.loadCell(U,this._workCell);let W=this._workCell.getWidth();if(W===0)continue;let V=!1,O=U>=P,$=U,z=this._workCell;if(v.length>0&&U===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||o<je[0]||o>=je[1]),O?(V=!0,z=new CG(this._workCell,e.translateToString(!0,je[0],je[1]),je[1]-je[0]),$=je[1]-1,W=z.getWidth()):P=je[1]}let G=this._isCellInSelection(U,t),M=n&&U===o,B=F&&U>=d&&U<=g,Z=!1;this._decorationService.forEachDecorationAtCell(U,t,void 0,je=>{Z=!0});let A=z.getChars()||pa;if(A===" "&&(z.isUnderline()||z.isOverline())&&(A=" "),Y=W*c-h.get(A,z.isBold(),z.isItalic()),!S)S=this._document.createElement("span");else if(C&&(G&&H||!G&&!H&&z.bg===E)&&(G&&H&&b.selectionForeground||z.fg===N)&&z.extended.ext===L&&B===j&&Y===D&&!M&&!V&&!Z&&O){z.isInvisible()?k+=pa:k+=A,C++;continue}else C&&(S.textContent=k),S=this._document.createElement("span"),C=0,k="";if(E=z.bg,N=z.fg,L=z.extended.ext,j=B,D=Y,H=G,V&&o>=U&&o<=$&&(o=U),!this._coreService.isCursorHidden&&M&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&q.push("xterm-cursor-blink"),q.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline");break}}if(z.isBold()&&q.push("xterm-bold"),z.isItalic()&&q.push("xterm-italic"),z.isDim()&&q.push("xterm-dim"),z.isInvisible()?k=pa:k=z.getChars()||pa,z.isUnderline()&&(q.push(`xterm-underline-${z.extended.underlineStyle}`),k===" "&&(k=" "),!z.isUnderlineColorDefault()))if(z.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${Ah.toColorRGB(z.getUnderlineColor()).join(",")})`;else{let je=z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&z.isBold()&&je<8&&(je+=8),S.style.textDecorationColor=b.ansi[je].css}z.isOverline()&&(q.push("xterm-overline"),k===" "&&(k=" ")),z.isStrikethrough()&&q.push("xterm-strikethrough"),B&&(S.style.textDecoration="underline");let ie=z.getFgColor(),J=z.getFgColorMode(),ee=z.getBgColor(),re=z.getBgColorMode(),ce=!!z.isInverse();if(ce){let je=ie;ie=ee,ee=je;let Xe=J;J=re,re=Xe}let he,pe,Se=!1;this._decorationService.forEachDecorationAtCell(U,t,void 0,je=>{je.options.layer!=="top"&&Se||(je.backgroundColorRGB&&(re=50331648,ee=je.backgroundColorRGB.rgba>>8&16777215,he=je.backgroundColorRGB),je.foregroundColorRGB&&(J=50331648,ie=je.foregroundColorRGB.rgba>>8&16777215,pe=je.foregroundColorRGB),Se=je.options.layer==="top")}),!Se&&G&&(he=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,ee=he.rgba>>8&16777215,re=50331648,Se=!0,b.selectionForeground&&(J=50331648,ie=b.selectionForeground.rgba>>8&16777215,pe=b.selectionForeground)),Se&&q.push("xterm-decoration-top");let Re;switch(re){case 16777216:case 33554432:Re=b.ansi[ee],q.push(`xterm-bg-${ee}`);break;case 50331648:Re=Jn.toColor(ee>>16,ee>>8&255,ee&255),this._addStyle(S,`background-color:#${fR((ee>>>0).toString(16),"0",6)}`);break;case 0:default:ce?(Re=b.foreground,q.push("xterm-bg-257")):Re=b.background}switch(he||z.isDim()&&(he=Sn.multiplyOpacity(Re,.5)),J){case 16777216:case 33554432:z.isBold()&&ie<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ie+=8),this._applyMinimumContrast(S,Re,b.ansi[ie],z,he,void 0)||q.push(`xterm-fg-${ie}`);break;case 50331648:let je=Jn.toColor(ie>>16&255,ie>>8&255,ie&255);this._applyMinimumContrast(S,Re,je,z,he,pe)||this._addStyle(S,`color:#${fR(ie.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(S,Re,b.foreground,z,he,pe)||ce&&q.push("xterm-fg-257")}q.length&&(S.className=q.join(" "),q.length=0),!M&&!V&&!Z&&O?C++:S.textContent=k,Y!==this.defaultSpacing&&(S.style.letterSpacing=`${Y}px`),p.push(S),U=$}return S&&C&&(S.textContent=k),p}_applyMinimumContrast(e,t,n,r,i,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||RG(r.getCode()))return!1;let l=this._getContrastCache(r),c;if(!i&&!o&&(c=l.getColor(t.rgba,n.rgba)),c===void 0){let h=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);c=Sn.ensureContrastRatio(i||t,o||n,h),l.setColor((i||t).rgba,(o||n).rgba,c??null)}return c?(this._addStyle(e,`color:${c.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]}};wx=zn([Pe(1,kD),Pe(2,Kr),Pe(3,Ro),Pe(4,Al),Pe(5,jh),Pe(6,lu)],wx);function fR(e,t,n){for(;e.length<n;)e=t+e;return e}var NG=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[n,r,i,o],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(o),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 i=e;t&&(i+="B"),n&&(i+="I");let o=this._holey.get(i);if(o===void 0){let l=0;t&&(l|=1),n&&(l|=2),o=this._measure(e,l),o>0&&this._holey.set(i,o)}return o}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},MG=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,o=t[1]-i,l=n[1]-i,c=Math.max(o,0),h=Math.min(l,e.rows-1);if(c>=e.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=o,this.viewportEndRow=l,this.viewportCappedStartRow=c,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 AG(){return new MG}var jy="xterm-dom-renderer-owner-",Oi="xterm-rows",Sm="xterm-fg-",mR="xterm-bg-",dd="xterm-focus",Cm="xterm-selection",jG=1,Sx=class extends kt{constructor(e,t,n,r,i,o,l,c,h,d,g,p,v,b){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=o,this._linkifier2=l,this._charSizeService=h,this._optionsService=d,this._bufferService=g,this._coreService=p,this._coreBrowserService=v,this._themeService=b,this._terminalClass=jG++,this._rowElements=[],this._selectionRenderModel=AG(),this.onRequestRedraw=this._register(new Me).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Oi),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(Cm),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=TG(),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=c.createInstance(wx,document),this._element.classList.add(jy+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(Tn(()=>{this._element.classList.remove(jy+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new NG(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} .${Oi} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Oi} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Oi} .xterm-dim { color: ${Sn.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Oi}.${dd} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Oi}.${dd} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Oi}.${dd} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Oi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Oi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Oi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Oi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Oi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Cm} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Cm} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Cm} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,l]of e.ansi.entries())t+=`${this._terminalSelector} .${Sm}${o} { color: ${l.css}; }${this._terminalSelector} .${Sm}${o}.xterm-dim { color: ${Sn.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${mR}${o} { background-color: ${l.css}; }`;t+=`${this._terminalSelector} .${Sm}257 { color: ${Sn.opaque(e.background).css}; }${this._terminalSelector} .${Sm}257.xterm-dim { color: ${Sn.multiplyOpacity(Sn.opaque(e.background),.5).css}; }${this._terminalSelector} .${mR}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(dd),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(dd),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,c=this._document.createDocumentFragment();if(n){let h=e[0]>t[0];c.appendChild(this._createSelectionElement(o,h?t[0]:e[0],h?e[0]:t[0],l-o+1))}else{let h=r===o?e[0]:0,d=o===i?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(o,h,d));let g=l-o-1;if(c.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,g)),o!==l){let p=i===l?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(l,0,p))}}this._selectionContainer.appendChild(c)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(n-t);return o+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-o),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${o}px`,i.style.width=`${l}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,c=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,c,i,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${jy}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,o){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),i=Math.min(i,this._bufferService.cols);let c=this._bufferService.buffer,h=c.ybase+c.y,d=Math.min(c.x,i-1),g=this._optionsService.rawOptions.cursorBlink,p=this._optionsService.rawOptions.cursorStyle,v=this._optionsService.rawOptions.cursorInactiveStyle;for(let b=n;b<=r;++b){let w=b+c.ydisp,S=this._rowElements[b],C=c.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,o?b===n?e:0:-1,o?(b===r?t:i)-1:-1))}}};Sx=zn([Pe(7,Cw),Pe(8,Ng),Pe(9,Kr),Pe(10,qr),Pe(11,Al),Pe(12,Ro),Pe(13,lu)],Sx);var Cx=class extends kt{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Me),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new OG(this._optionsService))}catch{this._measureStrategy=this._register(new DG(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())}};Cx=zn([Pe(2,Kr)],Cx);var VD=class extends kt{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)}},DG=class extends VD{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}},OG=class extends VD{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}},LG=class extends kt{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 zG(this._window)),this._onDprChange=this._register(new Me),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Me),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Nr.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(lt(this._textarea,"focus",()=>this._isFocused=!0)),this._register(lt(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}},zG=class extends kt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Vc),this._onDprChange=this._register(new Me),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Tn(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=lt(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)}},PG=class extends kt{constructor(){super(),this.linkProviders=[],this._register(Tn(()=>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 jw(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),o=parseInt(i.getPropertyValue("padding-left")),l=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-r.left-o,t.clientY-r.top-l]}function IG(e,t,n,r,i,o,l,c,h){if(!o)return;let d=jw(e,t,n);if(d)return d[0]=Math.ceil((d[0]+(h?l/2:0))/l),d[1]=Math.ceil(d[1]/c),d[0]=Math.min(Math.max(d[0],1),r+(h?1:0)),d[1]=Math.min(Math.max(d[1],1),i),d}var kx=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return IG(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=jw(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])}}};kx=zn([Pe(0,To),Pe(1,Ng)],kx);var BG=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=[]}},WD={};Yq(WD,{getSafariVersion:()=>HG,isChromeOS:()=>YD,isFirefox:()=>qD,isIpad:()=>$G,isIphone:()=>UG,isLegacyEdge:()=>FG,isLinux:()=>Dw,isMac:()=>Mp,isNode:()=>Mg,isSafari:()=>KD,isWindows:()=>GD});var Mg=typeof process<"u"&&"title"in process,Dh=Mg?"node":navigator.userAgent,Oh=Mg?"node":navigator.platform,qD=Dh.includes("Firefox"),FG=Dh.includes("Edge"),KD=/^((?!chrome|android).)*safari/i.test(Dh);function HG(){if(!KD)return 0;let e=Dh.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Mp=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Oh),$G=Oh==="iPad",UG=Oh==="iPhone",GD=["Windows","Win16","Win32","WinCE"].includes(Oh),Dw=Oh.indexOf("Linux")>=0,YD=/\bCrOS\b/.test(Dh),XD=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(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},VG=class extends XD{_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())}}},WG=class extends XD{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Ap=!Mg&&"requestIdleCallback"in window?WG:VG,qG=class{constructor(){this._queue=new Ap}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Ex=class extends kt{constructor(e,t,n,r,i,o,l,c,h){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=c,this._renderer=this._register(new Vc),this._pausedResizeTask=new qG,this._observerDisposable=this._register(new Vc),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 Me),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Me),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Me),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Me),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new BG((d,g)=>this._renderRows(d,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new KG(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Tn(()=>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(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.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=Tn(()=>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()}};Ex=zn([Pe(2,Kr),Pe(3,Ng),Pe(4,Al),Pe(5,jh),Pe(6,qr),Pe(7,Ro),Pe(8,lu)],Ex);var KG=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 GG(e,t,n,r){let i=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return ZG(i,o,e,t,n,r)+Ag(o,t,n,r)+QG(i,o,e,t,n,r);let l;if(o===t)return l=i>e?"D":"C",oh(Math.abs(i-e),sh(l,r));l=o>t?"D":"C";let c=Math.abs(o-t),h=XG(o>t?e:i,n)+(c-1)*n.cols+1+YG(o>t?i:e);return oh(h,sh(l,r))}function YG(e,t){return e-1}function XG(e,t){return t.cols-e}function ZG(e,t,n,r,i,o){return Ag(t,r,i,o).length===0?"":oh(QD(e,t,e,t-wl(t,i),!1,i).length,sh("D",o))}function Ag(e,t,n,r){let i=e-wl(e,n),o=t-wl(t,n),l=Math.abs(i-o)-JG(e,t,n);return oh(l,sh(ZD(e,t),r))}function QG(e,t,n,r,i,o){let l;Ag(t,r,i,o).length>0?l=r-wl(r,i):l=t;let c=r,h=eY(e,t,n,r,i,o);return oh(QD(e,l,n,c,h==="C",i).length,sh(h,o))}function JG(e,t,n){var l;let r=0,i=e-wl(e,n),o=t-wl(t,n);for(let c=0;c<Math.abs(i-o);c++){let h=ZD(e,t)==="A"?-1:1;(l=n.buffer.lines.get(i+h*c))!=null&&l.isWrapped&&r++}return r}function wl(e,t){let n=0,r=t.buffer.lines.get(e),i=r==null?void 0:r.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r==null?void 0:r.isWrapped;return n}function eY(e,t,n,r,i,o){let l;return Ag(n,r,i,o).length>0?l=r-wl(r,i):l=t,e<n&&l<=r||e>=n&&l<r?"C":"D"}function ZD(e,t){return e>t?"A":"B"}function QD(e,t,n,r,i,o){let l=e,c=t,h="";for(;(l!==n||c!==r)&&c>=0&&c<o.buffer.lines.length;)l+=i?1:-1,i&&l>o.cols-1?(h+=o.buffer.translateBufferLineToString(c,!1,e,l),l=0,e=0,c++):!i&&l<0&&(h+=o.buffer.translateBufferLineToString(c,!1,0,e+1),l=o.cols-1,e=l,c--);return h+o.buffer.translateBufferLineToString(c,!1,e,l)}function sh(e,t){let n=t?"O":"[";return be.ESC+n+e}function oh(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var tY=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 pR(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 Dy=50,nY=15,rY=50,iY=500,sY=" ",oY=new RegExp(sY,"g"),Rx=class extends kt{constructor(e,t,n,r,i,o,l,c,h){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=o,this._optionsService=l,this._renderService=c,this._coreBrowserService=h,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new qi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Me),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Me),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Me),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Me),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 tY(this._bufferService),this._activeSelectionMode=0,this._register(Tn(()=>{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 i=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let l=e[1];l<=t[1];l++){let c=n.translateBufferLineToString(l,!0,i,o);r.push(c)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let o=e[1]+1;o<=t[1]-1;o++){let l=n.lines.get(o),c=n.translateBufferLineToString(o,!0);l!=null&&l.isWrapped?r[r.length-1]+=c:r.push(c)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),l=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?r[r.length-1]+=l:r.push(l)}}return r.map(i=>i.replace(oY," ")).join(GD?`\r
553
+ `:`
554
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Dw&&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 i,o;let n=(o=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:o.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=pR(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=jw(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,-Dy),Dy),t/=Dy,t/Math.abs(t)+Math.round(t*(nY-1)))}shouldForceSelection(e){return Mp?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(),rY)}_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&&!(Mp&&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<iY&&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=GG(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 i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,o=i.lines.get(e[1]);if(!o)return;let l=i.translateBufferLineToString(e[1],!1),c=this._convertViewportColToCharacterIndex(o,e[0]),h=c,d=e[0]-c,g=0,p=0,v=0,b=0;if(l.charAt(c)===" "){for(;c>0&&l.charAt(c-1)===" ";)c--;for(;h<l.length&&l.charAt(h+1)===" ";)h++}else{let C=e[0],k=e[0];o.getWidth(C)===0&&(g++,C--),o.getWidth(k)===2&&(p++,k++);let R=o.getString(k).length;for(R>1&&(b+=R-1,h+=R-1);C>0&&c>0&&!this._isCharWordSeparator(o.loadCell(C-1,this._workCell));){o.loadCell(C-1,this._workCell);let E=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,C--):E>1&&(v+=E-1,c-=E-1),c--,C--}for(;k<o.length&&h+1<l.length&&!this._isCharWordSeparator(o.loadCell(k+1,this._workCell));){o.loadCell(k+1,this._workCell);let E=this._workCell.getChars().length;this._workCell.getWidth()===2?(p++,k++):E>1&&(b+=E-1,h+=E-1),h++,k++}}h++;let w=c+d-g+v,S=Math.min(this._bufferService.cols,h-c+g+p-v-b);if(!(!t&&l.slice(c,h).trim()==="")){if(n&&w===0&&o.getCodePoint(0)!==32){let C=i.lines.get(e[1]-1);if(C&&o.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&&o.getCodePoint(this._bufferService.cols-1)!==32){let C=i.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=pR(n,this._bufferService.cols)}};Rx=zn([Pe(3,qr),Pe(4,Al),Pe(5,kw),Pe(6,Kr),Pe(7,To),Pe(8,Ro)],Rx);var gR=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={}}},vR=class{constructor(){this._color=new gR,this._css=new gR}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()}},rr=Object.freeze((()=>{let e=[Mn.toColor("#2e3436"),Mn.toColor("#cc0000"),Mn.toColor("#4e9a06"),Mn.toColor("#c4a000"),Mn.toColor("#3465a4"),Mn.toColor("#75507b"),Mn.toColor("#06989a"),Mn.toColor("#d3d7cf"),Mn.toColor("#555753"),Mn.toColor("#ef2929"),Mn.toColor("#8ae234"),Mn.toColor("#fce94f"),Mn.toColor("#729fcf"),Mn.toColor("#ad7fa8"),Mn.toColor("#34e2e2"),Mn.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],o=t[n%6];e.push({css:Jn.toCss(r,i,o),rgba:Jn.toRgba(r,i,o)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Jn.toCss(r,r,r),rgba:Jn.toRgba(r,r,r)})}return e})()),tl=Mn.toColor("#ffffff"),Rd=Mn.toColor("#000000"),_R=Mn.toColor("#ffffff"),yR=Rd,hd={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},aY=tl,Tx=class extends kt{constructor(e){super(),this._optionsService=e,this._contrastCache=new vR,this._halfContrastCache=new vR,this._onChangeColors=this._register(new Me),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:tl,background:Rd,cursor:_R,cursorAccent:yR,selectionForeground:void 0,selectionBackgroundTransparent:hd,selectionBackgroundOpaque:Sn.blend(Rd,hd),selectionInactiveBackgroundTransparent:hd,selectionInactiveBackgroundOpaque:Sn.blend(Rd,hd),scrollbarSliderBackground:Sn.opacity(tl,.2),scrollbarSliderHoverBackground:Sn.opacity(tl,.4),scrollbarSliderActiveBackground:Sn.opacity(tl,.5),overviewRulerBorder:tl,ansi:rr.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=un(e.foreground,tl),t.background=un(e.background,Rd),t.cursor=Sn.blend(t.background,un(e.cursor,_R)),t.cursorAccent=Sn.blend(t.background,un(e.cursorAccent,yR)),t.selectionBackgroundTransparent=un(e.selectionBackground,hd),t.selectionBackgroundOpaque=Sn.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=un(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Sn.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?un(e.selectionForeground,hR):void 0,t.selectionForeground===hR&&(t.selectionForeground=void 0),Sn.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Sn.opacity(t.selectionBackgroundTransparent,.3)),Sn.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Sn.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=un(e.scrollbarSliderBackground,Sn.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=un(e.scrollbarSliderHoverBackground,Sn.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=un(e.scrollbarSliderActiveBackground,Sn.opacity(t.foreground,.5)),t.overviewRulerBorder=un(e.overviewRulerBorder,aY),t.ansi=rr.slice(),t.ansi[0]=un(e.black,rr[0]),t.ansi[1]=un(e.red,rr[1]),t.ansi[2]=un(e.green,rr[2]),t.ansi[3]=un(e.yellow,rr[3]),t.ansi[4]=un(e.blue,rr[4]),t.ansi[5]=un(e.magenta,rr[5]),t.ansi[6]=un(e.cyan,rr[6]),t.ansi[7]=un(e.white,rr[7]),t.ansi[8]=un(e.brightBlack,rr[8]),t.ansi[9]=un(e.brightRed,rr[9]),t.ansi[10]=un(e.brightGreen,rr[10]),t.ansi[11]=un(e.brightYellow,rr[11]),t.ansi[12]=un(e.brightBlue,rr[12]),t.ansi[13]=un(e.brightMagenta,rr[13]),t.ansi[14]=un(e.brightCyan,rr[14]),t.ansi[15]=un(e.brightWhite,rr[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]=un(e.extendedAnsi[r],rr[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()}}};Tx=zn([Pe(0,Kr)],Tx);function un(e,t){if(e!==void 0)try{return Mn.toColor(e)}catch{}return t}var lY=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)}},cY=class{constructor(){this._services=new lY,this._services.set(Cw,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=nK(e).sort((o,l)=>o.index-l.index),r=[];for(let o of n){let l=this._services.get(o.id);if(!l)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);r.push(l)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},uY={trace:0,debug:1,info:2,warn:3,error:4,off:5},dY="xterm.js: ",Nx=class extends kt{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=uY[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?"":dY)+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)}};Nx=zn([Pe(0,Kr)],Nx);var bR=class extends kt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Me),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Me),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Me),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 i=t-1;i>=0;i--)this.set(e+i+n,this.get(e+i));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}},St=3,Xn=Object.freeze(new Ah),km=0,Oy=2,Td=class JD{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*St);let i=n||qi.fromCharData([0,_D,1,0]);for(let o=0;o<t;++o)this.setCell(o,i);this.length=t}get(t){let n=this._data[t*St+0],r=n&2097151;return[this._data[t*St+1],n&2097152?this._combined[t]:r?da(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*St+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*St+0]=t|2097152|n[2]<<22):this._data[t*St+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*St+0]>>22}hasWidth(t){return this._data[t*St+0]&12582912}getFg(t){return this._data[t*St+1]}getBg(t){return this._data[t*St+2]}hasContent(t){return this._data[t*St+0]&4194303}getCodePoint(t){let n=this._data[t*St+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*St+0]&2097152}getString(t){let n=this._data[t*St+0];return n&2097152?this._combined[t]:n&2097151?da(n&2097151):""}isProtected(t){return this._data[t*St+2]&536870912}loadCell(t,n){return km=t*St,n.content=this._data[km+0],n.fg=this._data[km+1],n.bg=this._data[km+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*St+0]=n.content,this._data[t*St+1]=n.fg,this._data[t*St+2]=n.bg}setCellFromCodepoint(t,n,r,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*St+0]=n|r<<22,this._data[t*St+1]=i.fg,this._data[t*St+2]=i.bg}addCodepointToCell(t,n,r){let i=this._data[t*St+0];i&2097152?this._combined[t]+=da(n):i&2097151?(this._combined[t]=da(i&2097151)+da(n),i&=-2097152,i|=2097152):i=n|1<<22,r&&(i&=-12582913,i|=r<<22),this._data[t*St+0]=i}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 i=new qi;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,i));for(let o=0;o<n;++o)this.setCell(t+o,r)}else for(let i=t;i<this.length;++i)this.setCell(i,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 i=new qi;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,i));for(let o=this.length-n;o<this.length;++o)this.setCell(o,r)}else for(let i=t;i<this.length;++i)this.setCell(i,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,i=!1){if(i){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*Oy<this._data.buffer.byteLength;let r=t*St;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let i=new Uint32Array(r);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,n)}else{this._data=this._data.subarray(0,r);let i=Object.keys(this._combined);for(let l=0;l<i.length;l++){let c=parseInt(i[l],10);c>=t&&delete this._combined[c]}let o=Object.keys(this._extendedAttrs);for(let l=0;l<o.length;l++){let c=parseInt(o[l],10);c>=t&&delete this._extendedAttrs[c]}}return this.length=t,r*4*Oy<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Oy<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 JD(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*St+0]&4194303)return t+(this._data[t*St+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*St+0]&4194303||this._data[t*St+2]&50331648)return t+(this._data[t*St+0]>>22);return 0}copyCellsFrom(t,n,r,i,o){let l=t._data;if(o)for(let h=i-1;h>=0;h--){for(let d=0;d<St;d++)this._data[(r+h)*St+d]=l[(n+h)*St+d];l[(n+h)*St+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[n+h])}else for(let h=0;h<i;h++){for(let d=0;d<St;d++)this._data[(r+h)*St+d]=l[(n+h)*St+d];l[(n+h)*St+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[n+h])}let c=Object.keys(t._combined);for(let h=0;h<c.length;h++){let d=parseInt(c[h],10);d>=n&&(this._combined[d-n+r]=t._combined[d])}}translateToString(t,n,r,i){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),i&&(i.length=0);let o="";for(;n<r;){let l=this._data[n*St+0],c=l&2097151,h=l&2097152?this._combined[n]:c?da(c):pa;if(o+=h,i)for(let d=0;d<h.length;++d)i.push(n);n+=l>>22||1}return i&&i.push(n),o}};function hY(e,t,n,r,i,o){let l=[];for(let c=0;c<e.length-1;c++){let h=c,d=e.get(++h);if(!d.isWrapped)continue;let g=[e.get(c)];for(;h<e.length&&d.isWrapped;)g.push(d),d=e.get(++h);if(!o&&r>=c&&r<h){c+=g.length-1;continue}let p=0,v=ah(g,p,t),b=1,w=0;for(;b<g.length;){let C=ah(g,b,t),k=C-w,R=n-v,E=Math.min(k,R);g[p].copyCellsFrom(g[b],w,v,E,!1),v+=E,v===n&&(p++,v=0),w+=E,w===C&&(b++,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,i))}g[p].replaceCells(v,n,i);let S=0;for(let C=g.length-1;C>0&&(C>p||g[C].getTrimmedLength()===0);C--)S++;S>0&&(l.push(c+g.length-S),l.push(S)),c+=g.length-1}return l}function fY(e,t){let n=[],r=0,i=t[r],o=0;for(let l=0;l<e.length;l++)if(i===l){let c=t[++r];e.onDeleteEmitter.fire({index:l-o,amount:c}),l+=c-1,o+=c,i=t[++r]}else n.push(l);return{layout:n,countRemoved:o}}function mY(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 pY(e,t,n){let r=[],i=e.map((h,d)=>ah(e,d,t)).reduce((h,d)=>h+d),o=0,l=0,c=0;for(;c<i;){if(i-c<n){r.push(i-c);break}o+=n;let h=ah(e,l,t);o>h&&(o-=h,l++);let d=e[l].getWidth(o-1)===2;d&&o--;let g=d?n-1:n;r.push(g),c+=g}return r}function ah(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var eO=class tO{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=tO._nextId++,this._onDispose=this.register(new Me),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),xl(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};eO._nextId=1;var gY=eO,ar={},nl=ar.B;ar[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ar.A={"#":"£"};ar.B=void 0;ar[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ar.C=ar[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ar.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ar.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ar.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ar.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ar.E=ar[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ar.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ar.H=ar[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ar["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var xR=4294967295,wR=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=Xn.clone(),this.savedCharset=nl,this.markers=[],this._nullCell=qi.fromCharData([0,_D,1,0]),this._whitespaceCell=qi.fromCharData([0,pa,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Ap,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new bR(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 Rp),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 Rp),this._whitespaceCell}getBlankLine(e,t){return new Td(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>xR?xR:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Xn);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 bR(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Xn),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let l=0;l<this.lines.length;l++)r+=+this.lines.get(l).resize(e,n);let o=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 Td(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new Td(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(i<this.lines.maxLength){let l=this.lines.length-i;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=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),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 o=0;o<this.lines.length;o++)r+=+this.lines.get(o).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=hY(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Xn),n);if(r.length>0){let i=fY(this.lines,r);mY(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Xn),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Td(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(Xn),i=[],o=0;for(let l=this.lines.length-1;l>=0;l--){let c=this.lines.get(l);if(!c||!c.isWrapped&&c.getTrimmedLength()<=e)continue;let h=[c];for(;c.isWrapped&&l>0;)c=this.lines.get(--l),h.unshift(c);if(!n){let E=this.ybase+this.y;if(E>=l&&E<l+h.length)continue}let d=h[h.length-1].getTrimmedLength(),g=pY(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 b=[];for(let E=0;E<p;E++){let N=this.getBlankLine(Xn,!0);b.push(N)}b.length>0&&(i.push({start:l+h.length+o,newLines:b}),o+=b.length),h.push(...b);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=ah(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+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+p,this.ybase+t-1)}if(i.length>0){let l=[],c=[];for(let S=0;S<this.lines.length;S++)c.push(this.lines.get(S));let h=this.lines.length,d=h-1,g=0,p=i[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let v=0;for(let S=Math.min(this.lines.maxLength-1,h+o-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=i[++g]}else this.lines.set(S,c[d--]);let b=0;for(let S=l.length-1;S>=0;S--)l[S].index+=b,this.lines.onInsertEmitter.fire(l[S]),b+=l[S].amount;let w=Math.max(0,h+o-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(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 gY(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)}},vY=class extends kt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Me),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 wR(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new wR(!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)}},nO=2,rO=1,Mx=class extends kt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Me),this.onResize=this._onResize.event,this._onScroll=this._register(new Me),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,nO),this.rows=Math.max(e.rawOptions.rows||0,rO),this.buffers=this._register(new vY(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 i=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(n.scrollTop===0){let l=n.lines.isFull;o===n.lines.length-1?l?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(o+1,0,r.clone()),l?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let l=o-i+1;n.lines.shiftElements(i+1,l-1,-1),n.lines.set(o,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))}};Mx=zn([Pe(0,Kr)],Mx);var _c={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:Mp,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},_Y=["normal","bold","100","200","300","400","500","600","700","800","900"],yY=class extends kt{constructor(e){super(),this._onOptionChange=this._register(new Me),this.onOptionChange=this._onOptionChange.event;let t={..._c};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(Tn(()=>{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 _c))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in _c))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=_c[e]),!bY(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=_c[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=_Y.includes(t)?t:_c[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 bY(e){return e==="block"||e==="underline"||e==="bar"}function Nd(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]&&Nd(e[r],t-1);return n}var SR=Object.freeze({insertMode:!1}),CR=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Ax=class extends kt{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 Me),this.onData=this._onData.event,this._onUserInput=this._register(new Me),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Me),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Me),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Nd(SR),this.decPrivateModes=Nd(CR)}reset(){this.modes=Nd(SR),this.decPrivateModes=Nd(CR)}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))}};Ax=zn([Pe(0,qr),Pe(1,SD),Pe(2,Kr)],Ax);var kR={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 Ly(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 zy=String.fromCharCode,ER={DEFAULT:e=>{let t=[Ly(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${zy(t[0])}${zy(t[1])}${zy(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Ly(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Ly(e,!0)};${e.x};${e.y}${t}`}},jx=class extends kt{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 Me),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(kR))this.addProtocol(r,kR[r]);for(let r of Object.keys(ER))this.addEncoding(r,ER[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,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};jx=zn([Pe(0,qr),Pe(1,Al),Pe(2,Kr)],jx);var Py=[[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]],xY=[[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]],ir;function wY(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var SY=class{constructor(){if(this.version="6",!ir){ir=new Uint8Array(65536),ir.fill(1),ir[0]=0,ir.fill(0,1,32),ir.fill(0,127,160),ir.fill(2,4352,4448),ir[9001]=2,ir[9002]=2,ir.fill(2,11904,42192),ir[12351]=1,ir.fill(2,44032,55204),ir.fill(2,63744,64256),ir.fill(2,65040,65050),ir.fill(2,65072,65136),ir.fill(2,65280,65377),ir.fill(2,65504,65511);for(let e=0;e<Py.length;++e)ir.fill(0,Py[e][0],Py[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ir[e]:wY(e,xY)?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 i=cl.extractWidth(t);i===0?r=!1:i>n&&(n=i)}return cl.createPropertyValue(0,n,r)}},cl=class ep{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Me,this.onChange=this._onChange.event;let t=new SY;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,i=t.length;for(let o=0;o<i;++o){let l=t.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=i)return n+this.wcwidth(l);let d=t.charCodeAt(o);56320<=d&&d<=57343?l=(l-55296)*1024+d-56320+65536:n+=this.wcwidth(d)}let c=this.charProperties(l,r),h=ep.extractWidth(c);ep.extractShouldJoin(c)&&(h-=ep.extractWidth(r)),n+=h,r=c}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},CY=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 RR(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 fd=2147483647,kY=256,iO=class Dx{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>kY)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 Dx;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let i=t[r];if(Array.isArray(i))for(let o=0;o<i.length;++o)n.addSubParam(i[o]);else n.addParam(i)}return n}clone(){let t=new Dx(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,i=this._subParamsIdx[n]&255;i-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,i))}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>fd?fd: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>fd?fd: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,i=this._subParamsIdx[n]&255;i-r>0&&(t[n]=this._subParams.slice(r,i))}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,i=r[n-1];r[n-1]=~i?Math.min(i*10+t,fd):t}},md=[],EY=class{constructor(){this._state=0,this._active=md,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=md}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=md,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||md,!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",Tg(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,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=md,this._id=-1,this._state=0}}},gi=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+=Tg(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}},pd=[],RY=class{constructor(){this._handlers=Object.create(null),this._active=pd,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=pd}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=pd,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||pd,!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",Tg(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=pd,this._ident=0}},Md=new iO;Md.addParam(0);var TR=class{constructor(e){this._handler=e,this._data="",this._params=Md,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Md,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Tg(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=Md,this._data="",this._hitLimit=!1,n));return this._params=Md,this._data="",this._hitLimit=!1,t}},TY=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},Hi=160,NY=function(){let e=new TY(4095),t=Array.apply(null,Array(256)).map((c,h)=>h),n=(c,h)=>t.slice(c,h),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let o=n(0,14),l;e.setDefault(1,0),e.addMany(r,0,2,0);for(l in o)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(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Hi,0,2,0),e.add(Hi,8,5,8),e.add(Hi,6,0,6),e.add(Hi,11,0,11),e.add(Hi,13,13,13),e}(),MY=class extends kt{constructor(e=NY){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 iO,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(Tn(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new EY),this._dcsParser=this._register(new RY),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 i=0;i<e.intermediates.length;++i){let o=e.intermediates.charCodeAt(i);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=o}}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 i=r.indexOf(t);i!==-1&&r.splice(i,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 i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,o=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=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 c=this._parseStack.handlers,h=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&h>-1){for(;h>=0&&(l=c[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=c[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,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let c=o;c<t;++c){switch(r=e[c],i=this._transitions.table[this.currentState<<8|(r<160?r:Hi)],i>>4){case 2:for(let v=c+1;;++v){if(v>=t||(r=e[v])<32||r>126&&r<Hi){this._printHandler(e,c,v),c=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<Hi){this._printHandler(e,c,v),c=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<Hi){this._printHandler(e,c,v),c=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<Hi){this._printHandler(e,c,v),c=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:c,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,i,c),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(++c<t&&(r=e[c])>47&&r<60);c--;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,i,c),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=c+1;;++v)if(v>=t||(r=e[v])===24||r===26||r===27||r>127&&r<Hi){this._dcsParser.put(e,c,v),c=v-1;break}break;case 14:if(l=this._dcsParser.unhook(r!==24&&r!==26),l)return this._preserveStack(6,[],0,i,c),l;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let v=c+1;;v++)if(v>=t||(r=e[v])<32||r>127&&r<Hi){this._oscParser.put(e,c,v),c=v-1;break}break;case 6:if(l=this._oscParser.end(r!==24&&r!==26),l)return this._preserveStack(5,[],0,i,c),l;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},AY=/^([\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})$/,jY=/^[\da-f]+$/;function NR(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=AY.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),jY.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let i=0;i<3;++i){let o=parseInt(t.slice(n*i,n*i+n),16);r[i]=n===1?o<<4:n===2?o:n===3?o>>4:o>>8}return r}}function Iy(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 DY(e,t=16){let[n,r,i]=e;return`rgb:${Iy(n,t)}/${Iy(r,t)}/${Iy(i,t)}`}var OY={"(":0,")":1,"*":2,"+":3,"-":1,".":2},oa=131072,MR=10;function AR(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 jR=5e3,DR=0,LY=class extends kt{constructor(e,t,n,r,i,o,l,c,h=new MY){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=o,this._coreMouseService=l,this._unicodeService=c,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new eK,this._utf8Decoder=new tK,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Xn.clone(),this._eraseAttrDataInternal=Xn.clone(),this._onRequestBell=this._register(new Me),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Me),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Me),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Me),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Me),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Me),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Me),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Me),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Me),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Me),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Me),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Me),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Me),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 Ox(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(be.BEL,()=>this.bell()),this._parser.setExecuteHandler(be.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(be.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(be.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(be.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(be.BS,()=>this.backspace()),this._parser.setExecuteHandler(be.HT,()=>this.tab()),this._parser.setExecuteHandler(be.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(be.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Qm.IND,()=>this.index()),this._parser.setExecuteHandler(Qm.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Qm.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new gi(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new gi(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new gi(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new gi(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new gi(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new gi(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new gi(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new gi(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new gi(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new gi(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new gi(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new gi(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 ar)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 TR((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"),jR))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${jR} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,o=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,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>oa&&(o=this._parseStack.position+oa)}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<oa&&(this._parseBuffer=new Uint32Array(Math.min(e.length,oa))),l||this._dirtyRowTracker.clearRange(),e.length>oa)for(let d=o;d<e.length;d+=oa){let g=d+oa<e.length?d+oa: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,i,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,i,d,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let c=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(c,this._bufferService.rows-1)})}print(e,t,n){let r,i,o=this._charsetService.charset,l=this._optionsService.rawOptions.screenReaderMode,c=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 b=t;b<n;++b){if(r=e[b],r<127&&o){let k=o[String.fromCharCode(r)];k&&(r=k.charCodeAt(0))}let w=this._unicodeService.charProperties(r,v);i=cl.extractWidth(w);let S=cl.extractShouldJoin(w),C=S?cl.extractWidth(v):0;if(v=w,l&&this._onA11yChar.fire(da(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-C>c){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 Td&&p.copyCellsFrom(k,R,0,C,!1);R<c;)k.setCellFromCodepoint(R++,0,1,g)}else if(this._activeBuffer.x=c-1,i===2)continue}if(S&&this._activeBuffer.x){let k=p.getWidth(this._activeBuffer.x-1)?1:2;p.addCodepointToCell(this._activeBuffer.x-k,r,i);for(let R=i-C;--R>=0;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(d&&(p.insertCells(this._activeBuffer.x,i-C,this._activeBuffer.getNullCell(g)),p.getWidth(c-1)===2&&p.setCellFromCodepoint(c-1,0,1,g)),p.setCellFromCodepoint(this._activeBuffer.x++,r,i,g),i>0)for(;--i;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=v,this._activeBuffer.x<c&&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=>AR(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new TR(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new gi(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,i=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(o.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 i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Xn));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=cl.extractWidth(t),i=this._activeBuffer.x-r,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),l=new Uint32Array(o.length*n),c=0;for(let d=0;d<o.length;){let g=o.codePointAt(d)||0;l[c++]=g,d+=g>65535?2:1}let h=c;for(let d=1;d<n;++d)l.copyWithin(h,0,c),h+=c;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(be.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(be.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(be.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(be.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(be.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,nl),this._charsetService.setgCharset(1,nl),this._charsetService.setgCharset(2,nl),this._charsetService.setgCharset(3,nl);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:i,activeEncoding:o}=this._coreMouseService,l=this._coreService,{buffers:c,cols:h}=this._bufferService,{active:d,alt:g}=c,p=this._optionsService.rawOptions,v=(S,C)=>(l.triggerDataEvent(`${be.ESC}[${t?"":"?"}${S};${C}$y`),!0),b=S=>S?1:2,w=e.params[0];return t?w===2?v(w,4):w===4?v(w,b(l.modes.insertMode)):w===12?v(w,3):w===20?v(w,b(p.convertEol)):v(w,0):w===1?v(w,b(r.applicationCursorKeys)):w===3?v(w,p.windowOptions.setWinLines?h===80?2:h===132?1:0:0):w===6?v(w,b(r.origin)):w===7?v(w,b(r.wraparound)):w===8?v(w,3):w===9?v(w,b(i==="X10")):w===12?v(w,b(p.cursorBlink)):w===25?v(w,b(!l.isCursorHidden)):w===45?v(w,b(r.reverseWraparound)):w===66?v(w,b(r.applicationKeypad)):w===67?v(w,4):w===1e3?v(w,b(i==="VT200")):w===1002?v(w,b(i==="DRAG")):w===1003?v(w,b(i==="ANY")):w===1004?v(w,b(r.sendFocus)):w===1005?v(w,4):w===1006?v(w,b(o==="SGR")):w===1015?v(w,4):w===1016?v(w,b(o==="SGR_PIXELS")):w===1048?v(w,1):w===47||w===1047||w===1049?v(w,b(d===g)):w===2004?v(w,b(r.bracketedPasteMode)):w===2026?v(w,b(r.synchronizedOutput)):v(w,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Ah.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,o=0;do{if(r[o+i]=e.params[t+o],e.hasSubParams(t+o)){let l=e.getSubParams(t+o),c=0;do r[1]===5&&(i=1),r[o+c+1+i]=l[c];while(++c<l.length&&c+o+1+i<r.length);break}if(r[1]===5&&o+i>=2||r[1]===2&&o+i>=5)break;r[1]&&(i=1)}while(++o+t<e.length&&o+i<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 o}_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=Xn.fg,e.bg=Xn.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=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(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=Xn.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Xn.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=Xn.fg&16777215,r.bg&=-67108864,r.bg|=Xn.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${be.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${be.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(`${be.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=Xn.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(!AR(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(`${be.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>MR&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>MR&&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(),i=n.shift();if(/^\d+$/.exec(r)){let o=parseInt(r);if(OR(o))if(i==="?")t.push({type:0,index:o});else{let l=NR(i);l&&t.push({type:1,index:o,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,i=n.findIndex(o=>o.startsWith("id="));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let 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 i=NR(n[r]);i&&this._onColor.fire([{type:1,index:this._specialColors[t],color:i}])}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 i=parseInt(n[r]);OR(i)&&t.push({type:2,index:i})}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,nl),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(OY[e[0]],ar[e[1]]||nl),!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=Xn.clone(),this._eraseAttrDataInternal=Xn.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 qi;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(`${be.ESC}${l}${be.ESC}\\`),!0),r=this._bufferService.buffer,i=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}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Ox=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&&(DR=e,e=t,t=DR),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Ox=zn([Pe(0,qr)],Ox);function OR(e){return 0<=e&&e<256}var zY=5e7,LR=12,PY=50,IY=class extends kt{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 Me),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>zY)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],i=this._action(r,t);if(i){let l=c=>performance.now()-n>=LR?setTimeout(()=>this._innerWrite(0,c)):this._innerWrite(n,c);i.catch(c=>(queueMicrotask(()=>{throw c}),Promise.resolve(!1))).then(l);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=LR)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>PY&&(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()}},Lx=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 c=t.addMarker(t.ybase+t.y),h={data:e,id:this._nextId++,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(h,c)),this._dataByLinkId.set(h.id,h),h.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let o=t.addMarker(t.ybase+t.y),l={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),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)))}};Lx=zn([Pe(0,qr)],Lx);var zR=!1,BY=class extends kt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Vc),this._onBinary=this._register(new Me),this.onBinary=this._onBinary.event,this._onData=this._register(new Me),this.onData=this._onData.event,this._onLineFeed=this._register(new Me),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Me),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Me),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Me),this._instantiationService=new cY,this.optionsService=this._register(new yY(e)),this._instantiationService.setService(Kr,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Mx)),this._instantiationService.setService(qr,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Nx)),this._instantiationService.setService(SD,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Ax)),this._instantiationService.setService(Al,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(jx)),this._instantiationService.setService(wD,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(cl)),this._instantiationService.setService(sK,this.unicodeService),this._charsetService=this._instantiationService.createInstance(CY),this._instantiationService.setService(iK,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Lx),this._instantiationService.setService(CD,this._oscLinkService),this._inputHandler=this._register(new LY(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Nr.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Nr.forward(this._bufferService.onResize,this._onResize)),this._register(Nr.forward(this.coreService.onData,this._onData)),this._register(Nr.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 IY((t,n)=>this._inputHandler.parse(t,n))),this._register(Nr.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Me),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&&!zR&&(this._logService.warn("writeSync is unreliable and will be removed soon."),zR=!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,nO),t=Math.max(t,rO),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(RR.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(RR(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Tn(()=>{for(let t of e)t.dispose()})}}},FY={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 HY(e,t,n,r){var l;let i={type:0,cancel:!1,key:void 0},o=(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?i.key=be.ESC+"OA":i.key=be.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=be.ESC+"OD":i.key=be.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=be.ESC+"OC":i.key=be.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=be.ESC+"OB":i.key=be.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":be.DEL,e.altKey&&(i.key=be.ESC+i.key);break;case 9:if(e.shiftKey){i.key=be.ESC+"[Z";break}i.key=be.HT,i.cancel=!0;break;case 13:i.key=e.altKey?be.ESC+be.CR:be.CR,i.cancel=!0;break;case 27:i.key=be.ESC,e.altKey&&(i.key=be.ESC+be.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;o?i.key=be.ESC+"[1;"+(o+1)+"D":t?i.key=be.ESC+"OD":i.key=be.ESC+"[D";break;case 39:if(e.metaKey)break;o?i.key=be.ESC+"[1;"+(o+1)+"C":t?i.key=be.ESC+"OC":i.key=be.ESC+"[C";break;case 38:if(e.metaKey)break;o?i.key=be.ESC+"[1;"+(o+1)+"A":t?i.key=be.ESC+"OA":i.key=be.ESC+"[A";break;case 40:if(e.metaKey)break;o?i.key=be.ESC+"[1;"+(o+1)+"B":t?i.key=be.ESC+"OB":i.key=be.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=be.ESC+"[2~");break;case 46:o?i.key=be.ESC+"[3;"+(o+1)+"~":i.key=be.ESC+"[3~";break;case 36:o?i.key=be.ESC+"[1;"+(o+1)+"H":t?i.key=be.ESC+"OH":i.key=be.ESC+"[H";break;case 35:o?i.key=be.ESC+"[1;"+(o+1)+"F":t?i.key=be.ESC+"OF":i.key=be.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=be.ESC+"[5;"+(o+1)+"~":i.key=be.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=be.ESC+"[6;"+(o+1)+"~":i.key=be.ESC+"[6~";break;case 112:o?i.key=be.ESC+"[1;"+(o+1)+"P":i.key=be.ESC+"OP";break;case 113:o?i.key=be.ESC+"[1;"+(o+1)+"Q":i.key=be.ESC+"OQ";break;case 114:o?i.key=be.ESC+"[1;"+(o+1)+"R":i.key=be.ESC+"OR";break;case 115:o?i.key=be.ESC+"[1;"+(o+1)+"S":i.key=be.ESC+"OS";break;case 116:o?i.key=be.ESC+"[15;"+(o+1)+"~":i.key=be.ESC+"[15~";break;case 117:o?i.key=be.ESC+"[17;"+(o+1)+"~":i.key=be.ESC+"[17~";break;case 118:o?i.key=be.ESC+"[18;"+(o+1)+"~":i.key=be.ESC+"[18~";break;case 119:o?i.key=be.ESC+"[19;"+(o+1)+"~":i.key=be.ESC+"[19~";break;case 120:o?i.key=be.ESC+"[20;"+(o+1)+"~":i.key=be.ESC+"[20~";break;case 121:o?i.key=be.ESC+"[21;"+(o+1)+"~":i.key=be.ESC+"[21~";break;case 122:o?i.key=be.ESC+"[23;"+(o+1)+"~":i.key=be.ESC+"[23~";break;case 123:o?i.key=be.ESC+"[24;"+(o+1)+"~":i.key=be.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=be.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=be.DEL:e.keyCode===219?i.key=be.ESC:e.keyCode===220?i.key=be.FS:e.keyCode===221&&(i.key=be.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let c=(l=FY[e.keyCode])==null?void 0:l[e.shiftKey?1:0];if(c)i.key=be.ESC+c;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()),i.key=be.ESC+d}else if(e.keyCode===32)i.key=be.ESC+(e.ctrlKey?be.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),i.key=be.ESC+h,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(i.key=be.US),e.key==="@"&&(i.key=be.NUL));break}return i}var Fn=0,$Y=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Ap,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Ap,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((i,o)=>this._getKey(i)-this._getKey(o)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Fn=this._search(t),Fn===-1)||this._getKey(this._array[Fn])!==t)return!1;do if(this._array[Fn]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Fn),!0;while(++Fn<this._array.length&&this._getKey(this._array[Fn])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,o)=>i-o),t=0,n=new Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Fn=this._search(e),!(Fn<0||Fn>=this._array.length)&&this._getKey(this._array[Fn])===e))do yield this._array[Fn];while(++Fn<this._array.length&&this._getKey(this._array[Fn])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Fn=this._search(e),!(Fn<0||Fn>=this._array.length)&&this._getKey(this._array[Fn])===e))do t(this._array[Fn]);while(++Fn<this._array.length&&this._getKey(this._array[Fn])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},By=0,PR=0,UY=class extends kt{constructor(){super(),this._decorations=new $Y(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new Me),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Me),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Tn(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new VY(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,i=0;for(let o of this._decorations.getKeyIterator(t))r=o.options.x??0,i=r+(o.options.width??1),e>=r&&e<i&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,i=>{By=i.options.x??0,PR=By+(i.options.width??1),e>=By&&e<PR&&(!n||(i.options.layer??"bottom")===n)&&r(i)})}},VY=class extends _a{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Me),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Me),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=Mn.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Mn.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},WY=1e3,qY=class{constructor(e,t=WY){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 i=r-this._lastRefreshMs,o=this._debounceThresholdMS-i;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_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)}},IR=20,jp=class extends kt{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new qY(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(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
555
+ `))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(lt(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Tn(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<IR+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
556
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===IR+1&&(this._liveRegion.textContent+=tx.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 i=e;i<=t;i++){let o=n.lines.get(n.ydisp+i),l=[],c=(o==null?void 0:o.translateToString(!0,void 0,void 0,l))||"",h=(n.ydisp+i+1).toString(),d=this._rowElements[i];d&&(c.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=c,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],i=n.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===o||e.relatedTarget!==r)return;let l,c;if(t===0?(l=n,c=this._rowElements.pop(),this._rowContainer.removeChild(c)):(l=this._rowElements.shift(),c=n,this._rowContainer.removeChild(l)),l.removeEventListener("focus",this._topBoundaryFocusListener),c.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 c;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:((c=r.textContent)==null?void 0:c.length)??0}),!this._rowContainer.contains(n.node))return;let i=({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 b=d<v.length?v[d]:v.slice(-1)[0]+1;return b>=this._terminal.cols&&(++p,b=0),{row:p,column:b}},o=i(t),l=i(n);if(!(!o||!l)){if(o.row>l.row||o.row===l.row&&o.column>=l.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(l.row-o.row)*this._terminal.cols-o.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 i,o;e.style.transform="";let t=e.getBoundingClientRect().width,n=(o=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:o[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};jp=zn([Pe(1,Cw),Pe(2,Ro),Pe(3,To)],jp);var zx=class extends kt{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Me),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Me),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Tn(()=>{var o;xl(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(o=this._activeProviderReplies)==null||o.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(lt(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(lt(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(lt(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(lt(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 i=n[r];if(i.classList.contains("xterm"))break;if(i.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,i;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(o=>{o==null||o.forEach(l=>{l.link.dispose&&l.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[o,l]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(o)&&(n=this._checkLinkProviderResult(o,e,n)):l.provideLinks(e.y,c=>{var d,g;if(this._isMouseOut)return;let h=c==null?void 0:c.map(p=>({link:p}));(d=this._activeProviderReplies)==null||d.set(o,h),n=this._checkLinkProviderResult(o,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 i=t.get(r);if(i)for(let o=0;o<i.length;o++){let l=i[o],c=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=c;d<=h;d++){if(n.has(d)){i.splice(o--,1);break}n.add(d)}}}}_checkLinkProviderResult(e,t,n){var o;if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let l=0;l<e;l++)(!this._activeProviderReplies.has(l)||this._activeProviderReplies.get(l))&&(i=!0);if(!i&&r){let l=r.find(c=>this._linkAtPosition(c.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 c=(o=this._activeProviderReplies.get(l))==null?void 0:o.find(h=>this._linkAtPosition(h.link,t));if(c){n=!0,this._handleNewLink(c);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&&KY(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,xl(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,i,o;(r=this._currentLink)!=null&&r.state&&((o=(i=this._currentLink)==null?void 0:i.state)==null?void 0:o.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,i=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(r,i),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!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,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){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,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};zx=zn([Pe(1,kw),Pe(2,To),Pe(3,qr),Pe(4,ED)],zx);function KY(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 GY=class extends BY{constructor(e={}){super(e),this._linkifier=this._register(new Vc),this.browser=WD,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Vc),this._onCursorMove=this._register(new Me),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Me),this.onKey=this._onKey.event,this._onRender=this._register(new Me),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Me),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Me),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Me),this.onBell=this._onBell.event,this._onFocus=this._register(new Me),this._onBlur=this._register(new Me),this._onA11yCharEmitter=this._register(new Me),this._onA11yTabEmitter=this._register(new Me),this._onWillOpen=this._register(new Me),this._setup(),this._decorationService=this._instantiationService.createInstance(UY),this._instantiationService.setService(jh,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(PG),this._instantiationService.setService(ED,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(rx)),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(Nr.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Nr.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Nr.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Nr.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Tn(()=>{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 i=Sn.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${be.ESC}]${r};${DY(i)}${UD.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Jn.toColor(...t.color));else{let o=n;this._themeService.modifyColors(l=>l[o]=Jn.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(jp,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(be.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(be.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*i,l=this.buffer.y*this._renderService.dimensions.css.cell.height,c=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=c+"px",this.textarea.style.top=l+"px",this.textarea.style.width=o+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(lt(this.element,"copy",t=>{this.hasSelection()&&Qq(t,this._selectionService)}));let e=t=>Jq(t,this.textarea,this.coreService,this.optionsService);this._register(lt(this.textarea,"paste",e)),this._register(lt(this.element,"paste",e)),qD?this._register(lt(this.element,"mousedown",t=>{t.button===2&&GE(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(lt(this.element,"contextmenu",t=>{GE(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Dw&&this._register(lt(this.element,"auxclick",t=>{t.button===1&&vD(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(lt(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(lt(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(lt(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(lt(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(lt(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(lt(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(lt(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var i;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"),((i=this.element)==null?void 0:i.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(lt(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",ex.get()),YD||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(LG,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Ro,this._coreBrowserService),this._register(lt(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(lt(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Cx,this._document,this._helperContainer),this._instantiationService.setService(Ng,this._charSizeService),this._themeService=this._instantiationService.createInstance(Tx),this._instantiationService.setService(lu,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Np),this._instantiationService.setService(kD,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Ex,this.rows,this.screenElement)),this._instantiationService.setService(To,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(xx,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(kx),this._instantiationService.setService(kw,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(zx,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(yx,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Rx,this.element,this.screenElement,r)),this._instantiationService.setService(aK,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(Nr.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(bx,this.screenElement)),this._register(lt(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(jp,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Tp,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Tp,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Sx,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){var d,g,p,v,b;let l=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!l)return!1;let c,h;switch(o.overrideType||o.type){case"mousemove":h=32,o.buttons===void 0?(c=3,o.button!==void 0&&(c=o.button<3?o.button:3)):c=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":h=0,c=o.button<3?o.button:3;break;case"mousedown":h=1,c=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let w=o.deltaY;if(w===0||e.coreMouseService.consumeWheelEvent(o,(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,(b=e._coreBrowserService)==null?void 0:b.dpr)===0)return!1;h=w<0?0:1,c=4;break;default:return!1}return h===void 0||c===void 0||c>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:c,action:h,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:o=>(n(o),o.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(o)),wheel:o=>(n(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&n(o)},mousemove:o=>{o.buttons||n(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),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()),o&8?r.mousemove||(t.addEventListener("mousemove",i.mousemove),r.mousemove=i.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),o&16?r.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),r.wheel=i.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),o&2?r.mouseup||(r.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),o&4?r.mousedrag||(r.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(lt(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return n(o),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(o)})),this._register(lt(t,"wheel",o=>{var l,c,h,d,g;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(d=(h=(c=(l=e._renderService)==null?void 0:l.dimensions)==null?void 0:c.device)==null?void 0:h.cell)==null?void 0:d.height,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return this.cancel(o,!0);let p=be.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(p,!0),this.cancel(o,!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){gD(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=HY(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===be.ETX||n.key===be.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)&&(YY(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(Xn));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(be.ESC+"[I"):this.coreService.triggerDataEvent(be.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(`${be.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${be.ESC}[6;${i};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function YY(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var XY=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)}},ZY=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 qi)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},BR=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 ZY(t)}getNullCell(){return new qi}},QY=class extends kt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Me),this.onBufferChange=this._onBufferChange.event,this._normal=new BR(this._core.buffers.normal,"normal"),this._alternate=new BR(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)}},JY=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)}},eX=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}},tX=["cols","rows"],ws=0,nX=class extends kt{constructor(e){super(),this._core=this._register(new GY(e)),this._addonManager=this._register(new XY),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,i)=>{this._checkReadonlyOptions(r),this._core.options[r]=i};for(let r in this._core.options){let i={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,i)}}_checkReadonlyOptions(e){if(tX.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 JY(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new eX(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 QY(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
557
+ `,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 ex.get()},set promptLabel(e){ex.set(e)},get tooMuchOutput(){return tx.get()},set tooMuchOutput(e){tx.set(e)}}}_verifyIntegers(...e){for(ws of e)if(ws===1/0||isNaN(ws)||ws%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(ws of e)if(ws&&(ws===1/0||isNaN(ws)||ws%1!==0||ws<0))throw new Error("This API only accepts positive integers")}};const FR="lever-theme",Fy="20260329-iconpad",rX={light:`/manifest.webmanifest?v=${Fy}`,dark:`/manifest-dark.webmanifest?v=${Fy}`,custom:`/manifest-dark.webmanifest?v=${Fy}`},sO=_.createContext(void 0),iX=e=>e==="light"||e==="dark"||e==="system"||e==="custom",sl=()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",HR=(e,t)=>{if(typeof document>"u")return;let n;e==="custom"?n=t==="system"||!t?sl():t:n=e==="system"?sl():e,document.documentElement.classList.toggle("dark",n==="dark")},$R=e=>{if(typeof document>"u")return;document.documentElement.style.colorScheme=e;const t=document.querySelector('meta[name="theme-color"]');if(t){const i=getComputedStyle(document.body).backgroundColor;i&&i!=="rgba(0, 0, 0, 0)"&&i!=="transparent"&&t.setAttribute("content",i)}const n=document.querySelector('link[rel="manifest"]#app-manifest'),r=rX[e];n&&n.getAttribute("href")!==r&&n.setAttribute("href",r)};function sX({children:e}){const t=yn(p=>p.themePreference),n=yn(p=>p.setThemePreference),r=yn(p=>p.themeId),i=yn(p=>p.customAppearance),o=yn(p=>p.backgroundImage),l=yn(p=>p.backgroundOpacity),c=yn(p=>p.backgroundBlur),h=yn(p=>p.themeCssText);_.useEffect(()=>{if(typeof window>"u")return;const p=window.localStorage.getItem(FR);iX(p)&&(yn.getState().themePreference==="system"&&p!=="system"&&n(p),window.localStorage.removeItem(FR))},[]),_.useEffect(()=>{HR(t,i);const p=t==="custom"?i==="system"?sl():i:t==="system"?sl():t;$R(p)},[t,i]),_.useEffect(()=>{if(t!=="system"&&(t!=="custom"||i!=="system"))return;const p=window.matchMedia("(prefers-color-scheme: dark)"),v=()=>{HR(t,i),$R(sl())};return p.addEventListener?(p.addEventListener("change",v),()=>p.removeEventListener("change",v)):(p.addListener(v),()=>p.removeListener(v))},[t,i]),_.useEffect(()=>{if(typeof document>"u")return;let p=document.getElementById("kaizen-theme-registry-styles");p||(p=document.createElement("style"),p.id="kaizen-theme-registry-styles",document.head.appendChild(p)),p.textContent=h},[h]),_.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 p=document.getElementById("kaizen-custom-theme-styles");p||(p=document.createElement("style"),p.id="kaizen-custom-theme-styles",document.head.appendChild(p));const v=t==="custom"&&o&&o.trim()!=="",b=[];if(v){const w=c?c*2:0;b.push(`
558
+ body {
559
+ background-image: none !important;
560
+ background-color: transparent !important;
561
+ }
562
+ body::before {
563
+ content: "";
564
+ position: fixed;
565
+ top: -${w}px;
566
+ left: -${w}px;
567
+ right: -${w}px;
568
+ bottom: -${w}px;
569
+ background-image: url("${o}");
570
+ background-size: cover;
571
+ background-position: center;
572
+ filter: blur(${c}px);
573
+ z-index: -2;
574
+ pointer-events: none;
575
+ }
576
+ body::after {
577
+ content: "";
578
+ position: fixed;
579
+ inset: 0;
580
+ background-color: hsl(var(--background) / ${l});
581
+ z-index: -1;
582
+ pointer-events: none;
583
+ }
584
+ #root {
585
+ background-color: transparent !important;
586
+ }
587
+ :root {
588
+ --color-background: transparent !important;
589
+ --color-card: hsl(var(--card) / 0.15) !important;
590
+ --color-popover: hsl(var(--popover) / 0.8) !important;
591
+ --color-muted: hsl(var(--muted) / 0.25) !important;
592
+ }
593
+ .kaizen-terminal, .xterm-viewport, .xterm-screen {
594
+ background-color: transparent !important;
595
+ }
596
+ `)}else b.push(`
597
+ body {
598
+ background-image: none !important;
599
+ }
600
+ body::before {
601
+ display: none;
602
+ }
603
+ #root {
604
+ background-color: transparent;
605
+ }
606
+ `);p.textContent=b.join(`
607
+ `)},[t,o,l,c]);const d=p=>{n(p)},g=_.useMemo(()=>{const p=t==="custom"?i==="system"?sl():i:t==="system"?sl():t;return{theme:t,resolvedTheme:p,setTheme:d}},[t,i,n]);return f.jsx(sO.Provider,{value:g,children:e})}function oO(){const e=_.useContext(sO);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const oX={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"},aX={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 aO(e){return{cols:Math.max(1,e.cols||80),rows:Math.max(1,e.rows||24)}}function lO(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,i=(r==null?void 0:r.width)??0,o=(r==null?void 0:r.height)??0;if(!n||!Number.isFinite(i)||!Number.isFinite(o)||i<=0||o<=0)return null;const l=t.getBoundingClientRect(),c=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(c.paddingLeft)+parseFloat(c.paddingRight)+parseFloat(h.paddingLeft)+parseFloat(h.paddingRight),p=parseFloat(c.paddingTop)+parseFloat(c.paddingBottom)+parseFloat(h.paddingTop)+parseFloat(h.paddingBottom),v=Math.max(0,l.width-g-d-1),b=Math.max(0,l.height-p);return{cols:Math.max(2,Math.floor(v/i)),rows:Math.max(1,Math.floor(b/o))}}function Em(e){e.refresh(0,Math.max(0,e.rows-1))}function Rm(e,t,n,r,i){const o=lO(e,t)??aO(e);return n.current&&n.current.cols===o.cols&&n.current.rows===o.rows||(e.resize(o.cols,o.rows),n.current=o,r&&i(o.cols,o.rows)),o}function lX({projectId:e,terminalId:t,socket:n,scrollback:r,connectionStatus:i,clearVersion:o=0,focusRequestVersion:l=0,onPathChange:c}){const{resolvedTheme:h}=oO(),d=_.useRef(null),g=_.useRef(null),p=_.useRef(null),v=_.useRef(!1),b=_.useRef(0),w=_.useRef(null),S=_.useRef(null),[C,k]=_.useState(null),[R,E]=_.useState(null),N=h==="dark"?aX:oX,L=(D,H)=>{n.command({type:"terminal.resize",terminalId:t,cols:D,rows:H}).catch(()=>{})},j=()=>{const D=()=>{const H=g.current,Y=d.current;!H||!Y||!v.current||Rm(H,Y,S,!0,L)};requestAnimationFrame(()=>{D(),setTimeout(D,0)})};return _.useEffect(()=>{const D=new nX({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}),H=new Fq;D.loadAddon(H),D.loadAddon(new Kq),g.current=D;const Y=d.current;Y&&(D.open(Y),p.current&&D.write(p.current),Rm(D,Y,S,!1,()=>{}),Em(D),j());const P=D.onData(U=>{n.command({type:"terminal.input",terminalId:t,data:U}).catch(W=>{E(W instanceof Error?W.message:String(W))})}),q=D.onResize(({cols:U,rows:W})=>{if(!v.current)return;const V={cols:U,rows:W};S.current&&S.current.cols===U&&S.current.rows===W||(S.current=V,L(U,W))}),F=new ResizeObserver(()=>{const U=g.current,W=d.current;!U||!W||Rm(U,W,S,v.current,(V,O)=>{n.command({type:"terminal.resize",terminalId:t,cols:V,rows:O}).catch(()=>{})})});return Y&&F.observe(Y),()=>{F.disconnect(),q.dispose(),P.dispose(),p.current=H.serialize(),D.dispose(),g.current=null}},[r,n,t,N]),_.useEffect(()=>{const D=g.current;D&&(D.options.scrollback=r)},[r]),_.useEffect(()=>{const D=g.current;D&&(D.options.theme=N,Em(D))},[N]),_.useEffect(()=>{if(l===0)return;const D=g.current;D&&requestAnimationFrame(()=>{D.focus()})},[l]),_.useEffect(()=>{if(o===0)return;const D=g.current;D&&(v.current=!1,b.current+=1,w.current=null,p.current=null,k(null),E(null),D.reset(),Em(D),n.command({type:"terminal.close",terminalId:t}).catch(H=>{E(H instanceof Error?H.message:String(H))}))},[o,n,t]),_.useEffect(()=>{c==null||c((C==null?void 0:C.cwd)??null)},[C==null?void 0:C.cwd,c]),_.useEffect(()=>{const D=P=>{const q=g.current;if(!q)return;const F=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===F){k({cwd:P.cwd,shell:P.shell,status:P.status,exitCode:P.exitCode}),p.current=P.serializedState||null;return}w.current=F,k({cwd:P.cwd,shell:P.shell,status:P.status,exitCode:P.exitCode}),p.current=P.serializedState||null,q.options.scrollback=P.scrollback,q.reset(),P.serializedState&&q.write(P.serializedState),Em(q)},H=()=>{const P=g.current,q=d.current;if(!P||!q)return;const F=lO(P,q)??aO(P);P.resize(F.cols,F.rows),S.current=F,n.command({type:"terminal.create",projectId:e,terminalId:t,cols:F.cols,rows:F.rows,scrollback:r}).then(U=>{v.current=!0,E(null),U&&D(U),j()}).catch(U=>{E(U instanceof Error?U.message:String(U))})},Y=()=>{const P=++b.current,q=()=>{if(b.current!==P)return;const F=g.current,U=d.current;if(!F||!U)return;Rm(F,U,S,!1,()=>{});const W=U.getBoundingClientRect();if(W.width<=0||W.height<=0){requestAnimationFrame(q);return}H()};requestAnimationFrame(()=>{requestAnimationFrame(q)})};return Y(),n.subscribeTerminal(t,{onSnapshot:P=>{if(!P){v.current=!1,w.current=null,i==="connected"&&Y();return}v.current=!0,E(null),D(P),j()},onEvent:P=>{const q=g.current;if(q){if(P.type==="terminal.output"){q.write(P.data);return}P.type==="terminal.exit"&&k(F=>({cwd:(F==null?void 0:F.cwd)??"",shell:(F==null?void 0:F.shell)??"",status:"exited",exitCode:P.exitCode}))}}})},[i,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 cX=24;function cO(e){return e+cX}function uX(e,t){return Math.max(1,e)*cO(t)}function UR({projectId:e,layout:t,socket:n,connectionStatus:r,scrollback:i,minColumnWidth:o,focusRequestVersion:l=0,splitTerminalShortcut:c,onAddTerminal:h,onRemoveTerminal:d,onTerminalLayout:g}){const p=_.useRef(null),v=_.useRef({}),b=_.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)},q=new ResizeObserver(P);return q.observe(Y),P(),()=>q.disconnect()},[]);const N=t.terminals.length,L=cO(o),j=uX(N,o),D=Math.max(w,j),H=_.useMemo(()=>t.terminals.map(Y=>Y.id).join(":"),[t.terminals]);return _.useLayoutEffect(()=>{const Y=b.current,P=t.terminals.map(U=>U.id),q=P.find(U=>!Y.includes(U));if(b.current=P,!q||Y.length===0)return;const F=v.current[q];F&&F.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:D||"100%"},children:f.jsx(Fd,{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(fo,{id:Y.id,defaultSize:`${Y.size}%`,minSize:`${L}px`,className:"min-h-0 overflow-hidden",style:{minWidth:L},children:f.jsxs("div",{ref:q=>{v.current[Y.id]=q},className:"flex h-full min-h-0 min-w-0 flex-col border-r border-border bg-transparent last:border-r-0",style:{minWidth:L},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(et,{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(R9,{className:"size-3.5"})}),f.jsx(et,{variant:"ghost",size:"icon-sm","aria-label":"Clear terminal",onClick:()=>E(q=>({...q,[Y.id]:(q[Y.id]??0)+1})),children:f.jsx(x8,{className:"size-3.5"})}),f.jsxs(bd,{children:[f.jsx(xd,{asChild:!0,children:f.jsx(et,{variant:"ghost",size:"icon-sm","aria-label":"Add terminal to the right",onClick:()=>h(e,Y.id),children:f.jsx(x0,{className:"size-3.5"})})}),f.jsx(Rc,{side:"bottom",shortcut:c})]}),f.jsx(et,{variant:"ghost",size:"icon-sm","aria-label":"Archive terminal",onClick:()=>d(e,Y.id),children:f.jsx(vo,{className:"size-3.5"})})]})]}),f.jsx(lX,{projectId:e,terminalId:Y.id,socket:n,scrollback:i,connectionStatus:r,clearVersion:R[Y.id]??0,focusRequestVersion:P===0?l:0,onPathChange:q=>k(F=>F[Y.id]===q?F:{...F,[Y.id]:q})})]})}),P<t.terminals.length-1?f.jsx(Hd,{withHandle:!0,orientation:"horizontal"}):null]},Y.id))},H)})})})}function VR(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function dX(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:VR(n.groups.line),column:VR(n.groups.column)}:{path:t}}function Hy(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 Ow=()=>{},uO=_.createContext(Ow);function hX({children:e,onOpenLocalLink:t}){return f.jsx(uO.Provider,{value:t??Ow,children:e})}const Px={Task:sp,TaskOutput:sp,Bash:w0,Glob:uy,Grep:uy,ExitPlanMode:j2,Read:j8,Edit:E8,Write:T8,NotebookEdit:Bc,WebFetch:L6,TodoWrite:X6,WebSearch:uy,KillShell:k9,AskUserQuestion:HM,Skill:Hn,EnterPlanMode:j2},dO=M9;function hO(e){return Px[e]?Px[e]:dO}function No({children:e,className:t}){return f.jsx("div",{className:me("flex gap-3 justify-start items-center",t),children:e})}function fX({children:e,className:t}){return f.jsx("div",{className:me("flex items-center gap-1.5 text-xs",t),children:e})}function xo({children:e,className:t}){return f.jsx("span",{className:me("font-medium text-foreground/80",t),children:e})}function mX({children:e}){return f.jsx("span",{className:"text-muted-foreground",children:e})}function Lh({children:e,expandedContent:t,defaultExpanded:n=!1}){const[r,i]=_.useState(n);return f.jsxs("div",{className:"flex flex-col w-full",children:[f.jsxs("button",{onClick:()=>i(!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(Vr,{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 $y({label:e,children:t,copyText:n}){const[r,i]=_.useState(!1),o=n??Dp(t),l=_.useCallback(async()=>{await navigator.clipboard.writeText(o),i(!0),setTimeout(()=>i(!1),2e3)},[o]);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(et,{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(Vi,{className:"h-3.5 w-3.5 text-green-400"}):f.jsx(ul,{className:"h-4 w-4"})})]})]})}function fO({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 zh({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 Dp(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(Array.isArray(e))return e.map(Dp).join("");if(e&&typeof e=="object"&&"props"in e){const t=e.props;return Dp(t.children)}return""}function WR(e,t){return _.isValidElement(e)?_.cloneElement(e,{className:me(e.props.className,t)}):e}const pX={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),i=Dp(e),o=async()=>{await navigator.clipboard.writeText(i),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(et,{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:o,children:n?f.jsx(Vi,{className:"h-4 w-4 text-green-400"}):f.jsx(ul,{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]=WR(r,"mt-0"));const i=n.length-1,o=n[i];return o!==void 0&&(n[i]=WR(o,"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 uu(e){return{...pX,a:({children:t,href:n,onClick:r,...i})=>{const o=(e==null?void 0:e.onOpenLocalLink)??_.useContext(uO),l=dX(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:c=>{r==null||r(c),!(c.defaultPrevented||!l||o===Ow)&&(c.preventDefault(),o(l))},...i,children:t})}}}const gX={connecting:"Connecting...",acquiring_sandbox:"Booting...",initializing:"Initializing...",starting:"Starting...",running:"Running...",waiting_for_user:"Waiting...",failed:"Failed"};function vX({status:e}){const t=(e?gX[e]:void 0)||"Processing...",n=e==="failed";return f.jsx(No,{className:"ml-[1px]",children:f.jsxs(fX,{children:[n?f.jsx(vo,{className:"size-4.5 text-red-500"}):f.jsx(Lr,{className:"size-4.5 animate-spin text-muted-icon"}),f.jsx(vg,{className:"ml-[1px] text-sm",shimmerWidth:44,children:t})]})})}const jg=_.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}));jg.displayName="ScrollArea";function mO(e){return e==="localhost"||e==="127.0.0.1"||e==="::1"}const Dg=20,Ix=50,pO=30;function gO(e){return Number.isFinite(e)?Math.min(Ix,Math.max(Dg,e)):pO}function _X(){return{isVisible:!1,size:Dg}}function Tm(e,t){return e[t]??_X()}function yX(e){return!e||typeof e!="object"?{projects:{}}:{projects:Object.fromEntries(Object.entries(e.projects??{}).map(([r,i])=>[r,{isVisible:!1,size:gO(i.size??pO)}]))}}const Ud=ko()(Eo(e=>({projects:{},toggleVisibility:t=>e(n=>({projects:{...n.projects,[t]:{...Tm(n.projects,t),isVisible:!Tm(n.projects,t).isVisible}}})),setVisibility:(t,n)=>e(r=>({projects:{...r.projects,[t]:{...Tm(r.projects,t),isVisible:n}}})),setSize:(t,n)=>e(r=>({projects:{...r.projects,[t]:{...Tm(r.projects,t),size:gO(n)}}})),clearProject:t=>e(n=>{const{[t]:r,...i}=n.projects;return{projects:i}})}),{name:"right-sidebar-layouts",version:2,migrate:yX})),bX={isVisible:!1,size:Dg},Lw=[68,32];function xX(){return{isVisible:!1,mainSizes:[...Lw],terminals:[],nextTerminalIndex:0}}function wX(e,t){return e[t]??xX()}function Uy(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 SX(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 CX(e){if(e.length===0)return e;const t=e.length+1;return e.map(n=>({...n,size:n.size*e.length/t}))}function yc(e,t,n){return{...e,[t]:n(wX(e,t))}}const ca=ko()(Eo(e=>({projects:{},addTerminal:(t,n)=>e(r=>({projects:yc(r.projects,t,i=>{var h,d;const o=CX(i.terminals),l={id:((d=(h=globalThis.crypto)==null?void 0:h.randomUUID)==null?void 0:d.call(h))??`terminal-${Date.now()}-${i.nextTerminalIndex}`,title:SX(i.nextTerminalIndex),size:100/(o.length+1)},c=n?Math.max(o.findIndex(g=>g.id===n)+1,0):o.length;return{...i,isVisible:!0,nextTerminalIndex:i.nextTerminalIndex+1,terminals:[...o.slice(0,c),l,...o.slice(c)]}})})),removeTerminal:(t,n)=>e(r=>({projects:yc(r.projects,t,i=>{const o=i.terminals.filter(c=>c.id!==n);if(o.length===0)return{...i,isVisible:!1,terminals:[]};const l=Uy(o.map(c=>c.size));return{...i,terminals:o.map((c,h)=>({...c,size:l[h]??100/o.length}))}})})),toggleVisibility:t=>e(n=>({projects:yc(n.projects,t,r=>({...r,isVisible:r.terminals.length>0?!r.isVisible:!1}))})),resetMainSizes:t=>e(n=>({projects:yc(n.projects,t,r=>({...r,mainSizes:[...Lw]}))})),setMainSizes:(t,n)=>e(r=>{if(n.length!==2)return r;const i=Uy(n);return{projects:yc(r.projects,t,o=>({...o,mainSizes:i}))}}),setTerminalSizes:(t,n)=>e(r=>({projects:yc(r.projects,t,i=>{if(n.length!==i.terminals.length)return i;const o=Uy(n);return{...i,terminals:i.terminals.map((l,c)=>({...l,size:o[c]??l.size}))}})})),clearProject:t=>e(n=>{const{[t]:r,...i}=n.projects;return{projects:i}})}),{name:"terminal-layouts",version:1})),kX={isVisible:!1,mainSizes:[...Lw],terminals:[],nextTerminalIndex:0},Op=1e3,Bx=500,Fx=5e3,Lp=450,Hx=250,$x=900,Ux="cursor";function Vx(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 EX(e){switch(e){case"vscode":return"VS Code";case"windsurf":return"Windsurf";case"custom":return"Custom";case"cursor":default:return"Cursor"}}function qR(e){return Number.isFinite(e)?Math.min(Fx,Math.max(Bx,Math.round(e))):Op}function KR(e){return Number.isFinite(e)?Math.min($x,Math.max(Hx,Math.round(e))):Lp}function GR(e){switch(e){case"vscode":case"windsurf":case"custom":case"cursor":return e;default:return Ux}}function Vy(e,t){const n=e==null?void 0:e.trim();return n&&n.length>0?n:Vx(t)}const Ii=ko()(Eo(e=>({scrollbackLines:Op,minColumnWidth:Lp,editorPreset:Ux,editorCommandTemplate:Vx(Ux),setScrollbackLines:t=>e({scrollbackLines:qR(t)}),setMinColumnWidth:t=>e({minColumnWidth:KR(t)}),setEditorPreset:t=>e(n=>{const r=GR(t);return{editorPreset:r,editorCommandTemplate:r==="custom"?Vy(n.editorCommandTemplate,r):Vx(r)}}),setEditorCommandTemplate:t=>e(n=>({editorCommandTemplate:Vy(t,n.editorPreset)}))}),{name:"terminal-preferences",version:3,migrate:e=>{const t=e,n=GR(t==null?void 0:t.editorPreset);return{scrollbackLines:qR((t==null?void 0:t.scrollbackLines)??Op),minColumnWidth:KR((t==null?void 0:t.minColumnWidth)??Lp),editorPreset:n,editorCommandTemplate:Vy(t==null?void 0:t.editorCommandTemplate,n)}}})),RX=35;function TX(e,t){return!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0?0:e*(t/100)}function NX(e,t){const n=TX(e,t);return n>=0&&n<RX}const Ac=350,MX=[.4,0,.2,1],AX=8,YR=1e-6;function jX(e,t,n){const r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function DX(e,t,n){const r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function OX(e,t,n){const r=1-e;return 3*r*r*t+6*r*e*(n-t)+3*e*e*(1-n)}function LX(e,t,n){let r=e;for(let i=0;i<AX;i+=1){const o=jX(r,t,n)-e;if(Math.abs(o)<YR)return r;const l=OX(r,t,n);if(Math.abs(l)<YR)break;r-=o/l}return r}function zX(e){if(e<=0)return 0;if(e>=1)return 1;const[t,n,r,i]=MX,o=LX(e,t,r);return DX(o,n,i)}function vO(e,t,n){const r=zX(n);return[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r]}function PX({projectId:e,shouldRenderRightSidebarLayout:t,showRightSidebar:n,rightSidebarSize:r}){const i=_.useRef(null),o=_.useRef(null),l=_.useRef(null),c=_.useRef(null),h=_.useRef(null),d=_.useRef(!1),g=_.useRef(null),p=_.useRef(!1),v=_.useRef(!1);return _.useEffect(()=>()=>{c.current!==null&&window.cancelAnimationFrame(c.current),h.current!==null&&window.clearTimeout(h.current)},[]),_.useLayoutEffect(()=>{var D,H,Y,P,q,F;if(!t){c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null),h.current!==null&&(window.clearTimeout(h.current),h.current=null),d.current=!1;return}const b=i.current;if(!b)return;c.current!==null&&(window.cancelAnimationFrame(c.current),c.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]:[b.getLayout().workspace??R[0],b.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){b.setLayout({workspace:R[0],rightSidebar:R[1]}),(D=o.current)==null||D.setAttribute("data-right-sidebar-open",n?"true":"false"),(H=l.current)==null||H.setAttribute("data-right-sidebar-open",n?"true":"false"),(Y=l.current)==null||Y.setAttribute("data-right-sidebar-animated","false");return}d.current=!0,(P=o.current)==null||P.setAttribute("data-right-sidebar-open",n?"true":"false"),(q=l.current)==null||q.setAttribute("data-right-sidebar-open",n?"true":"false"),(F=l.current)==null||F.setAttribute("data-right-sidebar-animated","true"),b.setLayout({workspace:N[0],rightSidebar:N[1]});const L=performance.now(),j=U=>{const W=Math.min(1,(U-L)/Ac),V=vO(N,R,W);if(b.setLayout({workspace:V[0],rightSidebar:V[1]}),W<1){c.current=window.requestAnimationFrame(j);return}b.setLayout({workspace:R[0],rightSidebar:R[1]}),c.current=null,h.current=window.setTimeout(()=>{d.current=!1,h.current=null},0)};c.current=window.requestAnimationFrame(j)},[e,r,t,n]),_.useEffect(()=>{t||(p.current=!1,v.current=!1)},[t]),{isAnimating:d,panelGroupRef:i,sidebarPanelRef:o,sidebarVisualRef:l}}function IX(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 BX({previousProjectId:e,projectId:t,previousShouldRenderTerminalLayout:n,previousShowTerminalPane:r,showTerminalPane:i,terminalLayout:o,liveLayout:l}){const c=e!==null&&e!==t,h=i&&!r,d=!n,g=e===null&&t!==null,p=i?o.mainSizes:[100,0];return{currentLayout:h||d?[100,0]:l,shouldSkipAnimation:c||g&&d,targetLayout:p}}function FX({chatInputRef:e,projectId:t,shouldRenderTerminalLayout:n,showTerminalPane:r,terminalLayout:i}){const o=_.useRef(null),l=_.useRef(null),c=_.useRef(null),h=_.useRef(null),d=_.useRef(null),g=_.useRef(!1),p=_.useRef(null),v=_.useRef(!1),b=_.useRef(!1),w=_.useRef(!1),[S,C]=_.useState(0);return _.useEffect(()=>{var E;const k=p.current,R=w.current;IX({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 H,Y,P,q,F,U;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=o.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:L}=BX({previousProjectId:R,projectId:t,previousShouldRenderTerminalLayout:v.current,previousShowTerminalPane:b.current,showTerminalPane:r,terminalLayout:i,liveLayout:[k.getLayout().chat??i.mainSizes[0],k.getLayout().terminal??i.mainSizes[1]]});if(v.current=n,b.current=r,N||Math.abs(E[0]-L[0])<.1&&Math.abs(E[1]-L[1])<.1){k.setLayout({chat:L[0],terminal:L[1]}),(H=l.current)==null||H.setAttribute("data-terminal-open",r?"true":"false"),(Y=c.current)==null||Y.setAttribute("data-terminal-open",r?"true":"false"),(P=c.current)==null||P.setAttribute("data-terminal-animated","false");return}g.current=!0,(q=l.current)==null||q.setAttribute("data-terminal-open",r?"true":"false"),(F=c.current)==null||F.setAttribute("data-terminal-open",r?"true":"false"),(U=c.current)==null||U.setAttribute("data-terminal-animated","true"),k.setLayout({chat:E[0],terminal:E[1]});const j=performance.now(),D=W=>{const V=Math.min(1,(W-j)/Ac),O=vO(E,L,V);if(k.setLayout({chat:O[0],terminal:O[1]}),V<1){h.current=window.requestAnimationFrame(D);return}k.setLayout({chat:L[0],terminal:L[1]}),h.current=null,d.current=window.setTimeout(()=>{g.current=!1,d.current=null},0)};h.current=window.requestAnimationFrame(D)},[t,n,r,i.mainSizes]),_.useEffect(()=>{n||(v.current=!1,b.current=!1)},[n]),{isAnimating:g,mainPanelGroupRef:o,terminalFocusRequestVersion:S,terminalPanelRef:l,terminalVisualRef:c}}const yi=ko()(Eo(e=>({folderGroupsEnabled:!1,showFeatureOverviewInSidebar:!0,kanbanStatusesEnabled:!0,commitProjectMetadataDirectory:!0,setFolderGroupsEnabled:t=>e({folderGroupsEnabled:t}),setShowFeatureOverviewInSidebar:t=>e({showFeatureOverviewInSidebar:t}),setKanbanStatusesEnabled:t=>e({kanbanStatusesEnabled:t}),setCommitProjectMetadataDirectory:t=>e({commitProjectMetadataDirectory:t})}),{name:"feature-settings"}));function Nm(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function HX(e){if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}}function $X(e,t){const n=HX(t);switch(e.toolKind){case"ask_user_question":{const i=Nm(n),o=Nm(i==null?void 0:i.answers)??(i||{});return{answers:Object.fromEntries(Object.entries(o).map(([l,c])=>Array.isArray(c)?[l,c.map(h=>String(h))]:c&&typeof c=="object"&&Array.isArray(c.answers)?[l,c.answers.map(h=>String(h))]:c==null||c===""?[l,[]]:[l,[String(c)]])),...(i==null?void 0:i.discarded)===!0?{discarded:!0}:{}}}case"exit_plan_mode":{const i=Nm(n);return{confirmed:typeof(i==null?void 0:i.confirmed)=="boolean"?i.confirmed:void 0,clearContext:typeof(i==null?void 0:i.clearContext)=="boolean"?i.clearContext:void 0,message:typeof(i==null?void 0:i.message)=="string"?i.message:void 0,...(i==null?void 0:i.discarded)===!0?{discarded:!0}:{}}}case"read_file":if(typeof n=="string")return n;const r=Nm(n);return{content:typeof(r==null?void 0:r.content)=="string"?r.content:JSON.stringify(n,null,2)};default:return n}}function _O(e){return new Date(e).toISOString()}function Li(e){return{id:e._id,messageId:e.messageId,timestamp:_O(e.createdAt),hidden:e.hidden}}function UX(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:_O(e.createdAt)}}function VX(e){if(e.debugRaw)try{return JSON.parse(e.debugRaw).tool_use_result}catch{return}}function WX(e){if(e!=null&&e.length)return e.map(t=>({...t,previewUrl:`/attachments/${t.relativePath.split("/").map(encodeURIComponent).join("/")}`}))}function XR(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 qX(e){const t=new Map,n=[];for(const r of e)switch(r.kind){case"user_prompt":n.push({...Li(r),kind:"user_prompt",content:r.content,attachments:WX(r.attachments)});break;case"system_init":n.push({...Li(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({...Li(r),kind:"account_info",accountInfo:r.accountInfo});break;case"assistant_text":XR(n,{...Li(r),kind:"assistant_text",text:r.text});break;case"assistant_thought":XR(n,{...Li(r),kind:"assistant_thought",text:r.text});break;case"tool_call":{const i=UX(r);t.set(r.tool.toolId,{hydrated:i,normalized:r.tool}),n.push(i);break}case"tool_result":{const i=t.get(r.toolId);if(i){const o=i.normalized.toolKind==="ask_user_question"||i.normalized.toolKind==="exit_plan_mode"?VX(r)??r.content:r.content;i.hydrated.result=$X(i.normalized,o),i.hydrated.rawResult=o,i.hydrated.isError=r.isError}break}case"result":n.push({...Li(r),kind:"result",success:!r.isError,cancelled:r.subtype==="cancelled",result:r.result,durationMs:r.durationMs,costUsd:r.costUsd});break;case"status":n.push({...Li(r),kind:"status",status:r.status});break;case"compact_boundary":n.push({...Li(r),kind:"compact_boundary"});break;case"compact_summary":n.push({...Li(r),kind:"compact_summary",summary:r.summary});break;case"context_cleared":n.push({...Li(r),kind:"context_cleared"});break;case"interrupted":n.push({...Li(r),kind:"interrupted"});break;default:n.push({...Li(r),kind:"unknown",json:JSON.stringify(r,null,2)});break}return n}const KX=["AskUserQuestion","ExitPlanMode","TodoWrite"],GX=new Set(["TodoWrite"]);function YX(e,t){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r.kind!=="tool")continue;const i=r;if(i.toolName===t&&!i.result)return i.id}return null}function XX(e,t){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r.kind!=="tool")continue;const i=r;if(i.toolName===t)return i.id}return null}function ZX(e){const t={};for(const n of KX)t[n]=GX.has(n)?XX(e,n):YX(e,n);return t}function QX(e){return e==="starting"||e==="running"||e==="waiting_for_user"}function Wy(e){return e==="starting"||e==="running"||e==="waiting_for_user"}const JX=25e3,eZ=15e3,tZ=4e3;class nZ{constructor(t){tr(this,"url");tr(this,"ws",null);tr(this,"started",!1);tr(this,"reconnectTimer",null);tr(this,"reconnectDelayMs",750);tr(this,"subscriptions",new Map);tr(this,"pending",new Map);tr(this,"outboundQueue",[]);tr(this,"statusListeners",new Set);tr(this,"heartbeatTimer",null);tr(this,"pingTimeoutTimer",null);tr(this,"pingPromise",null);tr(this,"lastOpenAt",0);tr(this,"lastMessageAt",0);tr(this,"reconnectImmediatelyOnClose",!1);tr(this,"handleWindowFocus",()=>{this.ensureHealthyConnection()});tr(this,"handleVisibilityChange",()=>{if(document.visibilityState==="visible"){this.startHeartbeat(),this.ensureHealthyConnection();return}this.stopHeartbeat()});tr(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 i=Od();return this.subscriptions.set(i,{topic:t,listener:n,eventListener:r}),this.enqueue({v:1,type:"subscribe",id:i,topic:t}),()=>{this.subscriptions.delete(i),this.enqueue({v:1,type:"unsubscribe",id:i})}}subscribeTerminal(t,n){const r=Od(),i={type:"terminal",terminalId:t};return this.subscriptions.set(r,{topic:i,listener:n.onSnapshot,eventListener:n.onEvent}),this.enqueue({v:1,type:"subscribe",id:r,topic:i}),()=>{this.subscriptions.delete(r),this.enqueue({v:1,type:"unsubscribe",id:r})}}command(t){const n=Od(),r={v:1,type:"command",id:n,command:t};return new Promise((i,o)=>{this.pending.set(n,{resolve:i,reject:o}),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 i;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 o=this.subscriptions.get(r.id);o==null||o.listener(r.snapshot.data);return}if(r.type==="event"){const o=this.subscriptions.get(r.id);(i=o==null?void 0:o.eventListener)==null||i.call(o,r.event);return}if(r.type==="ack"){const o=this.pending.get(r.id);if(!o)return;this.pending.delete(r.id),o.resolve(r.result);return}if(r.type==="error"){if(!r.id){console.error(DF,r.message);return}const o=this.pending.get(r.id);if(!o)return;this.pending.delete(r.id),o.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>=JX}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()},tZ),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()},eZ))}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 rZ(e,t){var r;const n=e.find(i=>lh(i).some(o=>o.chatId===t));return n?((r=lh(n).find(i=>i.chatId!==t))==null?void 0:r.chatId)??null:null}function ZR(e,t){var n;return((n=e.find(r=>lh(r).some(i=>i.chatId===t)))==null?void 0:n.groupKey)??null}function iZ(e,t){for(const n of e){const r=lh(n).find(i=>i.chatId===t);if(r)return r}return null}function sZ(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function oZ(){const e=_.useRef(null);return e.current||(e.current=new nZ(sZ())),_.useEffect(()=>{const t=e.current;return t==null||t.start(),()=>{t==null||t.dispose()}},[]),e.current}function Ad(e,t){if(t===void 0){console.info(`[useKaizenState] ${e}`);return}console.info(`[useKaizenState] ${e}`,t)}function yO(e){return e<24}function aZ(e){return Math.max(136,Math.round(e+24))}function lZ(e,t){return e==="awaiting_disconnect"&&t==="disconnected"?"awaiting_reconnect":e==="awaiting_reconnect"&&t==="connected"?"clear_phase":"none"}const bO=8e3;function cZ(e,t,n){return e==="awaiting_reconnect"&&t==="disconnected"&&n>=bO}const zw=`${pg}ui-update-restart`;function qy(){return window.sessionStorage.getItem(zw)}function QR(e){window.sessionStorage.setItem(zw,e)}function Mm(){window.sessionStorage.removeItem(zw)}function uZ(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 dZ(e,t){return!e||!t?null:e.runtime.chatId!==t?(Ad("stale snapshot masked",{routeChatId:t,snapshotChatId:e.runtime.chatId,snapshotProvider:e.runtime.provider}),null):e}function hZ(e){var gu,Ma,Wh;const{activeChatId:t,activeOverviewFeatureId:n}=e,r=kl(),i=oZ(),o=H9(),[l,c]=_.useState({projectGroups:[]}),[h,d]=_.useState(null),[g,p]=_.useState(null),[v,b]=_.useState(null),[w,S]=_.useState(null),[C,k]=_.useState(null),[R,E]=_.useState(null),[N,L]=_.useState(null),[j,D]=_.useState("connecting"),[H,Y]=_.useState(!1),[P,q]=_.useState(!1),[F,U]=_.useState(!1),[W,V]=_.useState(null),[O,$]=_.useState(!1),[z,G]=_.useState(!1),[M,B]=_.useState(148),[Z,A]=_.useState(!0),[ie,J]=_.useState(null),[ee,re]=_.useState(null),[ce,he]=_.useState(null),[pe,Se]=_.useState(null),[Re,je]=_.useState(!1),Xe=yi(X=>X.folderGroupsEnabled),Et=yi(X=>X.showFeatureOverviewInSidebar),Rt=yi(X=>X.kanbanStatusesEnabled),fe=EX(Ii(X=>X.editorPreset)),He=_.useRef(null),De=_.useRef(null),mt=Ud(X=>X.setVisibility),[ct,ot]=_.useState(new Set),fn=_.useRef(new Map),Ce=_.useRef(t),tt=_.useRef(typeof document<"u"?document.visibilityState==="visible":!0),oe=_.useRef(!1),ve=_.useRef(null),Ne=_.useRef(new Map);_.useEffect(()=>i.onStatus(D),[i]),_.useEffect(()=>{Ce.current=t},[t]),_.useEffect(()=>{function X(){const ne=document.visibilityState==="visible";if(tt.current=ne,ne){const we=Ce.current;we&&ot($e=>{if(!$e.has(we))return $e;const Bt=new Set($e);return Bt.delete(we),Bt})}}return document.addEventListener("visibilitychange",X),()=>document.removeEventListener("visibilitychange",X)},[]),_.useEffect(()=>i.subscribe({type:"sidebar"},X=>{const ne=new Map;for(const kn of X.projectGroups)for(const xr of[...kn.generalChats,...kn.features.flatMap(Gr=>Gr.chats)])ne.set(xr.chatId,xr.status);const we=fn.current,$e=Ce.current,Bt=tt.current;ot(kn=>{let xr=kn;for(const[Gr,qh]of ne){const vu=we.get(Gr);Wy(qh)&&xr.has(Gr)&&(xr===kn&&(xr=new Set(kn)),xr.delete(Gr)),vu&&Wy(vu)&&qh==="idle"&&(Gr!==$e||!Bt)&&(xr===kn&&(xr=new Set(kn)),xr.add(Gr))}return xr}),fn.current=ne,c(X),Y(!0),J(null)}),[i]),_.useEffect(()=>i.subscribe({type:"local-projects"},X=>{d(X),q(!0),J(null)}),[i]),_.useEffect(()=>i.subscribe({type:"update"},X=>{p(X),J(null)}),[i]),_.useEffect(()=>{j==="connected"&&i.command({type:"update.check",force:!0}).catch(X=>{J(X instanceof Error?X.message:String(X))})},[j,i]),_.useEffect(()=>{const X=qy(),ne=lZ(X,j);if(ne==="awaiting_reconnect"){QR("awaiting_reconnect");return}ne==="clear_phase"&&Mm()},[j,r]),_.useEffect(()=>{if(qy()!=="awaiting_reconnect"||j!=="disconnected")return;const ne=Date.now(),we=window.setTimeout(()=>{cZ(qy(),j,Date.now()-ne)&&Mm()},bO);return()=>{window.clearTimeout(we)}},[j]),_.useEffect(()=>{function X(){g!=null&&g.lastCheckedAt&&(Date.now()-g.lastCheckedAt<=3600*1e3||i.command({type:"update.check"}).catch(ne=>{J(ne instanceof Error?ne.message:String(ne))}))}return window.addEventListener("focus",X),()=>{window.removeEventListener("focus",X)}},[i,g==null?void 0:g.lastCheckedAt]),_.useEffect(()=>i.subscribe({type:"keybindings"},X=>{k(X),J(null)}),[i]),_.useEffect(()=>i.subscribe({type:"theme-settings"},X=>{E(X),yn.setState({themePreference:X.settings.themePreference,themeId:X.settings.themeId,customAppearance:X.settings.customAppearance,backgroundImage:X.settings.backgroundImage,backgroundOpacity:X.settings.backgroundOpacity,backgroundBlur:X.settings.backgroundBlur,showProjectIconsInSidebar:X.settings.showProjectIconsInSidebar,availableThemes:X.availableThemes,themeCssText:X.themeCssText})}),[i]),_.useEffect(()=>i.subscribe({type:"provider-settings"},X=>{L(X),J(null)}),[i]),_.useEffect(()=>{if(!t){Ad("clearing chat snapshot for non-chat route"),b(null),U(!0);return}return Ad("subscribing to chat",{activeChatId:t}),b(null),U(!1),i.subscribe({type:"chat",chatId:t},X=>{Ad("chat snapshot received",{activeChatId:t,snapshotChatId:(X==null?void 0:X.runtime.chatId)??null,snapshotProvider:(X==null?void 0:X.runtime.provider)??null,snapshotStatus:(X==null?void 0:X.runtime.status)??null}),b(X),U(!0),J(null)})},[t,i]),_.useEffect(()=>{if(!n){S(null);return}return S(null),i.subscribe({type:"feature-overview",featureId:n},X=>{S(X),J(null)})},[n,i]),_.useEffect(()=>{t&&ot(X=>{if(!X.has(t))return X;const ne=new Set(X);return ne.delete(t),ne})},[t]),_.useEffect(()=>{if(!t)return;const X=ZR(l.projectGroups,t);X&&mt(X,!1)},[t,mt,l.projectGroups]),_.useEffect(()=>{n&&w&&V(w.projectId)},[n,w]),_.useEffect(()=>{if(W)return;const X=l.projectGroups[0];X&&V(X.groupKey)},[W,l.projectGroups]),_.useEffect(()=>{if(!t||!H||!F)return;if(l.projectGroups.some(ne=>lh(ne).some(we=>we.chatId===t))){ce===t&&he(null);return}ce!==t&&r("/")},[t,F,r,ce,l.projectGroups,H]),_.useEffect(()=>{v&&(V(v.runtime.projectId),ce===v.runtime.chatId&&he(null))},[v,ce]),_.useEffect(()=>{oe.current=!1,ve.current!==null&&(window.cancelAnimationFrame(ve.current),ve.current=null),A(!0)},[t]),_.useEffect(()=>()=>{ve.current!==null&&window.cancelAnimationFrame(ve.current)},[]),_.useLayoutEffect(()=>{const X=De.current;if(!X)return;const ne=new ResizeObserver(()=>{B(X.getBoundingClientRect().height)});return ne.observe(X),B(X.getBoundingClientRect().height),()=>ne.disconnect()},[]);const Ae=_.useMemo(()=>dZ(v,t),[t,v]);_.useEffect(()=>{Ad("active snapshot resolved",{routeChatId:t,rawSnapshotChatId:(v==null?void 0:v.runtime.chatId)??null,rawSnapshotProvider:(v==null?void 0:v.runtime.provider)??null,activeSnapshotChatId:(Ae==null?void 0:Ae.runtime.chatId)??null,activeSnapshotProvider:(Ae==null?void 0:Ae.runtime.provider)??null,pendingChatId:ce})},[t,Ae,v,ce]);const Qe=_.useMemo(()=>{const X=Ae;if(!X)return[];const ne=X.messages,we=X.runtime.chatId,$e=ne.at(-1),Bt=`${ne.length}:${($e==null?void 0:$e._id)??""}:${($e==null?void 0:$e.createdAt)??0}`,kn=Ne.current.get(we);if((kn==null?void 0:kn.signature)===Bt)return kn.messages;const xr=qX(ne);return Ne.current.set(we,{signature:Bt,messages:xr}),xr},[Ae]),At=_.useMemo(()=>ZX(Qe),[Qe]),rt=(Ae==null?void 0:Ae.runtime)??null,Oe=(Ae==null?void 0:Ae.usage)??null,qe=(Ae==null?void 0:Ae.availableProviders)??B0((N==null?void 0:N.settings)??sr),gt=Wy(rt==null?void 0:rt.status),Ve=QX(rt==null?void 0:rt.status),mn=aZ(M),sn=!Z&&Qe.length>0,Je=((gu=h==null?void 0:h.projects[0])==null?void 0:gu.localPath)??null,tn=(w==null?void 0:w.localPath)??(rt==null?void 0:rt.localPath)??Je??((Ma=l.projectGroups[0])==null?void 0:Ma.localPath),$n=(w==null?void 0:w.projectId)??(rt==null?void 0:rt.projectId)??null,Jt=!!(W??$n??((Wh=l.projectGroups[0])==null?void 0:Wh.groupKey)??Je);_.useLayoutEffect(()=>{if(oe.current)return;const X=He.current;X&&(t&&!rt||(X.scrollTo({top:X.scrollHeight,behavior:"auto"}),ve.current!==null&&window.cancelAnimationFrame(ve.current),ve.current=window.requestAnimationFrame(()=>{const ne=He.current;ne&&(ne.scrollTo({top:ne.scrollHeight,behavior:"auto"}),ve.current=null)}),oe.current=!0))},[t,M,Qe.length,rt]),_.useEffect(()=>{if(!oe.current||!Z)return;const X=window.requestAnimationFrame(()=>{const ne=He.current;!ne||!Z||ne.scrollTo({top:ne.scrollHeight,behavior:"auto"})});return()=>window.cancelAnimationFrame(X)},[t,M,Z,Qe.length,rt==null?void 0:rt.status]);function Kt(){const X=He.current;if(!X)return;const ne=X.scrollHeight-X.scrollTop-X.clientHeight;A(yO(ne))}function Be(X){const ne=He.current;A(!0),ne&&ne.scrollTo({top:ne.scrollHeight,behavior:X})}function vt(){Be("smooth")}async function wt(X,ne){Pi.getState().initializeComposerForNewChat();const we=await i.command({type:"chat.create",projectId:X,featureId:ne});V(X),he(we.chatId),r(`/chat/${we.chatId}`),$(!1),J(null)}async function Tt(X,ne=yi.getState().commitProjectMetadataDirectory){await i.command({type:"project.setProjectMetadataDirectoryCommitMode",projectId:X.projectId,localPath:X.localPath,commitProjectMetadata:ne})}async function en(X){return X.kind==="project_id"?{projectId:X.projectId}:X.kind==="local_path"?{projectId:(await i.command({type:"project.open",localPath:X.localPath})).projectId,localPath:X.localPath}:{projectId:(await i.command(X.project.mode==="new"?{type:"project.create",localPath:X.project.localPath,title:X.project.title}:{type:"project.open",localPath:X.project.localPath})).projectId,localPath:X.project.localPath}}async function _t(X){try{const ne=X.kind==="project_id"?null:X.kind==="local_path"?X.localPath:X.project.localPath;ne&&re(ne);const{projectId:we}=await en(X);await Tt({projectId:we}),await wt(we)}catch(ne){J(ne instanceof Error?ne.message:String(ne))}finally{re(null)}}async function yt(X){const ne=X.split("/").filter(Boolean).pop()??X;if(await o.confirm({title:"Hide Project",description:`Hide "${ne}" from ${Zn}? This only removes it from ${Zn} until you re-add it or reset local state.`,confirmLabel:"Hide",confirmVariant:"destructive"}))try{await i.command({type:"project.hide",localPath:X}),J(null)}catch($e){J($e instanceof Error?$e.message:String($e))}}async function Cn(X,ne){try{await wt(X,ne)}catch(we){J(we instanceof Error?we.message:String(we))}}function ke(X){Se(X)}function Le(X){r(`/overview/${X}`),$(!1),J(null)}function Nt(){Se(null)}async function ut(X){const ne=pe;if(ne)try{const we=await i.command({type:"feature.create",projectId:ne,title:X.title,description:X.description,generateOverview:yi.getState().showFeatureOverviewInSidebar});Se(null),await wt(ne,we.featureId)}catch(we){J(we instanceof Error?we.message:String(we))}}async function pn(X){const ne=l.projectGroups.flatMap($e=>$e.features).find($e=>$e.featureId===X);if(!ne)return;const we=await o.prompt({title:"Rename Feature",placeholder:"Feature name",initialValue:ne.title,confirmLabel:"Rename"});if(!(!we||we===ne.title))try{await i.command({type:"feature.rename",featureId:X,title:we}),J(null)}catch($e){J($e instanceof Error?$e.message:String($e))}}async function bn(X){const ne=l.projectGroups.flatMap($e=>$e.features).find($e=>$e.featureId===X);if(!(!ne||!await o.confirm({title:"Delete Feature",description:`Delete "${ne.title}"? Its chats will move to General and the feature folder will be removed.`,confirmLabel:"Delete",confirmVariant:"destructive"})))try{await i.command({type:"feature.delete",featureId:X}),n===X&&r("/"),J(null)}catch($e){J($e instanceof Error?$e.message:String($e))}}async function on(X,ne){try{await i.command({type:"feature.setBrowserState",featureId:X,browserState:ne}),J(null)}catch(we){J(we instanceof Error?we.message:String(we))}}async function Gt(X,ne){try{await i.command({type:"project.setBrowserState",projectId:X,browserState:ne}),J(null)}catch(we){J(we instanceof Error?we.message:String(we))}}async function Yt(X,ne){try{await i.command({type:"project.setGeneralChatsBrowserState",projectId:X,browserState:ne}),J(null)}catch(we){J(we instanceof Error?we.message:String(we))}}async function Mr(X,ne){try{await i.command({type:"feature.setStage",featureId:X,stage:ne}),J(null)}catch(we){J(we instanceof Error?we.message:String(we))}}async function fs(X,ne){try{const we=await i.command({type:"feature.updateOverview",featureId:X,content:ne});return J(null),we}catch(we){const $e=we instanceof Error?we.message:String(we);throw J($e),we}}async function Dl(X){try{await i.command({type:"provider.refreshUsage",provider:X}),J(null)}catch(ne){J(ne instanceof Error?ne.message:String(ne))}}async function K(X){if(X==="cursor")try{const ne=await i.command({type:"provider.browserLogin",provider:X});if(ne.availability==="login_required"){ne.statusDetail==="browser_launch_failed"&&je(!0),J(ne.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}J(null)}catch(ne){J(ne instanceof Error?ne.message:String(ne))}}async function at(X){try{const ne=await i.command({type:"provider.importUsageCurl",provider:"cursor",curlCommand:X});if(ne.availability==="login_required"&&ne.statusDetail==="invalid_curl_import"){J("Could not import that cURL command. Copy the get-current-period-usage request as cURL and paste it here.");return}je(!1),J(null)}catch(ne){J(ne instanceof Error?ne.message:String(ne))}}async function Un(X,ne){try{await i.command({type:"chat.setFeature",chatId:X,featureId:ne}),J(null)}catch(we){J(we instanceof Error?we.message:String(we))}}async function ms(X,ne){try{await i.command({type:"feature.reorder",projectId:X,orderedFeatureIds:ne}),J(null)}catch(we){J(we instanceof Error?we.message:String(we))}}async function ki(X){await _t({kind:"local_path",localPath:X})}async function Ht(X){await _t({kind:"project_request",project:X})}async function Pn(X){try{await Promise.all(fZ((h==null?void 0:h.projects.map(ne=>({localPath:ne.localPath})))??l.projectGroups.map(ne=>({projectId:ne.groupKey,localPath:ne.localPath}))).map(ne=>Tt(ne,X))),J(null)}catch(ne){throw J(ne instanceof Error?ne.message:String(ne)),ne}}async function ps(X){const ne=new URL("/api/directories",window.location.origin);X&&ne.searchParams.set("path",X);const we=await fetch(ne.toString());if(!we.ok){let Bt="Failed to load directories";try{const kn=await we.json();kn.error&&(Bt=kn.error)}catch{}throw new Error(Bt)}const $e=await we.json();return J(null),$e}async function Vn(X){try{await i.command({type:"update.check",force:X==null?void 0:X.force}),J(null)}catch(ne){J(ne instanceof Error?ne.message:String(ne))}}async function Fh(){try{const X=await i.command({type:"update.install"});if(!X.ok){Mm(),J(null),await o.alert({title:X.userTitle??"Update failed",description:X.userMessage??`${Zn} could not install the update. Try again later.`,closeLabel:"OK"});return}if(X.ok&&X.action==="reload"){window.location.reload();return}X.ok&&X.action==="restart"&&QR("awaiting_disconnect"),J(null)}catch(X){Mm(),J(X instanceof Error?X.message:String(X))}}async function Hh(X,ne){var we;try{let $e=W??((we=l.projectGroups[0])==null?void 0:we.groupKey)??null;if(!t&&!$e&&Je&&($e=(await i.command({type:"project.open",localPath:Je})).projectId,V($e)),!t&&!$e)throw new Error("Open a project first");if(ne!=null&&ne.provider&&!J2(ne.provider,(N==null?void 0:N.settings)??sr))throw new Error(`${ne.provider} is inactive.`);if(Be("auto"),ne!=null&&ne.provider&&!J2(ne.provider,(N==null?void 0:N.settings)??sr))throw new Error(`${ne.provider} is inactive.`);Be("auto");const Bt=await i.command({type:"chat.send",chatId:t??void 0,projectId:t?void 0:$e??void 0,provider:ne==null?void 0:ne.provider,message:X,model:ne==null?void 0:ne.model,modelOptions:ne==null?void 0:ne.modelOptions,planMode:ne==null?void 0:ne.planMode});!t&&Bt.chatId&&(he(Bt.chatId),r(`/chat/${Bt.chatId}`)),J(null)}catch($e){throw J($e instanceof Error?$e.message:String($e)),$e}}async function $s(){if(t)try{await i.command({type:"chat.cancel",chatId:t})}catch(X){J(X instanceof Error?X.message:String(X))}}async function Ao(X){if(await o.confirm({title:"Delete Chat",description:`Delete "${X.title}"? This cannot be undone.`,confirmLabel:"Delete",confirmVariant:"destructive"}))try{if(await i.command({type:"chat.delete",chatId:X.chatId}),X.chatId===t){const we=rZ(l.projectGroups,X.chatId);r(we?`/chat/${we}`:"/")}}catch(we){J(we instanceof Error?we.message:String(we))}}async function Bg(X){const ne=l.projectGroups.find(Bt=>Bt.groupKey===X);if(!ne)return;const we=ne.localPath.split("/").filter(Boolean).pop()??ne.localPath;if(await o.confirm({title:"Hide Project",description:`Hide "${we}" from ${Zn}? Existing chats for this project will be removed from ${Zn}, but the project itself is not deleted.`,confirmLabel:"Hide",confirmVariant:"destructive"}))try{await i.command({type:"project.remove",projectId:X}),ca.getState().clearProject(X),Ud.getState().clearProject(X),((rt==null?void 0:rt.projectId)??(w==null?void 0:w.projectId))===X&&r("/"),J(null)}catch(Bt){J(Bt instanceof Error?Bt.message:String(Bt))}}async function $h(X){var we,$e;const ne=(rt==null?void 0:rt.localPath)??((we=h==null?void 0:h.projects[0])==null?void 0:we.localPath)??(($e=l.projectGroups[0])==null?void 0:$e.localPath);if(ne)try{await br({action:X,localPath:ne})}catch(Bt){J(Bt instanceof Error?Bt.message:String(Bt))}}async function Uh(X){try{await br({action:"open_editor",localPath:X.path,line:X.line,column:X.column})}catch(ne){J(ne instanceof Error?ne.message:String(ne))}}async function Fg(X,ne){try{await br({action:X,localPath:ne})}catch(we){J(we instanceof Error?we.message:String(we))}}async function Ol(){var X;try{J(null);const ne=await i.command({type:"settings.bootstrapCustomThemes"}),we=(R==null?void 0:R.themesReadmeFileDisplay)??((X=ne==null?void 0:ne.localPath)==null?void 0:X.replace(/[/\\][^/\\]+$/,`${Ll(ne==null?void 0:ne.localPath)??"/"}THEME_README.md`))??BF();await br({action:"open_editor",localPath:we})}catch(ne){J(ne instanceof Error?ne.message:String(ne))}}function Ll(X){return X?X.includes("\\")?"\\":"/":null}async function Qi(){try{J(null);const X=await i.command({type:"settings.reloadThemeSettings"});X&&(E(X),yn.setState({themePreference:X.settings.themePreference,themeId:X.settings.themeId,customAppearance:X.settings.customAppearance,backgroundImage:X.settings.backgroundImage,backgroundOpacity:X.settings.backgroundOpacity,backgroundBlur:X.settings.backgroundBlur,showProjectIconsInSidebar:X.settings.showProjectIconsInSidebar,availableThemes:X.availableThemes,themeCssText:X.themeCssText}))}catch(X){J(X instanceof Error?X.message:String(X))}}async function br(X){const ne=Ii.getState();J(null),await i.command({type:"system.openExternal",...X,editor:X.action==="open_editor"?{preset:ne.editorPreset,commandTemplate:ne.editorCommandTemplate}:void 0})}function Vh(){var $e;const X=t?iZ(l.projectGroups,t):null,ne=t?ZR(l.projectGroups,t):null;if(X&&ne){J(null),Cn(ne,X.featureId??void 0);return}const we=uZ({selectedProjectId:W,sidebarProjectId:($e=l.projectGroups[0])==null?void 0:$e.groupKey,fallbackLocalProjectPath:Je});if(we){J(null),_t(we);return}J("Open a project first")}async function Hg(X,ne,we){if(t)try{await i.command({type:"chat.respondTool",chatId:t,toolUseId:X,result:{questions:ne,answers:we}})}catch($e){J($e instanceof Error?$e.message:String($e))}}async function pu(X,ne,we,$e,Bt){if(t){ne&&Pi.getState().setComposerPlanMode(!1);try{await i.command({type:"chat.respondTool",chatId:t,toolUseId:X,result:{confirmed:ne,...we?{clearContext:!0}:{},...$e?{message:$e}:{},...Bt?{attachments:Bt}:{}}})}catch(kn){J(kn instanceof Error?kn.message:String(kn))}}}return{socket:i,activeChatId:t,activeOverviewFeatureId:n,sidebarData:l,completedChatIds:ct,localProjects:h,updateSnapshot:g,chatSnapshot:v,featureOverviewSnapshot:w,keybindings:C,themeSettings:R,providerSettings:N,connectionStatus:j,sidebarReady:H,localProjectsReady:P,commandError:ie,startingLocalPath:ee,folderGroupsEnabled:Xe,showFeatureOverviewInSidebar:Et,kanbanStatusesEnabled:Rt,sidebarOpen:O,sidebarCollapsed:z,scrollRef:He,inputRef:De,messages:Qe,latestToolIds:At,runtime:rt,usage:Oe,availableProviders:qe,isProcessing:gt,canCancel:Ve,transcriptPaddingBottom:mn,showScrollButton:sn,navbarLocalPath:tn,editorLabel:fe,hasSelectedProject:Jt,createFeatureModalProjectId:pe,cursorCurlImportOpen:Re,openSidebar:()=>$(!0),closeSidebar:()=>$(!1),collapseSidebar:()=>G(!0),expandSidebar:()=>G(!1),toggleProjectsSidebar:X=>{if(X){$(!1),G(ne=>!ne);return}$(ne=>!ne)},updateScrollState:Kt,scrollToBottom:vt,handleCreateChat:Cn,handleCreateFeature:ke,handleOpenFeatureOverview:Le,handleCloseCreateFeatureModal:Nt,handleConfirmCreateFeature:ut,handleRenameFeature:pn,handleDeleteFeature:bn,handleSetProjectBrowserState:Gt,handleSetProjectGeneralChatsBrowserState:Yt,handleSetFeatureBrowserState:on,handleSetFeatureStage:Mr,handleSetChatFeature:Un,handleReorderFeatures:ms,handleOpenLocalProject:ki,handleHideLocalProject:yt,handleListDirectories:ps,handleCreateProject:Ht,handleCheckForUpdates:Vn,handleInstallUpdate:Fh,handleRefreshProviderUsage:Dl,handleOpenProviderLogin:K,handleCloseCursorCurlImport:()=>je(!1),handleSubmitCursorCurlImport:at,handleSetCommitProjectMetadataDirectory:Pn,handleSend:Hh,handleCancel:$s,handleDeleteChat:Ao,handleRemoveProject:Bg,handleUpdateFeatureOverview:fs,handleOpenExternal:$h,handleOpenExternalPath:Fg,handleOpenCustomThemes:Ol,handleRefreshThemeSettings:Qi,handleOpenLocalLink:Uh,handleCompose:Vh,handleAskUserQuestion:Hg,handleExitPlanMode:pu}}function lh(e){return[...e.features.flatMap(t=>t.chats),...e.generalChats]}function fZ(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 mZ(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const pZ=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gZ=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,vZ={};function JR(e,t){return(vZ.jsx?gZ:pZ).test(e)}const _Z=/[ \t\n\f\r]/g;function yZ(e){return typeof e=="object"?e.type==="text"?eT(e.value):!1:eT(e)}function eT(e){return e.replace(_Z,"")===""}class Ph{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ph.prototype.normal={};Ph.prototype.property={};Ph.prototype.space=void 0;function xO(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Ph(n,r,t)}function Wx(e){return e.toLowerCase()}class ai{constructor(t,n){this.attribute=n,this.property=t}}ai.prototype.attribute="";ai.prototype.booleanish=!1;ai.prototype.boolean=!1;ai.prototype.commaOrSpaceSeparated=!1;ai.prototype.commaSeparated=!1;ai.prototype.defined=!1;ai.prototype.mustUseProperty=!1;ai.prototype.number=!1;ai.prototype.overloadedBoolean=!1;ai.prototype.property="";ai.prototype.spaceSeparated=!1;ai.prototype.space=void 0;let bZ=0;const xt=jl(),Yn=jl(),qx=jl(),Ee=jl(),_n=jl(),Pc=jl(),_i=jl();function jl(){return 2**++bZ}const Kx=Object.freeze(Object.defineProperty({__proto__:null,boolean:xt,booleanish:Yn,commaOrSpaceSeparated:_i,commaSeparated:Pc,number:Ee,overloadedBoolean:qx,spaceSeparated:_n},Symbol.toStringTag,{value:"Module"})),Ky=Object.keys(Kx);class Pw extends ai{constructor(t,n,r,i){let o=-1;if(super(t,n),tT(this,"space",i),typeof r=="number")for(;++o<Ky.length;){const l=Ky[o];tT(this,Ky[o],(r&Kx[l])===Kx[l])}}}Pw.prototype.defined=!0;function tT(e,t,n){n&&(e[t]=n)}function du(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new Pw(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Wx(r)]=r,n[Wx(o.attribute)]=r}return new Ph(t,n,e.space)}const wO=du({properties:{ariaActiveDescendant:null,ariaAtomic:Yn,ariaAutoComplete:null,ariaBusy:Yn,ariaChecked:Yn,ariaColCount:Ee,ariaColIndex:Ee,ariaColSpan:Ee,ariaControls:_n,ariaCurrent:null,ariaDescribedBy:_n,ariaDetails:null,ariaDisabled:Yn,ariaDropEffect:_n,ariaErrorMessage:null,ariaExpanded:Yn,ariaFlowTo:_n,ariaGrabbed:Yn,ariaHasPopup:null,ariaHidden:Yn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_n,ariaLevel:Ee,ariaLive:null,ariaModal:Yn,ariaMultiLine:Yn,ariaMultiSelectable:Yn,ariaOrientation:null,ariaOwns:_n,ariaPlaceholder:null,ariaPosInSet:Ee,ariaPressed:Yn,ariaReadOnly:Yn,ariaRelevant:null,ariaRequired:Yn,ariaRoleDescription:_n,ariaRowCount:Ee,ariaRowIndex:Ee,ariaRowSpan:Ee,ariaSelected:Yn,ariaSetSize:Ee,ariaSort:null,ariaValueMax:Ee,ariaValueMin:Ee,ariaValueNow:Ee,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function SO(e,t){return t in e?e[t]:t}function CO(e,t){return SO(e,t.toLowerCase())}const xZ=du({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Pc,acceptCharset:_n,accessKey:_n,action:null,allow:null,allowFullScreen:xt,allowPaymentRequest:xt,allowUserMedia:xt,alt:null,as:null,async:xt,autoCapitalize:null,autoComplete:_n,autoFocus:xt,autoPlay:xt,blocking:_n,capture:null,charSet:null,checked:xt,cite:null,className:_n,cols:Ee,colSpan:null,content:null,contentEditable:Yn,controls:xt,controlsList:_n,coords:Ee|Pc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:xt,defer:xt,dir:null,dirName:null,disabled:xt,download:qx,draggable:Yn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:xt,formTarget:null,headers:_n,height:Ee,hidden:qx,high:Ee,href:null,hrefLang:null,htmlFor:_n,httpEquiv:_n,id:null,imageSizes:null,imageSrcSet:null,inert:xt,inputMode:null,integrity:null,is:null,isMap:xt,itemId:null,itemProp:_n,itemRef:_n,itemScope:xt,itemType:_n,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:xt,low:Ee,manifest:null,max:null,maxLength:Ee,media:null,method:null,min:null,minLength:Ee,multiple:xt,muted:xt,name:null,nonce:null,noModule:xt,noValidate:xt,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:xt,optimum:Ee,pattern:null,ping:_n,placeholder:null,playsInline:xt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:xt,referrerPolicy:null,rel:_n,required:xt,reversed:xt,rows:Ee,rowSpan:Ee,sandbox:_n,scope:null,scoped:xt,seamless:xt,selected:xt,shadowRootClonable:xt,shadowRootDelegatesFocus:xt,shadowRootMode:null,shape:null,size:Ee,sizes:null,slot:null,span:Ee,spellCheck:Yn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ee,step:null,style:null,tabIndex:Ee,target:null,title:null,translate:null,type:null,typeMustMatch:xt,useMap:null,value:Yn,width:Ee,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_n,axis:null,background:null,bgColor:null,border:Ee,borderColor:null,bottomMargin:Ee,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:xt,declare:xt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ee,leftMargin:Ee,link:null,longDesc:null,lowSrc:null,marginHeight:Ee,marginWidth:Ee,noResize:xt,noHref:xt,noShade:xt,noWrap:xt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ee,rules:null,scheme:null,scrolling:Yn,standby:null,summary:null,text:null,topMargin:Ee,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ee,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:xt,disableRemotePlayback:xt,prefix:null,property:null,results:Ee,security:null,unselectable:null},space:"html",transform:CO}),wZ=du({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:_i,accentHeight:Ee,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ee,amplitude:Ee,arabicForm:null,ascent:Ee,attributeName:null,attributeType:null,azimuth:Ee,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ee,by:null,calcMode:null,capHeight:Ee,className:_n,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:Ee,diffuseConstant:Ee,direction:null,display:null,dur:null,divisor:Ee,dominantBaseline:null,download:xt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ee,enableBackground:null,end:null,event:null,exponent:Ee,externalResourcesRequired:null,fill:null,fillOpacity:Ee,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:Pc,g2:Pc,glyphName:Pc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ee,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ee,horizOriginX:Ee,horizOriginY:Ee,id:null,ideographic:Ee,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ee,k:Ee,k1:Ee,k2:Ee,k3:Ee,k4:Ee,kernelMatrix:_i,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ee,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:Ee,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:Ee,overlineThickness:Ee,paintOrder:null,panose1:null,path:null,pathLength:Ee,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_n,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ee,pointsAtY:Ee,pointsAtZ:Ee,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:_i,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:_i,rev:_i,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:_i,requiredFeatures:_i,requiredFonts:_i,requiredFormats:_i,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:Ee,specularExponent:Ee,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ee,strikethroughThickness:Ee,string:null,stroke:null,strokeDashArray:_i,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ee,strokeOpacity:Ee,strokeWidth:null,style:null,surfaceScale:Ee,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:_i,tabIndex:Ee,tableValues:null,target:null,targetX:Ee,targetY:Ee,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:_i,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ee,underlineThickness:Ee,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ee,values:null,vAlphabetic:Ee,vMathematical:Ee,vectorEffect:null,vHanging:Ee,vIdeographic:Ee,version:null,vertAdvY:Ee,vertOriginX:Ee,vertOriginY:Ee,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ee,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:SO}),kO=du({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()}}),EO=du({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:CO}),RO=du({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),SZ={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"},CZ=/[A-Z]/g,nT=/-[a-z]/g,kZ=/^data[-\w.:]+$/i;function EZ(e,t){const n=Wx(t);let r=t,i=ai;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&kZ.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(nT,TZ);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!nT.test(o)){let l=o.replace(CZ,RZ);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=Pw}return new i(r,t)}function RZ(e){return"-"+e.toLowerCase()}function TZ(e){return e.charAt(1).toUpperCase()}const NZ=xO([wO,xZ,kO,EO,RO],"html"),Iw=xO([wO,wZ,kO,EO,RO],"svg");function MZ(e){return e.join(" ").trim()}var bc={},Gy,rT;function AZ(){if(rT)return Gy;rT=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,h=`
608
+ `,d="/",g="*",p="",v="comment",b="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(W){var V=W.match(t);V&&(R+=V.length);var O=W.lastIndexOf(h);E=~O?W.length-O:E+W.length}function L(){var W={line:R,column:E};return function(V){return V.position=new j(W),Y(),V}}function j(W){this.start=W,this.end={line:R,column:E},this.source=k.source}j.prototype.content=C;function D(W){var V=new Error(k.source+":"+R+":"+E+": "+W);if(V.reason=W,V.filename=k.source,V.line=R,V.column=E,V.source=C,!k.silent)throw V}function H(W){var V=W.exec(C);if(V){var O=V[0];return N(O),C=C.slice(O.length),V}}function Y(){H(n)}function P(W){var V;for(W=W||[];V=q();)V!==!1&&W.push(V);return W}function q(){var W=L();if(!(d!=C.charAt(0)||g!=C.charAt(1))){for(var V=2;p!=C.charAt(V)&&(g!=C.charAt(V)||d!=C.charAt(V+1));)++V;if(V+=2,p===C.charAt(V-1))return D("End of comment missing");var O=C.slice(2,V-2);return E+=2,N(O),C=C.slice(V),E+=2,W({type:v,comment:O})}}function F(){var W=L(),V=H(r);if(V){if(q(),!H(i))return D("property missing ':'");var O=H(o),$=W({type:b,property:S(V[0].replace(e,p)),value:O?S(O[0].replace(e,p)):p});return H(l),$}}function U(){var W=[];P(W);for(var V;V=F();)V!==!1&&(W.push(V),P(W));return W}return Y(),U()}function S(C){return C?C.replace(c,p):p}return Gy=w,Gy}var iT;function jZ(){if(iT)return bc;iT=1;var e=bc&&bc.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(bc,"__esModule",{value:!0}),bc.default=n;const t=e(AZ());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const l=(0,t.default)(r),c=typeof i=="function";return l.forEach(h=>{if(h.type!=="declaration")return;const{property:d,value:g}=h;c?i(d,g,h):g&&(o=o||{},o[d]=g)}),o}return bc}var gd={},sT;function DZ(){if(sT)return gd;sT=1,Object.defineProperty(gd,"__esModule",{value:!0}),gd.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(d){return!d||n.test(d)||e.test(d)},l=function(d,g){return g.toUpperCase()},c=function(d,g){return"".concat(g,"-")},h=function(d,g){return g===void 0&&(g={}),o(d)?d:(d=d.toLowerCase(),g.reactCompat?d=d.replace(i,c):d=d.replace(r,c),d.replace(t,l))};return gd.camelCase=h,gd}var vd,oT;function OZ(){if(oT)return vd;oT=1;var e=vd&&vd.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(jZ()),n=DZ();function r(i,o){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(c,h){c&&h&&(l[(0,n.camelCase)(c,o)]=h)}),l}return r.default=r,vd=r,vd}var LZ=OZ();const zZ=qp(LZ),TO=NO("end"),Bw=NO("start");function NO(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 PZ(e){const t=Bw(e),n=TO(e);if(t&&n)return{start:t,end:n}}function Vd(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?aT(e.position):"start"in e||"end"in e?aT(e):"line"in e||"column"in e?Gx(e):""}function Gx(e){return lT(e&&e.line)+":"+lT(e&&e.column)}function aT(e){return Gx(e&&e.start)+"-"+Gx(e&&e.end)}function lT(e){return e&&typeof e=="number"?e:1}class Ir extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},l=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(l=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const h=r.indexOf(":");h===-1?o.ruleId=r:(o.source=r.slice(0,h),o.ruleId=r.slice(h+1))}if(!o.place&&o.ancestors&&o.ancestors){const h=o.ancestors[o.ancestors.length-1];h&&(o.place=h.position)}const c=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=c?c.line:void 0,this.name=Vd(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=l&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ir.prototype.file="";Ir.prototype.name="";Ir.prototype.reason="";Ir.prototype.message="";Ir.prototype.stack="";Ir.prototype.column=void 0;Ir.prototype.line=void 0;Ir.prototype.ancestors=void 0;Ir.prototype.cause=void 0;Ir.prototype.fatal=void 0;Ir.prototype.place=void 0;Ir.prototype.ruleId=void 0;Ir.prototype.source=void 0;const Fw={}.hasOwnProperty,IZ=new Map,BZ=/[A-Z]/g,FZ=new Set(["table","tbody","thead","tfoot","tr"]),HZ=new Set(["td","th"]),MO="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function $Z(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=XZ(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=YZ(n,t.jsx,t.jsxs)}const i={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"?Iw:NZ,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=AO(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function AO(e,t,n){if(t.type==="element")return UZ(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return VZ(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return qZ(e,t,n);if(t.type==="mdxjsEsm")return WZ(e,t);if(t.type==="root")return KZ(e,t,n);if(t.type==="text")return GZ(e,t)}function UZ(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Iw,e.schema=i),e.ancestors.push(t);const o=DO(e,t.tagName,!1),l=ZZ(e,t);let c=$w(e,t);return FZ.has(t.tagName)&&(c=c.filter(function(h){return typeof h=="string"?!yZ(h):!0})),jO(e,l,o,t),Hw(l,c),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function VZ(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)}ch(e,t.position)}function WZ(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ch(e,t.position)}function qZ(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Iw,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:DO(e,t.name,!0),l=QZ(e,t),c=$w(e,t);return jO(e,l,o,t),Hw(l,c),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function KZ(e,t,n){const r={};return Hw(r,$w(e,t)),e.create(t,e.Fragment,r,n)}function GZ(e,t){return t.value}function jO(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Hw(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function YZ(e,t,n){return r;function r(i,o,l,c){const d=Array.isArray(l.children)?n:t;return c?d(o,l,c):d(o,l)}}function XZ(e,t){return n;function n(r,i,o,l){const c=Array.isArray(o.children),h=Bw(r);return t(i,o,l,c,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function ZZ(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Fw.call(t.properties,i)){const o=JZ(e,i,t.properties[i]);if(o){const[l,c]=o;e.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&HZ.has(t.tagName)?r=c:n[l]=c}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function QZ(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const l=o.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else ch(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const c=r.value.data.estree.body[0];c.type,o=e.evaluater.evaluateExpression(c.expression)}else ch(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function $w(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:IZ;for(;++r<t.children.length;){const o=t.children[r];let l;if(e.passKeys){const h=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(h){const d=i.get(h)||0;l=h+"-"+d,i.set(h,d+1)}}const c=AO(e,o,l);c!==void 0&&n.push(c)}return n}function JZ(e,t,n){const r=EZ(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?mZ(n):MZ(n)),r.property==="style"){let i=typeof n=="object"?n:eQ(e,String(n));return e.stylePropertyNameCase==="css"&&(i=tQ(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?SZ[r.property]||r.property:r.attribute,n]}}function eQ(e,t){try{return zZ(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Ir("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=MO+"#cannot-parse-style-attribute",i}}function DO(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,l;for(;++o<i.length;){const c=JR(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};l=l?{type:"MemberExpression",object:l,property:c,computed:!!(o&&c.type==="Literal"),optional:!1}:c}r=l}else r=JR(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Fw.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);ch(e)}function ch(e,t){const n=new Ir("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=MO+"#cannot-handle-mdx-estrees-without-createevaluater",n}function tQ(e){const t={};let n;for(n in e)Fw.call(e,n)&&(t[nQ(n)]=e[n]);return t}function nQ(e){let t=e.replace(BZ,rQ);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function rQ(e){return"-"+e.toLowerCase()}const Yy={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"]},iQ={};function Uw(e,t){const n=iQ,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return OO(e,r,i)}function OO(e,t,n){if(sQ(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 cT(e.children,t,n)}return Array.isArray(e)?cT(e,t,n):""}function cT(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=OO(e[i],t,n);return r.join("")}function sQ(e){return!!(e&&typeof e=="object")}const uT=document.createElement("i");function Vw(e){const t="&"+e+";";uT.innerHTML=t;const n=uT.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function wi(e,t,n,r){const i=e.length;let o=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i: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);o<r.length;)l=r.slice(o,o+1e4),l.unshift(t,0),e.splice(...l),o+=1e4,t+=1e4}function $i(e,t){return e.length>0?(wi(e,e.length,0,t),e):t}const dT={}.hasOwnProperty;function LO(e){const t={};let n=-1;for(;++n<e.length;)oQ(t,e[n]);return t}function oQ(e,t){let n;for(n in t){const i=(dT.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let l;if(o)for(l in o){dT.call(i,l)||(i[l]=[]);const c=o[l];aQ(i[l],Array.isArray(c)?c:c?[c]:[])}}}function aQ(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);wi(e,0,0,r)}function zO(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 as(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ur=Na(/[A-Za-z]/),zr=Na(/[\dA-Za-z]/),lQ=Na(/[#-'*+\--9=?A-Z^-~]/);function zp(e){return e!==null&&(e<32||e===127)}const Yx=Na(/\d/),cQ=Na(/[\dA-Fa-f]/),uQ=Na(/[!-/:-@[-`{-~]/);function it(e){return e!==null&&e<-2}function vn(e){return e!==null&&(e<0||e===32)}function Ot(e){return e===-2||e===-1||e===32}const Og=Na(new RegExp("\\p{P}|\\p{S}","u")),Sl=Na(/\s/);function Na(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function hu(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let l="";if(o===37&&zr(e.charCodeAt(n+1))&&zr(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){const c=e.charCodeAt(n+1);o<56320&&c>56319&&c<57344?(l=String.fromCharCode(o,c),i=1):l="�"}else l=String.fromCharCode(o);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Ft(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return l;function l(h){return Ot(h)?(e.enter(n),c(h)):t(h)}function c(h){return Ot(h)&&o++<i?(e.consume(h),c):(e.exit(n),t(h))}}const dQ={tokenize:hQ};function hQ(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Ft(e,t,"linePrefix")}function i(c){return e.enter("paragraph"),o(c)}function o(c){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,l(c)}function l(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return it(c)?(e.consume(c),e.exit("chunkText"),o):(e.consume(c),l)}}const fQ={tokenize:mQ},hT={tokenize:pQ};function mQ(e){const t=this,n=[];let r=0,i,o,l;return c;function c(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,i&&R();const N=t.events.length;let L=N,j;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){j=t.events[L][1].end;break}k(r);let D=N;for(;D<t.events.length;)t.events[D][1].end={...j},D++;return wi(t.events,L+1,0,t.events.slice(N)),t.events.length=D,d(E)}return c(E)}function d(E){if(r===n.length){if(!i)return v(E);if(i.currentConstruct&&i.currentConstruct.concrete)return w(E);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(hT,g,p)(E)}function g(E){return i&&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(hT,b,w)(E)}function b(E){return r++,n.push([t.currentConstruct,t.containerState]),v(E)}function w(E){if(E===null){i&&R(),k(0),e.consume(E);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),S(E)}function S(E){if(E===null){C(e.exit("chunkFlow"),!0),k(0),e.consume(E);return}return it(E)?(e.consume(E),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,c):(e.consume(E),S)}function C(E,N){const L=t.sliceStream(E);if(N&&L.push(null),E.previous=o,o&&(o.next=E),o=E,i.defineSkip(E.start),i.write(L),t.parser.lazy[E.start.line]){let j=i.events.length;for(;j--;)if(i.events[j][1].start.offset<l&&(!i.events[j][1].end||i.events[j][1].end.offset>l))return;const D=t.events.length;let H=D,Y,P;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){if(Y){P=t.events[H][1].end;break}Y=!0}for(k(r),j=D;j<t.events.length;)t.events[j][1].end={...P},j++;wi(t.events,H+1,0,t.events.slice(D)),t.events.length=j}}function k(E){let N=n.length;for(;N-- >E;){const L=n[N];t.containerState=L[1],L[0].exit.call(t,e)}n.length=E}function R(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function pQ(e,t,n){return Ft(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Wc(e){if(e===null||vn(e)||Sl(e))return 1;if(Og(e))return 2}function Lg(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const Xx={name:"attention",resolveAll:gQ,tokenize:vQ};function gQ(e,t){let n=-1,r,i,o,l,c,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};fT(p,-h),fT(v,h),l={type:h>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},c={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:v},o={type:h>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:h>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},e[r][1].end={...l.start},e[n][1].start={...c.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=$i(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=$i(d,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",o,t]]),d=$i(d,Lg(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=$i(d,[["exit",o,t],["enter",c,t],["exit",c,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,d=$i(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,wi(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 vQ(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Wc(r);let o;return l;function l(h){return o=h,e.enter("attentionSequence"),c(h)}function c(h){if(h===o)return e.consume(h),c;const d=e.exit("attentionSequence"),g=Wc(h),p=!g||g===2&&i||n.includes(h),v=!i||i===2&&g||n.includes(r);return d._open=!!(o===42?p:p&&(i||!v)),d._close=!!(o===42?v:v&&(g||!p)),t(h)}}function fT(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const _Q={name:"autolink",tokenize:yQ};function yQ(e,t,n){let r=0;return i;function i(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(b){return Ur(b)?(e.consume(b),l):b===64?n(b):d(b)}function l(b){return b===43||b===45||b===46||zr(b)?(r=1,c(b)):d(b)}function c(b){return b===58?(e.consume(b),r=0,h):(b===43||b===45||b===46||zr(b))&&r++<32?(e.consume(b),c):(r=0,d(b))}function h(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||zp(b)?n(b):(e.consume(b),h)}function d(b){return b===64?(e.consume(b),g):lQ(b)?(e.consume(b),d):n(b)}function g(b){return zr(b)?p(b):n(b)}function p(b){return b===46?(e.consume(b),r=0,g):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):v(b)}function v(b){if((b===45||zr(b))&&r++<63){const w=b===45?v:p;return e.consume(b),w}return n(b)}}const Ih={partial:!0,tokenize:bQ};function bQ(e,t,n){return r;function r(o){return Ot(o)?Ft(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||it(o)?t(o):n(o)}}const PO={continuation:{tokenize:wQ},exit:SQ,name:"blockQuote",tokenize:xQ};function xQ(e,t,n){const r=this;return i;function i(l){if(l===62){const c=r.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),o}return n(l)}function o(l){return Ot(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function wQ(e,t,n){const r=this;return i;function i(l){return Ot(l)?Ft(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(PO,t,n)(l)}}function SQ(e){e.exit("blockQuote")}const IO={name:"characterEscape",tokenize:CQ};function CQ(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return uQ(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const BO={name:"characterReference",tokenize:kQ};function kQ(e,t,n){const r=this;let i=0,o,l;return c;function c(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"),o=31,l=zr,g(p))}function d(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=cQ,g):(e.enter("characterReferenceValue"),o=7,l=Yx,g(p))}function g(p){if(p===59&&i){const v=e.exit("characterReferenceValue");return l===zr&&!Vw(r.sliceSerialize(v))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(p)&&i++<o?(e.consume(p),g):n(p)}}const mT={partial:!0,tokenize:RQ},pT={concrete:!0,name:"codeFenced",tokenize:EQ};function EQ(e,t,n){const r=this,i={partial:!0,tokenize:L};let o=0,l=0,c;return h;function h(j){return d(j)}function d(j){const D=r.events[r.events.length-1];return o=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,c=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(j)}function g(j){return j===c?(l++,e.consume(j),g):l<3?n(j):(e.exit("codeFencedFenceSequence"),Ot(j)?Ft(e,p,"whitespace")(j):p(j))}function p(j){return j===null||it(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(mT,S,N)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(j))}function v(j){return j===null||it(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(j)):Ot(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ft(e,b,"whitespace")(j)):j===96&&j===c?n(j):(e.consume(j),v)}function b(j){return j===null||it(j)?p(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(j))}function w(j){return j===null||it(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(j)):j===96&&j===c?n(j):(e.consume(j),w)}function S(j){return e.attempt(i,N,C)(j)}function C(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),k}function k(j){return o>0&&Ot(j)?Ft(e,R,"linePrefix",o+1)(j):R(j)}function R(j){return j===null||it(j)?e.check(mT,S,N)(j):(e.enter("codeFlowValue"),E(j))}function E(j){return j===null||it(j)?(e.exit("codeFlowValue"),R(j)):(e.consume(j),E)}function N(j){return e.exit("codeFenced"),t(j)}function L(j,D,H){let Y=0;return P;function P(V){return j.enter("lineEnding"),j.consume(V),j.exit("lineEnding"),q}function q(V){return j.enter("codeFencedFence"),Ot(V)?Ft(j,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):F(V)}function F(V){return V===c?(j.enter("codeFencedFenceSequence"),U(V)):H(V)}function U(V){return V===c?(Y++,j.consume(V),U):Y>=l?(j.exit("codeFencedFenceSequence"),Ot(V)?Ft(j,W,"whitespace")(V):W(V)):H(V)}function W(V){return V===null||it(V)?(j.exit("codeFencedFence"),D(V)):H(V)}}}function RQ(e,t,n){const r=this;return i;function i(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Xy={name:"codeIndented",tokenize:NQ},TQ={partial:!0,tokenize:MQ};function NQ(e,t,n){const r=this;return i;function i(d){return e.enter("codeIndented"),Ft(e,o,"linePrefix",5)(d)}function o(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):it(d)?e.attempt(TQ,l,h)(d):(e.enter("codeFlowValue"),c(d))}function c(d){return d===null||it(d)?(e.exit("codeFlowValue"),l(d)):(e.consume(d),c)}function h(d){return e.exit("codeIndented"),t(d)}}function MQ(e,t,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):it(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):Ft(e,o,"linePrefix",5)(l)}function o(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):it(l)?i(l):n(l)}}const AQ={name:"codeText",previous:DQ,resolve:jQ,tokenize:OQ};function jQ(e){let t=e.length-4,n=3,r,i;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;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function DQ(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function OQ(e,t,n){let r=0,i,o;return l;function l(p){return e.enter("codeText"),e.enter("codeTextSequence"),c(p)}function c(p){return p===96?(e.consume(p),r++,c):(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?(o=e.enter("codeTextSequence"),i=0,g(p)):it(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||it(p)?(e.exit("codeTextData"),h(p)):(e.consume(p),d)}function g(p){return p===96?(e.consume(p),i++,g):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(o.type="codeTextData",d(p))}}class LQ{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 i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&_d(this.left,r),o.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),_d(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),_d(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);_d(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);_d(this.left,n.reverse())}}}function _d(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 FO(e){const t={};let n=-1,r,i,o,l,c,h,d;const g=new LQ(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,o=0,o<h.length&&h[o][1].type==="lineEndingBlank"&&(o+=2),o<h.length&&h[o][1].type==="content"))for(;++o<h.length&&h[o][1].type!=="content";)h[o][1].type==="chunkText"&&(h[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,zQ(g,n)),n=t[n],d=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(l=g.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(g.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...g.get(i)[1].start},c=g.slice(i,n),c.unshift(r),g.splice(i,n-i+1,c))}}return wi(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!d}function zQ(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const c=l.events,h=[],d={};let g,p,v=-1,b=n,w=0,S=0;const C=[S];for(;b;){for(;e.get(++i)[1]!==b;);o.push(i),b._tokenizer||(g=r.sliceStream(b),b.next||g.push(null),p&&l.defineSkip(b.start),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(g),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),p=b,b=b.next}for(b=n;++v<c.length;)c[v][0]==="exit"&&c[v-1][0]==="enter"&&c[v][1].type===c[v-1][1].type&&c[v][1].start.line!==c[v][1].end.line&&(S=v+1,C.push(S),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(l.events=[],b?(b._tokenizer=void 0,b.previous=void 0):C.pop(),v=C.length;v--;){const k=c.slice(C[v],C[v+1]),R=o.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 PQ={resolve:BQ,tokenize:FQ},IQ={partial:!0,tokenize:HQ};function BQ(e){return FO(e),e}function FQ(e,t){let n;return r;function r(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(c)}function i(c){return c===null?o(c):it(c)?e.check(IQ,l,o)(c):(e.consume(c),i)}function o(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function l(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function HQ(e,t,n){const r=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Ft(e,o,"linePrefix")}function o(l){if(l===null||it(l))return n(l);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function HO(e,t,n,r,i,o,l,c,h){const d=h||Number.POSITIVE_INFINITY;let g=0;return p;function p(k){return k===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(k),e.exit(o),v):k===null||k===32||k===41||zp(k)?n(k):(e.enter(r),e.enter(l),e.enter(c),e.enter("chunkString",{contentType:"string"}),S(k))}function v(k){return k===62?(e.enter(o),e.consume(k),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===62?(e.exit("chunkString"),e.exit(c),v(k)):k===null||k===60||it(k)?n(k):(e.consume(k),k===92?w:b)}function w(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function S(k){return!g&&(k===null||k===41||vn(k))?(e.exit("chunkString"),e.exit(c),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||zp(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 $O(e,t,n,r,i,o){const l=this;let c=0,h;return d;function d(b){return e.enter(r),e.enter(i),e.consume(b),e.exit(i),e.enter(o),g}function g(b){return c>999||b===null||b===91||b===93&&!h||b===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(b):b===93?(e.exit(o),e.enter(i),e.consume(b),e.exit(i),e.exit(r),t):it(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===null||b===91||b===93||it(b)||c++>999?(e.exit("chunkString"),g(b)):(e.consume(b),h||(h=!Ot(b)),b===92?v:p)}function v(b){return b===91||b===92||b===93?(e.consume(b),c++,p):p(b)}}function UO(e,t,n,r,i,o){let l;return c;function c(v){return v===34||v===39||v===40?(e.enter(r),e.enter(i),e.consume(v),e.exit(i),l=v===40?41:v,h):n(v)}function h(v){return v===l?(e.enter(i),e.consume(v),e.exit(i),e.exit(r),t):(e.enter(o),d(v))}function d(v){return v===l?(e.exit(o),h(l)):v===null?n(v):it(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),Ft(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===l||v===null||it(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 Wd(e,t){let n;return r;function r(i){return it(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ot(i)?Ft(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const $Q={name:"definition",tokenize:VQ},UQ={partial:!0,tokenize:WQ};function VQ(e,t,n){const r=this;let i;return o;function o(b){return e.enter("definition"),l(b)}function l(b){return $O.call(r,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function c(b){return i=as(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),h):n(b)}function h(b){return vn(b)?Wd(e,d)(b):d(b)}function d(b){return HO(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt(UQ,p,p)(b)}function p(b){return Ot(b)?Ft(e,v,"whitespace")(b):v(b)}function v(b){return b===null||it(b)?(e.exit("definition"),r.parser.defined.push(i),t(b)):n(b)}}function WQ(e,t,n){return r;function r(c){return vn(c)?Wd(e,i)(c):n(c)}function i(c){return UO(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function o(c){return Ot(c)?Ft(e,l,"whitespace")(c):l(c)}function l(c){return c===null||it(c)?t(c):n(c)}}const qQ={name:"hardBreakEscape",tokenize:KQ};function KQ(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return it(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const GQ={name:"headingAtx",resolve:YQ,tokenize:XQ};function YQ(e,t){let n=e.length-2,r=3,i,o;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&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},wi(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function XQ(e,t,n){let r=0;return i;function i(g){return e.enter("atxHeading"),o(g)}function o(g){return e.enter("atxHeadingSequence"),l(g)}function l(g){return g===35&&r++<6?(e.consume(g),l):g===null||vn(g)?(e.exit("atxHeadingSequence"),c(g)):n(g)}function c(g){return g===35?(e.enter("atxHeadingSequence"),h(g)):g===null||it(g)?(e.exit("atxHeading"),t(g)):Ot(g)?Ft(e,c,"whitespace")(g):(e.enter("atxHeadingText"),d(g))}function h(g){return g===35?(e.consume(g),h):(e.exit("atxHeadingSequence"),c(g))}function d(g){return g===null||g===35||vn(g)?(e.exit("atxHeadingText"),c(g)):(e.consume(g),d)}}const ZQ=["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"],gT=["pre","script","style","textarea"],QQ={concrete:!0,name:"htmlFlow",resolveTo:tJ,tokenize:nJ},JQ={partial:!0,tokenize:iJ},eJ={partial:!0,tokenize:rJ};function tJ(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 nJ(e,t,n){const r=this;let i,o,l,c,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),o=!0,S):A===63?(e.consume(A),i=3,r.interrupt?t:M):Ur(A)?(e.consume(A),l=String.fromCharCode(A),C):n(A)}function v(A){return A===45?(e.consume(A),i=2,b):A===91?(e.consume(A),i=5,c=0,w):Ur(A)?(e.consume(A),i=4,r.interrupt?t:M):n(A)}function b(A){return A===45?(e.consume(A),r.interrupt?t:M):n(A)}function w(A){const ie="CDATA[";return A===ie.charCodeAt(c++)?(e.consume(A),c===ie.length?r.interrupt?t:F:w):n(A)}function S(A){return Ur(A)?(e.consume(A),l=String.fromCharCode(A),C):n(A)}function C(A){if(A===null||A===47||A===62||vn(A)){const ie=A===47,J=l.toLowerCase();return!ie&&!o&&gT.includes(J)?(i=1,r.interrupt?t(A):F(A)):ZQ.includes(l.toLowerCase())?(i=6,ie?(e.consume(A),k):r.interrupt?t(A):F(A)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(A):o?R(A):E(A))}return A===45||zr(A)?(e.consume(A),l+=String.fromCharCode(A),C):n(A)}function k(A){return A===62?(e.consume(A),r.interrupt?t:F):n(A)}function R(A){return Ot(A)?(e.consume(A),R):P(A)}function E(A){return A===47?(e.consume(A),P):A===58||A===95||Ur(A)?(e.consume(A),N):Ot(A)?(e.consume(A),E):P(A)}function N(A){return A===45||A===46||A===58||A===95||zr(A)?(e.consume(A),N):L(A)}function L(A){return A===61?(e.consume(A),j):Ot(A)?(e.consume(A),L):E(A)}function j(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),h=A,D):Ot(A)?(e.consume(A),j):H(A)}function D(A){return A===h?(e.consume(A),h=null,Y):A===null||it(A)?n(A):(e.consume(A),D)}function H(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||vn(A)?L(A):(e.consume(A),H)}function Y(A){return A===47||A===62||Ot(A)?E(A):n(A)}function P(A){return A===62?(e.consume(A),q):n(A)}function q(A){return A===null||it(A)?F(A):Ot(A)?(e.consume(A),q):n(A)}function F(A){return A===45&&i===2?(e.consume(A),O):A===60&&i===1?(e.consume(A),$):A===62&&i===4?(e.consume(A),B):A===63&&i===3?(e.consume(A),M):A===93&&i===5?(e.consume(A),G):it(A)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(JQ,Z,U)(A)):A===null||it(A)?(e.exit("htmlFlowData"),U(A)):(e.consume(A),F)}function U(A){return e.check(eJ,W,Z)(A)}function W(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),V}function V(A){return A===null||it(A)?U(A):(e.enter("htmlFlowData"),F(A))}function O(A){return A===45?(e.consume(A),M):F(A)}function $(A){return A===47?(e.consume(A),l="",z):F(A)}function z(A){if(A===62){const ie=l.toLowerCase();return gT.includes(ie)?(e.consume(A),B):F(A)}return Ur(A)&&l.length<8?(e.consume(A),l+=String.fromCharCode(A),z):F(A)}function G(A){return A===93?(e.consume(A),M):F(A)}function M(A){return A===62?(e.consume(A),B):A===45&&i===2?(e.consume(A),M):F(A)}function B(A){return A===null||it(A)?(e.exit("htmlFlowData"),Z(A)):(e.consume(A),B)}function Z(A){return e.exit("htmlFlow"),t(A)}}function rJ(e,t,n){const r=this;return i;function i(l){return it(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):n(l)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function iJ(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ih,t,n)}}const sJ={name:"htmlText",tokenize:oJ};function oJ(e,t,n){const r=this;let i,o,l;return c;function c(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),L):M===63?(e.consume(M),E):Ur(M)?(e.consume(M),H):n(M)}function d(M){return M===45?(e.consume(M),g):M===91?(e.consume(M),o=0,w):Ur(M)?(e.consume(M),R):n(M)}function g(M){return M===45?(e.consume(M),b):n(M)}function p(M){return M===null?n(M):M===45?(e.consume(M),v):it(M)?(l=p,$(M)):(e.consume(M),p)}function v(M){return M===45?(e.consume(M),b):p(M)}function b(M){return M===62?O(M):M===45?v(M):p(M)}function w(M){const B="CDATA[";return M===B.charCodeAt(o++)?(e.consume(M),o===B.length?S:w):n(M)}function S(M){return M===null?n(M):M===93?(e.consume(M),C):it(M)?(l=S,$(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):it(M)?(l=R,$(M)):(e.consume(M),R)}function E(M){return M===null?n(M):M===63?(e.consume(M),N):it(M)?(l=E,$(M)):(e.consume(M),E)}function N(M){return M===62?O(M):E(M)}function L(M){return Ur(M)?(e.consume(M),j):n(M)}function j(M){return M===45||zr(M)?(e.consume(M),j):D(M)}function D(M){return it(M)?(l=D,$(M)):Ot(M)?(e.consume(M),D):O(M)}function H(M){return M===45||zr(M)?(e.consume(M),H):M===47||M===62||vn(M)?Y(M):n(M)}function Y(M){return M===47?(e.consume(M),O):M===58||M===95||Ur(M)?(e.consume(M),P):it(M)?(l=Y,$(M)):Ot(M)?(e.consume(M),Y):O(M)}function P(M){return M===45||M===46||M===58||M===95||zr(M)?(e.consume(M),P):q(M)}function q(M){return M===61?(e.consume(M),F):it(M)?(l=q,$(M)):Ot(M)?(e.consume(M),q):Y(M)}function F(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),i=M,U):it(M)?(l=F,$(M)):Ot(M)?(e.consume(M),F):(e.consume(M),W)}function U(M){return M===i?(e.consume(M),i=void 0,V):M===null?n(M):it(M)?(l=U,$(M)):(e.consume(M),U)}function W(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||vn(M)?Y(M):(e.consume(M),W)}function V(M){return M===47||M===62||vn(M)?Y(M):n(M)}function O(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function $(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),z}function z(M){return Ot(M)?Ft(e,G,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):G(M)}function G(M){return e.enter("htmlTextData"),l(M)}}const Ww={name:"labelEnd",resolveAll:uJ,resolveTo:dJ,tokenize:hJ},aJ={tokenize:fJ},lJ={tokenize:mJ},cJ={tokenize:pJ};function uJ(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 i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&wi(e,0,e.length,n),e}function dJ(e,t){let n=e.length,r=0,i,o,l,c;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const h={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[o][1].start},end:{...e[l][1].end}},g={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[l-2][1].start}};return c=[["enter",h,t],["enter",d,t]],c=$i(c,e.slice(o+1,o+r+3)),c=$i(c,[["enter",g,t]]),c=$i(c,Lg(t.parser.constructs.insideSpan.null,e.slice(o+r+4,l-3),t)),c=$i(c,[["exit",g,t],e[l-2],e[l-1],["exit",d,t]]),c=$i(c,e.slice(l+1)),c=$i(c,[["exit",h,t]]),wi(e,o,e.length,c),e}function hJ(e,t,n){const r=this;let i=r.events.length,o,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return c;function c(v){return o?o._inactive?p(v):(l=r.parser.defined.includes(as(r.sliceSerialize({start:o.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(aJ,g,l?g:p)(v):v===91?e.attempt(lJ,g,l?d:p)(v):l?g(v):p(v)}function d(v){return e.attempt(cJ,g,p)(v)}function g(v){return t(v)}function p(v){return o._balanced=!0,n(v)}}function fJ(e,t,n){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),i}function i(p){return vn(p)?Wd(e,o)(p):o(p)}function o(p){return p===41?g(p):HO(e,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function l(p){return vn(p)?Wd(e,h)(p):g(p)}function c(p){return n(p)}function h(p){return p===34||p===39||p===40?UO(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):g(p)}function d(p){return vn(p)?Wd(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 mJ(e,t,n){const r=this;return i;function i(c){return $O.call(r,e,o,l,"reference","referenceMarker","referenceString")(c)}function o(c){return r.parser.defined.includes(as(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function l(c){return n(c)}}function pJ(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const gJ={name:"labelStartImage",resolveAll:Ww.resolveAll,tokenize:vJ};function vJ(e,t,n){const r=this;return i;function i(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),o}function o(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),l):n(c)}function l(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const _J={name:"labelStartLink",resolveAll:Ww.resolveAll,tokenize:yJ};function yJ(e,t,n){const r=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),o}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Zy={name:"lineEnding",tokenize:bJ};function bJ(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ft(e,t,"linePrefix")}}const tp={name:"thematicBreak",tokenize:xJ};function xJ(e,t,n){let r=0,i;return o;function o(d){return e.enter("thematicBreak"),l(d)}function l(d){return i=d,c(d)}function c(d){return d===i?(e.enter("thematicBreakSequence"),h(d)):r>=3&&(d===null||it(d))?(e.exit("thematicBreak"),t(d)):n(d)}function h(d){return d===i?(e.consume(d),r++,h):(e.exit("thematicBreakSequence"),Ot(d)?Ft(e,c,"whitespace")(d):c(d))}}const ri={continuation:{tokenize:kJ},exit:RJ,name:"list",tokenize:CJ},wJ={partial:!0,tokenize:TJ},SJ={partial:!0,tokenize:EJ};function CJ(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return c;function c(b){const w=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:Yx(b)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(tp,n,d)(b):d(b);if(!r.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(b)}return n(b)}function h(b){return Yx(b)&&++l<10?(e.consume(b),h):(!r.interrupt||l<2)&&(r.containerState.marker?b===r.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),d(b)):n(b)}function d(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||b,e.check(Ih,r.interrupt?n:g,e.attempt(wJ,v,p))}function g(b){return r.containerState.initialBlankLine=!0,o++,v(b)}function p(b){return Ot(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),v):n(b)}function v(b){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function kJ(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ih,i,o);function i(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ft(e,t,"listItemIndent",r.containerState.size+1)(c)}function o(c){return r.containerState.furtherBlankLines||!Ot(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(SJ,t,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ft(e,e.attempt(ri,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function EJ(e,t,n){const r=this;return Ft(e,i,"listItemIndent",r.containerState.size+1);function i(o){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(o):n(o)}}function RJ(e){e.exit(this.containerState.type)}function TJ(e,t,n){const r=this;return Ft(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const l=r.events[r.events.length-1];return!Ot(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const vT={name:"setextUnderline",resolveTo:NJ,tokenize:MJ};function NJ(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",l,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function MJ(e,t,n){const r=this;let i;return o;function o(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"),i=d,l(d)):n(d)}function l(d){return e.enter("setextHeadingLineSequence"),c(d)}function c(d){return d===i?(e.consume(d),c):(e.exit("setextHeadingLineSequence"),Ot(d)?Ft(e,h,"lineSuffix")(d):h(d))}function h(d){return d===null||it(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const AJ={tokenize:jJ};function jJ(e){const t=this,n=e.attempt(Ih,r,e.attempt(this.parser.constructs.flowInitial,i,Ft(e,e.attempt(this.parser.constructs.flow,i,e.attempt(PQ,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const DJ={resolveAll:WO()},OJ=VO("string"),LJ=VO("text");function VO(e){return{resolveAll:WO(e==="text"?zJ:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,l,c);return l;function l(g){return d(g)?o(g):c(g)}function c(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"),o(g)):(n.consume(g),h)}function d(g){if(g===null)return!0;const p=i[g];let v=-1;if(p)for(;++v<p.length;){const b=p[v];if(!b.previous||b.previous.call(r,r.previous))return!0}return!1}}}function WO(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function zJ(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],i=t.sliceStream(r);let o=i.length,l=-1,c=0,h;for(;o--;){const d=i[o];if(typeof d=="string"){for(l=d.length;d.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(d===-2)h=!0,c++;else if(d!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const d={type:n===e.length||h||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?l:r.start._bufferIndex+l,_index:r.start._index+o,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},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 PJ={42:ri,43:ri,45:ri,48:ri,49:ri,50:ri,51:ri,52:ri,53:ri,54:ri,55:ri,56:ri,57:ri,62:PO},IJ={91:$Q},BJ={[-2]:Xy,[-1]:Xy,32:Xy},FJ={35:GQ,42:tp,45:[vT,tp],60:QQ,61:vT,95:tp,96:pT,126:pT},HJ={38:BO,92:IO},$J={[-5]:Zy,[-4]:Zy,[-3]:Zy,33:gJ,38:BO,42:Xx,60:[_Q,sJ],91:_J,92:[qQ,IO],93:Ww,95:Xx,96:AQ},UJ={null:[Xx,DJ]},VJ={null:[42,95]},WJ={null:[]},qJ=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:VJ,contentInitial:IJ,disable:WJ,document:PJ,flow:FJ,flowInitial:BJ,insideSpan:UJ,string:HJ,text:$J},Symbol.toStringTag,{value:"Module"}));function KJ(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 i={},o=[];let l=[],c=[];const h={attempt:D(L),check:D(j),consume:R,enter:E,exit:N,interrupt:D(j,{interrupt:!0})},d={code:null,containerState:{},defineSkip:S,events:[],now:w,parser:e,previous:null,sliceSerialize:v,sliceStream:b,write:p};let g=t.tokenize.call(d,h);return t.resolveAll&&o.push(t),d;function p(q){return l=$i(l,q),C(),l[l.length-1]!==null?[]:(H(t,0),d.events=Lg(o,d.events,d),d.events)}function v(q,F){return YJ(b(q),F)}function b(q){return GJ(l,q)}function w(){const{_bufferIndex:q,_index:F,line:U,column:W,offset:V}=r;return{_bufferIndex:q,_index:F,line:U,column:W,offset:V}}function S(q){i[q.line]=q.column,P()}function C(){let q;for(;r._index<l.length;){const F=l[r._index];if(typeof F=="string")for(q=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===q&&r._bufferIndex<F.length;)k(F.charCodeAt(r._bufferIndex));else k(F)}}function k(q){g=g(q)}function R(q){it(q)?(r.line++,r.column=1,r.offset+=q===-3?2:1,P()):q!==-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=q}function E(q,F){const U=F||{};return U.type=q,U.start=w(),d.events.push(["enter",U,d]),c.push(U),U}function N(q){const F=c.pop();return F.end=w(),d.events.push(["exit",F,d]),F}function L(q,F){H(q,F.from)}function j(q,F){F.restore()}function D(q,F){return U;function U(W,V,O){let $,z,G,M;return Array.isArray(W)?Z(W):"tokenize"in W?Z([W]):B(W);function B(ee){return re;function re(ce){const he=ce!==null&&ee[ce],pe=ce!==null&&ee.null,Se=[...Array.isArray(he)?he:he?[he]:[],...Array.isArray(pe)?pe:pe?[pe]:[]];return Z(Se)(ce)}}function Z(ee){return $=ee,z=0,ee.length===0?O:A(ee[z])}function A(ee){return re;function re(ce){return M=Y(),G=ee,ee.partial||(d.currentConstruct=ee),ee.name&&d.parser.constructs.disable.null.includes(ee.name)?J():ee.tokenize.call(F?Object.assign(Object.create(d),F):d,h,ie,J)(ce)}}function ie(ee){return q(G,M),V}function J(ee){return M.restore(),++z<$.length?A($[z]):O}}}function H(q,F){q.resolveAll&&!o.includes(q)&&o.push(q),q.resolve&&wi(d.events,F,d.events.length-F,q.resolve(d.events.slice(F),d)),q.resolveTo&&(d.events=q.resolveTo(d.events,d))}function Y(){const q=w(),F=d.previous,U=d.currentConstruct,W=d.events.length,V=Array.from(c);return{from:W,restore:O};function O(){r=q,d.previous=F,d.currentConstruct=U,d.events.length=W,c=V,P()}}function P(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function GJ(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(r,o)];else{if(l=e.slice(n,i),r>-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}o>0&&l.push(e[i].slice(0,o))}return l}function YJ(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let l;if(typeof o=="string")l=o;else switch(o){case-5:{l="\r";break}case-4:{l=`
609
+ `;break}case-3:{l=`\r
610
+ `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(o)}i=o===-2,r.push(l)}return r.join("")}function XJ(e){const r={constructs:LO([qJ,...(e||{}).extensions||[]]),content:i(dQ),defined:[],document:i(fQ),flow:i(AJ),lazy:{},string:i(OJ),text:i(LJ)};return r;function i(o){return l;function l(c){return KJ(r,o,c)}}}function ZJ(e){for(;!FO(e););return e}const _T=/[\0\t\n\r]/g;function QJ(){let e=1,t="",n=!0,r;return i;function i(o,l,c){const h=[];let d,g,p,v,b;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(l||void 0).decode(o)),p=0,t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){if(_T.lastIndex=p,d=_T.exec(o),v=d&&d.index!==void 0?d.index:o.length,b=o.charCodeAt(v),!d){t=o.slice(p);break}if(b===10&&p===v&&r)h.push(-3),r=void 0;else switch(r&&(h.push(-5),r=void 0),p<v&&(h.push(o.slice(p,v)),e+=v-p),b){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 c&&(r&&h.push(-5),t&&h.push(t),h.push(null)),h}}const JJ=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function eee(e){return e.replace(JJ,tee)}function tee(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return zO(n.slice(o?2:1),o?16:10)}return Vw(n)||e}const qO={}.hasOwnProperty;function nee(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),ree(n)(ZJ(XJ(n).document().write(QJ()(e,t,!0))))}function ree(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(De),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:o(Et),blockQuote:o(pe),characterEscape:Y,characterReference:Y,codeFenced:o(Se),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:o(Se,l),codeText:o(Re,l),codeTextData:Y,data:Y,codeFlowValue:Y,definition:o(je),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:o(Xe),hardBreakEscape:o(Rt),hardBreakTrailing:o(Rt),htmlFlow:o(fe,l),htmlFlowData:Y,htmlText:o(fe,l),htmlTextData:Y,image:o(He),label:l,link:o(De),listItem:o(ct),listItemValue:v,listOrdered:o(mt,p),listUnordered:o(mt),paragraph:o(ot),reference:A,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:o(Et),strong:o(fn),thematicBreak:o(tt)},exit:{atxHeading:h(),atxHeadingSequence:L,autolink:h(),autolinkEmail:he,autolinkProtocol:ce,blockQuote:h(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:J,characterReferenceMarkerNumeric:J,characterReferenceValue:ee,characterReference:re,codeFenced:h(C),codeFencedFence:S,codeFencedFenceInfo:b,codeFencedFenceMeta:w,codeFlowValue:P,codeIndented:h(k),codeText:h(V),codeTextData:P,data:P,definition:h(),definitionDestinationString:N,definitionLabelString:R,definitionTitleString:E,emphasis:h(),hardBreakEscape:h(F),hardBreakTrailing:h(F),htmlFlow:h(U),htmlFlowData:P,htmlText:h(W),htmlTextData:P,image:h($),label:G,labelText:z,lineEnding:q,link:h(O),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:ie,resourceDestinationString:M,resourceTitleString:B,resource:Z,setextHeading:h(H),setextHeadingLineSequence:D,setextHeadingText:j,strong:h(),thematicBreak:h()}};KO(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(oe){let ve={type:"root",children:[]};const Ne={stack:[ve],tokenStack:[],config:t,enter:c,exit:d,buffer:l,resume:g,data:n},Ae=[];let Qe=-1;for(;++Qe<oe.length;)if(oe[Qe][1].type==="listOrdered"||oe[Qe][1].type==="listUnordered")if(oe[Qe][0]==="enter")Ae.push(Qe);else{const At=Ae.pop();Qe=i(oe,At,Qe)}for(Qe=-1;++Qe<oe.length;){const At=t[oe[Qe][0]];qO.call(At,oe[Qe][1].type)&&At[oe[Qe][1].type].call(Object.assign({sliceSerialize:oe[Qe][2].sliceSerialize},Ne),oe[Qe][1])}if(Ne.tokenStack.length>0){const At=Ne.tokenStack[Ne.tokenStack.length-1];(At[1]||yT).call(Ne,void 0,At[0])}for(ve.position={start:aa(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:aa(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},Qe=-1;++Qe<t.transforms.length;)ve=t.transforms[Qe](ve)||ve;return ve}function i(oe,ve,Ne){let Ae=ve-1,Qe=-1,At=!1,rt,Oe,qe,gt;for(;++Ae<=Ne;){const Ve=oe[Ae];switch(Ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ve[0]==="enter"?Qe++:Qe--,gt=void 0;break}case"lineEndingBlank":{Ve[0]==="enter"&&(rt&&!gt&&!Qe&&!qe&&(qe=Ae),gt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:gt=void 0}if(!Qe&&Ve[0]==="enter"&&Ve[1].type==="listItemPrefix"||Qe===-1&&Ve[0]==="exit"&&(Ve[1].type==="listUnordered"||Ve[1].type==="listOrdered")){if(rt){let mn=Ae;for(Oe=void 0;mn--;){const sn=oe[mn];if(sn[1].type==="lineEnding"||sn[1].type==="lineEndingBlank"){if(sn[0]==="exit")continue;Oe&&(oe[Oe][1].type="lineEndingBlank",At=!0),sn[1].type="lineEnding",Oe=mn}else if(!(sn[1].type==="linePrefix"||sn[1].type==="blockQuotePrefix"||sn[1].type==="blockQuotePrefixWhitespace"||sn[1].type==="blockQuoteMarker"||sn[1].type==="listItemIndent"))break}qe&&(!Oe||qe<Oe)&&(rt._spread=!0),rt.end=Object.assign({},Oe?oe[Oe][1].start:Ve[1].end),oe.splice(Oe||Ae,0,["exit",rt,Ve[2]]),Ae++,Ne++}if(Ve[1].type==="listItemPrefix"){const mn={type:"listItem",_spread:!1,start:Object.assign({},Ve[1].start),end:void 0};rt=mn,oe.splice(Ae,0,["enter",mn,Ve[2]]),Ae++,Ne++,qe=void 0,gt=!0}}}return oe[ve][1]._spread=At,Ne}function o(oe,ve){return Ne;function Ne(Ae){c.call(this,oe(Ae),Ae),ve&&ve.call(this,Ae)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(oe,ve,Ne){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([ve,Ne||void 0]),oe.position={start:aa(ve.start),end:void 0}}function h(oe){return ve;function ve(Ne){oe&&oe.call(this,Ne),d.call(this,Ne)}}function d(oe,ve){const Ne=this.stack.pop(),Ae=this.tokenStack.pop();if(Ae)Ae[0].type!==oe.type&&(ve?ve.call(this,oe,Ae[0]):(Ae[1]||yT).call(this,oe,Ae[0]));else throw new Error("Cannot close `"+oe.type+"` ("+Vd({start:oe.start,end:oe.end})+"): it’s not open");Ne.position.end=aa(oe.end)}function g(){return Uw(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function v(oe){if(this.data.expectingFirstListItemValue){const ve=this.stack[this.stack.length-2];ve.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function b(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.lang=oe}function w(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.meta=oe}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=oe.replace(/(\r?\n|\r)$/g,"")}function R(oe){const ve=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=ve,Ne.identifier=as(this.sliceSerialize(oe)).toLowerCase()}function E(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.title=oe}function N(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.url=oe}function L(oe){const ve=this.stack[this.stack.length-1];if(!ve.depth){const Ne=this.sliceSerialize(oe).length;ve.depth=Ne}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function D(oe){const ve=this.stack[this.stack.length-1];ve.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function H(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(oe){const Ne=this.stack[this.stack.length-1].children;let Ae=Ne[Ne.length-1];(!Ae||Ae.type!=="text")&&(Ae=Ce(),Ae.position={start:aa(oe.start),end:void 0},Ne.push(Ae)),this.stack.push(Ae)}function P(oe){const ve=this.stack.pop();ve.value+=this.sliceSerialize(oe),ve.position.end=aa(oe.end)}function q(oe){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ne=ve.children[ve.children.length-1];Ne.position.end=aa(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ve.type)&&(Y.call(this,oe),P.call(this,oe))}function F(){this.data.atHardBreak=!0}function U(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=oe}function W(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=oe}function V(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=oe}function O(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ve,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function $(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ve,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function z(oe){const ve=this.sliceSerialize(oe),Ne=this.stack[this.stack.length-2];Ne.label=eee(ve),Ne.identifier=as(ve).toLowerCase()}function G(){const oe=this.stack[this.stack.length-1],ve=this.resume(),Ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ne.type==="link"){const Ae=oe.children;Ne.children=Ae}else Ne.alt=ve}function M(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.url=oe}function B(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.title=oe}function Z(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function ie(oe){const ve=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=ve,Ne.identifier=as(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function J(oe){this.data.characterReferenceType=oe.type}function ee(oe){const ve=this.sliceSerialize(oe),Ne=this.data.characterReferenceType;let Ae;Ne?(Ae=zO(ve,Ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ae=Vw(ve);const Qe=this.stack[this.stack.length-1];Qe.value+=Ae}function re(oe){const ve=this.stack.pop();ve.position.end=aa(oe.end)}function ce(oe){P.call(this,oe);const ve=this.stack[this.stack.length-1];ve.url=this.sliceSerialize(oe)}function he(oe){P.call(this,oe);const ve=this.stack[this.stack.length-1];ve.url="mailto:"+this.sliceSerialize(oe)}function pe(){return{type:"blockquote",children:[]}}function Se(){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 Et(){return{type:"heading",depth:0,children:[]}}function Rt(){return{type:"break"}}function fe(){return{type:"html",value:""}}function He(){return{type:"image",title:null,url:"",alt:null}}function De(){return{type:"link",title:null,url:"",children:[]}}function mt(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function ct(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function ot(){return{type:"paragraph",children:[]}}function fn(){return{type:"strong",children:[]}}function Ce(){return{type:"text",value:""}}function tt(){return{type:"thematicBreak"}}}function aa(e){return{line:e.line,column:e.column,offset:e.offset}}function KO(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?KO(e,r):iee(e,r)}}function iee(e,t){let n;for(n in t)if(qO.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 yT(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Vd({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Vd({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Vd({start:t.start,end:t.end})+") is still open")}function see(e){const t=this;t.parser=n;function n(r){return nee(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function oee(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 aee(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
611
+ `}]}function lee(e,t){const n=t.value?t.value+`
612
+ `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function cee(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function uee(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dee(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=hu(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let l,c=e.footnoteCounts.get(r);c===void 0?(c=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=o+1,c+=1,e.footnoteCounts.set(r,c);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(c>1?"-"+c:""),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 hee(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 fee(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function GO(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 i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=r:i.push({type:"text",value:r}),i}function mee(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return GO(e,t);const i={src:hu(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function pee(e,t){const n={src:hu(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 gee(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 vee(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return GO(e,t);const i={href:hu(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function _ee(e,t){const n={href:hu(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 yee(e,t,n){const r=e.all(t),i=n?bee(n):YO(t),o={},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:[]}),o.className=["task-list-item"]}let c=-1;for(;++c<r.length;){const g=r[c];(i||c!==0||g.type!=="element"||g.tagName!=="p")&&l.push({type:"text",value:`
613
+ `}),g.type==="element"&&g.tagName==="p"&&!i?l.push(...g.children):l.push(g)}const h=r[r.length-1];h&&(i||h.type!=="element"||h.tagName!=="p")&&l.push({type:"text",value:`
614
+ `});const d={type:"element",tagName:"li",properties:o,children:l};return e.patch(t,d),e.applyData(t,d)}function bee(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=YO(n[r])}return t}function YO(e){const t=e.spread;return t??e.children.length>1}function xee(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const l=r[i];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 o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function wee(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function See(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Cee(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kee(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),i.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},c=Bw(t.children[1]),h=TO(t.children[t.children.length-1]);c&&h&&(l.position={start:c,end:h}),i.push(l)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function Eee(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,c=l?l.length:t.children.length;let h=-1;const d=[];for(;++h<c;){const p=t.children[h],v={},b=l?l[h]:void 0;b&&(v.align=b);let w={type:"element",tagName:o,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 Ree(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const bT=9,xT=32;function Tee(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(wT(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(wT(t.slice(i),i>0,!1)),o.join("")}function wT(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===bT||o===xT;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===bT||o===xT;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function Nee(e,t){const n={type:"text",value:Tee(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Mee(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Aee={blockquote:oee,break:aee,code:lee,delete:cee,emphasis:uee,footnoteReference:dee,heading:hee,html:fee,imageReference:mee,image:pee,inlineCode:gee,linkReference:vee,link:_ee,listItem:yee,list:xee,paragraph:wee,root:See,strong:Cee,table:kee,tableCell:Ree,tableRow:Eee,text:Nee,thematicBreak:Mee,toml:Am,yaml:Am,definition:Am,footnoteDefinition:Am};function Am(){}const XO=-1,zg=0,qd=1,Pp=2,qw=3,Kw=4,Gw=5,Yw=6,ZO=7,QO=8,ST=typeof self=="object"?self:globalThis,jee=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,l]=t[i];switch(o){case zg:case XO:return n(l,i);case qd:{const c=n([],i);for(const h of l)c.push(r(h));return c}case Pp:{const c=n({},i);for(const[h,d]of l)c[r(h)]=r(d);return c}case qw:return n(new Date(l),i);case Kw:{const{source:c,flags:h}=l;return n(new RegExp(c,h),i)}case Gw:{const c=n(new Map,i);for(const[h,d]of l)c.set(r(h),r(d));return c}case Yw:{const c=n(new Set,i);for(const h of l)c.add(r(h));return c}case ZO:{const{name:c,message:h}=l;return n(new ST[c](h),i)}case QO:return n(BigInt(l),i);case"BigInt":return n(Object(BigInt(l)),i);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:c}=new Uint8Array(l);return n(new DataView(c),l)}}return n(new ST[o](l),i)};return r},CT=e=>jee(new Map,e)(0),xc="",{toString:Dee}={},{keys:Oee}=Object,yd=e=>{const t=typeof e;if(t!=="object"||!e)return[zg,t];const n=Dee.call(e).slice(8,-1);switch(n){case"Array":return[qd,xc];case"Object":return[Pp,xc];case"Date":return[qw,xc];case"RegExp":return[Kw,xc];case"Map":return[Gw,xc];case"Set":return[Yw,xc];case"DataView":return[qd,n]}return n.includes("Array")?[qd,n]:n.includes("Error")?[ZO,n]:[Pp,n]},jm=([e,t])=>e===zg&&(t==="function"||t==="symbol"),Lee=(e,t,n,r)=>{const i=(l,c)=>{const h=r.push(l)-1;return n.set(c,h),h},o=l=>{if(n.has(l))return n.get(l);let[c,h]=yd(l);switch(c){case zg:{let g=l;switch(h){case"bigint":c=QO,g=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);g=null;break;case"undefined":return i([XO],l)}return i([c,g],l)}case qd:{if(h){let v=l;return h==="DataView"?v=new Uint8Array(l.buffer):h==="ArrayBuffer"&&(v=new Uint8Array(l)),i([h,[...v]],l)}const g=[],p=i([c,g],l);for(const v of l)g.push(o(v));return p}case Pp:{if(h)switch(h){case"BigInt":return i([h,l.toString()],l);case"Boolean":case"Number":case"String":return i([h,l.valueOf()],l)}if(t&&"toJSON"in l)return o(l.toJSON());const g=[],p=i([c,g],l);for(const v of Oee(l))(e||!jm(yd(l[v])))&&g.push([o(v),o(l[v])]);return p}case qw:return i([c,l.toISOString()],l);case Kw:{const{source:g,flags:p}=l;return i([c,{source:g,flags:p}],l)}case Gw:{const g=[],p=i([c,g],l);for(const[v,b]of l)(e||!(jm(yd(v))||jm(yd(b))))&&g.push([o(v),o(b)]);return p}case Yw:{const g=[],p=i([c,g],l);for(const v of l)(e||!jm(yd(v)))&&g.push(o(v));return p}}const{message:d}=l;return i([c,{name:h,message:d}],l)};return o},kT=(e,{json:t,lossy:n}={})=>{const r=[];return Lee(!(t||n),!!t,new Map,r)(e),r},Ip=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?CT(kT(e,t)):structuredClone(e):(e,t)=>CT(kT(e,t));function zee(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 Pee(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Iee(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||zee,r=e.options.footnoteBackLabel||Pee,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];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=hu(p.toLowerCase());let b=0;const w=[],S=e.footnoteCounts.get(p);for(;S!==void 0&&++b<=S;){w.length>0&&w.push({type:"text",value:" "});let R=typeof n=="string"?n:n(h,b);typeof R=="string"&&(R={type:"text",value:R}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+v+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(h,b),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),c.push(k)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Ip(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
615
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
616
+ `}]}}const Pg=function(e){if(e==null)return $ee;if(typeof e=="function")return Ig(e);if(typeof e=="object")return Array.isArray(e)?Bee(e):Fee(e);if(typeof e=="string")return Hee(e);throw new Error("Expected function, string, or object as test")};function Bee(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Pg(e[n]);return Ig(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function Fee(e){const t=e;return Ig(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function Hee(e){return Ig(t);function t(n){return n&&n.type===e}}function Ig(e){return t;function t(n,r,i){return!!(Uee(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function $ee(){return!0}function Uee(e){return e!==null&&typeof e=="object"&&"type"in e}const JO=[],Vee=!0,Zx=!1,Wee="skip";function e4(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const o=Pg(i),l=r?-1:1;c(e,void 0,[])();function c(h,d,g){const p=h&&typeof h=="object"?h:{};if(typeof p.type=="string"){const b=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(h.type+(b?"<"+b+">":""))+")"})}return v;function v(){let b=JO,w,S,C;if((!t||o(h,d,g[g.length-1]||void 0))&&(b=qee(n(h,g)),b[0]===Zx))return b;if("children"in h&&h.children){const k=h;if(k.children&&b[0]!==Wee)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=c(R,S,C)(),w[0]===Zx)return w;S=typeof w[1]=="number"?w[1]:S+l}}return b}}}function qee(e){return Array.isArray(e)?e:typeof e=="number"?[Vee,e]:e==null?JO:[e]}function Xw(e,t,n,r){let i,o,l;typeof t=="function"&&typeof n!="function"?(o=void 0,l=t,i=n):(o=t,l=n,i=r),e4(e,o,c,i);function c(h,d){const g=d[d.length-1],p=g?g.children.indexOf(h):void 0;return l(h,p,g)}}const Qx={}.hasOwnProperty,Kee={};function Gee(e,t){const n=t||Kee,r=new Map,i=new Map,o=new Map,l={...Aee,...n.handlers},c={all:d,applyData:Xee,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:l,one:h,options:n,patch:Yee,wrap:Qee};return Xw(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const p=g.type==="definition"?r:i,v=String(g.identifier).toUpperCase();p.has(v)||p.set(v,g)}}),c;function h(g,p){const v=g.type,b=c.handlers[v];if(Qx.call(c.handlers,v)&&b)return b(c,g,p);if(c.options.passThrough&&c.options.passThrough.includes(v)){if("children"in g){const{children:S,...C}=g,k=Ip(C);return k.children=c.all(g),k}return Ip(g)}return(c.options.unknownHandler||Zee)(c,g,p)}function d(g){const p=[];if("children"in g){const v=g.children;let b=-1;for(;++b<v.length;){const w=c.one(v[b],g);if(w){if(b&&v[b-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=ET(w.value)),!Array.isArray(w)&&w.type==="element")){const S=w.children[0];S&&S.type==="text"&&(S.value=ET(S.value))}Array.isArray(w)?p.push(...w):p.push(w)}}}return p}}function Yee(e,t){e.position&&(t.position=PZ(e))}function Xee(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,o=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"&&o&&Object.assign(n.properties,Ip(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function Zee(e,t){const n=t.data||{},r="value"in t&&!(Qx.call(n,"hProperties")||Qx.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 Qee(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
617
+ `});++r<e.length;)r&&n.push({type:"text",value:`
618
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
619
+ `}),n}function ET(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function RT(e,t){const n=Gee(e,t),r=n.one(e,void 0),i=Iee(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
620
+ `},i),o}function Jee(e,t){return e&&"run"in e?async function(n,r){const i=RT(n,{file:r,...t});await e.run(i,r)}:function(n,r){return RT(n,{file:r,...e||t})}}function TT(e){if(e)throw e}var Qy,NT;function ete(){if(NT)return Qy;NT=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(d){return typeof Array.isArray=="function"?Array.isArray(d):t.call(d)==="[object Array]"},o=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},c=function(d,g){if(g==="__proto__")if(e.call(d,g)){if(r)return r(d,g).value}else return;return d[g]};return Qy=function h(){var d,g,p,v,b,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=c(S,g),v=c(d,g),S!==v&&(R&&v&&(o(v)||(b=i(v)))?(b?(b=!1,w=p&&i(p)?p:[]):w=p&&o(p)?p:{},l(S,{name:g,newValue:h(R,w,v)})):typeof v<"u"&&l(S,{name:g,newValue:v}));return S},Qy}var tte=ete();const Jy=qp(tte);function Jx(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 nte(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);c(null,...i);function c(h,...d){const g=e[++o];let p=-1;if(h){l(h);return}for(;++p<i.length;)(d[p]===null||d[p]===void 0)&&(d[p]=i[p]);i=d,g?rte(g,c)(...d):l(null,...d)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function rte(e,t){let n;return r;function r(...l){const c=e.length>l.length;let h;c&&l.push(i);try{h=e.apply(this,l)}catch(d){const g=d;if(c&&n)throw g;return i(g)}c||(h&&h.then&&typeof h.then=="function"?h.then(o,i):h instanceof Error?i(h):o(h))}function i(l,...c){n||(n=!0,t(l,...c))}function o(l){i(null,l)}}const Cs={basename:ite,dirname:ste,extname:ote,join:ate,sep:"/"};function ite(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Bh(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,c=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else l<0&&(o=!0,l=i+1),c>-1&&(e.codePointAt(i)===t.codePointAt(c--)?c<0&&(r=i):(c=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function ste(e){if(Bh(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 ote(e){Bh(e);let t=e.length,n=-1,r=0,i=-1,o=0,l;for(;t--;){const c=e.codePointAt(t);if(c===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),c===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function ate(...e){let t=-1,n;for(;++t<e.length;)Bh(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":lte(n)}function lte(e){Bh(e);const t=e.codePointAt(0)===47;let n=cte(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function cte(e,t){let n="",r=0,i=-1,o=0,l=-1,c,h;for(;++l<=e.length;){if(l<e.length)c=e.codePointAt(l);else{if(c===47)break;c=47}if(c===47){if(!(i===l-1||o===1))if(i!==l-1&&o===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("/")),i=l,o=0;continue}}else if(n.length>0){n="",r=0,i=l,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,l):n=e.slice(i+1,l),r=l-i-1;i=l,o=0}else c===46&&o>-1?o++:o=-1}return n}function Bh(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const ute={cwd:dte};function dte(){return"/"}function e0(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function hte(e){if(typeof e=="string")e=new URL(e);else if(!e0(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 fte(e)}function fte(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 i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const eb=["history","path","basename","stem","extname","dirname"];class t4{constructor(t){let n;t?e0(t)?n={path:t}:typeof t=="string"||mte(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":ute.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<eb.length;){const o=eb[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)eb.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Cs.basename(this.path):void 0}set basename(t){nb(t,"basename"),tb(t,"basename"),this.path=Cs.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Cs.dirname(this.path):void 0}set dirname(t){MT(this.basename,"dirname"),this.path=Cs.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Cs.extname(this.path):void 0}set extname(t){if(tb(t,"extname"),MT(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=Cs.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){e0(t)&&(t=hte(t)),nb(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Cs.basename(this.path,this.extname):void 0}set stem(t){nb(t,"stem"),tb(t,"stem"),this.path=Cs.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Ir(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function tb(e,t){if(e&&e.includes(Cs.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Cs.sep+"`")}function nb(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function MT(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function mte(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pte=function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o},gte={}.hasOwnProperty;class Zw extends pte{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=nte()}copy(){const t=new Zw;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Jy(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(sb("data",this.frozen),this.namespace[t]=n,this):gte.call(this.namespace,t)&&this.namespace[t]||void 0:t?(sb("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 i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Dm(t),r=this.parser||this.Parser;return rb("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),rb("process",this.parser||this.Parser),ib("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,l){const c=Dm(t),h=r.parse(c);r.run(h,c,function(g,p,v){if(g||!p||!v)return d(g);const b=p,w=r.stringify(b,v);yte(w)?v.value=w:v.result=w,d(g,v)});function d(g,p){g||!p?l(g):o?o(p):n(void 0,p)}}}processSync(t){let n=!1,r;return this.freeze(),rb("processSync",this.parser||this.Parser),ib("processSync",this.compiler||this.Compiler),this.process(t,i),jT("processSync","process",n),r;function i(o,l){n=!0,TT(o),r=l}}run(t,n,r){AT(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(l,c){const h=Dm(n);i.run(t,h,d);function d(g,p,v){const b=p||t;g?c(g):l?l(b):r(void 0,b,v)}}}runSync(t,n){let r=!1,i;return this.run(t,n,o),jT("runSync","run",r),i;function o(l,c){TT(l),i=c,r=!0}}stringify(t,n){this.freeze();const r=Dm(n),i=this.compiler||this.Compiler;return ib("stringify",i),AT(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(sb("use",this.frozen),t!=null)if(typeof t=="function")h(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(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");c(d.plugins),d.settings&&(i.settings=Jy(!0,i.settings,d.settings))}function c(d){let g=-1;if(d!=null)if(Array.isArray(d))for(;++g<d.length;){const p=d[g];o(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[b,...w]=g;const S=r[v][1];Jx(S)&&Jx(b)&&(b=Jy(!0,S,b)),r[v]=[d,b,...w]}}}}const vte=new Zw().freeze();function rb(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ib(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function sb(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 AT(e){if(!Jx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function jT(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Dm(e){return _te(e)?e:new t4(e)}function _te(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function yte(e){return typeof e=="string"||bte(e)}function bte(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const xte="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",DT=[],OT={allowDangerousHtml:!0},wte=/^(https?|ircs?|mailto|xmpp)$/i,Ste=[{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 fu(e){const t=Cte(e),n=kte(e);return Ete(t.runSync(t.parse(n),n),e)}function Cte(e){const t=e.rehypePlugins||DT,n=e.remarkPlugins||DT,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...OT}:OT;return vte().use(see).use(n).use(Jee,r).use(t)}function kte(e){const t=e.children||"",n=new t4;return typeof t=="string"&&(n.value=t),n}function Ete(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,l=t.skipHtml,c=t.unwrapDisallowed,h=t.urlTransform||Rte;for(const g of Ste)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+xte+g.id,void 0);return Xw(e,d),$Z(e,{Fragment:f.Fragment,components:i,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 b;for(b in Yy)if(Object.hasOwn(Yy,b)&&Object.hasOwn(g.properties,b)){const w=g.properties[b],S=Yy[b];(S===null||S.includes(g.tagName))&&(g.properties[b]=h(String(w||""),b,g))}}if(g.type==="element"){let b=n?!n.includes(g.tagName):o?o.includes(g.tagName):!1;if(!b&&r&&typeof p=="number"&&(b=!r(g,p,v)),b&&v&&typeof p=="number")return c&&g.children?v.children.splice(p,1,...g.children):v.children.splice(p,1),p}}}function Rte(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||wte.test(e.slice(0,t))?e:""}function LT(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Tte(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Nte(e,t,n){const i=Pg((n||{}).ignore||[]),o=Mte(t);let l=-1;for(;++l<o.length;)e4(e,"text",c);function c(d,g){let p=-1,v;for(;++p<g.length;){const b=g[p],w=v?v.children:void 0;if(i(b,w?w.indexOf(b):void 0,v))return;v=b}if(v)return h(d,g)}function h(d,g){const p=g[g.length-1],v=o[l][0],b=o[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,L={index:E.index,input:E.input,stack:[...g,d]};let j=b(...E,L);if(typeof j=="string"&&(j=j.length>0?{type:"text",value:j}:void 0),j===!1?v.lastIndex=N+1:(w!==N&&R.push({type:"text",value:d.value.slice(w,N)}),Array.isArray(j)?R.push(...j):j&&R.push(j),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 Mte(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 i=n[r];t.push([Ate(i[0]),jte(i[1])])}return t}function Ate(e){return typeof e=="string"?new RegExp(Tte(e),"g"):e}function jte(e){return typeof e=="function"?e:function(){return e}}const ob="phrasing",ab=["autolink","link","image","label"];function Dte(){return{transforms:[Fte],enter:{literalAutolink:Lte,literalAutolinkEmail:lb,literalAutolinkHttp:lb,literalAutolinkWww:lb},exit:{literalAutolink:Bte,literalAutolinkEmail:Ite,literalAutolinkHttp:zte,literalAutolinkWww:Pte}}}function Ote(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ob,notInConstruct:ab},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ob,notInConstruct:ab},{character:":",before:"[ps]",after:"\\/",inConstruct:ob,notInConstruct:ab}]}}function Lte(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function lb(e){this.config.enter.autolinkProtocol.call(this,e)}function zte(e){this.config.exit.autolinkProtocol.call(this,e)}function Pte(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 Ite(e){this.config.exit.autolinkEmail.call(this,e)}function Bte(e){this.exit(e)}function Fte(e){Nte(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Hte],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),$te]],{ignore:["link","linkReference"]})}function Hte(e,t,n,r,i){let o="";if(!n4(i)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!Ute(n)))return!1;const l=Vte(n+r);if(!l[0])return!1;const c={type:"link",title:null,url:o+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[c,{type:"text",value:l[1]}]:c}function $te(e,t,n,r){return!n4(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Ute(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 Vte(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 i=LT(e,"(");let o=LT(e,")");for(;r!==-1&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function n4(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Sl(n)||Og(n))&&(!t||n!==47)}r4.peek=Jte;function Wte(){this.buffer()}function qte(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Kte(){this.buffer()}function Gte(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Yte(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=as(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Xte(e){this.exit(e)}function Zte(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=as(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Qte(e){this.exit(e)}function Jte(){return"["}function r4(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const l=n.enter("footnoteReference"),c=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),c(),l(),o+=i.move("]"),o}function ene(){return{enter:{gfmFootnoteCallString:Wte,gfmFootnoteCall:qte,gfmFootnoteDefinitionLabelString:Kte,gfmFootnoteDefinition:Gte},exit:{gfmFootnoteCallString:Yte,gfmFootnoteCall:Xte,gfmFootnoteDefinitionLabelString:Zte,gfmFootnoteDefinition:Qte}}}function tne(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:r4},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,o,l){const c=o.createTracker(l);let h=c.move("[^");const d=o.enter("footnoteDefinition"),g=o.enter("label");return h+=c.move(o.safe(o.associationId(r),{before:h,after:"]"})),g(),h+=c.move("]:"),r.children&&r.children.length>0&&(c.shift(4),h+=c.move((t?`
621
+ `:" ")+o.indentLines(o.containerFlow(r,c.current()),t?i4:nne))),d(),h}}function nne(e,t,n){return t===0?e:i4(e,t,n)}function i4(e,t,n){return(n?"":" ")+e}const rne=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];s4.peek=lne;function ine(){return{canContainEols:["delete"],enter:{strikethrough:one},exit:{strikethrough:ane}}}function sne(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:rne}],handlers:{delete:s4}}}function one(e){this.enter({type:"delete",children:[]},e)}function ane(e){this.exit(e)}function s4(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let l=i.move("~~");return l+=n.containerPhrasing(e,{...i.current(),before:l,after:"~"}),l+=i.move("~~"),o(),l}function lne(){return"~"}function cne(e){return e.length}function une(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||cne,o=[],l=[],c=[],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=dne(e[g][k]);if(n.alignDelimiters!==!1){const E=i(R);C[k]=E,(h[k]===void 0||E>h[k])&&(h[k]=E)}S.push(R)}l[g]=S,c[g]=C}let p=-1;if(typeof r=="object"&&"length"in r)for(;++p<d;)o[p]=zT(r[p]);else{const S=zT(r);for(;++p<d;)o[p]=S}p=-1;const v=[],b=[];for(;++p<d;){const S=o[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),b[p]=R),v[p]=E}l.splice(1,0,v),c.splice(1,0,b),g=-1;const w=[];for(;++g<l.length;){const S=l[g],C=c[g];p=-1;const k=[];for(;++p<d;){const R=S[p]||"";let E="",N="";if(n.alignDelimiters!==!1){const L=h[p]-(C[p]||0),j=o[p];j===114?E=" ".repeat(L):j===99?L%2?(E=" ".repeat(L/2+.5),N=" ".repeat(L/2-.5)):(E=" ".repeat(L/2),N=E):N=" ".repeat(L)}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(`
622
+ `)}function dne(e){return e==null?"":String(e)}function zT(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 hne(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const l=n.indentLines(n.containerFlow(e,o.current()),fne);return i(),l}function fne(e,t,n){return">"+(n?"":" ")+e}function mne(e,t){return PT(e,t.inConstruct,!0)&&!PT(e,t.notInConstruct,!1)}function PT(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 IT(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
623
+ `&&mne(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
624
+ `}function pne(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>l&&(l=o):o=1,i=r+t.length,r=n.indexOf(t,i);return l}function gne(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 vne(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 _ne(e,t,n,r){const i=vne(n),o=e.value||"",l=i==="`"?"GraveAccent":"Tilde";if(gne(e,n)){const p=n.enter("codeIndented"),v=n.indentLines(o,yne);return p(),v}const c=n.createTracker(r),h=i.repeat(Math.max(pne(o,i)+1,3)),d=n.enter("codeFenced");let g=c.move(h);if(e.lang){const p=n.enter(`codeFencedLang${l}`);g+=c.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...c.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${l}`);g+=c.move(" "),g+=c.move(n.safe(e.meta,{before:g,after:`
625
+ `,encode:["`"],...c.current()})),p()}return g+=c.move(`
626
+ `),o&&(g+=c.move(o+`
627
+ `)),g+=c.move(h),d(),g}function yne(e,t,n){return(n?"":" ")+e}function Qw(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 bne(e,t,n,r){const i=Qw(n),o=i==='"'?"Quote":"Apostrophe",l=n.enter("definition");let c=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("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=h.move("<"),d+=h.move(n.safe(e.url,{before:d,after:">",...h.current()})),d+=h.move(">")):(c=n.enter("destinationRaw"),d+=h.move(n.safe(e.url,{before:d,after:e.title?" ":`
628
+ `,...h.current()}))),c(),e.title&&(c=n.enter(`title${o}`),d+=h.move(" "+i),d+=h.move(n.safe(e.title,{before:d,after:i,...h.current()})),d+=h.move(i),c()),l(),d}function xne(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 uh(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Bp(e,t,n){const r=Wc(e),i=Wc(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}o4.peek=wne;function o4(e,t,n,r){const i=xne(n),o=n.enter("emphasis"),l=n.createTracker(r),c=l.move(i);let h=l.move(n.containerPhrasing(e,{after:i,before:c,...l.current()}));const d=h.charCodeAt(0),g=Bp(r.before.charCodeAt(r.before.length-1),d,i);g.inside&&(h=uh(d)+h.slice(1));const p=h.charCodeAt(h.length-1),v=Bp(r.after.charCodeAt(0),p,i);v.inside&&(h=h.slice(0,-1)+uh(p));const b=l.move(i);return o(),n.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},c+h+b}function wne(e,t,n){return n.options.emphasis||"*"}function Sne(e,t){let n=!1;return Xw(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Zx}),!!((!e.depth||e.depth<3)&&Uw(e)&&(t.options.setext||n))}function Cne(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(Sne(e,n)){const g=n.enter("headingSetext"),p=n.enter("phrasing"),v=n.containerPhrasing(e,{...o.current(),before:`
629
+ `,after:`
630
+ `});return p(),g(),v+`
631
+ `+(i===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
632
+ `))+1))}const l="#".repeat(i),c=n.enter("headingAtx"),h=n.enter("phrasing");o.move(l+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
633
+ `,...o.current()});return/^[\t ]/.test(d)&&(d=uh(d.charCodeAt(0))+d.slice(1)),d=d?l+" "+d:l,n.options.closeAtx&&(d+=" "+l),h(),c(),d}a4.peek=kne;function a4(e){return e.value||""}function kne(){return"<"}l4.peek=Ene;function l4(e,t,n,r){const i=Qw(n),o=i==='"'?"Quote":"Apostrophe",l=n.enter("image");let c=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("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=h.move("<"),d+=h.move(n.safe(e.url,{before:d,after:">",...h.current()})),d+=h.move(">")):(c=n.enter("destinationRaw"),d+=h.move(n.safe(e.url,{before:d,after:e.title?" ":")",...h.current()}))),c(),e.title&&(c=n.enter(`title${o}`),d+=h.move(" "+i),d+=h.move(n.safe(e.title,{before:d,after:i,...h.current()})),d+=h.move(i),c()),d+=h.move(")"),l(),d}function Ene(){return"!"}c4.peek=Rne;function c4(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let l=n.enter("label");const c=n.createTracker(r);let h=c.move("![");const d=n.safe(e.alt,{before:h,after:"]",...c.current()});h+=c.move(d+"]["),l();const g=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),{before:h,after:"]",...c.current()});return l(),n.stack=g,o(),i==="full"||!d||d!==p?h+=c.move(p+"]"):i==="shortcut"?h=h.slice(0,-1):h+=c.move("]"),h}function Rne(){return"!"}u4.peek=Tne;function u4(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const l=n.unsafe[o],c=n.compilePattern(l);let h;if(l.atBreak)for(;h=c.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 i+r+i}function Tne(){return"`"}function d4(e,t){const n=Uw(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))}h4.peek=Nne;function h4(e,t,n,r){const i=Qw(n),o=i==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let c,h;if(d4(e,n)){const g=n.stack;n.stack=[],c=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(e,{before:p,after:">",...l.current()})),p+=l.move(">"),c(),n.stack=g,p}c=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${o}`),d+=l.move(" "+i),d+=l.move(n.safe(e.title,{before:d,after:i,...l.current()})),d+=l.move(i),h()),d+=l.move(")"),c(),d}function Nne(e,t,n){return d4(e,n)?"<":"["}f4.peek=Mne;function f4(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let l=n.enter("label");const c=n.createTracker(r);let h=c.move("[");const d=n.containerPhrasing(e,{before:h,after:"]",...c.current()});h+=c.move(d+"]["),l();const g=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),{before:h,after:"]",...c.current()});return l(),n.stack=g,o(),i==="full"||!d||d!==p?h+=c.move(p+"]"):i==="shortcut"?h=h.slice(0,-1):h+=c.move("]"),h}function Mne(){return"["}function Jw(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 Ane(e){const t=Jw(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 jne(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 m4(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 Dne(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let l=e.ordered?jne(n):Jw(n);const c=e.ordered?l==="."?")":".":Ane(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),m4(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=c),n.bulletCurrent=l;const d=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=o,i(),d}function One(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 Lne(e,t,n,r){const i=One(n);let o=n.bulletCurrent||Jw(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let l=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const c=n.createTracker(r);c.move(o+" ".repeat(l-o.length)),c.shift(l);const h=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,c.current()),g);return h(),d;function g(p,v,b){return v?(b?"":" ".repeat(l))+p:(b?o:o+" ".repeat(l-o.length))+p}}function zne(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),l=n.containerPhrasing(e,r);return o(),i(),l}const Pne=Pg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Ine(e,t,n,r){return(e.children.some(function(l){return Pne(l)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Bne(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}p4.peek=Fne;function p4(e,t,n,r){const i=Bne(n),o=n.enter("strong"),l=n.createTracker(r),c=l.move(i+i);let h=l.move(n.containerPhrasing(e,{after:i,before:c,...l.current()}));const d=h.charCodeAt(0),g=Bp(r.before.charCodeAt(r.before.length-1),d,i);g.inside&&(h=uh(d)+h.slice(1));const p=h.charCodeAt(h.length-1),v=Bp(r.after.charCodeAt(0),p,i);v.inside&&(h=h.slice(0,-1)+uh(p));const b=l.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},c+h+b}function Fne(e,t,n){return n.options.strong||"*"}function Hne(e,t,n,r){return n.safe(e.value,r)}function $ne(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 Une(e,t,n){const r=(m4(n)+(n.options.ruleSpaces?" ":"")).repeat($ne(n));return n.options.ruleSpaces?r.slice(0,-1):r}const g4={blockquote:hne,break:IT,code:_ne,definition:bne,emphasis:o4,hardBreak:IT,heading:Cne,html:a4,image:l4,imageReference:c4,inlineCode:u4,link:h4,linkReference:f4,list:Dne,listItem:Lne,paragraph:zne,root:Ine,strong:p4,text:Hne,thematicBreak:Une};function Vne(){return{enter:{table:Wne,tableData:BT,tableHeader:BT,tableRow:Kne},exit:{codeText:Gne,table:qne,tableData:cb,tableHeader:cb,tableRow:cb}}}function Wne(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 qne(e){this.exit(e),this.data.inTable=void 0}function Kne(e){this.enter({type:"tableRow",children:[]},e)}function cb(e){this.exit(e)}function BT(e){this.enter({type:"tableCell",children:[]},e)}function Gne(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Yne));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Yne(e,t){return t==="|"?t:e}function Xne(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
634
+ `,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:c}};function l(b,w,S,C){return d(g(b,S,C),b.align)}function c(b,w,S,C){const k=p(b,S,C),R=d([k]);return R.slice(0,R.indexOf(`
635
+ `))}function h(b,w,S,C){const k=S.enter("tableCell"),R=S.enter("phrasing"),E=S.containerPhrasing(b,{...C,before:o,after:o});return R(),k(),E}function d(b,w){return une(b,{align:w,alignDelimiters:r,padding:n,stringLength:i})}function g(b,w,S){const C=b.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(b,w,S){const C=b.children;let k=-1;const R=[],E=w.enter("tableRow");for(;++k<C.length;)R[k]=h(C[k],b,w,S);return E(),R}function v(b,w,S){let C=g4.inlineCode(b,w,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function Zne(){return{exit:{taskListCheckValueChecked:FT,taskListCheckValueUnchecked:FT,paragraph:Jne}}}function Qne(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:ere}}}function FT(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Jne(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 i=t.children;let o=-1,l;for(;++o<i.length;){const c=i[o];if(c.type==="paragraph"){l=c;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 ere(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",c=n.createTracker(r);o&&c.move(l);let h=g4.listItem(e,t,n,{...r,...c.current()});return o&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),h;function d(g){return g+l}}function tre(){return[Dte(),ene(),ine(),Vne(),Zne()]}function nre(e){return{extensions:[Ote(),tne(e),sne(),Xne(e),Qne()]}}const rre={tokenize:cre,partial:!0},v4={tokenize:ure,partial:!0},_4={tokenize:dre,partial:!0},y4={tokenize:hre,partial:!0},ire={tokenize:fre,partial:!0},b4={name:"wwwAutolink",tokenize:are,previous:w4},x4={name:"protocolAutolink",tokenize:lre,previous:S4},Mo={name:"emailAutolink",tokenize:ore,previous:C4},Hs={};function sre(){return{text:Hs}}let Ja=48;for(;Ja<123;)Hs[Ja]=Mo,Ja++,Ja===58?Ja=65:Ja===91&&(Ja=97);Hs[43]=Mo;Hs[45]=Mo;Hs[46]=Mo;Hs[95]=Mo;Hs[72]=[Mo,x4];Hs[104]=[Mo,x4];Hs[87]=[Mo,b4];Hs[119]=[Mo,b4];function ore(e,t,n){const r=this;let i,o;return l;function l(p){return!t0(p)||!C4.call(r,r.previous)||e1(r.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(p))}function c(p){return t0(p)?(e.consume(p),c):p===64?(e.consume(p),h):n(p)}function h(p){return p===46?e.check(ire,g,d)(p):p===45||p===95||zr(p)?(o=!0,e.consume(p),h):g(p)}function d(p){return e.consume(p),i=!0,h}function g(p){return o&&i&&Ur(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function are(e,t,n){const r=this;return i;function i(l){return l!==87&&l!==119||!w4.call(r,r.previous)||e1(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(rre,e.attempt(v4,e.attempt(_4,o),n),n)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function lre(e,t,n){const r=this;let i="",o=!1;return l;function l(p){return(p===72||p===104)&&S4.call(r,r.previous)&&!e1(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(p),e.consume(p),c):n(p)}function c(p){if(Ur(p)&&i.length<5)return i+=String.fromCodePoint(p),e.consume(p),c;if(p===58){const v=i.toLowerCase();if(v==="http"||v==="https")return e.consume(p),h}return n(p)}function h(p){return p===47?(e.consume(p),o?d:(o=!0,h)):n(p)}function d(p){return p===null||zp(p)||vn(p)||Sl(p)||Og(p)?n(p):e.attempt(v4,e.attempt(_4,g),n)(p)}function g(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function cre(e,t,n){let r=0;return i;function i(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),i):l===46&&r===3?(e.consume(l),o):n(l)}function o(l){return l===null?n(l):t(l)}}function ure(e,t,n){let r,i,o;return l;function l(d){return d===46||d===95?e.check(y4,h,c)(d):d===null||vn(d)||Sl(d)||d!==45&&Og(d)?h(d):(o=!0,e.consume(d),l)}function c(d){return d===95?r=!0:(i=r,r=void 0),e.consume(d),l}function h(d){return i||r||!o?n(d):t(d)}}function dre(e,t){let n=0,r=0;return i;function i(l){return l===40?(n++,e.consume(l),i):l===41&&r<n?o(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(y4,t,o)(l):l===null||vn(l)||Sl(l)?t(l):(e.consume(l),i)}function o(l){return l===41&&r++,e.consume(l),i}}function hre(e,t,n){return r;function r(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),r):c===38?(e.consume(c),o):c===93?(e.consume(c),i):c===60||c===null||vn(c)||Sl(c)?t(c):n(c)}function i(c){return c===null||c===40||c===91||vn(c)||Sl(c)?t(c):r(c)}function o(c){return Ur(c)?l(c):n(c)}function l(c){return c===59?(e.consume(c),r):Ur(c)?(e.consume(c),l):n(c)}}function fre(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return zr(o)?n(o):t(o)}}function w4(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||vn(e)}function S4(e){return!Ur(e)}function C4(e){return!(e===47||t0(e))}function t0(e){return e===43||e===45||e===46||e===95||zr(e)}function e1(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 mre={tokenize:wre,partial:!0};function pre(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:yre,continuation:{tokenize:bre},exit:xre}},text:{91:{name:"gfmFootnoteCall",tokenize:_re},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:gre,resolveTo:vre}}}}function gre(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;i--;){const h=r.events[i][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 c;function c(h){if(!l||!l._balanced)return n(h);const d=as(r.sliceSerialize({start:l.end,end:r.now()}));return d.codePointAt(0)!==94||!o.includes(d.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function vre(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)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},c=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",l,t],["exit",l,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...c),e}function _re(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,l;return c;function c(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(o>999||p===93&&!l||p===null||p===91||vn(p))return n(p);if(p===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return i.includes(as(r.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return vn(p)||(l=!0),o++,e.consume(p),p===92?g:d}function g(p){return p===91||p===92||p===93?(e.consume(p),o++,d):d(p)}}function yre(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,l=0,c;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&&!c||w===null||w===91||vn(w))return n(w);if(w===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return o=as(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return vn(w)||(c=!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"),i.includes(o)||i.push(o),Ft(e,b,"gfmFootnoteDefinitionWhitespace")):n(w)}function b(w){return t(w)}}function bre(e,t,n){return e.check(Ih,t,e.attempt(mre,t,n))}function xre(e){e.exit("gfmFootnoteDefinition")}function wre(e,t,n){const r=this;return Ft(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(o):n(o)}}function Sre(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(l,c){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,c],["enter",l[d][1],c],["exit",l[d][1],c],["enter",p,c]],b=c.parser.constructs.insideSpan.null;b&&wi(v,v.length,0,Lg(b,l.slice(d+1,h),c)),wi(v,v.length,0,[["exit",p,c],["enter",l[h][1],c],["exit",l[h][1],c],["exit",g,c]]),wi(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 o(l,c,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"),b(w))}function b(w){const S=Wc(d);if(w===126)return p>1?h(w):(l.consume(w),p++,b);if(p<2&&!n)return h(w);const C=l.exit("strikethroughSequenceTemporary"),k=Wc(w);return C._open=!k||k===2&&!!S,C._close=!S||S===2&&!!k,c(w)}}}class Cre{constructor(){this.map=[]}add(t,n,r){kre(this,t,n,r)}consume(t){if(this.map.sort(function(o,l){return o[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 i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0}}function kre(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function Ere(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function Rre(){return{flow:{null:{name:"table",tokenize:Tre,resolveAll:Nre}}}}function Tre(e,t,n){const r=this;let i=0,o=0,l;return c;function c(P){let q=r.events.length-1;for(;q>-1;){const W=r.events[q][1].type;if(W==="lineEnding"||W==="linePrefix")q--;else break}const F=q>-1?r.events[q][1].type:null,U=F==="tableHead"||F==="tableRow"?j:h;return U===j&&r.parser.lazy[r.now().line]?n(P):U(P)}function h(P){return e.enter("tableHead"),e.enter("tableRow"),d(P)}function d(P){return P===124||(l=!0,o+=1),g(P)}function g(P){return P===null?n(P):it(P)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),b):n(P):Ot(P)?Ft(e,g,"whitespace")(P):(o+=1,l&&(l=!1,i+=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||vn(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 b(P){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(P):(e.enter("tableDelimiterRow"),l=!1,Ot(P)?Ft(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):L(P)}function S(P){return Ot(P)?Ft(e,C,"whitespace")(P):C(P)}function C(P){return P===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),k):P===45?(o+=1,k(P)):P===null||it(P)?N(P):L(P)}function k(P){return P===45?(e.enter("tableDelimiterFiller"),R(P)):L(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 Ot(P)?Ft(e,N,"whitespace")(P):N(P)}function N(P){return P===124?w(P):P===null||it(P)?!l||i!==o?L(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(P)):L(P)}function L(P){return n(P)}function j(P){return e.enter("tableRow"),D(P)}function D(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),D):P===null||it(P)?(e.exit("tableRow"),t(P)):Ot(P)?Ft(e,D,"whitespace")(P):(e.enter("data"),H(P))}function H(P){return P===null||P===124||vn(P)?(e.exit("data"),D(P)):(e.consume(P),P===92?Y:H)}function Y(P){return P===92||P===124?(e.consume(P),H):H(P)}}function Nre(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],l=[0,0,0,0],c=!1,h=0,d,g,p;const v=new Cre;for(;++n<e.length;){const b=e[n],w=b[1];b[0]==="enter"?w.type==="tableHead"?(c=!1,h!==0&&(HT(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,o=[0,0,0,0],l=[0,n+1,0,0],c&&(c=!1,g={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},v.add(n,0,[["enter",g,t]])),i=w.type==="tableDelimiterRow"?2:g?3:1):i&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],p=Om(v,t,o,i,void 0,p),o=[0,0,0,0]),l[2]=n)):w.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(l[0]=l[1],p=Om(v,t,o,i,void 0,p)),o=l,l=[o[1],n,0,0])):w.type==="tableHead"?(c=!0,h=n):w.type==="tableRow"||w.type==="tableDelimiterRow"?(h=n,o[1]!==0?(l[0]=l[1],p=Om(v,t,o,i,n,p)):l[1]!==0&&(p=Om(v,t,l,i,n,p)),i=0):i&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(l[3]=n)}for(h!==0&&HT(v,t,h,d,g),v.consume(t.events),n=-1;++n<t.events.length;){const b=t.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=Ere(t.events,n))}return e}function Om(e,t,n,r,i,o){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(o.end=Object.assign({},Cc(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const h=Cc(t.events,n[1]);if(o={type:l,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const d=Cc(t.events,n[2]),g=Cc(t.events,n[3]),p={type:c,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]],b=t.events[n[3]];if(v[1].end=Object.assign({},b[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 i!==void 0&&(o.end=Object.assign({},Cc(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function HT(e,t,n,r,i){const o=[],l=Cc(t.events,n);i&&(i.end=Object.assign({},l),o.push(["exit",i,t])),r.end=Object.assign({},l),o.push(["exit",r,t]),e.add(n+1,0,o)}function Cc(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Mre={name:"tasklistCheck",tokenize:jre};function Are(){return{text:{91:Mre}}}function jre(e,t,n){const r=this;return i;function i(h){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),o)}function o(h){return vn(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"),c):n(h)}function c(h){return it(h)?t(h):Ot(h)?e.check({tokenize:Dre},t,n)(h):n(h)}}function Dre(e,t,n){return Ft(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function Ore(e){return LO([sre(),pre(),Sre(e),Rre(),Are()])}const Lre={};function mu(e){const t=this,n=e||Lre,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Ore(n)),o.push(tre()),l.push(nre(n))}function zre({content:e,attachments:t}){const[n,r]=_.useState(null),i=(t==null?void 0:t.find(o=>o.id===n))??null;return _.useEffect(()=>{i||r(null)},[i]),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(o=>f.jsxs("button",{type:"button",className:"overflow-hidden rounded-lg border border-border/80 bg-background/70 text-left cursor-zoom-in",onClick:()=>r(o.id),children:[f.jsx("img",{src:o.previewUrl,alt:o.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:o.name})]},o.id))}):null,e.trim()?f.jsx(fu,{remarkPlugins:[mu],components:uu(),children:e}):null]})}),i?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:i.previewUrl,alt:i.name,className:"max-h-full max-w-full rounded-xl shadow-2xl"})}):null]})}function Pre({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 k4({title:e,count:t,children:n,badge:r}){const[i,o]=_.useState(!1);return t===0?null:f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsxs("button",{onClick:()=>o(!i),className:"flex items-center gap-1 cursor-pointer group/section hover:opacity-60 transition-opacity",children:[f.jsx(Vr,{className:me("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",i&&"rotate-90")}),f.jsx("span",{className:"text-muted-foreground font-medium",children:e}),f.jsx("span",{className:"text-muted-foreground/60",children:t}),r]}),i&&f.jsx("div",{className:"ml-5",children:n})]})}function ub({title:e,items:t,icon:n,getIcon:r}){return t.length===0?null:f.jsx(k4,{title:e,count:t.length,children:f.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map(i=>f.jsx(fO,{icon:r?r(i):n,children:i},i))})})}function Ire(e){const t=e.match(/^mcp__([^_]+)__(.+)$/);return t?{server:t[1],tool:t[2]}:null}function E4({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 Bre(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 $T({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(Vr,{className:me("h-3 w-3 text-muted-foreground transition-transform duration-200",t&&"rotate-90")}),f.jsx(E4,{status:e.status}),f.jsx("span",{className:"text-muted-foreground font-medium",children:Lb(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:Bre(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(i=>f.jsx(fO,{icon:hO(`mcp__${e.name}__${i}`),children:i},i))})]})}function Fre({servers:e}){if(e.length===0)return null;const t=e.filter(i=>i.status==="connected"),n=e.filter(i=>i.status!=="connected"),r=n.length>0?f.jsxs("span",{className:"flex items-center gap-1 ml-1",children:[f.jsx(E4,{status:"failed"}),f.jsxs("span",{className:"text-muted-foreground/60",children:[n.length," disconnected"]})]}):null;return f.jsx(k4,{title:"MCP Servers",count:e.length,badge:r,children:f.jsxs("div",{className:"flex flex-col gap-2",children:[t.map(i=>f.jsx($T,{server:i},i.name)),n.map(i=>f.jsx($T,{server:i},i.name))]})})}function Hre({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(Vr,{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 $re({message:e,rawJson:t}){const{coreTools:n,mcpServersWithTools:r}=_.useMemo(()=>{const i=new Map,o=[];for(const c of e.tools){const h=Ire(c);if(h){const d=i.get(h.server)||[];d.push(h.tool),i.set(h.server,d)}else o.push(c)}const l=e.mcpServers.map(c=>({name:c.name,status:c.status,error:c.error,tools:i.get(c.name)||[]}));return{coreTools:o,mcpServersWithTools:l}},[e.tools,e.mcpServers]);return f.jsx(No,{children:f.jsxs(Lh,{expandedContent:f.jsx(zh,{className:"my-4 text-xs",children:f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsx(mX,{children:e.model}),f.jsx(ub,{title:"Tools",items:n,getIcon:i=>Px[i]??dO}),f.jsx(ub,{title:"Agents",items:e.agents,icon:S0}),f.jsx(ub,{title:"Commands",items:e.slashCommands,icon:y9}),f.jsx(Fre,{servers:r}),t&&f.jsx(Hre,{rawJson:t})]})}),children:[f.jsx(W6,{className:"h-5 w-5 text-logo"}),f.jsx(xo,{children:"Session Started"})]})})}function Ure({message:e}){return f.jsx(No,{className:"hidden",children:f.jsxs(Lh,{expandedContent:f.jsx(zh,{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(S0,{className:"h-4 w-4 text-muted-foreground"})}),f.jsx(xo,{children:"Account"})]})})}function Vre({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(fu,{remarkPlugins:[mu],components:uu(),children:e.text})})}function Wre({message:e}){return f.jsx(No,{className:"w-full",children:f.jsxs(Lh,{expandedContent:f.jsx(zh,{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(fu,{remarkPlugins:[mu],components:uu(),children:e.text})})}),children:[f.jsx(vi,{className:"h-4 w-4 text-muted-icon"}),f.jsx(xo,{className:"text-left text-muted-foreground",children:"Thinking"})]})})}function qre({question:e,currentIndex:t,totalQuestions:n,onBack:r,children:i}){const o=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:[o?f.jsx("button",{onClick:r,className:" text-muted-foreground hover:opacity-60 transition-all flex items-center",children:f.jsx(zM,{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}%`}})})]}),i]})}function UT({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 R4({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(Vi,{strokeWidth:3,className:"translate-y-[0.5px] h-3 w-3 text-white dark:text-background"})})}function Kre({option:e,selected:t,multiSelect:n,onClick:r,isLast:i}){const o="w-full text-left p-3 pt-2.5 pl-4 pr-5 bg-background",l=i?"":"border-b border-border";return r?f.jsx("button",{onClick:r,className:me(o,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(UT,{label:e.label,description:e.description})}),f.jsx(R4,{selected:t,multiSelect:n})]})}):f.jsx("div",{className:me(o,l),children:f.jsx(UT,{label:e.label,description:e.description})})}function Gre(e){return e==null?void 0:e.answers}function ns(e){return e.id||e.question}function Yre({message:e,onSubmit:t,isLatest:n}){var O,$;const r=e.input.questions,i=!!e.result,o=Gre(e.result),l=((O=e.result)==null?void 0:O.discarded)===!0,[c,h]=_.useState(0),[d,g]=_.useState({}),[p,v]=_.useState({}),[b,w]=_.useState(o??null),[S,C]=_.useState(i),k=(z,G)=>{var ie;const M=(ie=p[z])==null?void 0:ie.trim(),B=d[z]||"",Z=G||r.find(J=>ns(J)===z);if(Z!=null&&Z.multiSelect)return[B,M].filter(Boolean).flatMap(J=>J.split(", ").filter(Boolean));const A=M||B;return A?[A]:[]},R=z=>{const G=d[ns(z)]||"";return z.multiSelect?G.split(", ").filter(Boolean):[G]},E=(z,G)=>{const M=ns(z);if(z.multiSelect){const B=d[M]?d[M].split(", ").filter(Boolean):[],Z=B.includes(G)?B.filter(A=>A!==G):[...B,G];g({...d,[M]:Z.join(", ")})}else g({...d,[M]:G}),v({...p,[M]:""}),c<r.length-1&&setTimeout(()=>h(c+1),150)},N=(z,G)=>{const M=ns(z);v({...p,[M]:G}),G&&!z.multiSelect&&g({...d,[M]:""})},L=z=>{const G=ns(z);z.multiSelect&&p[G]&&v({...p,[G]:""})},j=r.every(z=>k(ns(z),z).length>0),D=r[c],H=c===r.length-1,Y=D&&k(ns(D),D).length>0,P=()=>{c<r.length-1&&h(c+1)},q=()=>{c>0&&h(c-1)},F=()=>{if(!j)return;const z={};for(const G of r){const M=ns(G);z[M]=k(M,G)}w(z),C(!0),t(e.toolId,r,z)},U=z=>{if(z.key==="Enter"&&!(!D||!Y)){if(z.preventDefault(),H){F();return}P()}};if(S||i){const z=o||b||{};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((G,M)=>{const B=z[ns(G)]||z[G.question]||[],Z=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",!Z&&"border-b border-border"),children:[f.jsx("div",{className:"text-sm text-pretty",children:G.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"})]},ns(G))})]})})}if(!n)return f.jsx("div",{className:"w-full py-2",children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(HM,{className:"h-4 w-4 text-muted-foreground"}),f.jsx("span",{className:"text-sm text-muted-foreground",children:"Questions pending (newer question active)"})]})});if(!D)return null;const W=R(D),V=p[ns(D)]||"";return f.jsxs("div",{className:"w-full space-y-3",children:[f.jsxs(qre,{question:D.question,currentIndex:c,totalQuestions:r.length,onBack:c>0?q:void 0,children:[($=D.options)==null?void 0:$.map(z=>f.jsx(Kre,{option:z,selected:W.includes(z.label),multiSelect:D.multiSelect,onClick:()=>E(D,z.label)},z.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:V,onChange:z=>N(D,z.target.value),onKeyDown:U,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(R4,{selected:!!V,multiSelect:D.multiSelect,onClick:D.multiSelect&&V?()=>L(D):void 0})]})})]}),f.jsxs("div",{className:"flex justify-end gap-2 mx-2",children:[!H&&Y&&(D.multiSelect||!!V)&&f.jsx(et,{size:"sm",onClick:P,children:"Next"}),H&&f.jsx(et,{size:"sm",onClick:F,disabled:!j,className:me(!j&&"opacity-50 cursor-not-allowed","rounded-full"),children:"Submit"})]})]})}async function Xre(e){const t=await new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{if(typeof i.result=="string"){n(i.result);return}r(new Error("Failed to read image attachment"))},i.onerror=()=>r(i.error??new Error("Failed to read image attachment")),i.readAsDataURL(e)});return{type:"image",name:e.name,mimeType:e.type,sizeBytes:e.size,dataUrl:t}}function Lm(e){return String(e).padStart(2,"0")}function Zre(e,t=new Date){const n=e?new Date(e):null,r=n&&!Number.isNaN(n.getTime())?n:t;return["kaizen-plan",`${r.getFullYear()}-${Lm(r.getMonth()+1)}-${Lm(r.getDate())}`,`${Lm(r.getHours())}-${Lm(r.getMinutes())}.md`].join("-")}function Qre(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n}function Jre({message:e,onConfirm:t,isLatest:n,isActionable:r=n}){const i=!!e.result,[o,l]=_.useState(!1),[c,h]=_.useState(!1),[d,g]=_.useState(!1),[p,v]=_.useState(""),[b,w]=_.useState([]),[S,C]=_.useState(null),[k,R]=_.useState(!1),[E,N]=_.useState(!1),[L,j]=_.useState(null),D=_.useRef(null),H=_.useRef(null),Y=_.useRef(null),P=e.input;_.useEffect(()=>{d&&D.current&&D.current.focus()},[d]),_.useEffect(()=>()=>{for(const z of b)URL.revokeObjectURL(z.previewUrl);Y.current&&clearTimeout(Y.current)},[b]);const q=async()=>{var z;if(P!=null&&P.plan)try{if((z=navigator.clipboard)!=null&&z.writeText)await navigator.clipboard.writeText(P.plan);else if(!Qre(P.plan))throw new Error("Clipboard copy failed");h(!0),Ec("Plan copied to clipboard."),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>h(!1),2e3)}catch{Ec("Failed to copy plan.")}},F=_.useCallback(()=>{if(!(P!=null&&P.plan))return;const z=new Blob([P.plan],{type:"text/markdown;charset=utf-8"}),G=URL.createObjectURL(z),M=document.createElement("a");M.href=G,M.download=Zre(e.timestamp),M.click(),URL.revokeObjectURL(G)},[P==null?void 0:P.plan,e.timestamp]),U=_.useCallback(z=>{const G=z.filter(M=>M.type.startsWith("image/"));if(G.length===0){C("Only PNG, JPEG, WEBP, and GIF images are supported.");return}w(M=>{const B=[...M];let Z=null;for(const A of G){if(!pp.includes(A.type)){Z=`Unsupported image type: ${A.type||"unknown"}`;continue}if(A.size<=0||A.size>D5){Z=`${A.name} is empty or larger than 10 MB.`;continue}if(B.length>=mp){Z=`You can attach up to ${mp} images per message.`;break}B.push({id:Od(),file:A,name:A.name||"image",mimeType:A.type,sizeBytes:A.size,previewUrl:URL.createObjectURL(A)})}return C(Z),B})},[]),W=_.useCallback(z=>{w(G=>{const M=G.find(B=>B.id===z);return M&&URL.revokeObjectURL(M.previewUrl),G.filter(B=>B.id!==z)}),C(null)},[]),V=async()=>{if(!(!p.trim()&&b.length===0)){N(!0);try{const z=b.length?await Promise.all(b.map(G=>Xre(G.file))):void 0;t(e.toolId,!1,void 0,p.trim(),z)}finally{N(!1)}}},O=i?e.result:null,$=(O==null?void 0:O.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:[(P==null?void 0:P.plan)&&f.jsx(et,{variant:"ghost",size:"icon",className:me("absolute top-2 right-2 z-10 h-8 w-8 rounded-md text-muted-foreground opacity-100 transition-opacity",!c&&"md:opacity-0 md:group-hover/plan:opacity-100",!c&&"hover:text-foreground",c&&"hover:!bg-transparent hover:!border-transparent"),onClick:q,"aria-label":c?"Plan copied":"Copy plan",title:c?"Plan copied":"Copy plan",children:c?f.jsx(Vi,{className:"h-4 w-4 text-green-400"}):f.jsx(ul,{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",i&&!o?"max-h-[min(400px,40vh)] ":"",i?"hover:!pb-[32px]":""),children:[i&&f.jsxs(et,{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(!o),children:[o?"Show Less":"Show More",f.jsx(tg,{className:`size-3.5 transition-transform ${o?"rotate-180":""}`})]}),P!=null&&P.plan?f.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:[f.jsx(fu,{remarkPlugins:[mu],components:uu(),children:P.plan}),f.jsx("div",{className:"mt-5"})]}):f.jsx("p",{className:"text-sm text-muted-foreground",children:"No plan provided"})]})]}),i?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:$?"Discarded":O!=null&&O.clearContext?"Approved & Cleared Context":O!=null&&O.confirmed?"Approved":O!=null&&O.message?`Adjusted: "${O.message}"`:"Adjusted Plan"}),f.jsx(g8,{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 gap-2 mx-2 md:flex-row md:items-center md:justify-between",children:[f.jsx("div",{className:"flex items-center gap-2",children:P!=null&&P.plan?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"hidden items-center gap-2 md:flex",children:[f.jsxs(et,{type:"button",size:"sm",variant:"outline",className:"rounded-full",onClick:()=>void q(),children:[c?f.jsx(Vi,{className:"h-4 w-4 mr-1.5 text-green-400"}):f.jsx(ul,{className:"h-4 w-4 mr-1.5"}),c?"Copied":"Copy"]}),f.jsxs(et,{type:"button",size:"sm",variant:"outline",className:"rounded-full",onClick:F,children:[f.jsx(N2,{className:"h-4 w-4 mr-1.5"}),"Download .md"]})]}),f.jsxs("div",{className:"md:hidden",children:[f.jsx(et,{type:"button",size:"icon",variant:"outline",className:"rounded-full","aria-label":"More plan actions",title:"More plan actions",onClick:z=>{const G=z.currentTarget.getBoundingClientRect();j({x:G.left,y:G.bottom+4})},children:f.jsx(y8,{className:"h-4 w-4"})}),f.jsxs(hw,{open:L!==null,onOpenChange:z=>{z||j(null)},position:L,children:[f.jsxs(rh,{onSelect:()=>{j(null),q()},children:[f.jsx(ul,{className:"h-4 w-4"}),f.jsx("span",{children:"Copy"})]}),f.jsxs(rh,{onSelect:()=>{j(null),F()},children:[f.jsx(N2,{className:"h-4 w-4"}),f.jsx("span",{children:"Download .md"})]})]})]})]}):null}),f.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center justify-end gap-2",children:[f.jsxs(et,{size:"sm",onClick:()=>t(e.toolId,!0,!0),className:"rounded-full bg-primary text-primary-foreground pr-4 md:order-last",children:[f.jsx(G6,{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(et,{size:"sm",variant:"outline",onClick:()=>g(!0),className:"rounded-full border-border flex-1 md:flex-initial md:order-first",children:[f.jsx(Bc,{className:"h-4 w-4 mr-1.5"}),"Suggest Edits"]}),f.jsxs(et,{size:"sm",variant:"outline",onClick:()=>t(e.toolId,!0),className:"rounded-full border-border flex-1 md:flex-initial",children:[f.jsx(Vi,{className:"h-4 w-4 mr-1.5"}),"Approve"]})]})]})]}),d&&f.jsxs("div",{className:me("flex flex-col gap-2 rounded-2xl border bg-muted dark:bg-card px-4 py-3 transition-colors",k?"border-foreground/40 bg-muted/80":"border-border"),onDragEnter:z=>{z.dataTransfer.types.includes("Files")&&(z.preventDefault(),R(!0))},onDragOver:z=>{z.dataTransfer.types.includes("Files")&&(z.preventDefault(),z.dataTransfer.dropEffect="copy",R(!0))},onDragLeave:z=>{if(!z.dataTransfer.types.includes("Files"))return;z.preventDefault();const G=z.relatedTarget;G instanceof Node&&z.currentTarget.contains(G)||R(!1)},onDrop:z=>{var G;z.dataTransfer.types.includes("Files")&&(z.preventDefault(),R(!1),U(Array.from(z.dataTransfer.files)),(G=D.current)==null||G.focus())},children:[f.jsx("input",{ref:H,type:"file",accept:pp.join(","),multiple:!0,className:"hidden",onChange:z=>{U(Array.from(z.target.files??[])),z.target.value=""}}),b.length?f.jsx("div",{className:"grid grid-cols-2 gap-2 pt-1 pb-2 sm:grid-cols-3",children:b.map(z=>f.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border/80 bg-background/80",children:[f.jsx("img",{src:z.previewUrl,alt:z.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:z.name}),f.jsxs("div",{className:"text-[11px] text-muted-foreground",children:[Math.max(1,Math.round(z.sizeBytes/1024))," KB"]})]}),f.jsx(et,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:()=>W(z.id),disabled:E,children:f.jsx(vo,{className:"h-3.5 w-3.5"})})]})]},z.id))}):null,f.jsx("textarea",{ref:D,value:p,onChange:z=>v(z.target.value),onPaste:z=>{const G=Array.from(z.clipboardData.files);G.some(M=>M.type.startsWith("image/"))&&(z.preventDefault(),U(G))},onKeyDown:z=>{z.key==="Enter"&&!z.shiftKey&&(p.trim()||b.length>0)&&(z.preventDefault(),V()),z.key==="Escape"&&(g(!1),v(""),w([]),C(null))},placeholder:"Describe what you'd like to change...",rows:3,className:"w-full bg-transparent text-[16px] md:text-sm text-foreground placeholder:text-muted-foreground resize-none outline-none"}),S?f.jsx("div",{className:"text-xs text-destructive",children:S}):null,f.jsxs("div",{className:"flex items-center justify-between mt-1",children:[f.jsx(et,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 rounded-full text-muted-foreground hover:text-foreground",onClick:()=>{var z;return(z=H.current)==null?void 0:z.click()},disabled:E,children:f.jsx(VM,{className:"h-4 w-4"})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(et,{size:"sm",variant:"ghost",onClick:()=>{g(!1),v(""),w([]),C(null)},className:"rounded-full text-muted-foreground",disabled:E,children:"Cancel"}),f.jsxs(et,{size:"sm",disabled:!p.trim()&&b.length===0||E,onClick:()=>void V(),className:"rounded-full bg-primary text-primary-foreground disabled:opacity-50 disabled:pointer-events-none",children:[f.jsx(f9,{className:"h-4 w-4 mr-1.5"}),E?"Adjusting...":"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 eie={completed:{Icon:Vi,iconClass:"text-emerald-500",textClass:"text-muted-foreground"},in_progress:{Icon:Lr,iconClass:"text-foreground animate-spin",textClass:"text-foreground font-medium"},pending:{Icon:l8,iconClass:"text-muted-foreground",textClass:"text-muted-foreground"}};function tie({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(W8,{className:"h-4 w-4 text-muted-foreground"}),"Progress"]}),f.jsx("div",{children:t.map((n,r)=>{const i=r===t.length-1,{Icon:o,iconClass:l,textClass:c}=eie[n.status];return f.jsxs("div",{className:me("flex items-center gap-3 px-4 py-2.5 bg-background",!i&&"border-b border-border"),children:[f.jsx(o,{className:me("h-4 w-4 flex-shrink-0",l)}),f.jsx("span",{className:me("text-sm",c),children:n.status==="in_progress"?n.activeForm:n.content})]},r)})})]})}):null}function nie(e){const t=e.split(`
636
+ `),n=/^\s*(\d+)→(.*)$/;return t.map(r=>{const i=r.match(n);return i?{lineNumber:parseInt(i[1],10),content:i[2]}:{lineNumber:null,content:r}})}function rie(e){return e.replace(/<[^>]+>/g,"")}function iie(e,t){const n=e.split(`
637
+ `),r=t.split(`
638
+ `),i=sie(n,r),o=oie(n,r,i);return aie(o)}function sie(e,t){const n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let o=1;o<=n;o++)for(let l=1;l<=r;l++)i[o][l]=e[o-1]===t[l-1]?i[o-1][l-1]+1:Math.max(i[o-1][l],i[o][l-1]);return i}function oie(e,t,n){const r=[];let i=e.length,o=t.length;for(;i>0||o>0;)i>0&&o>0&&e[i-1]===t[o-1]?(r.push({type:"context",text:e[i-1],oldIdx:i,newIdx:o}),i--,o--):o>0&&(i===0||n[i][o-1]>=n[i-1][o])?(r.push({type:"added",text:t[o-1],oldIdx:i,newIdx:o}),o--):(r.push({type:"removed",text:e[i-1],oldIdx:i,newIdx:o}),i--);return r.reverse()}function aie(e){return e.map(t=>{const n=t.type==="removed"?"-":t.type==="added"?"+":" ";return{type:t.type,content:`${n}${t.text}`}})}function db({content:e,isDiff:t=!1,oldString:n,newString:r}){const i=_.useMemo(()=>t&&n!==void 0&&r!==void 0?iie(n,r):[],[t,n,r]),o=_.useMemo(()=>t?[]:nie(e),[e,t]),l=_.useMemo(()=>o.some(c=>c.lineNumber!==null),[o]);return t&&i.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:i.map((c,h)=>{const d=c.type==="removed"?"bg-red-500/10 dark:bg-red-500/15":c.type==="added"?"bg-green-500/10 dark:bg-green-500/15":"",g=c.type==="removed"?"text-red-700 dark:text-red-400":c.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 ${c.type==="removed"?"text-red-500/50":c.type==="added"?"text-green-500/50":"text-muted-foreground/50"}`,children:c.type==="removed"?"-":c.type==="added"?"+":" "}),f.jsx("td",{className:`px-2 py-0 whitespace-pre select-all ${g}`,children:c.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:o.map((c,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:c.lineNumber!==null?c.lineNumber:""}),f.jsx("td",{className:"px-2 py-0 whitespace-pre select-all text-foreground",children:rie(c.content)})]},h))})})})})}function T4({message:e,isLoading:t=!1,localPath:n}){var k;const r=e.result!==void 0,i=!r&&t,o=_.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=o.match(/^Updated\s+(.+)$/m);if(R!=null&&R[1])return R[1].trim()}return""},[e.input,e.toolKind,o]),c=_.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?pH(e.input.command):"Bash"):e.toolKind==="web_search"?e.input.query||"Web Search":e.toolKind==="read_file"?l?`Read ${Hy(l,n)}`:"Read file":e.toolKind==="write_file"?l?`Write ${Hy(l,n)}`:"Write file":e.toolKind==="edit_file"?l?`Edit ${Hy(l,n)}`:"Edit file":e.toolKind==="mcp_generic"?`${Lb(e.input.tool)} from ${Lb(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",b=e.toolKind==="read_file",w=b&&!!o.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(No,{className:"w-full",children:f.jsxs(Lh,{expandedContent:f.jsx(zh,{className:"my-4 text-sm",children:f.jsxs("div",{className:"flex flex-col gap-2",children:[v?S?f.jsx(db,{content:"",isDiff:!0,oldString:e.input.oldString,newString:e.input.newString}):o.trim()?f.jsx($y,{label:e.isError?"Error":"Result",copyText:o,children:o}):f.jsx("div",{className:"text-muted-foreground text-xs",children:"Cursor completed this edit, but ACP did not include the file diff details."}):!b&&!p&&f.jsx($y,{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&&b&&!e.isError&&(w?f.jsx(db,{content:o}):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(db,{content:e.input.content}),r&&!b&&!(p&&!e.isError)&&!(v&&!e.isError)&&f.jsx($y,{label:e.isError?"Error":"Result",copyText:o,children:o})]})}),children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:(()=>{if(e.isError)return f.jsx(vo,{className:"size-4 text-destructive"});if(h)return f.jsx(S0,{className:"size-4 text-muted-icon"});const R=hO(e.toolName);return f.jsx(R,{className:"size-4 text-muted-icon"})})()}),f.jsx(xo,{className:"text-left transition-opacity duration-200 truncate",children:f.jsx(vg,{animate:i,shimmerWidth:Math.max(20,(((k=d||c)==null?void 0:k.length)??33)*3),children:d||c})})]})})}function lie({message:e}){const t=n=>{if(n<1e3)return`${n}ms`;const r=Math.floor(n/1e3),i=Math.floor(r/3600),o=Math.floor(r%3600/60),l=r%60;return i>0?`${i}h${o>0?` ${o}m`:""}`:o>0?`${o}m${l>0?` ${l}s`:""}`:`${l}s`};return e.success?f.jsxs(No,{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(xo,{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 cie({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(o8,{className:"h-4 w-4 ml-1.5"}),f.jsx("em",{children:"Interrupted"})]})})}function Fp({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 uie(){return f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(Fp,{}),f.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Compacted"}),f.jsx(Fp,{})]})}function die(){return f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(Fp,{}),f.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Context Cleared"}),f.jsx(Fp,{})]})}function hie({message:e}){return f.jsx(No,{children:f.jsxs(Lh,{expandedContent:f.jsx(zh,{className:"my-4 text-xs",children:f.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:f.jsx(fu,{remarkPlugins:[mu],components:uu(),children:e.summary})})}),children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:f.jsx($M,{className:"h-4.5 w-4.5 text-muted-foreground"})}),f.jsx(xo,{children:"Summarized"})]})})}const fie={compacting:"Compacting..."};function mie({message:e}){const t=fie[e.status]||e.status;return f.jsxs(No,{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($M,{className:"h-4.5 w-4.5 text-muted-foreground"})}),f.jsx(xo,{className:"text-left transition-opacity duration-200 truncate",children:t})]})}const pie={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"}},gie={key:"other",singular:"tool call",plural:"tool calls"};function vie(e){return pie[e]??gie}function _ie(e){const t=new Map,n=[];for(const r of e){const i=r.toolKind,o=vie(i),l=t.get(o.key);l?l.count++:(t.set(o.key,{category:o,count:1}),n.push(o.key))}return n.map(r=>{const{category:i,count:o}=t.get(r);return`${o} ${o===1?i.singular:i.plural}`}).join(", ")}function yie({messages:e,isLoading:t,localPath:n}){const[r,i]=_.useState(!1),o=_.useMemo(()=>_ie(e),[e]),c=e.some(h=>h.result===void 0)&&t;return f.jsx(No,{className:"w-full",children:f.jsxs("div",{className:"flex flex-col w-full",children:[f.jsx("button",{onClick:()=>i(!r),className:`group cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${!r&&!c?"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(Vr,{className:`h-4.5 w-4.5 text-muted-icon transition-all duration-200 ${r?"rotate-90":""}`})}),f.jsx(xo,{className:"text-left",children:f.jsx(vg,{animate:c,children:o})})]})}),r&&f.jsxs("div",{className:"my-4 flex flex-col gap-3",children:[e.map(h=>f.jsx(T4,{message:h,isLoading:t,localPath:n},h.id)),e.length>5&&f.jsx("button",{onClick:()=>i(!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(Vr,{className:"h-4.5 w-4.5 text-muted-icon -rotate-90"})}),f.jsx(xo,{className:"text-left",children:"Collapse"})]})})]})]})})}const bie=new Set(["AskUserQuestion","ExitPlanMode","TodoWrite"]);function VT(e){if(e.kind!=="tool")return!1;const t=e.toolName;return!bie.has(t)}function xie(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(VT(r)){const i=[r],o=n;for(n+=1;n<e.length&&VT(e[n]);)i.push(e[n]),n+=1;i.length>=2?t.push({type:"tool-group",messages:i,startIndex:o}):t.push({type:"single",message:r,index:o});continue}t.push({type:"single",message:r,index:n}),n+=1}return t}function wie({messages:e,isLoading:t,localPath:n,latestToolIds:r,onOpenLocalLink:i,onAskUserQuestionSubmit:o,onExitPlanModeConfirm:l,pendingTool:c}){const h=_.useMemo(()=>xie(e),[e]);function d(g,p){if(g.kind==="user_prompt")return f.jsx(zre,{content:g.content,attachments:g.attachments},g.id);switch(g.kind){case"unknown":return f.jsx(Pre,{json:g.json},g.id);case"system_init":return e.findIndex(b=>b.kind==="system_init")===p?f.jsx($re,{message:g,rawJson:g.debugRaw},g.id):null;case"account_info":return e.findIndex(b=>b.kind==="account_info")===p?f.jsx(Ure,{message:g},g.id):null;case"assistant_text":return f.jsx(Vre,{message:g},g.id);case"assistant_thought":return f.jsx(Wre,{message:g},g.id);case"tool":return g.toolKind==="ask_user_question"?f.jsx(Yre,{message:g,onSubmit:o,isLatest:g.id===r.AskUserQuestion},g.id):g.toolKind==="exit_plan_mode"?f.jsx(Jre,{message:g,onConfirm:l,isLatest:g.id===r.ExitPlanMode,isActionable:(c==null?void 0:c.toolKind)==="exit_plan_mode"&&c.toolUseId===g.toolId},g.id):g.toolKind==="todo_write"?g.id!==r.TodoWrite?null:f.jsx(tie,{message:g},g.id):f.jsx(T4,{message:g,isLoading:t,localPath:n},g.id);case"result":{const v=e[p+1],b=e[p-1];return(v==null?void 0:v.kind)==="context_cleared"||(b==null?void 0:b.kind)==="context_cleared"?null:f.jsx(lie,{message:g},g.id)}case"interrupted":return f.jsx(cie,{message:g},g.id);case"compact_boundary":return f.jsx(uie,{},g.id);case"context_cleared":return f.jsx(die,{},g.id);case"compact_summary":return f.jsx(hie,{message:g},g.id);case"status":return p===e.length-1?f.jsx(mie,{message:g},g.id):null}}return f.jsx(hX,{onOpenLocalLink:i,children:h.map(g=>{if(g.type==="tool-group")return f.jsx("div",{className:"group relative",[lp]:"",children:f.jsx(yie,{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",[lp]:"",children:p},g.message.id):null})})}function Sie({rootRef:e,fallbackRef:t,enabled:n,canCancel:r}){_.useEffect(()=>{if(!n)return;let i=0,o=null;const l=p=>{const v=p instanceof Element?p:null,b=e.current,w=t.current;if(z2({trigger:"pointer",activeElement:document.activeElement,pointerStartTarget:o,pointerEndTarget:v,root:b,fallback:w,hasActiveOverlay:L2(document),hasActiveSelection:z9(window.getSelection())})!=="restore"){o=null;return}w==null||w.focus({preventScroll:!0}),o=null},c=p=>{cancelAnimationFrame(i),o=p.target instanceof Element?p.target:null},h=p=>{cancelAnimationFrame(i),i=window.requestAnimationFrame(()=>{l(p.target)})},d=()=>{o=null;const p=t.current;!p||p.disabled||p.focus({preventScroll:!0})},g=p=>{if(p.key!=="Escape")return;const v=t.current;z2({trigger:"escape",activeElement:document.activeElement,fallback:v,hasActiveOverlay:L2(document),canCancel:r,defaultPrevented:p.defaultPrevented})==="escape-focus"&&(p.preventDefault(),v==null||v.focus({preventScroll:!0}))};return window.addEventListener("pointerdown",c,!0),window.addEventListener("pointerup",h,!0),window.addEventListener("keydown",g,!0),window.addEventListener(ap,d),()=>{cancelAnimationFrame(i),window.removeEventListener("pointerdown",c,!0),window.removeEventListener("pointerup",h,!0),window.removeEventListener("keydown",g,!0),window.removeEventListener(ap,d)}},[r,n,t,e])}const zm="How can I help you?",Cie=19,kie=72,Eie=120;function Rie(){var je,Xe,Et,Rt,fe,He,De,mt,ct,ot,fn;const e=Yp(),t=_.useRef(null),n=_.useRef(null),r=_.useRef(null),[i,o]=_.useState(""),[l,c]=_.useState(!1),[h,d]=_.useState(0),g=Mh("(min-width: 768px)"),p=typeof window>"u"?!0:mO(window.location.hostname),v=((je=e.runtime)==null?void 0:je.projectId)??null,w=ca(Ce=>v?Ce.projects[v]:void 0)??kX,C=Ud(Ce=>v?Ce.projects[v]:void 0)??bX,k=ca(Ce=>Ce.addTerminal),R=ca(Ce=>Ce.removeTerminal),E=ca(Ce=>Ce.toggleVisibility),N=ca(Ce=>Ce.resetMainSizes),L=ca(Ce=>Ce.setMainSizes),j=ca(Ce=>Ce.setTerminalSizes),D=Ud(Ce=>Ce.toggleVisibility),H=Ud(Ce=>Ce.setSize),Y=Ii(Ce=>Ce.scrollbackLines),P=Ii(Ce=>Ce.minColumnWidth),q=e.keybindings,F=_.useMemo(()=>fw(q),[q]),U=w.terminals.length>0,W=!!(v&&w.isVisible&&U),V=!!(v&&U),O=!!(v&&C.isVisible),$=!!(v&&!g&&O),z=!!(v&&g),{isAnimating:G,mainPanelGroupRef:M,terminalFocusRequestVersion:B,terminalPanelRef:Z,terminalVisualRef:A}=FX({showTerminalPane:W,shouldRenderTerminalLayout:V,projectId:v,terminalLayout:w,chatInputRef:r}),{isAnimating:ie,panelGroupRef:J,sidebarPanelRef:ee,sidebarVisualRef:re}=PX({projectId:v,shouldRenderRightSidebarLayout:z,showRightSidebar:O,rightSidebarSize:C.size});Sie({rootRef:n,fallbackRef:r,enabled:e.hasSelectedProject&&((Xe=e.runtime)==null?void 0:Xe.status)!=="waiting_for_user",canCancel:e.canCancel});const ce=()=>{if(v){if(U){E(v);return}k(v)}},he=Ce=>{var Ne;if(!v||!W||G.current)return;const tt=Ce.chat,oe=Ce.terminal;if(!Number.isFinite(tt)||!Number.isFinite(oe))return;const ve=((Ne=t.current)==null?void 0:Ne.getBoundingClientRect().height)??0;if(NX(ve,oe)){N(v),E(v);return}L(v,[tt,oe])};_.useEffect(()=>{if(e.messages.length!==0)return;o(""),c(!1);let Ce=0;const tt=window.setInterval(()=>{Ce+=1,o(zm.slice(0,Ce)),Ce>=zm.length&&(window.clearInterval(tt),c(!0))},Cie);return()=>window.clearInterval(tt)},[e.activeChatId,e.messages.length]),_.useEffect(()=>{function Ce(tt){if(v){if(il(F,"toggleEmbeddedTerminal",tt)){tt.preventDefault(),ce();return}if(il(F,"toggleRightSidebar",tt)){tt.preventDefault(),D(v);return}if(il(F,"openInFinder",tt)){if(!p)return;tt.preventDefault(),e.handleOpenExternal("open_finder");return}if(il(F,"openInEditor",tt)){if(!p)return;tt.preventDefault(),e.handleOpenExternal("open_editor");return}il(F,"addSplitTerminal",tt)&&(tt.preventDefault(),k(v))}}return window.addEventListener("keydown",Ce),()=>window.removeEventListener("keydown",Ce)},[k,p,ce,v,F,D]),_.useEffect(()=>{const Ce=window.requestAnimationFrame(()=>{e.updateScrollState()}),tt=window.setTimeout(()=>{e.updateScrollState()},Ac);return()=>{window.cancelAnimationFrame(Ce),window.clearTimeout(tt)}},[V,W,e.updateScrollState]),_.useEffect(()=>{function Ce(){e.updateScrollState()}return window.addEventListener("resize",Ce),()=>window.removeEventListener("resize",Ce)},[e.updateScrollState]),_.useEffect(()=>{if(g)return;const Ce=window.visualViewport;if(!Ce)return;const tt=()=>{const oe=e.scrollRef.current;if(!oe)return;const ve=oe.scrollHeight-oe.scrollTop-oe.clientHeight;if(yO(ve)){requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.scrollToBottom(),e.updateScrollState()})});return}const Ne=document.activeElement;Ne&&oe.contains(Ne)&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{var At;const Ae=(At=e.inputRef.current)==null?void 0:At.getBoundingClientRect(),Qe=Ne.getBoundingClientRect();if(Ae&&Qe.bottom>Ae.top){const rt=Qe.bottom-Ae.top;oe.scrollBy({top:rt+16,behavior:"auto"})}e.updateScrollState()})})};return Ce.addEventListener("resize",tt),Ce.addEventListener("scroll",tt),()=>{Ce.removeEventListener("resize",tt),Ce.removeEventListener("scroll",tt)}},[g,e.scrollRef,e.scrollToBottom,e.updateScrollState]),_.useEffect(()=>{const Ce=t.current;if(!Ce||!V)return;const tt=()=>{const ve=Ce.getBoundingClientRect().height;if(ve<=0)return;const Ne=ve*(w.mainSizes[1]/100);Ne<=0||d(Ae=>Math.abs(Ae-Ne)<1?Ae:Ne)},oe=new ResizeObserver(tt);return oe.observe(Ce),tt(),()=>oe.disconnect()},[v,V,w.mainSizes]);const pe=Ce=>Number.isFinite(Ce)?Math.min(Ix,Math.max(Dg,Ce)):C.size,Se=()=>{v&&D(v)},Re=f.jsxs(mw,{ref:n,className:"bg-background h-full flex flex-col overflow-hidden border-0 rounded-none relative",children:[f.jsxs(pw,{className:"flex flex-1 min-h-0 flex-col p-0 overflow-hidden relative",children:[f.jsx(nq,{sidebarCollapsed:e.sidebarCollapsed,hasCompletedChats:e.completedChatIds.size>0,onOpenSidebar:e.openSidebar,onExpandSidebar:e.expandSidebar,usage:e.usage,localPath:e.navbarLocalPath,embeddedTerminalVisible:W,onToggleEmbeddedTerminal:v?ce:void 0,rightSidebarVisible:O,onToggleRightSidebar:v?()=>D(v):void 0,onOpenExternal:p?Ce=>{e.handleOpenExternal(Ce)}:void 0,editorLabel:e.editorLabel,projectId:v??void 0,socket:e.socket,finderShortcut:p?F.bindings.openInFinder:void 0,editorShortcut:p?F.bindings.openInEditor:void 0,terminalShortcut:F.bindings.toggleEmbeddedTerminal,rightSidebarShortcut:F.bindings.toggleRightSidebar}),f.jsxs(jg,{ref:e.scrollRef,onScroll:e.updateScrollState,className:"flex-1 min-h-0 px-4 scroll-pt-[72px]",children:[(Et=e.runtime)!=null&&Et.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(wie,{messages:e.messages,isLoading:e.isProcessing,localPath:(Rt=e.runtime)==null?void 0:Rt.localPath,latestToolIds:e.latestToolIds,pendingTool:((fe=e.runtime)==null?void 0:fe.pendingTool)??null,onOpenLocalLink:e.handleOpenLocalLink,onAskUserQuestionSubmit:e.handleAskUserQuestion,onExitPlanModeConfirm:e.handleExitPlanMode}),e.isProcessing?f.jsx(vX,{status:(He=e.runtime)==null?void 0:He.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:kie,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(Ld,{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":zm,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:zm}),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:i}),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:Eie},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(P6,{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(ZW,{ref:r,onSubmit:e.handleSend,onCancel:()=>{e.handleCancel()},disabled:!e.hasSelectedProject||((De=e.runtime)==null?void 0:De.status)==="waiting_for_user"||!!((mt=e.runtime)!=null&&mt.inactiveProviderMessage),canCancel:e.canCancel,chatId:e.activeChatId,activeProvider:((ct=e.runtime)==null?void 0:ct.provider)??null,activeModel:((ot=e.runtime)==null?void 0:ot.model)??null,activePlanMode:((fn=e.runtime)==null?void 0:fn.planMode)??!1,availableProviders:e.availableProviders,keybindings:F},e.activeChatId??"new-chat")})})]});return f.jsxs("div",{ref:t,className:"flex-1 flex flex-col min-w-0 relative",children:[z&&v?f.jsxs(Fd,{groupRef:J,orientation:"horizontal",className:"flex-1 min-h-0",onLayoutChange:Ce=>{var oe;if(!O||ie.current)return;const tt=pe(Ce.rightSidebar);Math.abs(tt-Ce.rightSidebar)<.1||(oe=J.current)==null||oe.setLayout({workspace:100-tt,rightSidebar:tt})},onLayoutChanged:Ce=>{!O||ie.current||H(v,pe(Ce.rightSidebar))},children:[f.jsx(fo,{id:"workspace",defaultSize:`${100-C.size}%`,minSize:"50%",className:"min-h-0 min-w-0",children:V?f.jsxs(Fd,{groupRef:M,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:he,children:[f.jsx(fo,{id:"chat",defaultSize:`${w.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:Re}),f.jsx(Hd,{withHandle:!0,orientation:"vertical",disabled:!W,className:me(!W&&"pointer-events-none opacity-0")}),f.jsx(fo,{id:"terminal",defaultSize:`${w.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:Z,children:f.jsx("div",{ref:A,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":W?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${Ac}ms`},children:f.jsx("div",{style:h>0?{height:`${h}px`}:void 0,children:f.jsx(UR,{projectId:v,layout:w,onAddTerminal:k,socket:e.socket,connectionStatus:e.connectionStatus,scrollback:Y,minColumnWidth:P,splitTerminalShortcut:F.bindings.addSplitTerminal,focusRequestVersion:B,onRemoveTerminal:(Ce,tt)=>{e.socket.command({type:"terminal.close",terminalId:tt}).catch(()=>{}),R(Ce,tt)},onTerminalLayout:j})})})})]},v):Re}),f.jsx(Hd,{withHandle:!0,orientation:"horizontal",disabled:!O,className:me(!O&&"pointer-events-none opacity-0")}),f.jsx(fo,{id:"rightSidebar",defaultSize:`${C.size}%`,maxSize:`${Ix}%`,className:"min-h-0 min-w-0",elementRef:ee,children:f.jsx("div",{ref:re,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":`${Ac}ms`},children:f.jsx(TE,{onClose:()=>D(v)})})})]},`${v}-right-sidebar`):V&&v?f.jsxs(Fd,{groupRef:M,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:he,children:[f.jsx(fo,{id:"chat",defaultSize:`${w.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:Re}),f.jsx(Hd,{withHandle:!0,orientation:"vertical",disabled:!W,className:me(!W&&"pointer-events-none opacity-0")}),f.jsx(fo,{id:"terminal",defaultSize:`${w.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:Z,children:f.jsx("div",{ref:A,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":W?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${Ac}ms`},children:f.jsx("div",{style:h>0?{height:`${h}px`}:void 0,children:f.jsx(UR,{projectId:v,layout:w,onAddTerminal:k,socket:e.socket,connectionStatus:e.connectionStatus,scrollback:Y,minColumnWidth:P,splitTerminalShortcut:F.bindings.addSplitTerminal,focusRequestVersion:B,onRemoveTerminal:(Ce,tt)=>{e.socket.command({type:"terminal.close",terminalId:tt}).catch(()=>{}),R(Ce,tt)},onTerminalLayout:j})})})})]},v):Re,$?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"fixed inset-0 z-40 bg-black/40 md:hidden",onClick:Se}),f.jsx("div",{className:"fixed inset-0 z-50 flex flex-col bg-background/95 backdrop-blur-2xl md:hidden",children:f.jsx(TE,{onClose:Se,className:"h-[var(--app-shell-height)]"})})]}):null]})}const Tie=700,Nie=1500;function Mie(){const e=kl(),t=Yp(),n=t.featureOverviewSnapshot,r=Mh("(min-width: 768px)"),i=typeof window>"u"?!0:mO(window.location.hostname),[o,l]=_.useState("view"),[c,h]=_.useState(""),[d,g]=_.useState(!1),[p,v]=_.useState("idle"),[b,w]=_.useState(null),S=_.useRef(""),C=_.useRef(0);if(_.useEffect(()=>{n&&(S.current=n.content,h(n.content),g(!1),v("idle"),w(null))},[n==null?void 0:n.featureId]),_.useEffect(()=>{n&&(S.current=n.content,h(j=>d?j:n.content),d||(v("idle"),w(null)))},[d,n]),_.useEffect(()=>{if(!n||!d)return;const j=C.current+1;C.current=j,v("saving"),w(null);const D=window.setTimeout(()=>{t.socket.command({type:"feature.updateOverview",featureId:n.featureId,content:c}).then(H=>{C.current!==j||!H||(S.current=H.content,g(!1),v("saved"))}).catch(H=>{C.current===j&&(v("error"),w(H instanceof Error?H.message:String(H)))})},Tie);return()=>window.clearTimeout(D)},[c,d,n==null?void 0:n.featureId,t.socket]),_.useEffect(()=>{if(p!=="saved")return;const j=window.setTimeout(()=>{v("idle")},Nie);return()=>window.clearTimeout(j)},[p]),_.useEffect(()=>{r||o!=="split"||l("view")},[r,o]),!n)return f.jsx("div",{className:"flex flex-1 items-center justify-center",children:f.jsx("div",{className:"text-sm text-muted-foreground",children:t.sidebarReady?"Overview not found.":"Loading overview…"})});const k=o==="view"||o==="split",R=p==="saving"?"Saving…":p==="saved"?"Saved":p==="error"?"Save failed":"Ready",E=me("shrink-0 text-[11px] md:text-xs",p==="error"?"text-destructive":"text-muted-foreground"),N=f.jsx(jg,{className:"h-full min-h-0",children:f.jsx("div",{className:"mx-auto max-w-4xl px-4 py-5",children:f.jsx("div",{className:"prose prose-slate max-w-none dark:prose-invert",children:f.jsx(fu,{remarkPlugins:[mu],components:uu({onOpenLocalLink:t.handleOpenLocalLink}),children:c})})})}),L=f.jsx("div",{className:"flex h-full min-h-0 flex-col",children:f.jsx("div",{className:"mx-auto flex h-full min-h-0 w-full max-w-4xl px-4 py-5",children:f.jsx(yh,{value:c,onChange:j=>{const D=j.target.value;h(D),g(D!==S.current),p!=="saving"&&v("idle"),w(null)},spellCheck:!1,className:"h-full min-h-0 resize-none rounded-none border-0 bg-transparent px-0 py-0 font-mono text-base leading-7 focus-visible:ring-0 md:text-[13px] md:leading-6"})})});return f.jsx("div",{className:"flex flex-1 min-w-0 flex-col",children:f.jsx(mw,{className:"h-full rounded-none border-0 bg-background",children:f.jsxs(pw,{className:"flex h-full min-h-0 flex-col p-0",children:[f.jsxs("div",{className:"flex flex-col gap-3 border-b border-border px-4 py-3 md:flex-row md:items-center md:justify-between",children:[f.jsxs("div",{className:"flex min-w-0 items-start gap-2 md:flex-1",children:[f.jsx(et,{variant:"ghost",size:"icon",className:"mt-0.5 h-8 w-8 shrink-0 rounded-full",title:"Back",onClick:()=>{if(window.history.length>1){e(-1);return}e("/")},children:f.jsx(H6,{className:"size-4"})}),f.jsxs("div",{className:"min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:n.title}),r?null:f.jsx("div",{className:me(E,"text-right"),children:R})]}),f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:n.overviewRelativePath})]})]}),f.jsxs("div",{className:"flex items-center gap-2 md:shrink-0 md:gap-3",children:[r?f.jsx("div",{className:E,children:R}):null,f.jsx("div",{className:"flex min-w-0 flex-1 items-center rounded-lg border border-border p-1 md:flex-none",children:(r?[{mode:"view",label:"View",icon:M2},{mode:"edit",label:"Edit",icon:Bc},{mode:"split",label:"Split",icon:U8}]:[{mode:"view",label:"View",icon:M2},{mode:"edit",label:"Edit",icon:Bc}]).map(({mode:j,label:D,icon:H})=>{const Y=o===j;return f.jsxs("button",{type:"button",onClick:()=>l(j),className:me("inline-flex flex-1 items-center justify-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors md:flex-none",Y?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),children:[f.jsx(H,{className:"size-4"}),f.jsx("span",{children:D})]},j)})}),i?f.jsxs(et,{variant:"outline",size:"sm",className:"shrink-0 px-2.5 md:px-3",title:`Open in ${t.editorLabel}`,onClick:()=>{t.handleOpenExternalPath("open_editor",n.localPath)},children:[f.jsx(S8,{className:"size-4"}),f.jsxs("span",{className:"hidden md:inline",children:["Open in ",t.editorLabel]})]}):null]})]}),b?f.jsx("div",{className:"border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-sm text-destructive",children:b}):null,f.jsx("div",{className:"flex-1 min-h-0",children:r&&o==="split"?f.jsxs(Fd,{orientation:"horizontal",className:"h-full",children:[f.jsx(fo,{defaultSize:"50%",minSize:"25%",className:"min-w-0",children:N}),f.jsx(Hd,{orientation:"horizontal",withHandle:!0}),f.jsx(fo,{defaultSize:"50%",minSize:"25%",className:"min-w-0 border-l border-border/60",children:L})]}):k?N:L})]})})})}function WT({narrow:e=!1,title:t,subtitle:n,icon:r=UM}){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 Aie={sm:"text-sm px-2.5 py-1",md:"text-sm px-3 py-1.5"};function jie({value:e,onValueChange:t,options:n,size:r="md",className:i,optionClassName:o}){return f.jsx("div",{className:me("inline-flex items-center rounded-lg border border-border p-[3px] ",i),children:n.map(l=>{const c=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":c,className:me("rounded-[4px] border transition-colors",h?"grid grid-cols-[auto_auto] items-center gap-2":"inline-flex items-center gap-1.5",Aie[r],c?"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",o),children:[d,f.jsx("span",{children:l.label})]},l.value);return l.tooltip?f.jsxs(Ms,{children:[f.jsx(As,{asChild:!0,children:g}),f.jsx(os,{children:l.tooltip})]},l.value):g})})}function Die(e){return e.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Oie(e){const t=e.split("/").filter(Boolean);return t[t.length-1]||e}function Lie({open:e,onOpenChange:t,initialDirectory:n,onListDirectories:r,onConfirm:i}){var O;const[o,l]=_.useState("new"),[c,h]=_.useState(""),[d,g]=_.useState([]),[p,v]=_.useState({}),[b,w]=_.useState([]),[S,C]=_.useState(null),[k,R]=_.useState(""),[E,N]=_.useState(null),[L,j]=_.useState(null),D=_.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),j(null),setTimeout(()=>{var $;return($=D.current)==null?void 0:$.focus()},0))},[n,e]),_.useEffect(()=>{e&&setTimeout(()=>{var $;o==="new"&&(($=D.current)==null||$.focus())},0)},[o,e]);const H=Die(c),Y=H?`${OF}/${H}`:"",P=k.trim(),q=o==="new"?!!H:!!P,F=async $=>{N(null),j($??"__root__");try{const z=await r($);if(!$){g(z.roots),C(z.currentPath),v({[z.currentPath]:z.entries}),w([z.currentPath]);return}d.length===0&&(g([{name:Oie(z.currentPath),localPath:z.currentPath}]),C(z.currentPath)),v(G=>({...G,[z.currentPath]:z.entries})),w(G=>G.includes(z.currentPath)?G:[...G,z.currentPath])}catch(z){N(z instanceof Error?z.message:String(z))}finally{j(null)}},U=async $=>{if(b.includes($)){w(z=>z.filter(G=>G!==$));return}if(p[$]){w(z=>[...z,$]);return}await F($)},W=($,z,G)=>{const M=b.includes($),B=k===$,Z=p[$]??[],A=L===$;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+G*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 U($),disabled:A,children:A?f.jsx(Lr,{className:"h-4 w-4 animate-spin text-muted-foreground"}):f.jsx(Vr,{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($),children:[M?f.jsx(IM,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):f.jsx(FM,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),f.jsx("span",{className:"truncate",children:z})]})]}),M&&Z.length>0?Z.map(ie=>W(ie.localPath,ie.name,G+1)):null]},$)},V=()=>{if(q){if(o==="new")i({mode:"new",localPath:Y,title:c.trim()});else{const $=P.split("/").pop()||P;i({mode:"existing",localPath:P,title:$})}t(!1)}};return f.jsx(ng,{open:e,onOpenChange:t,children:f.jsxs(_h,{size:"sm",children:[f.jsxs(ig,{className:"space-y-4",children:[f.jsx(rg,{children:"Add Project"}),f.jsx(jie,{value:o,onValueChange:l,options:[{value:"new",label:"New Folder"},{value:"existing",label:"Existing Folder"}],className:"w-full mb-2",optionClassName:"flex-1 justify-center"}),o==="new"?f.jsxs("div",{className:"space-y-2",children:[f.jsx(Bi,{ref:D,type:"text",value:c,onChange:$=>h($.target.value),onKeyDown:$=>{$.key==="Enter"&&V(),$.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(Bi,{type:"text",value:k,onChange:$=>R($.target.value),onKeyDown:$=>{$.key==="Enter"&&F(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(et,{type:"button",variant:"ghost",size:"sm",onClick:()=>void F("~"),disabled:L!==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(jg,{className:"max-h-64 rounded-xl border border-border",children:[d.map($=>W($.localPath,$.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]})]}):L?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(Lr,{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(sg,{children:[f.jsx(et,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),f.jsx(et,{variant:"secondary",size:"sm",onClick:V,disabled:!q,children:o==="new"?"Create":"Import"})]})]})})}function zie({text:e}){const[t,n]=_.useState(!1);async function r(){await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}return f.jsx(et,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>void r(),children:t?f.jsx(Vi,{className:"h-4 w-4 text-green-400"}):f.jsx(ul,{className:"h-4 w-4"})})}function qT({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(Vr,{className:"inline h-4 w-4 opacity-40"}),f.jsx("code",{children:e})]}),f.jsx(zie,{text:e})]})}function Pm({children:e}){return f.jsx("div",{className:"bg-card border border-border rounded-2xl p-4",children:e})}function hb({children:e}){return f.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider mb-3",children:e})}function fb({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 KT(){return f.jsx(B6,{className:"h-4 w-4 text-muted-foreground"})}function GT({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 Pie({localPath:e,iconDataUrl:t,loading:n,onClick:r,onHide:i}){const o=yn(l=>l.showProjectIconsInSidebar);return f.jsxs("div",{className:"relative group",children:[f.jsxs(Ms,{children:[f.jsx(As,{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:[o?f.jsx($j,{iconDataUrl:t,alt:`${vp(e)} icon`,className:"h-5.5 w-5.5",fallback:f.jsx(FM,{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:vp(e)}),n?f.jsx(Lr,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary animate-spin flex-shrink-0"}):null]})}),f.jsx(os,{children:f.jsx("p",{children:e})})]}),f.jsx(et,{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(),i()},children:f.jsx(Gd,{className:"h-4 w-4"})})]})}function Iie({connectionStatus:e,ready:t,snapshot:n,startingLocalPath:r,commandError:i,onOpenProject:o,onHideProject:l,onListDirectories:c,onCreateProject:h}){const[d,g]=EP(),[p,v]=_.useState(!1),b=_.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(WT,{title:(n==null?void 0:n.machine.displayName)??"Local Projects",subtitle:`${Zn} 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(et,{variant:"default",size:"sm",onClick:()=>v(!0),children:[f.jsx(x0,{className:"h-4 w-4 mr-1.5"}),"Add Project"]})]}),b.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:b.map(R=>f.jsx(Pie,{localPath:R.localPath,iconDataUrl:R.iconDataUrl,loading:r===R.localPath,onClick:()=>{o(R.localPath)},onHide:()=>{l(R.localPath)}},R.localPath))}):f.jsx(Pm,{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."})}),i?f.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3 mt-4",children:i}):null]})]}):f.jsxs(f.Fragment,{children:[f.jsx(WT,{narrow:!0,icon:T2,title:w?`Connecting ${Zn}`:`Connect ${Zn}`,subtitle:w?`${Zn} is starting up and loading your local projects.`:`Run ${Zn} 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(hb,{children:"Status"}),f.jsx("div",{className:"mb-8",children:f.jsx(Pm,{children:f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(Lr,{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 ${Zn} 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:fm()})," from any terminal on this machine."]})})]})})}),w?null:f.jsxs("div",{className:"mb-10",children:[f.jsx(hb,{children:"How it works"}),f.jsx(Pm,{children:f.jsxs("div",{className:"flex items-center justify-around gap-6 py-4 px-2",children:[f.jsx(fb,{icon:w0,title:`${Zn} CLI`,subtitle:"On Your Machine"}),f.jsx(KT,{}),f.jsx(fb,{icon:UM,title:`${Zn} Server`,subtitle:"Local WebSocket"}),f.jsx(KT,{}),f.jsx(fb,{icon:T2,title:`${Zn} UI`,subtitle:"Project Chat"})]})})]}),w?null:f.jsxs("div",{className:"mb-10",children:[f.jsx(hb,{children:"Setup"}),f.jsx(Pm,{children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs(GT,{number:1,title:`Start ${Zn}`,children:[f.jsx("p",{children:"Run this command in your terminal:"}),f.jsx(qT,{children:fm()})]}),f.jsxs(GT,{number:2,title:"Open the local UI",children:[f.jsxs("p",{children:[Zn," serves the app locally and opens the Local Projects page in an app-style browser window."]}),f.jsx(qT,{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:fm("").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:fm("--no-open")}),f.jsx("span",{className:"text-muted-foreground",children:"Start the server without opening the browser"})]})]})]})]})})]})]})]}),f.jsx(Lie,{open:p,onOpenChange:k,initialDirectory:(n==null?void 0:n.rootDirectory)??null,onListDirectories:c,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",P0.split("/")[1]]})})]})}function Bie(){const e=Yp();return f.jsx("div",{className:"flex-1 flex flex-col min-w-0 relative",children:f.jsx(Iie,{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 wc({children:e,className:t,icon:n,type:r="button",variant:i="outline",...o}){return f.jsxs("button",{type:r,className:me(iM({variant:i,size:"sm"}),"h-auto gap-1.5 px-3 py-1.5",t),...o,children:[n,e?f.jsx("span",{children:e}):null]})}var qt;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const l of i)o[l]=l;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),l={};for(const c of o)l[c]=i[c];return e.objectValues(l)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const l in i)Object.prototype.hasOwnProperty.call(i,l)&&o.push(l);return o},e.find=(i,o)=>{for(const l of i)if(o(l))return l},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(l=>typeof l=="string"?`'${l}'`:l).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(qt||(qt={}));var YT;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(YT||(YT={}));const Ge=qt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ha=e=>{switch(typeof e){case"undefined":return Ge.undefined;case"string":return Ge.string;case"number":return Number.isNaN(e)?Ge.nan:Ge.number;case"boolean":return Ge.boolean;case"function":return Ge.function;case"bigint":return Ge.bigint;case"symbol":return Ge.symbol;case"object":return Array.isArray(e)?Ge.array:e===null?Ge.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ge.promise:typeof Map<"u"&&e instanceof Map?Ge.map:typeof Set<"u"&&e instanceof Set?Ge.set:typeof Date<"u"&&e instanceof Date?Ge.date:Ge.object;default:return Ge.unknown}},Te=qt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class wo extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)r._errors.push(n(l));else{let c=r,h=0;for(;h<l.path.length;){const d=l.path[h];h===l.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(n(l))):c[d]=c[d]||{_errors:[]},c=c[d],h++}}};return i(this),r}static assert(t){if(!(t instanceof wo))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,qt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const o=i.path[0];n[o]=n[o]||[],n[o].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}wo.create=e=>new wo(e);const n0=(e,t)=>{let n;switch(e.code){case Te.invalid_type:e.received===Ge.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Te.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,qt.jsonStringifyReplacer)}`;break;case Te.unrecognized_keys:n=`Unrecognized key(s) in object: ${qt.joinValues(e.keys,", ")}`;break;case Te.invalid_union:n="Invalid input";break;case Te.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${qt.joinValues(e.options)}`;break;case Te.invalid_enum_value:n=`Invalid enum value. Expected ${qt.joinValues(e.options)}, received '${e.received}'`;break;case Te.invalid_arguments:n="Invalid function arguments";break;case Te.invalid_return_type:n="Invalid function return type";break;case Te.invalid_date:n="Invalid date";break;case Te.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:qt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Te.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Te.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Te.custom:n="Invalid input";break;case Te.invalid_intersection_types:n="Intersection results could not be merged";break;case Te.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Te.not_finite:n="Number must be finite";break;default:n=t.defaultError,qt.assertNever(e)}return{message:n}};let Fie=n0;function Hie(){return Fie}const $ie=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],l={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let c="";const h=r.filter(d=>!!d).slice().reverse();for(const d of h)c=d(l,{data:t,defaultError:c}).message;return{...i,path:o,message:c}};function Ie(e,t){const n=Hie(),r=$ie({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===n0?void 0:n0].filter(i=>!!i)});e.common.issues.push(r)}class Si{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return ht;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const o=await i.key,l=await i.value;r.push({key:o,value:l})}return Si.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:l}=i;if(o.status==="aborted"||l.status==="aborted")return ht;o.status==="dirty"&&t.dirty(),l.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||i.alwaysSet)&&(r[o.value]=l.value)}return{status:t.value,value:r}}}const ht=Object.freeze({status:"aborted"}),jd=e=>({status:"dirty",value:e}),Zi=e=>({status:"valid",value:e}),XT=e=>e.status==="aborted",ZT=e=>e.status==="dirty",qc=e=>e.status==="valid",Hp=e=>typeof Promise<"u"&&e instanceof Promise;var Ze;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ze||(Ze={}));class wa{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const QT=(e,t)=>{if(qc(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new wo(e.common.issues);return this._error=n,this._error}}};function Mt(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(l,c)=>{const{message:h}=e;return l.code==="invalid_enum_value"?{message:h??c.defaultError}:typeof c.data>"u"?{message:h??r??c.defaultError}:l.code!=="invalid_type"?{message:c.defaultError}:{message:h??n??c.defaultError}},description:i}}class Ut{get description(){return this._def.description}_getType(t){return ha(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:ha(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Si,ctx:{common:t.parent.common,data:t.data,parsedType:ha(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Hp(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ha(t)},i=this._parseSync({data:t,path:r.path,parent:r});return QT(r,i)}"~validate"(t){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ha(t)};if(!this["~standard"].async)try{const o=this._parseSync({data:t,path:[],parent:n});return qc(o)?{value:o.value}:{issues:n.common.issues}}catch(o){(i=(r=o==null?void 0:o.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(o=>qc(o)?{value:o.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ha(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(Hp(i)?i:Promise.resolve(i));return QT(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const l=t(i),c=()=>o.addIssue({code:Te.custom,...r(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(h=>h?!0:(c(),!1)):l?!0:(c(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Gc({schema:this,typeName:ft.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ya.create(this,this._def)}nullable(){return Yc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ps.create(this)}promise(){return Wp.create(this,this._def)}or(t){return Up.create([this,t],this._def)}and(t){return Vp.create(this,t,this._def)}transform(t){return new Gc({...Mt(this._def),schema:this,typeName:ft.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new s0({...Mt(this._def),innerType:this,defaultValue:n,typeName:ft.ZodDefault})}brand(){return new dse({typeName:ft.ZodBranded,type:this,...Mt(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new o0({...Mt(this._def),innerType:this,catchValue:n,typeName:ft.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return t1.create(this,t)}readonly(){return a0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Uie=/^c[^\s-]{8,}$/i,Vie=/^[0-9a-z]+$/,Wie=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qie=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Kie=/^[a-z0-9_-]{21}$/i,Gie=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Yie=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Xie=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zie="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let mb;const Qie=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Jie=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ese=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,tse=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nse=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rse=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,N4="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ise=new RegExp(`^${N4}$`);function M4(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function sse(e){return new RegExp(`^${M4(e)}$`)}function ose(e){let t=`${N4}T${M4(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function ase(e,t){return!!((t==="v4"||!t)&&Qie.test(e)||(t==="v6"||!t)&&ese.test(e))}function lse(e,t){if(!Gie.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function cse(e,t){return!!((t==="v4"||!t)&&Jie.test(e)||(t==="v6"||!t)&&tse.test(e))}class ga extends Ut{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ge.string){const o=this._getOrReturnCtx(t);return Ie(o,{code:Te.invalid_type,expected:Ge.string,received:o.parsedType}),ht}const r=new Si;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),Ie(i,{code:Te.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),Ie(i,{code:Te.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const l=t.data.length>o.value,c=t.data.length<o.value;(l||c)&&(i=this._getOrReturnCtx(t,i),l?Ie(i,{code:Te.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):c&&Ie(i,{code:Te.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")Xie.test(t.data)||(i=this._getOrReturnCtx(t,i),Ie(i,{validation:"email",code:Te.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")mb||(mb=new RegExp(Zie,"u")),mb.test(t.data)||(i=this._getOrReturnCtx(t,i),Ie(i,{validation:"emoji",code:Te.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")qie.test(t.data)||(i=this._getOrReturnCtx(t,i),Ie(i,{validation:"uuid",code:Te.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")Kie.test(t.data)||(i=this._getOrReturnCtx(t,i),Ie(i,{validation:"nanoid",code:Te.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")Uie.test(t.data)||(i=this._getOrReturnCtx(t,i),Ie(i,{validation:"cuid",code:Te.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")Vie.test(t.data)||(i=this._getOrReturnCtx(t,i),Ie(i,{validation:"cuid2",code:Te.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")Wie.test(t.data)||(i=this._getOrReturnCtx(t,i),Ie(i,{validation:"ulid",code:Te.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Ie(i,{validation:"url",code:Te.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Ie(i,{validation:"regex",code:Te.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),Ie(i,{code:Te.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),Ie(i,{code:Te.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),Ie(i,{code:Te.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?ose(o).test(t.data)||(i=this._getOrReturnCtx(t,i),Ie(i,{code:Te.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?ise.test(t.data)||(i=this._getOrReturnCtx(t,i),Ie(i,{code:Te.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?sse(o).test(t.data)||(i=this._getOrReturnCtx(t,i),Ie(i,{code:Te.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?Yie.test(t.data)||(i=this._getOrReturnCtx(t,i),Ie(i,{validation:"duration",code:Te.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?ase(t.data,o.version)||(i=this._getOrReturnCtx(t,i),Ie(i,{validation:"ip",code:Te.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?lse(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),Ie(i,{validation:"jwt",code:Te.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?cse(t.data,o.version)||(i=this._getOrReturnCtx(t,i),Ie(i,{validation:"cidr",code:Te.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?nse.test(t.data)||(i=this._getOrReturnCtx(t,i),Ie(i,{validation:"base64",code:Te.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?rse.test(t.data)||(i=this._getOrReturnCtx(t,i),Ie(i,{validation:"base64url",code:Te.invalid_string,message:o.message}),r.dirty()):qt.assertNever(o);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:Te.invalid_string,...Ze.errToObj(r)})}_addCheck(t){return new ga({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ze.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ze.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ze.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ze.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Ze.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ze.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ze.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ze.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Ze.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Ze.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Ze.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ze.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Ze.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...Ze.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Ze.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Ze.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Ze.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Ze.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Ze.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Ze.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Ze.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Ze.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Ze.errToObj(n)})}nonempty(t){return this.min(1,Ze.errToObj(t))}trim(){return new ga({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ga({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ga({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}ga.create=e=>new ga({checks:[],typeName:ft.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Mt(e)});function use(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=Number.parseInt(e.toFixed(i).replace(".","")),l=Number.parseInt(t.toFixed(i).replace(".",""));return o%l/10**i}class dh extends Ut{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Ge.number){const o=this._getOrReturnCtx(t);return Ie(o,{code:Te.invalid_type,expected:Ge.number,received:o.parsedType}),ht}let r;const i=new Si;for(const o of this._def.checks)o.kind==="int"?qt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Ie(r,{code:Te.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),Ie(r,{code:Te.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),Ie(r,{code:Te.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?use(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),Ie(r,{code:Te.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Ie(r,{code:Te.not_finite,message:o.message}),i.dirty()):qt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ze.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ze.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ze.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ze.toString(n))}setLimit(t,n,r,i){return new dh({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ze.toString(i)}]})}_addCheck(t){return new dh({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ze.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ze.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ze.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ze.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ze.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ze.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Ze.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ze.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ze.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&qt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}dh.create=e=>new dh({checks:[],typeName:ft.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Mt(e)});class hh extends Ut{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Ge.bigint)return this._getInvalidInput(t);let r;const i=new Si;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),Ie(r,{code:Te.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),Ie(r,{code:Te.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Ie(r,{code:Te.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):qt.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return Ie(n,{code:Te.invalid_type,expected:Ge.bigint,received:n.parsedType}),ht}gte(t,n){return this.setLimit("min",t,!0,Ze.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ze.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ze.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ze.toString(n))}setLimit(t,n,r,i){return new hh({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ze.toString(i)}]})}_addCheck(t){return new hh({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ze.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ze.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ze.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ze.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ze.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}hh.create=e=>new hh({checks:[],typeName:ft.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Mt(e)});class r0 extends Ut{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ge.boolean){const r=this._getOrReturnCtx(t);return Ie(r,{code:Te.invalid_type,expected:Ge.boolean,received:r.parsedType}),ht}return Zi(t.data)}}r0.create=e=>new r0({typeName:ft.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Mt(e)});class $p extends Ut{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ge.date){const o=this._getOrReturnCtx(t);return Ie(o,{code:Te.invalid_type,expected:Ge.date,received:o.parsedType}),ht}if(Number.isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return Ie(o,{code:Te.invalid_date}),ht}const r=new Si;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),Ie(i,{code:Te.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),Ie(i,{code:Te.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):qt.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new $p({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Ze.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Ze.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}$p.create=e=>new $p({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ft.ZodDate,...Mt(e)});class JT extends Ut{_parse(t){if(this._getType(t)!==Ge.symbol){const r=this._getOrReturnCtx(t);return Ie(r,{code:Te.invalid_type,expected:Ge.symbol,received:r.parsedType}),ht}return Zi(t.data)}}JT.create=e=>new JT({typeName:ft.ZodSymbol,...Mt(e)});class eN extends Ut{_parse(t){if(this._getType(t)!==Ge.undefined){const r=this._getOrReturnCtx(t);return Ie(r,{code:Te.invalid_type,expected:Ge.undefined,received:r.parsedType}),ht}return Zi(t.data)}}eN.create=e=>new eN({typeName:ft.ZodUndefined,...Mt(e)});class tN extends Ut{_parse(t){if(this._getType(t)!==Ge.null){const r=this._getOrReturnCtx(t);return Ie(r,{code:Te.invalid_type,expected:Ge.null,received:r.parsedType}),ht}return Zi(t.data)}}tN.create=e=>new tN({typeName:ft.ZodNull,...Mt(e)});class nN extends Ut{constructor(){super(...arguments),this._any=!0}_parse(t){return Zi(t.data)}}nN.create=e=>new nN({typeName:ft.ZodAny,...Mt(e)});class rN extends Ut{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Zi(t.data)}}rN.create=e=>new rN({typeName:ft.ZodUnknown,...Mt(e)});class Sa extends Ut{_parse(t){const n=this._getOrReturnCtx(t);return Ie(n,{code:Te.invalid_type,expected:Ge.never,received:n.parsedType}),ht}}Sa.create=e=>new Sa({typeName:ft.ZodNever,...Mt(e)});class iN extends Ut{_parse(t){if(this._getType(t)!==Ge.undefined){const r=this._getOrReturnCtx(t);return Ie(r,{code:Te.invalid_type,expected:Ge.void,received:r.parsedType}),ht}return Zi(t.data)}}iN.create=e=>new iN({typeName:ft.ZodVoid,...Mt(e)});class Ps extends Ut{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==Ge.array)return Ie(n,{code:Te.invalid_type,expected:Ge.array,received:n.parsedType}),ht;if(i.exactLength!==null){const l=n.data.length>i.exactLength.value,c=n.data.length<i.exactLength.value;(l||c)&&(Ie(n,{code:l?Te.too_big:Te.too_small,minimum:c?i.exactLength.value:void 0,maximum:l?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(Ie(n,{code:Te.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(Ie(n,{code:Te.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((l,c)=>i.type._parseAsync(new wa(n,l,n.path,c)))).then(l=>Si.mergeArray(r,l));const o=[...n.data].map((l,c)=>i.type._parseSync(new wa(n,l,n.path,c)));return Si.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new Ps({...this._def,minLength:{value:t,message:Ze.toString(n)}})}max(t,n){return new Ps({...this._def,maxLength:{value:t,message:Ze.toString(n)}})}length(t,n){return new Ps({...this._def,exactLength:{value:t,message:Ze.toString(n)}})}nonempty(t){return this.min(1,t)}}Ps.create=(e,t)=>new Ps({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ft.ZodArray,...Mt(t)});function kc(e){if(e instanceof Qn){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ya.create(kc(r))}return new Qn({...e._def,shape:()=>t})}else return e instanceof Ps?new Ps({...e._def,type:kc(e.element)}):e instanceof ya?ya.create(kc(e.unwrap())):e instanceof Yc?Yc.create(kc(e.unwrap())):e instanceof Cl?Cl.create(e.items.map(t=>kc(t))):e}class Qn extends Ut{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=qt.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Ge.object){const d=this._getOrReturnCtx(t);return Ie(d,{code:Te.invalid_type,expected:Ge.object,received:d.parsedType}),ht}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:l}=this._getCached(),c=[];if(!(this._def.catchall instanceof Sa&&this._def.unknownKeys==="strip"))for(const d in i.data)l.includes(d)||c.push(d);const h=[];for(const d of l){const g=o[d],p=i.data[d];h.push({key:{status:"valid",value:d},value:g._parse(new wa(i,p,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof Sa){const d=this._def.unknownKeys;if(d==="passthrough")for(const g of c)h.push({key:{status:"valid",value:g},value:{status:"valid",value:i.data[g]}});else if(d==="strict")c.length>0&&(Ie(i,{code:Te.unrecognized_keys,keys:c}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const g of c){const p=i.data[g];h.push({key:{status:"valid",value:g},value:d._parse(new wa(i,p,i.path,g)),alwaysSet:g in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const d=[];for(const g of h){const p=await g.key,v=await g.value;d.push({key:p,value:v,alwaysSet:g.alwaysSet})}return d}).then(d=>Si.mergeObjectSync(r,d)):Si.mergeObjectSync(r,h)}get shape(){return this._def.shape()}strict(t){return Ze.errToObj,new Qn({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,l;const i=((l=(o=this._def).errorMap)==null?void 0:l.call(o,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:Ze.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new Qn({...this._def,unknownKeys:"strip"})}passthrough(){return new Qn({...this._def,unknownKeys:"passthrough"})}extend(t){return new Qn({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Qn({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ft.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Qn({...this._def,catchall:t})}pick(t){const n={};for(const r of qt.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Qn({...this._def,shape:()=>n})}omit(t){const n={};for(const r of qt.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new Qn({...this._def,shape:()=>n})}deepPartial(){return kc(this)}partial(t){const n={};for(const r of qt.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new Qn({...this._def,shape:()=>n})}required(t){const n={};for(const r of qt.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof ya;)o=o._def.innerType;n[r]=o}return new Qn({...this._def,shape:()=>n})}keyof(){return A4(qt.objectKeys(this.shape))}}Qn.create=(e,t)=>new Qn({shape:()=>e,unknownKeys:"strip",catchall:Sa.create(),typeName:ft.ZodObject,...Mt(t)});Qn.strictCreate=(e,t)=>new Qn({shape:()=>e,unknownKeys:"strict",catchall:Sa.create(),typeName:ft.ZodObject,...Mt(t)});Qn.lazycreate=(e,t)=>new Qn({shape:e,unknownKeys:"strip",catchall:Sa.create(),typeName:ft.ZodObject,...Mt(t)});class Up extends Ut{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const c of o)if(c.result.status==="valid")return c.result;for(const c of o)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const l=o.map(c=>new wo(c.ctx.common.issues));return Ie(n,{code:Te.invalid_union,unionErrors:l}),ht}if(n.common.async)return Promise.all(r.map(async o=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(i);{let o;const l=[];for(const h of r){const d={...n,common:{...n.common,issues:[]},parent:null},g=h._parseSync({data:n.data,path:n.path,parent:d});if(g.status==="valid")return g;g.status==="dirty"&&!o&&(o={result:g,ctx:d}),d.common.issues.length&&l.push(d.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const c=l.map(h=>new wo(h));return Ie(n,{code:Te.invalid_union,unionErrors:c}),ht}}get options(){return this._def.options}}Up.create=(e,t)=>new Up({options:e,typeName:ft.ZodUnion,...Mt(t)});function i0(e,t){const n=ha(e),r=ha(t);if(e===t)return{valid:!0,data:e};if(n===Ge.object&&r===Ge.object){const i=qt.objectKeys(t),o=qt.objectKeys(e).filter(c=>i.indexOf(c)!==-1),l={...e,...t};for(const c of o){const h=i0(e[c],t[c]);if(!h.valid)return{valid:!1};l[c]=h.data}return{valid:!0,data:l}}else if(n===Ge.array&&r===Ge.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o<e.length;o++){const l=e[o],c=t[o],h=i0(l,c);if(!h.valid)return{valid:!1};i.push(h.data)}return{valid:!0,data:i}}else return n===Ge.date&&r===Ge.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Vp extends Ut{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(o,l)=>{if(XT(o)||XT(l))return ht;const c=i0(o.value,l.value);return c.valid?((ZT(o)||ZT(l))&&n.dirty(),{status:n.value,value:c.data}):(Ie(r,{code:Te.invalid_intersection_types}),ht)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,l])=>i(o,l)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Vp.create=(e,t,n)=>new Vp({left:e,right:t,typeName:ft.ZodIntersection,...Mt(n)});class Cl extends Ut{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ge.array)return Ie(r,{code:Te.invalid_type,expected:Ge.array,received:r.parsedType}),ht;if(r.data.length<this._def.items.length)return Ie(r,{code:Te.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ht;!this._def.rest&&r.data.length>this._def.items.length&&(Ie(r,{code:Te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((l,c)=>{const h=this._def.items[c]||this._def.rest;return h?h._parse(new wa(r,l,r.path,c)):null}).filter(l=>!!l);return r.common.async?Promise.all(o).then(l=>Si.mergeArray(n,l)):Si.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new Cl({...this._def,rest:t})}}Cl.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Cl({items:e,typeName:ft.ZodTuple,rest:null,...Mt(t)})};class sN extends Ut{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ge.map)return Ie(r,{code:Te.invalid_type,expected:Ge.map,received:r.parsedType}),ht;const i=this._def.keyType,o=this._def.valueType,l=[...r.data.entries()].map(([c,h],d)=>({key:i._parse(new wa(r,c,r.path,[d,"key"])),value:o._parse(new wa(r,h,r.path,[d,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const h of l){const d=await h.key,g=await h.value;if(d.status==="aborted"||g.status==="aborted")return ht;(d.status==="dirty"||g.status==="dirty")&&n.dirty(),c.set(d.value,g.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const h of l){const d=h.key,g=h.value;if(d.status==="aborted"||g.status==="aborted")return ht;(d.status==="dirty"||g.status==="dirty")&&n.dirty(),c.set(d.value,g.value)}return{status:n.value,value:c}}}}sN.create=(e,t,n)=>new sN({valueType:t,keyType:e,typeName:ft.ZodMap,...Mt(n)});class fh extends Ut{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ge.set)return Ie(r,{code:Te.invalid_type,expected:Ge.set,received:r.parsedType}),ht;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(Ie(r,{code:Te.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(Ie(r,{code:Te.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function l(h){const d=new Set;for(const g of h){if(g.status==="aborted")return ht;g.status==="dirty"&&n.dirty(),d.add(g.value)}return{status:n.value,value:d}}const c=[...r.data.values()].map((h,d)=>o._parse(new wa(r,h,r.path,d)));return r.common.async?Promise.all(c).then(h=>l(h)):l(c)}min(t,n){return new fh({...this._def,minSize:{value:t,message:Ze.toString(n)}})}max(t,n){return new fh({...this._def,maxSize:{value:t,message:Ze.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}fh.create=(e,t)=>new fh({valueType:e,minSize:null,maxSize:null,typeName:ft.ZodSet,...Mt(t)});class oN extends Ut{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}oN.create=(e,t)=>new oN({getter:e,typeName:ft.ZodLazy,...Mt(t)});class aN extends Ut{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Ie(n,{received:n.data,code:Te.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:t.data}}get value(){return this._def.value}}aN.create=(e,t)=>new aN({value:e,typeName:ft.ZodLiteral,...Mt(t)});function A4(e,t){return new Kc({values:e,typeName:ft.ZodEnum,...Mt(t)})}class Kc extends Ut{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Ie(n,{expected:qt.joinValues(r),received:n.parsedType,code:Te.invalid_type}),ht}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return Ie(n,{received:n.data,code:Te.invalid_enum_value,options:r}),ht}return Zi(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Kc.create(t,{...this._def,...n})}exclude(t,n=this._def){return Kc.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Kc.create=A4;class lN extends Ut{_parse(t){const n=qt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Ge.string&&r.parsedType!==Ge.number){const i=qt.objectValues(n);return Ie(r,{expected:qt.joinValues(i),received:r.parsedType,code:Te.invalid_type}),ht}if(this._cache||(this._cache=new Set(qt.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=qt.objectValues(n);return Ie(r,{received:r.data,code:Te.invalid_enum_value,options:i}),ht}return Zi(t.data)}get enum(){return this._def.values}}lN.create=(e,t)=>new lN({values:e,typeName:ft.ZodNativeEnum,...Mt(t)});class Wp extends Ut{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ge.promise&&n.common.async===!1)return Ie(n,{code:Te.invalid_type,expected:Ge.promise,received:n.parsedType}),ht;const r=n.parsedType===Ge.promise?n.data:Promise.resolve(n.data);return Zi(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Wp.create=(e,t)=>new Wp({type:e,typeName:ft.ZodPromise,...Mt(t)});class Gc extends Ut{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ft.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:l=>{Ie(r,l),l.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const l=i.transform(r.data,o);if(r.common.async)return Promise.resolve(l).then(async c=>{if(n.value==="aborted")return ht;const h=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return h.status==="aborted"?ht:h.status==="dirty"||n.value==="dirty"?jd(h.value):h});{if(n.value==="aborted")return ht;const c=this._def.schema._parseSync({data:l,path:r.path,parent:r});return c.status==="aborted"?ht:c.status==="dirty"||n.value==="dirty"?jd(c.value):c}}if(i.type==="refinement"){const l=c=>{const h=i.refinement(c,o);if(r.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?ht:(c.status==="dirty"&&n.dirty(),l(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?ht:(c.status==="dirty"&&n.dirty(),l(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!qc(l))return ht;const c=i.transform(l.value,o);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>qc(l)?Promise.resolve(i.transform(l.value,o)).then(c=>({status:n.value,value:c})):ht);qt.assertNever(i)}}Gc.create=(e,t,n)=>new Gc({schema:e,typeName:ft.ZodEffects,effect:t,...Mt(n)});Gc.createWithPreprocess=(e,t,n)=>new Gc({schema:t,effect:{type:"preprocess",transform:e},typeName:ft.ZodEffects,...Mt(n)});class ya extends Ut{_parse(t){return this._getType(t)===Ge.undefined?Zi(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ya.create=(e,t)=>new ya({innerType:e,typeName:ft.ZodOptional,...Mt(t)});class Yc extends Ut{_parse(t){return this._getType(t)===Ge.null?Zi(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Yc.create=(e,t)=>new Yc({innerType:e,typeName:ft.ZodNullable,...Mt(t)});class s0 extends Ut{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Ge.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}s0.create=(e,t)=>new s0({innerType:e,typeName:ft.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Mt(t)});class o0 extends Ut{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Hp(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new wo(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new wo(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}o0.create=(e,t)=>new o0({innerType:e,typeName:ft.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Mt(t)});class cN extends Ut{_parse(t){if(this._getType(t)!==Ge.nan){const r=this._getOrReturnCtx(t);return Ie(r,{code:Te.invalid_type,expected:Ge.nan,received:r.parsedType}),ht}return{status:"valid",value:t.data}}}cN.create=e=>new cN({typeName:ft.ZodNaN,...Mt(e)});class dse extends Ut{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class t1 extends Ut{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?ht:o.status==="dirty"?(n.dirty(),jd(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ht:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new t1({in:t,out:n,typeName:ft.ZodPipeline})}}class a0 extends Ut{_parse(t){const n=this._def.innerType._parse(t),r=i=>(qc(i)&&(i.value=Object.freeze(i.value)),i);return Hp(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}a0.create=(e,t)=>new a0({innerType:e,typeName:ft.ZodReadonly,...Mt(t)});var ft;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ft||(ft={}));const hl=ga.create,j4=r0.create;Sa.create;const D4=Ps.create,n1=Qn.create;Up.create;Vp.create;Cl.create;const hse=Kc.create;Wp.create;ya.create;Yc.create;const fse=/^\d{4}-\d{2}-\d{2}$/,mse=n1({title:hl().min(1),items:D4(hl().min(1)).min(1)}),pse=n1({version:hl().min(1),publishedAt:hl().regex(fse,"Expected YYYY-MM-DD"),title:hl().min(1),sections:D4(mse).min(1),prerelease:j4().optional()});n1({changeType:hse(["feature","improvement","fix","internal","docs"]),title:hl().min(1),summary:hl().min(1),public:j4()});const gse=[{version:"0.5.0",publishedAt:"2026-03-29",title:"Bundled release history and stronger session recovery",sections:[{title:"New Features",items:["Bundled release history and stronger session recovery: Kaizen now ships in-app and web release notes while recovering chat usage and session state more reliably after reloads."]}]},{version:"0.4.0",publishedAt:"2026-03-29",title:"Branding refresh and packaged runtime updates",sections:[{title:"Highlights",items:["Refreshed the Kaizen branding and theme system across the product surface.","Published the built Kaizen runtime and added the web start command needed for the packaged flow.","Renamed the `keizen` app paths to `kaizen`, fixed review follow-ups, and aligned web builds on Node 20."]}]},{version:"0.3.0",publishedAt:"2026-03-29",title:"Feature overview workflow and release workflow baseline",sections:[{title:"Highlights",items:["Added the feature overview workflow and plan attachment support for structured project work.","Added the pull-request skill and the first pass of the npm publish and release workflow guidance."]}]},{version:"0.2.2",publishedAt:"2026-03-28",title:"UI and restart regression fixes",sections:[{title:"Highlights",items:["Fixed Kaizen UI regressions and restart issues that were blocking a stable local runtime."]}]}];function uN(e){return new Date(`${e}T00:00:00.000Z`).getTime()}function vse(e,t="en-US"){return new Intl.DateTimeFormat(t,{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}).format(new Date(`${e}T00:00:00.000Z`))}function _se(e){return[...e].sort((t,n)=>{const r=uN(n.publishedAt)-uN(t.publishedAt);return r!==0?r:n.version.localeCompare(t.version,void 0,{numeric:!0,sensitivity:"base"})})}const yse=Object.freeze(_se(gse.map(e=>pse.parse(e))));function bse({entries:e}){return e.length===0?f.jsx("div",{className:"rounded-2xl border border-dashed border-border bg-card/30 px-6 py-10 text-sm text-muted-foreground",children:"No release notes have been published yet."}):f.jsx("div",{className:"space-y-4",children:e.map(t=>f.jsxs("article",{className:"rounded-2xl border border-border bg-card/60 p-5",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("h3",{className:"text-base font-semibold text-foreground",children:t.title}),f.jsxs("span",{className:"rounded-full border border-border bg-muted/60 px-2.5 py-1 text-xs font-medium text-muted-foreground",children:["v",t.version]}),t.prerelease?f.jsx("span",{className:"rounded-full border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-xs font-medium text-amber-600 dark:text-amber-300",children:"Prerelease"}):null]}),f.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Published ",vse(t.publishedAt)]}),f.jsx("div",{className:"mt-4 space-y-4 text-sm text-foreground",children:t.sections.map(n=>f.jsxs("section",{className:"space-y-2",children:[f.jsx("h4",{className:"text-sm font-semibold text-foreground",children:n.title}),f.jsx("ul",{className:"list-disc space-y-2 pl-5 text-muted-foreground",children:n.items.map(r=>f.jsx("li",{children:r},r))})]},n.title))})]},`${t.version}-${t.publishedAt}`))})}const Dd=[{id:"general",label:"General",icon:v9,subtitle:"Manage appearance, editor behavior, and embedded terminal defaults."},{id:"changelog",label:"Release Notes",icon:PM,subtitle:"Review shipped changes included in the npm release history."},{id:"providers",label:"Providers",icon:J8,subtitle:"Manage the default chat provider and saved model defaults for Claude, Codex, Gemini, and Cursor."},{id:"keybindings",label:"Keybindings",icon:f8,subtitle:"Edit global app shortcuts stored in the active keybindings file."}];function dN(e){return e&&Dd.some(t=>t.id===e)?e:null}const xse=[{value:"cursor",label:"Cursor"},{value:"vscode",label:"VS Code"},{value:"windsurf",label:"Windsurf"},{value:"custom",label:"Custom"}],hN=Object.keys(Kj);function wse(e){return`Edit global app shortcuts stored in ${e}.`}function Sse(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 Im(e,t){const n=dn(t),r=(e==null?void 0:e.settings[t])??sr[t];return n.systemActive?r.active?"Active.":"Inactive.":"Inactive by server policy."}function Cse(e){return e&&typeof e=="object"&&"idx"in e&&typeof e.idx=="number"&&e.idx>0?"back":"home"}function fN({themePreference:e,nextBackgroundImage:t,backgroundOpacity:n}){const r=typeof t=="string"&&t.trim()!=="";return e!=="custom"||!r||n!==1?{}:{backgroundOpacity:.85,backgroundBlur:6}}function Dn({title:e,description:t,children:n,bordered:r=!0,alignStart:i=!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 ${i?"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 kse(){var fs,Dl;const e=kl(),{sectionId:t}=jN(),n=Yp(),{theme:r,setTheme:i}=oO(),o=dN(t)??"general",l=n.connectionStatus==="connecting"||!n.localProjectsReady,c=((fs=n.localProjects)==null?void 0:fs.machine.displayName)??"Unavailable",h=((Dl=n.localProjects)==null?void 0:Dl.projects.length)??0,d=P0.split("/")[1]??"unknown",g=Ii(K=>K.scrollbackLines),p=Ii(K=>K.minColumnWidth),v=Ii(K=>K.editorPreset),b=Ii(K=>K.editorCommandTemplate),w=Ii(K=>K.setScrollbackLines),S=Ii(K=>K.setMinColumnWidth),C=Ii(K=>K.setEditorPreset),k=Ii(K=>K.setEditorCommandTemplate),R=n.keybindings,E=n.providerSettings,N=Pi(K=>K.defaultProvider),L=Pi(K=>K.providerDefaults),j=Pi(K=>K.showProviderIconsInSideTray),D=Pi(K=>K.setDefaultProvider),H=Pi(K=>K.setProviderDefaultModel),Y=Pi(K=>K.setProviderDefaultModelOptions),P=Pi(K=>K.setProviderDefaultPlanMode),q=Pi(K=>K.setShowProviderIconsInSideTray),F=yi(K=>K.folderGroupsEnabled),U=yi(K=>K.showFeatureOverviewInSidebar),W=yi(K=>K.kanbanStatusesEnabled),V=yi(K=>K.commitProjectMetadataDirectory),O=yi(K=>K.setFolderGroupsEnabled),$=yi(K=>K.setShowFeatureOverviewInSidebar),z=yi(K=>K.setKanbanStatusesEnabled),G=yi(K=>K.setCommitProjectMetadataDirectory),M=yn(K=>K.themeId),B=yn(K=>K.customAppearance),Z=yn(K=>K.backgroundImage),A=yn(K=>K.backgroundOpacity),ie=yn(K=>K.backgroundBlur),J=yn(K=>K.showProjectIconsInSidebar),ee=yn(K=>K.availableThemes),re=yn(K=>K.setThemeId),ce=yn(K=>K.setCustomAppearance),he=yn(K=>K.setBackgroundImage),pe=yn(K=>K.setBackgroundOpacity),Se=yn(K=>K.setBackgroundBlur),Re=yn(K=>K.setShowProjectIconsInSidebar),je=_.useMemo(()=>fw(R),[R]),Xe=je.filePathDisplay||PF(),[Et,Rt]=_.useState(String(g)),[fe,He]=_.useState(String(p)),[De,mt]=_.useState(b),[ct,ot]=_.useState(Z??""),[fn,Ce]=_.useState(String(A)),[tt,oe]=_.useState(String(ie)),[ve,Ne]=_.useState({}),[Ae,Qe]=_.useState(null),[At,rt]=_.useState(null),[Oe,qe]=_.useState(null),gt=_.useMemo(()=>B0((E==null?void 0:E.settings)??sr),[E==null?void 0:E.settings]),Ve=N==="last_used"||gt.some(K=>K.id===N)?N:"last_used",[mn,sn]=_.useState([]),Je=n.updateSnapshot,tn=n.themeSettings,$n=Sse(Je),Jt=(Je==null?void 0:Je.status)==="checking"?"Checking for updates…":(Je==null?void 0:Je.status)==="updating"?"Installing update…":(Je==null?void 0:Je.status)==="restart_pending"?`Restarting ${Zn}…`:(Je==null?void 0:Je.status)==="available"?`Update available${Je.latestVersion?`: ${Je.latestVersion}`:""}`:(Je==null?void 0:Je.status)==="up_to_date"?"Up to date":(Je==null?void 0:Je.status)==="error"?"Update check failed":"Not checked yet";_.useEffect(()=>{fetch("/api/backgrounds").then(K=>K.json()).then(K=>sn(K)).catch(K=>console.error("Failed to load system backgrounds",K))},[]),_.useEffect(()=>{Rt(String(g))},[g]),_.useEffect(()=>{He(String(p))},[p]),_.useEffect(()=>{mt(b)},[b]),_.useEffect(()=>{ot(Z??"")},[Z]),_.useEffect(()=>{Ce(String(A))},[A]),_.useEffect(()=>{oe(String(ie))},[ie]),_.useEffect(()=>{Ne(Object.fromEntries(hN.map(K=>[K,ky(je.bindings[K])])))},[je]),_.useEffect(()=>{t&&(dN(t)||e("/settings/general",{replace:!0}))},[e,t]);function Kt(){const K=Number(Et);if(!Number.isFinite(K)){Rt(String(g));return}w(K)}function Be(){const K=Number(fe);if(!Number.isFinite(K)){He(String(p));return}S(K)}function vt(){const K=ct.trim()===""?null:ct.trim(),at=fN({themePreference:r,nextBackgroundImage:K,backgroundOpacity:A});he(K),at.backgroundOpacity!==void 0&&pe(at.backgroundOpacity),at.backgroundBlur!==void 0&&Se(at.backgroundBlur),ke({backgroundImage:K,...at})}function wt(){const K=Number(fn);if(!Number.isFinite(K)||K<0||K>1){Ce(String(A));return}pe(K),ke({backgroundOpacity:K})}function Tt(){const K=Number(tt);if(!Number.isFinite(K)||K<0){oe(String(ie));return}Se(K),ke({backgroundBlur:K})}function en(K,at){K.key==="Enter"&&(at(),K.currentTarget.blur())}function _t(K,at){K.key==="Enter"&&(at(),K.currentTarget.blur())}function yt(){k(De)}async function Cn(K=ve){try{Qe(null),await n.socket.command({type:"settings.writeKeybindings",bindings:mN(K)})}catch(at){Qe(at instanceof Error?at.message:"Unable to save keybindings.")}}async function ke(K){try{await n.socket.command({type:"settings.writeThemeSettings",settings:{themePreference:(K==null?void 0:K.themePreference)??r,themeId:(K==null?void 0:K.themeId)??M,customAppearance:(K==null?void 0:K.customAppearance)??B,backgroundImage:(K==null?void 0:K.backgroundImage)!==void 0?K.backgroundImage:Z,backgroundOpacity:(K==null?void 0:K.backgroundOpacity)??A,backgroundBlur:(K==null?void 0:K.backgroundBlur)??ie,showProjectIconsInSidebar:(K==null?void 0:K.showProjectIconsInSidebar)??J}})}catch(at){console.error("Failed to save theme settings:",at)}}async function Le(K,at){qe(K);try{await at()}finally{qe(Un=>Un===K?null:Un)}}async function Nt(K){try{rt(null),await n.socket.command({type:"settings.writeProviderSettings",settings:K})}catch(at){rt(at instanceof Error?at.message:"Unable to save provider settings.")}}async function ut(K){const at={...ve,[K]:ky(ks[K])};Ne(at);try{Qe(null),await n.socket.command({type:"settings.writeKeybindings",bindings:mN(at)})}catch(Un){Qe(Un instanceof Error?Un.message:"Unable to save keybindings.")}}const pn=De.replaceAll("{path}","/Users/jake/Projects/kaizen/src/client/app/App.tsx").replaceAll("{line}","12").replaceAll("{column}","1"),bn=Dd.find(K=>K.id===o)??Dd[0],on=o==="keybindings"?wse(Xe):bn.subtitle,Gt=!l,Yt=o==="keybindings"?f.jsxs(wc,{onClick:()=>{n.handleOpenExternalPath("open_editor",Xe)},icon:f.jsx(wb,{className:"h-4 w-4"}),children:["Open in ",n.editorLabel]}):o==="general"?f.jsx(wc,{variant:$n.variant,onClick:()=>{if($n.kind==="update"){n.handleInstallUpdate();return}n.handleCheckForUpdates({force:!0})},disabled:$n.disabled,icon:$n.kind==="check"?f.jsx(op,{className:me("size-3.5",$n.spinning&&"animate-spin")}):$n.kind==="update"?f.jsx(PM,{className:me("size-3.5")}):void 0,children:$n.label}):null;function Mr(){if(Cse(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 ${Gt?"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"}),Dd.map(K=>f.jsx("button",{type:"button",onClick:()=>e(`/settings/${K.id}`),className:`cursor-pointer rounded-lg px-3 py-2 text-sm ${K.id===o?"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(K.icon,{className:"h-4 w-4 shrink-0"}),f.jsx("span",{children:K.label})]})},K.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:Dd.map(K=>f.jsxs("button",{type:"button",onClick:()=>e(`/settings/${K.id}`),className:`flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm transition-colors ${K.id===o?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`,children:[f.jsx(K.icon,{className:"h-3.5 w-3.5 shrink-0"}),f.jsx("span",{children:K.label})]},K.id))}),f.jsx("button",{type:"button","aria-label":"Close settings",onClick:Mr,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(vo,{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(Lr,{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:bn.label}),f.jsxs("div",{className:"flex items-center gap-2",children:[Yt,f.jsx(wc,{"aria-label":"Close settings",title:"Close settings",onClick:Mr,icon:f.jsx(vo,{className:"h-4 w-4"}),className:"hidden md:flex"})]})]}),f.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:on})]}),o==="general"?f.jsx(f.Fragment,{children:f.jsxs("div",{className:"border-b border-border",children:[f.jsx(Dn,{title:"Application Update",description:f.jsxs(f.Fragment,{children:[f.jsxs("span",{children:[Jt,"."]}),Je!=null&&Je.lastCheckedAt?f.jsxs("span",{children:[" ","Last checked"," ",new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(Je.lastCheckedAt),"."]}):null,Je!=null&&Je.error?f.jsxs("span",{children:[" ",Je.error]}):null]}),bordered:!1,children:f.jsxs("div",{className:"text-right text-sm text-foreground",children:[f.jsxs("div",{children:["Current:"," ",(Je==null?void 0:Je.currentVersion)??d]}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:["Latest: ",(Je==null?void 0:Je.latestVersion)??"Unknown"]})]})}),f.jsx(Dn,{title:"Theme",description:"Choose between light, dark, system, or custom appearance",children:f.jsxs(Er,{value:r,onValueChange:K=>{i(K),ke({themePreference:K})},children:[f.jsx(cr,{className:"w-[150px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx($t,{value:"light",children:"Light"}),f.jsx($t,{value:"dark",children:"Dark"}),f.jsx($t,{value:"system",children:"System"}),f.jsx($t,{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(Dn,{title:"Appearance",description:"Choose light, dark, or system mode for your custom theme",bordered:!1,children:f.jsxs(Er,{value:B,onValueChange:K=>{ce(K),ke({customAppearance:K})},children:[f.jsx(cr,{className:"w-[150px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx($t,{value:"light",children:"Light"}),f.jsx($t,{value:"dark",children:"Dark"}),f.jsx($t,{value:"system",children:"System"})]})]})}),f.jsx(Dn,{title:"Color Theme",description:`Choose a color palette for the interface. Custom JSON themes live in ${(tn==null?void 0:tn.themesDirectoryDisplay)??"~/.kaizen/themes"}. Read ${(tn==null?void 0:tn.themesReadmeFileDisplay)??"~/.kaizen/themes/THEME_README.md"} for authoring guidance.`,alignStart:!0,bordered:!1,children:f.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-2 sm:max-w-[320px]",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs(Er,{value:M,onValueChange:K=>{re(K),ke({themeId:K})},children:[f.jsx(cr,{className:"min-w-[180px]",children:f.jsx(jr,{})}),f.jsx(ur,{children:f.jsx(xy,{children:ee.map(K=>f.jsx($t,{value:K.id,children:K.label},K.id))})})]}),f.jsx(wc,{variant:"outline","aria-label":"Refresh themes",title:"Refresh themes",className:"px-2.5",disabled:Oe!==null,onClick:()=>{Le("refresh",()=>n.handleRefreshThemeSettings())},icon:Oe==="refresh"?f.jsx(Lr,{className:"size-3.5 animate-spin"}):f.jsx(op,{className:"size-3.5"})})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsxs(wc,{disabled:Oe!==null,onClick:()=>{Le("open_editor",()=>n.handleOpenCustomThemes())},icon:Oe==="open_editor"?f.jsx(Lr,{className:"size-3.5 animate-spin"}):f.jsx(r9,{className:"size-3.5"}),children:["Open in ",n.editorLabel]}),f.jsx(wc,{variant:"outline",disabled:Oe!==null,onClick:()=>{Le("open_folder",()=>n.handleOpenExternalPath("open_finder",(tn==null?void 0:tn.themesDirectoryDisplay)??"~/.kaizen/themes"))},icon:Oe==="open_folder"?f.jsx(Lr,{className:"size-3.5 animate-spin"}):f.jsx(wb,{className:"size-3.5"}),children:"Open folder"})]}),tn!=null&&tn.customThemeWarnings.length?f.jsx("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/5 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:tn.customThemeWarnings.join(" ")}):null]})}),f.jsx(Dn,{title:"Background Image",description:"Choose a background or enter a custom URL",alignStart:!0,bordered:!1,children:(()=>{const K=mn.find(Ht=>Ht.url===ct),at=!ct,Un=!!ct&&!K,ms=at?"__none__":Un?"__custom__":ct,ki=at?"None":Un?"Custom URL":(K==null?void 0:K.name)??"Unknown";return f.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-2 sm:max-w-[320px]",children:[f.jsxs(Er,{value:ms,onValueChange:Ht=>{if(Ht==="__none__")ot(""),he(null),ke({backgroundImage:null});else{const Pn=fN({themePreference:r,nextBackgroundImage:Ht,backgroundOpacity:A});ot(Ht),he(Ht),Pn.backgroundOpacity!==void 0&&pe(Pn.backgroundOpacity),Pn.backgroundBlur!==void 0&&Se(Pn.backgroundBlur),ke({backgroundImage:Ht,...Pn})}},children:[f.jsx(cr,{className:"w-full",children:f.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[at?null:f.jsx("img",{src:ct,alt:"",className:"h-5 w-9 shrink-0 rounded object-cover"}),f.jsx("span",{className:"truncate",children:ki})]})}),f.jsxs(ur,{children:[f.jsx(Wm,{value:"__none__",children:"None"}),mn.map(Ht=>f.jsx(Wm,{value:Ht.url,thumbnail:Ht.url,thumbnailAlt:Ht.name,children:Ht.name},Ht.id)),Un?f.jsx(Wm,{value:"__custom__",thumbnail:ct,thumbnailAlt:"Custom",children:"Custom URL"}):null]})]}),f.jsx(Bi,{type:"text",placeholder:"Or enter a custom URL...",value:ct,onChange:Ht=>ot(Ht.target.value),onBlur:vt,onKeyDown:Ht=>_t(Ht,vt),className:"w-full"})]})})()}),f.jsx(Dn,{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(Bi,{type:"number",min:0,max:1,step:.05,value:fn,onChange:K=>Ce(K.target.value),onBlur:wt,onKeyDown:K=>en(K,wt),className:"hide-number-steppers w-28 text-right font-mono"})})}),f.jsx(Dn,{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(Bi,{type:"number",min:0,max:50,step:1,value:tt,onChange:K=>oe(K.target.value),onBlur:Tt,onKeyDown:K=>en(K,Tt),className:"hide-number-steppers w-28 text-right font-mono"})})})]}):null,f.jsx(Dn,{title:"Project Icons",description:"Show detected project icons in the sidebar and open-project list.",children:f.jsxs(Er,{value:J?"enabled":"disabled",onValueChange:K=>{const at=K==="enabled";Re(at),ke({showProjectIconsInSidebar:at})},children:[f.jsx(cr,{className:"w-[100px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx($t,{value:"disabled",children:"Off"}),f.jsx($t,{value:"enabled",children:"On"})]})]})}),f.jsx(Dn,{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(Er,{value:F?"enabled":"disabled",onValueChange:K=>O(K==="enabled"),children:[f.jsx(cr,{className:"w-[100px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx($t,{value:"disabled",children:"Off"}),f.jsx($t,{value:"enabled",children:"On"})]})]})}),F?f.jsxs("div",{className:"mb-2 ml-6 space-y-0 border-l border-border/60 pl-4",children:[f.jsx(Dn,{title:"Feature Overview",description:"Generate and show an `overview.md` file for feature folders. Turning this off stops creating new overview files and hides existing overview rows from the sidebar.",bordered:!1,children:f.jsxs(Er,{value:U?"enabled":"disabled",onValueChange:K=>$(K==="enabled"),children:[f.jsx(cr,{className:"w-[100px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx($t,{value:"disabled",children:"Off"}),f.jsx($t,{value:"enabled",children:"On"})]})]})}),f.jsx(Dn,{title:"Kanban Status",description:"Show or hide feature status controls like Idea, Todo, Progress, Testing, and Done.",bordered:!1,children:f.jsxs(Er,{value:W?"enabled":"disabled",onValueChange:K=>z(K==="enabled"),children:[f.jsx(cr,{className:"w-[100px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx($t,{value:"disabled",children:"Off"}),f.jsx($t,{value:"enabled",children:"On"})]})]})}),f.jsx(Dn,{title:`${my} In Git`,description:`Control whether ${Zn} keeps the project ${my} 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 \`${my}\`.`,bordered:!1,children:f.jsxs(Er,{value:V?"commit":"ignore",onValueChange:K=>{const at=K==="commit";G(at),n.handleSetCommitProjectMetadataDirectory(at)},children:[f.jsx(cr,{className:"w-[120px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx($t,{value:"commit",children:"Commit"}),f.jsx($t,{value:"ignore",children:"Ignore"})]})]})})]}):null,f.jsx(Dn,{title:"Provider Icons In Side Tray",description:"Show provider badges next to chats in the left sidebar side tray.",children:f.jsxs(Er,{value:j?"enabled":"disabled",onValueChange:K=>q(K==="enabled"),children:[f.jsx(cr,{className:"w-[100px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx($t,{value:"disabled",children:"Off"}),f.jsx($t,{value:"enabled",children:"On"})]})]})}),f.jsx(Dn,{title:"Default Editor",description:"Used by the navbar code button and local file links in chat",alignStart:!0,children:f.jsxs(Er,{value:v,onValueChange:K=>C(K),children:[f.jsx(cr,{className:"min-w-[180px]",children:f.jsx(jr,{})}),f.jsx(ur,{children:f.jsx(xy,{children:xse.map(K=>f.jsx($t,{value:K.value,children:K.label},K.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(Bi,{type:"text",value:De,onChange:K=>mt(K.target.value),onBlur:yt,onKeyDown:K=>_t(K,yt),className:"font-mono"}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:["Preview:"," ",f.jsx("span",{className:"font-mono",children:pn})]})]})]})}):null,f.jsx(Dn,{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(Bi,{type:"number",min:Bx,max:Fx,step:100,value:Et,onChange:K=>Rt(K.target.value),onBlur:Kt,onKeyDown:K=>en(K,Kt),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:[Bx,"-",Fx," ","lines",g===Op?" (default)":""]})]})}),f.jsx(Dn,{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(Bi,{type:"number",min:Hx,max:$x,step:10,value:fe,onChange:K=>He(K.target.value),onBlur:Be,onKeyDown:K=>en(K,Be),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:[Hx,"-",$x," px",p===Lp?" (default)":""]})]})})]})}):o==="changelog"?f.jsx(bse,{entries:yse}):o==="providers"?f.jsxs("div",{className:"border-b border-border",children:[f.jsx(Dn,{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(Er,{value:Ve,onValueChange:K=>D(K),children:[f.jsx(cr,{className:"min-w-[180px]",children:f.jsx(jr,{})}),f.jsx(ur,{children:f.jsxs(xy,{children:[f.jsx($t,{value:"last_used",children:"Last Used"}),gt.map(K=>f.jsx($t,{value:K.id,children:K.label},K.id))]})})]})}),At?f.jsx("div",{className:"border-t border-border px-0 py-3 text-sm text-destructive",children:At}):null,f.jsx(Dn,{title:"Claude Code Defaults",description:`Saved defaults when using Claude Code. ${Im(E,"claude")}`,alignStart:!0,children:f.jsxs("div",{className:me("max-w-[420px]",!dn("claude").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(Er,{value:((E==null?void 0:E.settings.claude)??sr.claude).active?"active":"inactive",onValueChange:K=>{Nt({...(E==null?void 0:E.settings)??sr,claude:{...(E==null?void 0:E.settings.claude)??sr.claude,active:K==="active"}})},children:[f.jsx(cr,{className:"min-w-[140px]",disabled:!dn("claude").systemActive,children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx($t,{value:"active",children:"Active"}),f.jsx($t,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(wd,{availableProviders:ma,selectedProvider:"claude",disabled:!dn("claude").systemActive,showProviderPicker:!1,providerLocked:!0,model:L.claude.model,modelOptions:L.claude.modelOptions,onModelChange:(K,at)=>{H("claude",at)},onClaudeReasoningEffortChange:K=>{Y("claude",{reasoningEffort:K})},onClaudeContextWindowChange:K=>{Y("claude",{contextWindow:K})},onCodexReasoningEffortChange:()=>{},onGeminiThinkingModeChange:()=>{},onCodexFastModeChange:()=>{},planMode:L.claude.planMode,onPlanModeChange:K=>P("claude",K),includePlanMode:!0,className:"justify-start flex-wrap"})]})}),f.jsx(Dn,{title:"Codex Defaults",description:`Saved defaults when using Codex. ${Im(E,"codex")}`,alignStart:!0,children:f.jsxs("div",{className:me("max-w-[420px]",!dn("codex").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(Er,{value:((E==null?void 0:E.settings.codex)??sr.codex).active?"active":"inactive",onValueChange:K=>{Nt({...(E==null?void 0:E.settings)??sr,codex:{...(E==null?void 0:E.settings.codex)??sr.codex,active:K==="active"}})},children:[f.jsx(cr,{className:"min-w-[140px]",disabled:!dn("codex").systemActive,children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx($t,{value:"active",children:"Active"}),f.jsx($t,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(wd,{availableProviders:ma,selectedProvider:"codex",disabled:!dn("codex").systemActive,showProviderPicker:!1,providerLocked:!0,model:L.codex.model,modelOptions:L.codex.modelOptions,onModelChange:(K,at)=>{H("codex",at)},onClaudeReasoningEffortChange:()=>{},onClaudeContextWindowChange:()=>{},onCodexReasoningEffortChange:K=>{Y("codex",{reasoningEffort:K})},onGeminiThinkingModeChange:()=>{},onCodexFastModeChange:K=>{Y("codex",{fastMode:K})},planMode:L.codex.planMode,onPlanModeChange:K=>P("codex",K),includePlanMode:!0,className:"justify-start flex-wrap"})]})}),f.jsx(Dn,{title:"Gemini Defaults",description:`Saved defaults when using Gemini. ${Im(E,"gemini")}`,alignStart:!0,children:f.jsxs("div",{className:me("max-w-[420px]",!dn("gemini").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(Er,{value:((E==null?void 0:E.settings.gemini)??sr.gemini).active?"active":"inactive",onValueChange:K=>{Nt({...(E==null?void 0:E.settings)??sr,gemini:{...(E==null?void 0:E.settings.gemini)??sr.gemini,active:K==="active"}})},children:[f.jsx(cr,{className:"min-w-[140px]",disabled:!dn("gemini").systemActive,children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx($t,{value:"active",children:"Active"}),f.jsx($t,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(wd,{availableProviders:ma,selectedProvider:"gemini",disabled:!dn("gemini").systemActive,showProviderPicker:!1,providerLocked:!0,model:L.gemini.model,modelOptions:L.gemini.modelOptions,onModelChange:(K,at)=>{H("gemini",at)},onClaudeReasoningEffortChange:()=>{},onClaudeContextWindowChange:()=>{},onCodexReasoningEffortChange:()=>{},onGeminiThinkingModeChange:K=>{Y("gemini",{thinkingMode:K})},onCodexFastModeChange:()=>{},planMode:L.gemini.planMode,onPlanModeChange:K=>P("gemini",K),includePlanMode:!0,className:"justify-start flex-wrap"})]})}),f.jsx(Dn,{title:"Cursor Defaults",description:`Saved defaults when using Cursor. ${Im(E,"cursor")}`,alignStart:!0,children:f.jsxs("div",{className:me("max-w-[420px]",!dn("cursor").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(Er,{value:((E==null?void 0:E.settings.cursor)??sr.cursor).active?"active":"inactive",onValueChange:K=>{Nt({...(E==null?void 0:E.settings)??sr,cursor:{...(E==null?void 0:E.settings.cursor)??sr.cursor,active:K==="active"}})},children:[f.jsx(cr,{className:"min-w-[140px]",disabled:!dn("cursor").systemActive,children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx($t,{value:"active",children:"Active"}),f.jsx($t,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(wd,{availableProviders:ma,selectedProvider:"cursor",disabled:!dn("cursor").systemActive,showProviderPicker:!1,providerLocked:!0,model:L.cursor.model,modelOptions:L.cursor.modelOptions,onModelChange:(K,at)=>{H("cursor",at)},onClaudeReasoningEffortChange:()=>{},onClaudeContextWindowChange:()=>{},onCodexReasoningEffortChange:()=>{},onGeminiThinkingModeChange:()=>{},onCodexFastModeChange:()=>{},planMode:L.cursor.planMode,onPlanModeChange:K=>P("cursor",K),includePlanMode:!0,className:"justify-start flex-wrap"})]})})]}):o==="keybindings"?f.jsxs("div",{className:"border-b border-border",children:[Ae?f.jsx("div",{className:"mb-4 rounded-2xl border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:Ae}):null,je.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:je.warning}):null,hN.map((K,at)=>{const Un=ky(ks[K]),ms=ve[K]??"",ki=ms!==Un;return f.jsx(Dn,{title:Kj[K],description:f.jsxs(f.Fragment,{children:[f.jsx("span",{children:"Comma-separated shortcuts."}),ki?f.jsxs(f.Fragment,{children:[f.jsx("span",{children:" "}),f.jsxs("button",{type:"button",onClick:()=>{ut(K)},className:"inline rounded text-foreground hover:text-foreground/80",children:["Restore: ",Un]})]}):null]}),bordered:at!==0,children:f.jsx("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:f.jsx(Bi,{type:"text",value:ms,onChange:Ht=>{const Pn=Ht.target.value;Ne(ps=>({...ps,[K]:Pn}))},onBlur:Ht=>{const Pn={...ve,[K]:Ht.currentTarget.value};Ne(Pn),Cn(Pn)},onKeyDown:Ht=>_t(Ht,()=>{const Pn={...ve,[K]:Ht.currentTarget.value};Ne(Pn),Cn(Pn)}),className:"font-mono"})})},K)})]}):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(H8,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),f.jsx("span",{children:n.commandError})]}):null]})]})]}),Gt?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:c})]})}),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 mN(e){return{submitChatMessage:Ya(e.submitChatMessage??""),toggleProjectsSidebar:Ya(e.toggleProjectsSidebar??""),toggleEmbeddedTerminal:Ya(e.toggleEmbeddedTerminal??""),toggleRightSidebar:Ya(e.toggleRightSidebar??""),openInFinder:Ya(e.openInFinder??""),openInEditor:Ya(e.openInEditor??""),addSplitTerminal:Ya(e.addSplitTerminal??"")}}function Ese(){const e=typeof navigator<"u"&&navigator.standalone===!0,t=typeof window<"u"&&window.matchMedia("(display-mode: standalone)").matches;return e||t}function Rse(){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 Tse(){_.useLayoutEffect(()=>{let e=0,t=null,n=0;const r=Ese(),i=()=>{e=0;const{height:c,offsetTop:h}=Rse();t===null&&(t=h),c>n&&(n=c);const d=Math.max(0,h-t),g=n-c>120||d>12,p=document.documentElement;p.style.setProperty("--app-shell-height",`${c}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")},o=()=>{e!==0&&window.cancelAnimationFrame(e),e=window.requestAnimationFrame(i)};o();const l=window.visualViewport;return window.addEventListener("resize",o),window.addEventListener("orientationchange",o),l==null||l.addEventListener("resize",o),l==null||l.addEventListener("scroll",o),()=>{e!==0&&window.cancelAnimationFrame(e),window.removeEventListener("resize",o),window.removeEventListener("orientationchange",o),l==null||l.removeEventListener("resize",o),l==null||l.removeEventListener("scroll",o)}},[])}const Nse=`${pg}last-seen-version`;function Mse(e,t){return!(!t||e.defaultPrevented||e.isComposing||VW(e.target))}function Ase(){const e=Yi(),t=jN(),n=hZ({activeChatId:t.chatId??null,activeOverviewFeatureId:t.featureId??null}),r=Mh("(min-width: 768px)"),i=CE(d=>d.widthPx),o=CE(d=>d.setWidth),l=e.pathname==="/",c=P0.split("/")[1]??"unknown",h=_.useMemo(()=>fw(n.keybindings),[n.keybindings]);return Tse(),_.useEffect(()=>{window.localStorage.setItem(Nse,c)},[c]),_.useEffect(()=>{function d(g){const p=il(h,"toggleProjectsSidebar",g);Mse(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(FW,{data:n.sidebarData,completedChatIds:n.completedChatIds,activeChatId:n.activeChatId,activeOverviewFeatureId:n.activeOverviewFeatureId,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:i,toggleShortcut:h.bindings.toggleProjectsSidebar,onResizeDesktopWidth:o,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,showFeatureOverviewInSidebar:n.showFeatureOverviewInSidebar,kanbanStatusesEnabled:n.kanbanStatusesEnabled,onOpenFeatureOverview:d=>{n.handleOpenFeatureOverview(d)},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(U9,{open:n.createFeatureModalProjectId!==null,onOpenChange:d=>{d||n.handleCloseCreateFeatureModal()},onConfirm:d=>n.handleConfirmCreateFeature(d)}),f.jsx(V9,{open:n.cursorCurlImportOpen,onOpenChange:d=>{d||n.handleCloseCursorCurlImport()},onSubmit:d=>n.handleSubmitCursorCurlImport(d)}),f.jsx(Gz,{context:n})]})}function jse(){return f.jsx(EF,{children:f.jsxs(F9,{children:[f.jsx(Xz,{children:f.jsxs(el,{element:f.jsx(Ase,{}),children:[f.jsx(el,{path:"/",element:f.jsx(Bie,{})}),f.jsx(el,{path:"/settings",element:f.jsx(Kz,{to:"/settings/general",replace:!0})}),f.jsx(el,{path:"/settings/:sectionId",element:f.jsx(kse,{})}),f.jsx(el,{path:"/chat/:chatId",element:f.jsx(Rie,{})}),f.jsx(el,{path:"/overview/:featureId",element:f.jsx(Mie,{})})]})}),f.jsx(iI,{})]})})}const O4=document.getElementById("root");if(!O4)throw new Error("Missing #root");XL.createRoot(O4).render(f.jsx(_.StrictMode,{children:f.jsx(xP,{children:f.jsx(sX,{children:f.jsx(jse,{})})})}));